Reject SpringPP games with huge airports or helis approaching oil rigs.

Huge airports are not supported.
Annoyingly SpringPP has a bug where it uses the same ID for
AT_INTERCONTINENTAL2 and AT_OILRIG.
Consequently any aircraft approaching an oil rig in an SPP game
will be using the wrong aircraft movement data, and this will go
badly wrong as soon as the game is unpaused.
This commit is contained in:
Jonathan G Rennison
2015-08-17 21:41:05 +01:00
parent b5c453b21e
commit 279eac6e57
2 changed files with 42 additions and 0 deletions

View File

@@ -4527,6 +4527,9 @@ STR_GAME_SAVELOAD_ERROR_DATA_INTEGRITY_CHECK_FAILED :Data integrity
STR_GAME_SAVELOAD_NOT_AVAILABLE :<not available> STR_GAME_SAVELOAD_NOT_AVAILABLE :<not available>
STR_WARNING_LOADGAME_REMOVED_TRAMS :{WHITE}Game was saved in version without tram support. All trams have been removed STR_WARNING_LOADGAME_REMOVED_TRAMS :{WHITE}Game was saved in version without tram support. All trams have been removed
STR_GAME_SAVELOAD_ERROR_HUGE_AIRPORTS_PRESENT :Savegame uses huge airports
STR_GAME_SAVELOAD_ERROR_HELI_OILRIG_BUG :Savegame has a helicopter on approach to a buggy oil rig
# Map generation messages # Map generation messages
STR_ERROR_COULD_NOT_CREATE_TOWN :{WHITE}Map generation aborted...{}... no suitable town locations STR_ERROR_COULD_NOT_CREATE_TOWN :{WHITE}Map generation aborted...{}... no suitable town locations
STR_ERROR_NO_TOWN_IN_SCENARIO :{WHITE}... there is no town in this scenario STR_ERROR_NO_TOWN_IN_SCENARIO :{WHITE}... there is no town in this scenario

View File

@@ -3076,6 +3076,45 @@ bool AfterLoadGame()
DEBUG(sl, 3, "New inflation prices: %f", _economy.inflation_prices / 65536.0); DEBUG(sl, 3, "New inflation prices: %f", _economy.inflation_prices / 65536.0);
} }
if (SlXvIsFeaturePresent(XSLFI_SPRINGPP)) {
/*
* Reject huge airports and helicopters aproaching oil rigs using the wrong aircraft movement data
* Annoyingly SpringPP has a bug where it uses the same ID for AT_INTERCONTINENTAL2 and AT_OILRIG
*/
Station *st;
FOR_ALL_STATIONS(st) {
if (st->airport.tile == INVALID_TILE) continue;
StringID err = INVALID_STRING_ID;
if (st->airport.type == 9) {
if (st->dock_tile != INVALID_TILE && IsOilRig(st->dock_tile)) {
/* this airport is probably an oil rig, not a huge airport */
} else {
err = STR_GAME_SAVELOAD_ERROR_HUGE_AIRPORTS_PRESENT;
}
st->airport.type = AT_OILRIG;
} else if (st->airport.type == 10) {
err = STR_GAME_SAVELOAD_ERROR_HUGE_AIRPORTS_PRESENT;
}
if (err != INVALID_STRING_ID) {
SetSaveLoadError(err);
/* Restore the signals */
ResetSignalHandlers();
return false;
}
}
Aircraft *v;
FOR_ALL_AIRCRAFT(v) {
Station *st = GetTargetAirportIfValid(v);
if (st != NULL && st->dock_tile != INVALID_TILE && IsOilRig(st->dock_tile)) {
/* aircraft is on approach to an oil rig, bail out now */
SetSaveLoadError(STR_GAME_SAVELOAD_ERROR_HELI_OILRIG_BUG);
/* Restore the signals */
ResetSignalHandlers();
return false;
}
}
}
/* Station acceptance is some kind of cache */ /* Station acceptance is some kind of cache */
if (IsSavegameVersionBefore(127)) { if (IsSavegameVersionBefore(127)) {
Station *st; Station *st;