summaryrefslogtreecommitdiff
path: root/src/saveload
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-04-11 21:46:20 +0000
committerrubidium <rubidium@openttd.org>2010-04-11 21:46:20 +0000
commit7590651aeae35f804af90537e276b6e1d07a8d44 (patch)
tree390265644826eed706fd39fac4e72968ec7efc72 /src/saveload
parentcef89b4f91d2eb3a503ab0d1c637ef3799896d7f (diff)
downloadopenttd-7590651aeae35f804af90537e276b6e1d07a8d44.tar.xz
(svn r19612) -Fix [FS#3756] (r3212): crash when opening a savegame with a waypoint from around 0.4.0
Diffstat (limited to 'src/saveload')
-rw-r--r--src/saveload/waypoint_sl.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/saveload/waypoint_sl.cpp b/src/saveload/waypoint_sl.cpp
index 2cd95e104..ae5c36ac1 100644
--- a/src/saveload/waypoint_sl.cpp
+++ b/src/saveload/waypoint_sl.cpp
@@ -70,7 +70,12 @@ void MoveWaypointsToBaseStations()
* waypoint struct. */
if (CheckSavegameVersion(17)) {
for (OldWaypoint *wp = _old_waypoints.Begin(); wp != _old_waypoints.End(); wp++) {
- if (wp->delete_ctr == 0 && HasBit(_m[wp->xy].m3, 4)) {
+ if (wp->delete_ctr != 0) continue; // The waypoint was deleted
+
+ /* Waypoint indices were not added to the map prior to this. */
+ _m[wp->xy].m2 = wp->index;
+
+ if (HasBit(_m[wp->xy].m3, 4)) {
wp->spec = GetCustomStationSpec(STAT_CLASS_WAYP, _m[wp->xy].m4 + 1);
}
}