diff options
author | rubidium <rubidium@openttd.org> | 2007-07-10 22:45:09 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2007-07-10 22:45:09 +0000 |
commit | 255102d223272de5179ddfa4c13eb3245ef266cc (patch) | |
tree | c5a2d62b6acc4b1f29d9ec357bd66b0262cbaf51 /src | |
parent | 872e74c028679afad1e52481063b1624c235955e (diff) | |
download | openttd-255102d223272de5179ddfa4c13eb3245ef266cc.tar.xz |
(svn r10502) -Fix [FS#1017]: trying to get the town from a tile that can never be associated with a town.
Diffstat (limited to 'src')
-rw-r--r-- | src/road_cmd.cpp | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/src/road_cmd.cpp b/src/road_cmd.cpp index 29827b46c..c5e0622e8 100644 --- a/src/road_cmd.cpp +++ b/src/road_cmd.cpp @@ -112,7 +112,6 @@ CommandCost CmdRemoveRoad(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) /* cost for removing inner/edge -roads */ static const uint16 road_remove_cost[2] = {50, 18}; - Town *t; /* true if the roadpiece was always removeable, * false if it was a center piece. Affects town ratings drop */ bool edge_road; @@ -122,33 +121,25 @@ CommandCost CmdRemoveRoad(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) RoadType rt = (RoadType)GB(p1, 4, 2); if (!IsValidRoadType(rt)) return CMD_ERROR; - Owner owner; + Town *t = NULL; switch (GetTileType(tile)) { case MP_STREET: - owner = GetRoadOwner(tile, rt); + if (_game_mode != GM_EDITOR && GetRoadOwner(tile, rt) == OWNER_TOWN) t = GetTownByTile(tile); break; case MP_STATION: if (!IsDriveThroughStopTile(tile)) return CMD_ERROR; - owner = GetTileOwner(tile); break; case MP_TUNNELBRIDGE: if ((IsTunnel(tile) && GetTunnelTransportType(tile) != TRANSPORT_ROAD) || (IsBridge(tile) && GetBridgeTransportType(tile) != TRANSPORT_ROAD)) return CMD_ERROR; - owner = GetTileOwner(tile); break; default: return CMD_ERROR; } - if (owner == OWNER_TOWN && _game_mode != GM_EDITOR) { - t = GetTownByTile(tile); - } else { - t = NULL; - } - RoadBits pieces = Extract<RoadBits, 0>(p1); RoadTypes rts = GetRoadTypes(tile); /* The tile doesn't have the given road type */ |