diff options
author | peter1138 <peter1138@openttd.org> | 2006-01-22 16:23:05 +0000 |
---|---|---|
committer | peter1138 <peter1138@openttd.org> | 2006-01-22 16:23:05 +0000 |
commit | cc7a9d1ce69448beb55da1932ef9e209fa754b6d (patch) | |
tree | 9c66a70fac26063dec3a43c11ef8db2e0030aa4f | |
parent | 979a8fea86ad2036cb83192b7b9e51ac679c4cd3 (diff) | |
download | openttd-cc7a9d1ce69448beb55da1932ef9e209fa754b6d.tar.xz |
(svn r3418) - Fix: When removing a town-owned tunnel the player's rating was not reduced, as it checked the ownership of the tunnel after clearing it. Now we perform the rating adjustment before clearing the tiles. (spotted by glx)
-rw-r--r-- | tunnelbridge_cmd.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/tunnelbridge_cmd.c b/tunnelbridge_cmd.c index 3964ab4e1..524a1a62c 100644 --- a/tunnelbridge_cmd.c +++ b/tunnelbridge_cmd.c @@ -685,12 +685,15 @@ static int32 DoClearTunnel(TileIndex tile, uint32 flags) // else the direction is always 0.. dah!! ;) byte tile_dir = GB(_m[tile].m5, 0, 2); byte endtile_dir = GB(_m[endtile].m5, 0, 2); + + // 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, _updsignals_tunnel_dir[tile_dir]); UpdateSignalsOnSegment(endtile, _updsignals_tunnel_dir[endtile_dir]); - if (IsTileOwner(tile, OWNER_TOWN) && _game_mode != GM_EDITOR) - ChangeTownRating(t, RATING_TUNNEL_BRIDGE_DOWN_STEP, RATING_TUNNEL_BRIDGE_MINIMUM); } return _price.clear_tunnel * (length + 1); } |