diff options
author | rubidium <rubidium@openttd.org> | 2007-05-25 15:37:12 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2007-05-25 15:37:12 +0000 |
commit | 9fc73931f12e6a66c6fe5d72957d2d0eefbea725 (patch) | |
tree | ed0abba8b4f3b27ddcc1316d6c4eb747a5676878 /src | |
parent | f9cdc944cfb45f3092692c571be6390e29b28267 (diff) | |
download | openttd-9fc73931f12e6a66c6fe5d72957d2d0eefbea725.tar.xz |
(svn r9921) -Fix (r9892): ownership wasn't properly propagated on owner changes.
Diffstat (limited to 'src')
-rw-r--r-- | src/road_cmd.cpp | 18 |
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); + } + } } } |