From dda4ffab5e017c6e782c7ee10208fb0d364e907b Mon Sep 17 00:00:00 2001 From: fonsinchen Date: Sun, 2 Feb 2014 14:53:52 +0000 Subject: (svn r26290) -Codechange: Use nicer orthogonal tile iterator constructor and simplify calculation of explosion points when clearing. --- src/landscape.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'src/landscape.cpp') 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 { -- cgit v1.2.3-54-g00ecf