@@ -244,18 +244,16 @@ public void saveGameState(String filename) throws IOException {
244
244
@ Override
245
245
public void write (Json json ) {
246
246
BladeJson bjson = (BladeJson ) json ;
247
+
248
+ json .writeValue (Config .BLADE_ENGINE_VERSION_PROP ,
249
+ Config .getProperty (Config .BLADE_ENGINE_VERSION_PROP , null ));
247
250
248
251
if (bjson .getMode () == Mode .MODEL ) {
249
- json .writeValue (Config .BLADE_ENGINE_VERSION_PROP ,
250
- Config .getProperty (Config .BLADE_ENGINE_VERSION_PROP , null ));
251
-
252
252
json .writeValue ("sounds" , w .getSounds (), w .getSounds ().getClass (), SoundDesc .class );
253
253
json .writeValue ("scenes" , w .getScenes (), w .getScenes ().getClass (), Scene .class );
254
254
json .writeValue ("initScene" , w .getInitScene ());
255
255
256
256
} else {
257
- json .writeValue (Config .BLADE_ENGINE_VERSION_PROP ,
258
- Config .getProperty (Config .BLADE_ENGINE_VERSION_PROP , null ));
259
257
json .writeValue (Config .VERSION_PROP , Config .getProperty (Config .VERSION_PROP , null ));
260
258
json .writeValue ("scenes" , w .getScenes (), w .getScenes ().getClass (), Scene .class );
261
259
json .writeValue ("currentScene" , w .getCurrentScene ().getId ());
@@ -288,12 +286,13 @@ public void write(Json json) {
288
286
289
287
@ Override
290
288
public void read (Json json , JsonValue jsonData ) {
289
+
290
+ String bladeVersion = json .readValue (Config .BLADE_ENGINE_VERSION_PROP , String .class , jsonData );
291
291
292
292
BladeJson bjson = (BladeJson ) json ;
293
293
if (bjson .getMode () == Mode .MODEL ) {
294
- String version = json .readValue (Config .BLADE_ENGINE_VERSION_PROP , String .class , jsonData );
295
- if (version != null && !version .equals (Config .getProperty (Config .BLADE_ENGINE_VERSION_PROP , "" ))) {
296
- EngineLogger .debug ("Model Engine Version v" + version + " differs from Current Engine Version v"
294
+ if (bladeVersion != null && !bladeVersion .equals (Config .getProperty (Config .BLADE_ENGINE_VERSION_PROP , "" ))) {
295
+ EngineLogger .debug ("Model Engine Version v" + bladeVersion + " differs from Current Engine Version v"
297
296
+ Config .getProperty (Config .BLADE_ENGINE_VERSION_PROP , "" ));
298
297
}
299
298
@@ -333,19 +332,13 @@ public void read(Json json, JsonValue jsonData) {
333
332
// Add sounds to cache
334
333
cacheSounds ();
335
334
} else {
336
- String bladeVersion = json .readValue (Config .BLADE_ENGINE_VERSION_PROP , String .class , jsonData );
337
335
if (bladeVersion != null
338
336
&& !bladeVersion .equals (Config .getProperty (Config .BLADE_ENGINE_VERSION_PROP , "" ))) {
339
337
EngineLogger
340
338
.debug ("Saved Game Engine Version v" + bladeVersion + " differs from Current Engine Version v"
341
339
+ Config .getProperty (Config .BLADE_ENGINE_VERSION_PROP , "" ));
342
340
}
343
341
344
- String version = json .readValue (Config .VERSION_PROP , String .class , jsonData );
345
-
346
- if (version == null )
347
- version = "TEST" ;
348
-
349
342
String currentChapter = json .readValue ("chapter" , String .class , jsonData );
350
343
String currentScene = json .readValue ("currentScene" , String .class , jsonData );
351
344
@@ -402,6 +395,9 @@ public void read(Json json, JsonValue jsonData) {
402
395
props .put (jsonValue .name , jsonValue .asString ());
403
396
}
404
397
398
+ String version = json .readValue (Config .VERSION_PROP , String .class , jsonData );
399
+ if (version == null )
400
+ version = "TEST" ;
405
401
props .put (WorldProperties .SAVED_GAME_VERSION .toString (), version );
406
402
407
403
String actorId = json .readValue ("dialogActor" , String .class , jsonData );
0 commit comments