diff options
author | glx <glx@openttd.org> | 2008-01-09 17:47:05 +0000 |
---|---|---|
committer | glx <glx@openttd.org> | 2008-01-09 17:47:05 +0000 |
commit | 785572ea32e11064375e9de0a789f46c73acac75 (patch) | |
tree | 1d841ecd272ea4bb508f03002e59308992257cbf /src/tunnelbridge_cmd.cpp | |
parent | d133edd026b031ff45916f33bc2bed525e3c2f0b (diff) | |
download | openttd-785572ea32e11064375e9de0a789f46c73acac75.tar.xz |
(svn r11795) -Fix [FS#1616]: take town rating into account when testing if a command can be executed.
Diffstat (limited to 'src/tunnelbridge_cmd.cpp')
-rw-r--r-- | src/tunnelbridge_cmd.cpp | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/tunnelbridge_cmd.cpp b/src/tunnelbridge_cmd.cpp index 239d7f7e7..9148c9255 100644 --- a/src/tunnelbridge_cmd.cpp +++ b/src/tunnelbridge_cmd.cpp @@ -596,16 +596,18 @@ static CommandCost DoClearTunnel(TileIndex tile, uint32 flags) } } + /* checks if the owner is town then decrease town rating by RATING_TUNNEL_BRIDGE_DOWN_STEP until + * you have a "Poor" (0) town rating */ + if (IsTileOwner(tile, OWNER_TOWN) && _game_mode != GM_EDITOR) { + ChangeTownRating(t, RATING_TUNNEL_BRIDGE_DOWN_STEP, RATING_TUNNEL_BRIDGE_MINIMUM); + } + if (flags & DC_EXEC) { /* We first need to request the direction before calling DoClearSquare * else the direction is always 0.. dah!! ;) */ DiagDirection dir = GetTunnelBridgeDirection(tile); Track track; - /* Adjust the town's player rating. Do this before removing the tile owner info. */ - if (IsTileOwner(tile, OWNER_TOWN) && _game_mode != GM_EDITOR) - ChangeTownRating(t, RATING_TUNNEL_BRIDGE_DOWN_STEP, RATING_TUNNEL_BRIDGE_MINIMUM); - DoClearSquare(tile); DoClearSquare(endtile); UpdateSignalsOnSegment(tile, ReverseDiagDir(dir)); @@ -645,15 +647,16 @@ static CommandCost DoClearBridge(TileIndex tile, uint32 flags) } } + /* checks if the owner is town then decrease town rating by RATING_TUNNEL_BRIDGE_DOWN_STEP until + * you have a "Poor" (0) town rating */ + if (IsTileOwner(tile, OWNER_TOWN) && _game_mode != GM_EDITOR) { + ChangeTownRating(t, RATING_TUNNEL_BRIDGE_DOWN_STEP, RATING_TUNNEL_BRIDGE_MINIMUM); + } + if (flags & DC_EXEC) { TileIndex c; Track track; - /* checks if the owner is town then decrease town rating by RATING_TUNNEL_BRIDGE_DOWN_STEP until - * you have a "Poor" (0) town rating */ - if (IsTileOwner(tile, OWNER_TOWN) && _game_mode != GM_EDITOR) - ChangeTownRating(t, RATING_TUNNEL_BRIDGE_DOWN_STEP, RATING_TUNNEL_BRIDGE_MINIMUM); - DoClearSquare(tile); DoClearSquare(endtile); for (c = tile + delta; c != endtile; c += delta) { |