diff options
author | Darkvater <darkvater@openttd.org> | 2005-07-15 21:17:38 +0000 |
---|---|---|
committer | Darkvater <darkvater@openttd.org> | 2005-07-15 21:17:38 +0000 |
commit | c496d92c3e2d19c276a1d9ede104a7a86575693d (patch) | |
tree | e63c0fc2d2e8d7ef2f0f4f5837b6a1ba9798c670 | |
parent | 71f9078bddbf26a771c259bc4cde377b90a980ba (diff) | |
download | openttd-c496d92c3e2d19c276a1d9ede104a7a86575693d.tar.xz |
(svn r2584) - Fix: Game no longer asserts when you use the remove-road tool on a town building or industry.
-rw-r--r-- | road_cmd.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/road_cmd.c b/road_cmd.c index 2fc75a02a..3996901ef 100644 --- a/road_cmd.c +++ b/road_cmd.c @@ -139,7 +139,7 @@ int32 CmdRemoveRoad(int x, int y, uint32 flags, uint32 p1, uint32 p2) TileInfo ti; int32 cost; TileIndex tile; - byte owner; + PlayerID owner; Town *t; /* true if the roadpiece was always removeable, * false if it was a center piece. Affects town ratings drop */ @@ -154,12 +154,11 @@ int32 CmdRemoveRoad(int x, int y, uint32 flags, uint32 p1, uint32 p2) FindLandscapeHeight(&ti, x, y); tile = ti.tile; - // owner for railraod crossing is stored somewhere else + if (!IsTileType(tile, MP_STREET) && !IsTileType(tile, MP_TUNNELBRIDGE)) return CMD_ERROR; + + // owner for railroad crossing is stored somewhere else // XXX - Fix this so for a given tiletype the owner of the type is in the same variable - if (IsTileType(tile, MP_STREET) && IsLevelCrossing(tile)) { - owner = _m[tile].m3; - } else - owner = GetTileOwner(tile); + owner = IsLevelCrossing(tile) ? _m[tile].m3 : 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) |