From 9d2406729e7e2ef1690af65827ef277bb9754004 Mon Sep 17 00:00:00 2001 From: tron Date: Mon, 28 Mar 2005 18:59:33 +0000 Subject: [PATCH] (svn r2102) Fix bug introduced in r2038, which gave you money for clearing occupied railway tiles ([1171926]) --- rail_cmd.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/rail_cmd.c b/rail_cmd.c index 6c0d1890d8..57c882fbdb 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; } }