summaryrefslogtreecommitdiff
path: root/src/landscape.cpp
diff options
context:
space:
mode:
authorfonsinchen <fonsinchen@openttd.org>2014-02-02 14:53:52 +0000
committerfonsinchen <fonsinchen@openttd.org>2014-02-02 14:53:52 +0000
commitdda4ffab5e017c6e782c7ee10208fb0d364e907b (patch)
treeae872f19500fccc47243a728fee4909cf50ac238 /src/landscape.cpp
parent547e521381a4794c122e4fcea166b6e75b5bc48f (diff)
downloadopenttd-dda4ffab5e017c6e782c7ee10208fb0d364e907b.tar.xz
(svn r26290) -Codechange: Use nicer orthogonal tile iterator constructor and simplify calculation of explosion points when clearing.
Diffstat (limited to 'src/landscape.cpp')
-rw-r--r--src/landscape.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/landscape.cpp b/src/landscape.cpp
index d69275dd3..d5b06422a 100644
--- a/src/landscape.cpp
+++ b/src/landscape.cpp
@@ -667,8 +667,7 @@ CommandCost CmdClearArea(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
const Company *c = (flags & (DC_AUTO | DC_BANKRUPT)) ? NULL : Company::GetIfValid(_current_company);
int limit = (c == NULL ? INT32_MAX : GB(c->clear_limit, 16, 16));
- TileArea ta(tile, p1);
- TileIterator *iter = HasBit(p2, 0) ? (TileIterator *)new DiagonalTileIterator(tile, p1) : new OrthogonalTileIterator(ta);
+ TileIterator *iter = HasBit(p2, 0) ? (TileIterator *)new DiagonalTileIterator(tile, p1) : new OrthogonalTileIterator(tile, p1);
for (; *iter != INVALID_TILE; ++(*iter)) {
TileIndex t = *iter;
CommandCost ret = DoCommand(t, 0, 0, flags & ~DC_EXEC, CMD_LANDSCAPE_CLEAR);
@@ -692,11 +691,10 @@ CommandCost CmdClearArea(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
/* draw explosion animation...
* Disable explosions when game is paused. Looks silly and blocks the view. */
- TileIndex off = t - ta.tile;
- if ((TileX(off) == 0 || TileX(off) == ta.w - 1U) && (TileY(off) == 0 || TileY(off) == ta.h - 1U) && _pause_mode == PM_UNPAUSED) {
- /* big explosion in each corner, or small explosion for single tiles */
+ if ((t == tile || t == p1) && _pause_mode == PM_UNPAUSED) {
+ /* big explosion in two corners, or small explosion for single tiles */
CreateEffectVehicleAbove(TileX(t) * TILE_SIZE + TILE_SIZE / 2, TileY(t) * TILE_SIZE + TILE_SIZE / 2, 2,
- ta.w == 1 && ta.h == 1 ? EV_EXPLOSION_SMALL : EV_EXPLOSION_LARGE
+ TileX(tile) == TileX(p1) && TileY(tile) == TileY(p1) ? EV_EXPLOSION_SMALL : EV_EXPLOSION_LARGE
);
}
} else {