changeset 5697:8b344da3a046 draft

(svn r8161) -Fix (FS#555, r8144): enroute_from_xy was not set properly for old savegames.
author rubidium <rubidium@openttd.org>
date Tue, 16 Jan 2007 18:31:58 +0000
parents 943e51d31238
children 1686e15013d0
files src/station_cmd.cpp
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -3011,6 +3011,13 @@
 		if (CheckSavegameVersion(7) && st->goods[i].enroute_from == 0xFF) {
 			st->goods[i].enroute_from = INVALID_STATION;
 		}
+		if (CheckSavegameVersion(44)) {
+			/* Store position of the station where the goods come from, so there are no
+			 * very high payments when stations get removed. However, if the station
+			 * where the goods came from is already removed, the source information is
+			 * lost. In that case we set it to the position of this station */
+			st->goods[i].enroute_from_xy = IsValidStationID(st->goods[i].enroute_from) ? GetStation(st->goods[i].enroute_from)->xy : st->xy;
+		}
 	}
 
 	if (st->num_specs != 0) {