@@ -183,8 +183,8 @@ public void setRecharged(Campaign campaign) {
183
183
* forward
184
184
*/
185
185
public void newDay (Campaign campaign ) {
186
- //recharge even if there is no jump path
187
- //because JumpShips don't go anywhere
186
+ // recharge even if there is no jump path
187
+ // because JumpShips don't go anywhere
188
188
double hours = 24.0 ;
189
189
double neededRechargeTime = currentSystem .getRechargeTime (campaign .getLocalDate ());
190
190
double usedRechargeTime = Math .min (hours , neededRechargeTime - rechargeTime );
@@ -198,10 +198,10 @@ public void newDay(Campaign campaign) {
198
198
if ((null == jumpPath ) || jumpPath .isEmpty ()) {
199
199
return ;
200
200
}
201
- //if we are not at the final jump point, then check to see if we are transiting
202
- //or if we can jump
201
+ // if we are not at the final jump point, then check to see if we are transiting
202
+ // or if we can jump
203
203
if (jumpPath .size () > 1 ) {
204
- //first check to see if we are transiting
204
+ // first check to see if we are transiting
205
205
double usedTransitTime = Math .min (hours , 24.0 * (currentSystem .getTimeToJumpPoint (1.0 ) - transitTime ));
206
206
if (usedTransitTime > 0 ) {
207
207
transitTime += usedTransitTime /24.0 ;
@@ -227,11 +227,11 @@ public void newDay(Campaign campaign) {
227
227
jumpZenith = pickJumpPoint (campaign .getLocalDate ());
228
228
jumpPath .removeFirstSystem ();
229
229
MekHQ .triggerEvent (new LocationChangedEvent (this , true ));
230
- //reduce remaining hours by usedRechargeTime or usedTransitTime, whichever is greater
230
+ // reduce remaining hours by usedRechargeTime or usedTransitTime, whichever is greater
231
231
hours -= Math .max (usedRechargeTime , usedTransitTime );
232
232
transitTime = currentSystem .getTimeToJumpPoint (1.0 );
233
233
rechargeTime = 0 ;
234
- //if there are hours remaining, then begin recharging jump drive
234
+ // if there are hours remaining, then begin recharging jump drive
235
235
usedRechargeTime = Math .min (hours , neededRechargeTime - rechargeTime );
236
236
if (usedRechargeTime > 0 ) {
237
237
campaign .addReport ("JumpShips spent " + (Math .round (100.0 * usedRechargeTime ) / 100.0 ) + " hours recharging drives" );
@@ -242,7 +242,7 @@ public void newDay(Campaign campaign) {
242
242
}
243
243
}
244
244
}
245
- //if we are now at the final jump point, then lets begin in-system transit
245
+ // if we are now at the final jump point, then lets begin in-system transit
246
246
if (jumpPath .size () == 1 ) {
247
247
double usedTransitTime = Math .min (hours , 24.0 * transitTime );
248
248
campaign .addReport ("DropShips spent " + (Math .round (100.0 * usedTransitTime ) / 100.0 ) + " hours transiting into system" );
@@ -256,29 +256,16 @@ public void newDay(Campaign campaign) {
256
256
}
257
257
}
258
258
259
- public void writeToXml (PrintWriter pw1 , int indent ) {
260
- pw1 .println (MHQXMLUtility .indentStr (indent ) + "<location>" );
261
- pw1 .println (MHQXMLUtility .indentStr (indent +1 )
262
- + "<currentSystemId>"
263
- +MHQXMLUtility .escape (currentSystem .getId ())
264
- + "</currentSystemId>" );
265
- pw1 .println (MHQXMLUtility .indentStr (indent +1 )
266
- +"<transitTime>"
267
- +transitTime
268
- +"</transitTime>" );
269
- pw1 .println (MHQXMLUtility .indentStr (indent +1 )
270
- +"<rechargeTime>"
271
- +rechargeTime
272
- +"</rechargeTime>" );
273
- pw1 .println (MHQXMLUtility .indentStr (indent +1 )
274
- +"<jumpZenith>"
275
- +jumpZenith
276
- +"</jumpZenith>" );
277
- if (null != jumpPath ) {
278
- jumpPath .writeToXML (pw1 , indent +1 );
259
+ public void writeToXML (final PrintWriter pw , int indent ) {
260
+ MHQXMLUtility .writeSimpleXMLOpenTag (pw , indent ++, "location" );
261
+ MHQXMLUtility .writeSimpleXMLTag (pw , indent , "currentSystemId" , currentSystem .getId ());
262
+ MHQXMLUtility .writeSimpleXMLTag (pw , indent , "transitTime" , transitTime );
263
+ MHQXMLUtility .writeSimpleXMLTag (pw , indent , "rechargeTime" , rechargeTime );
264
+ MHQXMLUtility .writeSimpleXMLTag (pw , indent , "jumpZenith" , jumpZenith );
265
+ if (jumpPath != null ) {
266
+ jumpPath .writeToXML (pw , indent );
279
267
}
280
- pw1 .println (MHQXMLUtility .indentStr (indent ) + "</location>" );
281
-
268
+ MHQXMLUtility .writeSimpleXMLCloseTag (pw , --indent , "location" );
282
269
}
283
270
284
271
public static CurrentLocation generateInstanceFromXML (Node wn , Campaign c ) {
0 commit comments