summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-05-25 15:37:12 +0000
committerrubidium <rubidium@openttd.org>2007-05-25 15:37:12 +0000
commit8484a9a2e5d81a60b4848eb60c81d91244cd1066 (patch)
treeed0abba8b4f3b27ddcc1316d6c4eb747a5676878 /src
parentb194f38390db630e2ac5eea497310d96205274e8 (diff)
downloadopenttd-8484a9a2e5d81a60b4848eb60c81d91244cd1066.tar.xz
(svn r9921) -Fix (r9892): ownership wasn't properly propagated on owner changes.
Diffstat (limited to 'src')
-rw-r--r--src/road_cmd.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/road_cmd.cpp b/src/road_cmd.cpp
index 7fb49646e..394dcc370 100644
--- a/src/road_cmd.cpp
+++ b/src/road_cmd.cpp
@@ -1200,7 +1200,11 @@ static uint32 VehicleEnter_Road(Vehicle *v, TileIndex tile, int x, int y)
static void ChangeTileOwner_Road(TileIndex tile, PlayerID old_player, PlayerID new_player)
{
if (GetRoadTileType(tile) == ROAD_TILE_DEPOT) {
- DoCommand(tile, 0, 0, DC_EXEC, CMD_LANDSCAPE_CLEAR);
+ if (new_player == PLAYER_SPECTATOR) {
+ DoCommand(tile, 0, 0, DC_EXEC, CMD_LANDSCAPE_CLEAR);
+ } else {
+ SetTileOwner(tile, new_player);
+ }
return;
}
@@ -1209,15 +1213,17 @@ static void ChangeTileOwner_Road(TileIndex tile, PlayerID old_player, PlayerID n
if (GetRoadOwner(tile, rt) == old_player) {
SetRoadOwner(tile, rt, new_player == PLAYER_SPECTATOR ? OWNER_NONE : new_player);
-
- if (rt == ROADTYPE_TRAM) {
- DoCommand(tile, ROADTYPE_TRAM << 4 | GetRoadBits(tile, ROADTYPE_ROAD), 0, DC_EXEC, CMD_REMOVE_ROAD);
- }
}
}
if (IsLevelCrossing(tile)) {
- MakeRoadNormal(tile, GetCrossingRoadBits(tile), GetRoadTypes(tile), GetTownIndex(tile), GetRoadOwner(tile, ROADTYPE_ROAD), GetRoadOwner(tile, ROADTYPE_TRAM), GetRoadOwner(tile, ROADTYPE_HWAY));
+ if (GetTileOwner(tile) == old_player) {
+ if (new_player == PLAYER_SPECTATOR) {
+ MakeRoadNormal(tile, GetCrossingRoadBits(tile), GetRoadTypes(tile), GetTownIndex(tile), GetRoadOwner(tile, ROADTYPE_ROAD), GetRoadOwner(tile, ROADTYPE_TRAM), GetRoadOwner(tile, ROADTYPE_HWAY));
+ } else {
+ SetTileOwner(tile, new_player);
+ }
+ }
}
}