Initial support for loading savegames from SpringPP v2.0.102/103

Savegame version 220

Bin all extra settings added in SpringPP.
Bin extra features: trip histories, more conditional orders/jump counter,
prev order time, snow-line chunk, town auto adv. campaign, etc.
Fix vehicle flags.
Fix bridges wrt height changes.
Handle 60-bit RIFF chunk sizes.
Doesn't deal with huge airports, loading games with these may
lead to undefined ehaviour.
PAX signals and traffic lights are ignored.
This commit is contained in:
Jonathan G Rennison
2015-07-31 17:34:57 +01:00
parent bd10b0fb0b
commit 39608841f2
9 changed files with 246 additions and 6 deletions

View File

@@ -584,7 +584,7 @@ bool AfterLoadGame()
}
}
if (IsSavegameVersionBefore(194)) {
if (IsSavegameVersionBefore(194) && SlXvIsFeatureMissing(XSLFI_HEIGHT_8_BIT)) {
_settings_game.construction.max_heightlevel = 15;
/* In old savegame versions, the heightlevel was coded in bits 0..3 of the type field */
@@ -599,6 +599,17 @@ bool AfterLoadGame()
SB(_m[t].type, 2, 2, 0);
}
}
} else if (SlXvIsFeaturePresent(XSLFI_HEIGHT_8_BIT)) {
for (TileIndex t = 0; t < map_size; t++) {
SB(_m[t].type, 0, 2, GB(_me[t].m6, 0, 2));
SB(_me[t].m6, 0, 2, 0);
if (MayHaveBridgeAbove(t)) {
SB(_m[t].type, 2, 2, GB(_me[t].m6, 6, 2));
SB(_me[t].m6, 6, 2, 0);
} else {
SB(_m[t].type, 2, 2, 0);
}
}
}
/* in version 2.1 of the savegame, town owner was unified. */
@@ -2943,6 +2954,15 @@ bool AfterLoadGame()
}
}
if (SlXvIsFeaturePresent(XSLFI_SPRINGPP)) {
// re-arrange vehicle_flags
Vehicle *v;
FOR_ALL_VEHICLES(v) {
SB(v->vehicle_flags, VF_AUTOMATE_TIMETABLE, 1, GB(v->vehicle_flags, 6, 1));
SB(v->vehicle_flags, VF_STOP_LOADING, 4, GB(v->vehicle_flags, 7, 4));
}
}
if (IsSavegameVersionBefore(188)) {
/* Fix articulated road vehicles.
* Some curves were shorter than other curves.