From d63fad7a7b7e0ff6bc6c32f119042a0317961255 Mon Sep 17 00:00:00 2001 From: Darkvater Date: Sat, 15 Apr 2006 20:07:42 +0000 Subject: (svn r4435) - Fix: an assertion triggered when trying to remove a bridge with the remove-tool (r4348 surfaced this). In CmdRemoveRoad tiletype was not checked for ownership. Intorudce IsLevelCrossingTile() which checks if a tile is a crossing without knowing the type. Suggested by peter1138 and Tron. --- road_cmd.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'road_cmd.c') diff --git a/road_cmd.c b/road_cmd.c index 154968421..4948bd7bc 100644 --- a/road_cmd.c +++ b/road_cmd.c @@ -47,11 +47,8 @@ static bool CheckAllowRemoveRoad(TileIndex tile, RoadBits remove, bool* edge_roa // Only do the special processing for actual players. if (_current_player >= MAX_PLAYERS) return true; - if (IsTileType(tile, MP_STREET) && IsLevelCrossing(tile)) { - owner = GetCrossingRoadOwner(tile); - } else { - owner = GetTileOwner(tile); - } + owner = IsLevelCrossingTile(tile) ? GetCrossingRoadOwner(tile) : GetTileOwner(tile); + // Only do the special processing if the road is owned // by a town if (owner != OWNER_TOWN) { @@ -112,7 +109,7 @@ int32 CmdRemoveRoad(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) if (!IsTileType(tile, MP_STREET) && !IsTileType(tile, MP_TUNNELBRIDGE)) return CMD_ERROR; - owner = IsLevelCrossing(tile) ? GetCrossingRoadOwner(tile) : GetTileOwner(tile); + owner = IsLevelCrossingTile(tile) ? GetCrossingRoadOwner(tile) : GetTileOwner(tile); if (owner == OWNER_TOWN && _game_mode != GM_EDITOR) { if (IsTileType(tile, MP_TUNNELBRIDGE)) { // index of town is not saved for bridge (no space) -- cgit v1.2.3-70-g09d2