(svn r2102) Fix bug introduced in r2038, which gave you money for clearing occupied railway tiles ([1171926])

This commit is contained in:
tron 2005-03-28 18:59:33 +00:00
parent 6ec727d15c
commit 9d2406729e

View File

@ -1070,6 +1070,10 @@ static int32 ClearTile_Track(TileIndex tile, byte flags)
} }
m5 &= RAIL_BIT_MASK; m5 &= RAIL_BIT_MASK;
if (!(flags & DC_EXEC)) {
for (; m5 != 0; m5 >>= 1) if (m5 & 1) cost += _price.remove_rail;
return cost;
}
/* FALLTHROUGH */ /* FALLTHROUGH */
case RAIL_TYPE_NORMAL: { case RAIL_TYPE_NORMAL: {
@ -1077,12 +1081,8 @@ static int32 ClearTile_Track(TileIndex tile, byte flags)
for (i = 0; m5 != 0; i++, m5 >>= 1) { for (i = 0; m5 != 0; i++, m5 >>= 1) {
if (m5 & 1) { if (m5 & 1) {
if (flags & DC_EXEC) { ret = DoCommandByTile(tile, 0, i, flags, CMD_REMOVE_SINGLE_RAIL);
ret = DoCommandByTile(tile, 0, i, flags, CMD_REMOVE_SINGLE_RAIL); if (ret == CMD_ERROR) return CMD_ERROR;
if (ret == CMD_ERROR) return CMD_ERROR;
} else {
ret = _price.remove_rail;
}
cost += ret; cost += ret;
} }
} }