summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2012-02-13 17:18:20 +0000
committerrubidium <rubidium@openttd.org>2012-02-13 17:18:20 +0000
commit060cac439c721ccee04778cf7b1bfae463d5875f (patch)
treea481ba39afbe646ac5a1ecc238189f3c60302c6a /src
parentb5525fd33dc965728ffc0e22efc0b1ba806ef807 (diff)
downloadopenttd-060cac439c721ccee04778cf7b1bfae463d5875f.tar.xz
(svn r23942) -Fix: infrastructure cache of standard road stops would get messed up when buying a company with them
Diffstat (limited to 'src')
-rw-r--r--src/saveload/afterload.cpp10
-rw-r--r--src/station_cmd.cpp8
2 files changed, 12 insertions, 6 deletions
diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp
index f2a7c31a6..7cb9f0ff0 100644
--- a/src/saveload/afterload.cpp
+++ b/src/saveload/afterload.cpp
@@ -2722,6 +2722,16 @@ bool AfterLoadGame()
}
}
+ /* 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();
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp
index 2763f7c06..64b83e8e2 100644
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -3588,7 +3588,7 @@ void DeleteOilRig(TileIndex tile)
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 @@ static void ChangeTileOwner_Station(TileIndex tile, Owner old_owner, Owner new_o
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: