mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-02-04 05:15:21 +00:00
(svn r10502) -Fix [FS#1017]: trying to get the town from a tile that can never be associated with a town.
This commit is contained in:
parent
872e74c028
commit
255102d223
@ -112,7 +112,6 @@ CommandCost CmdRemoveRoad(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
|||||||
/* cost for removing inner/edge -roads */
|
/* cost for removing inner/edge -roads */
|
||||||
static const uint16 road_remove_cost[2] = {50, 18};
|
static const uint16 road_remove_cost[2] = {50, 18};
|
||||||
|
|
||||||
Town *t;
|
|
||||||
/* true if the roadpiece was always removeable,
|
/* true if the roadpiece was always removeable,
|
||||||
* false if it was a center piece. Affects town ratings drop */
|
* false if it was a center piece. Affects town ratings drop */
|
||||||
bool edge_road;
|
bool edge_road;
|
||||||
@ -122,33 +121,25 @@ CommandCost CmdRemoveRoad(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
|||||||
RoadType rt = (RoadType)GB(p1, 4, 2);
|
RoadType rt = (RoadType)GB(p1, 4, 2);
|
||||||
if (!IsValidRoadType(rt)) return CMD_ERROR;
|
if (!IsValidRoadType(rt)) return CMD_ERROR;
|
||||||
|
|
||||||
Owner owner;
|
Town *t = NULL;
|
||||||
switch (GetTileType(tile)) {
|
switch (GetTileType(tile)) {
|
||||||
case MP_STREET:
|
case MP_STREET:
|
||||||
owner = GetRoadOwner(tile, rt);
|
if (_game_mode != GM_EDITOR && GetRoadOwner(tile, rt) == OWNER_TOWN) t = GetTownByTile(tile);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MP_STATION:
|
case MP_STATION:
|
||||||
if (!IsDriveThroughStopTile(tile)) return CMD_ERROR;
|
if (!IsDriveThroughStopTile(tile)) return CMD_ERROR;
|
||||||
owner = GetTileOwner(tile);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MP_TUNNELBRIDGE:
|
case MP_TUNNELBRIDGE:
|
||||||
if ((IsTunnel(tile) && GetTunnelTransportType(tile) != TRANSPORT_ROAD) ||
|
if ((IsTunnel(tile) && GetTunnelTransportType(tile) != TRANSPORT_ROAD) ||
|
||||||
(IsBridge(tile) && GetBridgeTransportType(tile) != TRANSPORT_ROAD)) return CMD_ERROR;
|
(IsBridge(tile) && GetBridgeTransportType(tile) != TRANSPORT_ROAD)) return CMD_ERROR;
|
||||||
owner = GetTileOwner(tile);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return CMD_ERROR;
|
return CMD_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (owner == OWNER_TOWN && _game_mode != GM_EDITOR) {
|
|
||||||
t = GetTownByTile(tile);
|
|
||||||
} else {
|
|
||||||
t = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
RoadBits pieces = Extract<RoadBits, 0>(p1);
|
RoadBits pieces = Extract<RoadBits, 0>(p1);
|
||||||
RoadTypes rts = GetRoadTypes(tile);
|
RoadTypes rts = GetRoadTypes(tile);
|
||||||
/* The tile doesn't have the given road type */
|
/* The tile doesn't have the given road type */
|
||||||
|
Loading…
Reference in New Issue
Block a user