summaryrefslogtreecommitdiff
path: root/landscape.c
diff options
context:
space:
mode:
authortron <tron@openttd.org>2006-04-10 12:36:04 +0000
committertron <tron@openttd.org>2006-04-10 12:36:04 +0000
commit7a3345f4dfacb7e09dfbd04d3b1ef98716ae64a9 (patch)
tree12fb7916b2b5ea56c7e9648fb5ecfb5d29b93161 /landscape.c
parent4fcd2f0643e3d5a729252fcb013eec77f532c232 (diff)
downloadopenttd-7a3345f4dfacb7e09dfbd04d3b1ef98716ae64a9.tar.xz
(svn r4344) Use tile coordinates or even TileIndices instead of virtual tile coordinates where it suffices.
Diffstat (limited to 'landscape.c')
-rw-r--r--landscape.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/landscape.c b/landscape.c
index e163a9abb..a86a6c463 100644
--- a/landscape.c
+++ b/landscape.c
@@ -302,19 +302,19 @@ int32 CmdClearArea(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION);
// make sure sx,sy are smaller than ex,ey
- ex = TileX(tile) * TILE_SIZE;
- ey = TileY(tile) * TILE_SIZE;
- sx = TileX(p1) * TILE_SIZE;
- sy = TileY(p1) * TILE_SIZE;
+ ex = TileX(tile);
+ ey = TileY(tile);
+ sx = TileX(p1);
+ sy = TileY(p1);
if (ex < sx) intswap(ex, sx);
if (ey < sy) intswap(ey, sy);
money = GetAvailableMoneyForCommand();
cost = 0;
- for (x = sx; x <= ex; x += TILE_SIZE) {
- for (y = sy; y <= ey; y += TILE_SIZE) {
- ret = DoCommand(TileVirtXY(x, y), 0, 0, flags & ~DC_EXEC, CMD_LANDSCAPE_CLEAR);
+ for (x = sx; x <= ex; ++x) {
+ for (y = sy; y <= ey; ++y) {
+ ret = DoCommand(TileXY(x, y), 0, 0, flags & ~DC_EXEC, CMD_LANDSCAPE_CLEAR);
if (CmdFailed(ret)) continue;
cost += ret;
success = true;
@@ -324,12 +324,12 @@ int32 CmdClearArea(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
_additional_cash_required = ret;
return cost - ret;
}
- DoCommand(TileVirtXY(x, y), 0, 0, flags, CMD_LANDSCAPE_CLEAR);
+ DoCommand(TileXY(x, y), 0, 0, flags, CMD_LANDSCAPE_CLEAR);
// draw explosion animation...
if ((x == sx || x == ex) && (y == sy || y == ey)) {
// big explosion in each corner, or small explosion for single tiles
- CreateEffectVehicleAbove(x + 8, y + 8, 2,
+ CreateEffectVehicleAbove(x * TILE_SIZE + 8, y * TILE_SIZE + 8, 2,
sy == ey && sx == ex ? EV_EXPLOSION_SMALL : EV_EXPLOSION_LARGE
);
}