changeset 15000:c10b7750962f draft

(svn r19612) -Fix [FS#3756] (r3212): crash when opening a savegame with a waypoint from around 0.4.0
author rubidium <rubidium@openttd.org>
date Sun, 11 Apr 2010 21:46:20 +0000
parents 1c006f045890
children 43eedecffc5a
files src/saveload/waypoint_sl.cpp
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/saveload/waypoint_sl.cpp
+++ b/src/saveload/waypoint_sl.cpp
@@ -70,7 +70,12 @@
 	 * 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);
 			}
 		}