summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2009-05-19 12:47:47 +0000
committersmatz <smatz@openttd.org>2009-05-19 12:47:47 +0000
commit1e45f4bc4c1faf89469ef9b92ae7b5ce358dda46 (patch)
tree35ce927aa28188bf18cd6aa5321cc3055916b0b1
parent3bd52accd9c12f828bd53d247aa952b85d3e36ce (diff)
downloadopenttd-1e45f4bc4c1faf89469ef9b92ae7b5ce358dda46.tar.xz
(svn r16357) -Codechange: delete invalid depots in TTD savegames caused by improper SVXConverter conversions
-rw-r--r--src/saveload/oldloader_sl.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/saveload/oldloader_sl.cpp b/src/saveload/oldloader_sl.cpp
index fc2d2038c..ca63e7c1e 100644
--- a/src/saveload/oldloader_sl.cpp
+++ b/src/saveload/oldloader_sl.cpp
@@ -96,6 +96,17 @@ static void FixTTDMapArray()
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)
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...");
FixTTDMapArray();
+ FixTTDDepots();
/* Fix some general stuff */
_settings_game.game_creation.landscape = _settings_game.game_creation.landscape & 0xF;