changeset 19088:7cd49ed5628c draft

(svn r23942) -Fix: infrastructure cache of standard road stops would get messed up when buying a company with them
author rubidium <rubidium@openttd.org>
date Mon, 13 Feb 2012 17:18:20 +0000
parents 6c68329f2cfb
children eeca59added1
files src/saveload/afterload.cpp src/station_cmd.cpp
diffstat 2 files changed, 12 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/saveload/afterload.cpp
+++ b/src/saveload/afterload.cpp
@@ -2722,6 +2722,16 @@
 		}
 	}
 
+	/* The road owner of standard road stops was not properly accounted for. */
+	if (IsSavegameVersionBefore(172)) {
+		for (TileIndex t = 0; t < map_size; t++) {
+			if (!IsStandardRoadStopTile(t)) continue;
+			Owner o = GetTileOwner(t);
+			SetRoadOwner(t, ROADTYPE_ROAD, o);
+			SetRoadOwner(t, ROADTYPE_TRAM, o);
+		}
+	}
+
 	/* Road stops is 'only' updating some caches */
 	AfterLoadRoadStops();
 	AfterLoadLabelMaps();
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -3588,7 +3588,7 @@
 
 static void ChangeTileOwner_Station(TileIndex tile, Owner old_owner, Owner new_owner)
 {
-	if (IsDriveThroughStopTile(tile)) {
+	if (IsRoadStopTile(tile)) {
 		for (RoadType rt = ROADTYPE_ROAD; rt < ROADTYPE_END; rt++) {
 			/* Update all roadtypes, no matter if they are present */
 			if (GetRoadOwner(tile, rt) == old_owner) {
@@ -3624,11 +3624,7 @@
 
 			case STATION_BUS:
 			case STATION_TRUCK:
-				if (!IsDriveThroughStopTile(tile)) {
-					/* Drive-through stops were already handled above. */
-					old_company->infrastructure.road[FIND_FIRST_BIT(GetRoadTypes(tile))] -= 2;
-					new_company->infrastructure.road[FIND_FIRST_BIT(GetRoadTypes(tile))] += 2;
-				}
+				/* Road stops were already handled above. */
 				break;
 
 			case STATION_BUOY: