(svn r16357) -Codechange: delete invalid depots in TTD savegames caused by improper SVXConverter conversions

This commit is contained in:
smatz 2009-05-19 12:47:47 +00:00
parent 3bd52accd9
commit 1e45f4bc4c

View File

@ -96,6 +96,17 @@ static void FixTTDMapArray()
FixOldMapArray(); FixOldMapArray();
} }
static void FixTTDDepots()
{
const Depot *d;
FOR_ALL_DEPOTS_FROM(d, 252) {
if (!IsRoadDepotTile(d->xy) && !IsRailDepotTile(d->xy) && !IsShipDepotTile(d->xy) && !IsHangarTile(d->xy)) {
/** Workaround for SVXConverter bug, depots 252-255 could be invalid */
delete d;
}
}
}
#define FIXNUM(x, y, z) (((((x) << 16) / (y)) + 1) << z) #define FIXNUM(x, y, z) (((((x) << 16) / (y)) + 1) << z)
static uint32 RemapOldTownName(uint32 townnameparts, byte old_town_name_type) static uint32 RemapOldTownName(uint32 townnameparts, byte old_town_name_type)
@ -1769,6 +1780,7 @@ bool LoadTTDMain(LoadgameState *ls)
DEBUG(oldloader, 3, "Done, converting game data..."); DEBUG(oldloader, 3, "Done, converting game data...");
FixTTDMapArray(); FixTTDMapArray();
FixTTDDepots();
/* Fix some general stuff */ /* Fix some general stuff */
_settings_game.game_creation.landscape = _settings_game.game_creation.landscape & 0xF; _settings_game.game_creation.landscape = _settings_game.game_creation.landscape & 0xF;