summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-05-28 20:46:59 +0000
committerrubidium <rubidium@openttd.org>2007-05-28 20:46:59 +0000
commitc5d073a84f359a03c910b7a91ac8b356e7927ecc (patch)
tree3fa593a7c330097e50d616cb7ce72a59e1ded4a2
parent66c23060e21e887ada9afca18f98ece773850f3a (diff)
downloadopenttd-c5d073a84f359a03c910b7a91ac8b356e7927ecc.tar.xz
(svn r9965) -Fix: the ownership of drive through road stops on town owned roads wasn't properly reset when the road stop was removed.
-rw-r--r--src/station_cmd.cpp19
1 files changed, 5 insertions, 14 deletions
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp
index 1d9b986c4..b863481b8 100644
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -1438,20 +1438,11 @@ int32 CmdRemoveRoadStop(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
/* If the stop was a drive-through stop replace the road */
if ((flags & DC_EXEC) && !CmdFailed(ret) && is_drive_through) {
- uint index = 0;
- Owner cur_owner = _current_player;
-
- if (is_towns_road) {
- index = ClosestTownFromTile(tile, (uint)-1)->index;
- _current_player = OWNER_TOWN;
- }
- if (HASBIT(rts, ROADTYPE_ROAD)) {
- DoCommand(tile, ROADTYPE_ROAD << 4 | road_bits, index, DC_EXEC, CMD_BUILD_ROAD);
- }
- if (HASBIT(rts, ROADTYPE_TRAM)) {
- DoCommand(tile, ROADTYPE_TRAM << 4 | road_bits, index, DC_EXEC, CMD_BUILD_ROAD);
- }
- _current_player = cur_owner;
+ /* Rebuild the drive throuhg road stop. As a road stop can only be
+ * removed by the owner of the roadstop, _current_player is the
+ * owner of the road stop. */
+ MakeRoadNormal(tile, road_bits, rts, is_towns_road ? ClosestTownFromTile(tile, (uint)-1)->index : 0,
+ is_towns_road ? OWNER_TOWN : _current_player, _current_player, _current_player);
}
return ret;