summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortron <tron@openttd.org>2005-03-28 18:59:33 +0000
committertron <tron@openttd.org>2005-03-28 18:59:33 +0000
commitb2dd47f565d5ba9d92f808ce2e822c23cf562f78 (patch)
treee8abe57b542102484d3ab3eab8f8d285c30de37e
parent72dbefdebd551ae05b317f9b138e2a762fa5e2c5 (diff)
downloadopenttd-b2dd47f565d5ba9d92f808ce2e822c23cf562f78.tar.xz
(svn r2102) Fix bug introduced in r2038, which gave you money for clearing occupied railway tiles ([1171926])
-rw-r--r--rail_cmd.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/rail_cmd.c b/rail_cmd.c
index 6c0d1890d..57c882fbd 100644
--- a/rail_cmd.c
+++ b/rail_cmd.c
@@ -1070,6 +1070,10 @@ static int32 ClearTile_Track(TileIndex tile, byte flags)
}
m5 &= RAIL_BIT_MASK;
+ if (!(flags & DC_EXEC)) {
+ for (; m5 != 0; m5 >>= 1) if (m5 & 1) cost += _price.remove_rail;
+ return cost;
+ }
/* FALLTHROUGH */
case RAIL_TYPE_NORMAL: {
@@ -1077,12 +1081,8 @@ static int32 ClearTile_Track(TileIndex tile, byte flags)
for (i = 0; m5 != 0; i++, m5 >>= 1) {
if (m5 & 1) {
- if (flags & DC_EXEC) {
- ret = DoCommandByTile(tile, 0, i, flags, CMD_REMOVE_SINGLE_RAIL);
- if (ret == CMD_ERROR) return CMD_ERROR;
- } else {
- ret = _price.remove_rail;
- }
+ ret = DoCommandByTile(tile, 0, i, flags, CMD_REMOVE_SINGLE_RAIL);
+ if (ret == CMD_ERROR) return CMD_ERROR;
cost += ret;
}
}