diff options
author | smatz <smatz@openttd.org> | 2008-04-25 16:33:40 +0000 |
---|---|---|
committer | smatz <smatz@openttd.org> | 2008-04-25 16:33:40 +0000 |
commit | 805e1db332d3a746a7ce453f62b83d4442078a0b (patch) | |
tree | d8db094c166ef1686fc3cbd441747a5c0dc23cb1 /src/openttd.cpp | |
parent | 4e80f3f3b1befb54a7818ab678fa27e79273ddc3 (diff) | |
download | openttd-805e1db332d3a746a7ce453f62b83d4442078a0b.tar.xz |
(svn r12904) -Fix [FS#1953]: remove trams from savegames saved in OTTD without tram support, it is better than to simply crash
Diffstat (limited to 'src/openttd.cpp')
-rw-r--r-- | src/openttd.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/openttd.cpp b/src/openttd.cpp index 2d32c04f6..50bf799c7 100644 --- a/src/openttd.cpp +++ b/src/openttd.cpp @@ -2501,6 +2501,21 @@ bool AfterLoadGame() } } + if (CheckSavegameVersion(62)) { + /* Remove all trams from savegames without tram support. + * There would be trams without tram track under causing crashes sooner or later. */ + Vehicle *v; + FOR_ALL_VEHICLES(v) { + if (v->type == VEH_ROAD && v->First() == v && + HasBit(EngInfo(v->engine_type)->misc_flags, EF_ROAD_TRAM)) { + if (_switch_mode_errorstr == INVALID_STRING_ID || _switch_mode_errorstr == STR_NEWGRF_COMPATIBLE_LOAD_WARNING) { + _switch_mode_errorstr = STR_LOADGAME_REMOVED_TRAMS; + } + delete v; + } + } + } + return InitializeWindowsAndCaches(); } |