@@ -110,7 +110,7 @@ private void load(final LittleEndianDataInputStream stream) throws IOException {
110110 this .gameDataSet = stream .readInt ();
111111 }
112112
113- if (this .version >= 18 ) {
113+ if (this .version >= 13 && this . version != 18 && this . version != 19 ) {
114114 this .prologueScreenModel = ParseUtils .readUntilNull (stream );
115115 }
116116
@@ -182,6 +182,7 @@ private void load(final LittleEndianDataInputStream stream) throws IOException {
182182 // some kind of really stupid protected map???
183183 return ;
184184 }
185+
185186 if (stream .available () > 0 ) {
186187 for (int i = 0 , l = stream .readInt (); i < l ; i ++) {
187188 final UpgradeAvailabilityChange upgradeAvailabilityChange = new UpgradeAvailabilityChange ();
@@ -251,7 +252,7 @@ public void save(final LittleEndianDataOutputStream stream) throws IOException {
251252 stream .writeInt (this .campaignBackground );
252253 }
253254
254- if (this .version > 10 && this .version != 18 && this .version != 19 ) {
255+ if (this .version >= 10 && this .version != 18 && this .version != 19 ) {
255256 ParseUtils .writeWithNullTerminator (stream , this .loadingScreenModel );
256257 }
257258
@@ -278,7 +279,7 @@ public void save(final LittleEndianDataOutputStream stream) throws IOException {
278279 ParseUtils .writeWithNullTerminator (stream , this .prologueScreenSubtitle );
279280 }
280281
281- if (this .version > 19 ) {
282+ if (this .version >= 19 ) {
282283 stream .writeInt (this .useTerrainFog );
283284 ParseUtils .writeFloatArray (stream , this .fogHeight );
284285 stream .writeFloat (this .fogDensity );
@@ -359,41 +360,6 @@ public void save(final LittleEndianDataOutputStream stream) throws IOException {
359360 table .save (stream );
360361 }
361362 }
362-
363- }
364-
365- public int getByteLength () {
366- int size = 111 + this .name .length () + this .author .length () + this .description .length ()
367- + this .recommendedPlayers .length () + this .loadingScreenText .length () + this .loadingScreenTitle .length ()
368- + this .loadingScreenSubtitle .length () + this .prologueScreenText .length ()
369- + this .prologueScreenTitle .length () + this .prologueScreenSubtitle .length ();
370-
371- for (final Player player : this .players ) {
372- size += player .getByteLength ();
373- }
374-
375- for (final Force force : this .forces ) {
376- size += force .getByteLength ();
377- }
378-
379- size += this .upgradeAvailabilityChanges .size () * 16 ;
380-
381- size += this .techAvailabilityChanges .size () * 8 ;
382-
383- for (final RandomUnitTable table : this .randomUnitTables ) {
384- size += table .getByteLength ();
385- }
386-
387- if (this .version > 24 ) {
388- size += 36 + this .loadingScreenModel .length () + this .prologueScreenModel .length ()
389- + this .soundEnvironment .length ();
390-
391- for (final RandomItemTable table : this .randomItemTables ) {
392- size += table .getByteLength ();
393- }
394- }
395-
396- return size ;
397363 }
398364
399365 public int getVersion () {
0 commit comments