summaryrefslogtreecommitdiff
path: root/src/road_cmd.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2014-10-04 19:23:43 +0000
committerrubidium <rubidium@openttd.org>2014-10-04 19:23:43 +0000
commit4978ece6ee6ff1d48057f3cb225a3810f4454a33 (patch)
treeb8a16bd99ed787e761443f761c24c12f2e508fc0 /src/road_cmd.cpp
parentd4a9b3acedb52bfe6d59aec6fe9c2a83996f066d (diff)
downloadopenttd-4978ece6ee6ff1d48057f3cb225a3810f4454a33.tar.xz
(svn r26955) -Fix [FS#6126]: owner of road depot road types were not properly changed upon bankruptcy causing crashes when trying to remove the depot in certain situations
Diffstat (limited to 'src/road_cmd.cpp')
-rw-r--r--src/road_cmd.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/road_cmd.cpp b/src/road_cmd.cpp
index cdcedf460..e56633696 100644
--- a/src/road_cmd.cpp
+++ b/src/road_cmd.cpp
@@ -1762,6 +1762,11 @@ static void ChangeTileOwner_Road(TileIndex tile, Owner old_owner, Owner new_owne
Company::Get(new_owner)->infrastructure.road[rt] += 2;
SetTileOwner(tile, new_owner);
+ for (RoadType rt = ROADTYPE_ROAD; rt < ROADTYPE_END; rt++) {
+ if (GetRoadOwner(tile, rt) == old_owner) {
+ SetRoadOwner(tile, rt, new_owner);
+ }
+ }
}
}
return;