Mercurial > hg > openttd
changeset 15948:bad329a56468 draft
(svn r20636) -Codechange: Move MarkTileDirtyByTile() and DeleteAnimatedTile() into MakeWaterKeepingClass().
author | frosch <frosch@openttd.org> |
---|---|
date | Fri, 27 Aug 2010 20:46:36 +0000 |
parents | bc4dc3a47c50 |
children | e283599f568c |
files | src/industry_cmd.cpp src/station_cmd.cpp src/water_cmd.cpp src/waypoint_cmd.cpp |
diffstat | 4 files changed, 8 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
--- a/src/industry_cmd.cpp +++ b/src/industry_cmd.cpp @@ -145,12 +145,6 @@ /* MakeWaterKeepingClass() can also handle 'land' */ MakeWaterKeepingClass(tile_cur, OWNER_NONE); - - /* MakeWaterKeepingClass() doesn't remove animation if the tiles - * become watery, but be on the safe side an always remote it. */ - DeleteAnimatedTile(tile_cur); - - MarkTileDirtyByTile(tile_cur); } } else if (IsTileType(tile_cur, MP_STATION) && IsOilRig(tile_cur)) { DeleteOilRig(tile_cur);
--- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -2492,13 +2492,12 @@ if (flags & DC_EXEC) { DoClearSquare(tile1); + MarkTileDirtyByTile(tile1); MakeWaterKeepingClass(tile2, st->owner); st->rect.AfterRemoveTile(st, tile1); st->rect.AfterRemoveTile(st, tile2); - MarkTileDirtyByTile(tile2); - st->dock_tile = INVALID_TILE; st->facilities &= ~FACIL_DOCK; @@ -3398,7 +3397,6 @@ Station *st = Station::GetByTile(tile); MakeWaterKeepingClass(tile, OWNER_NONE); - MarkTileDirtyByTile(tile); st->dock_tile = INVALID_TILE; st->airport.Clear();
--- a/src/water_cmd.cpp +++ b/src/water_cmd.cpp @@ -136,8 +136,6 @@ void MakeWaterKeepingClass(TileIndex tile, Owner o) { - assert(IsTileType(tile, MP_WATER) || (IsTileType(tile, MP_STATION) && (IsBuoy(tile) || IsDock(tile) || IsOilRig(tile))) || IsTileType(tile, MP_INDUSTRY)); - WaterClass wc = GetWaterClass(tile); /* Autoslope might turn an originally canal or river tile into land */ @@ -146,12 +144,18 @@ if (wc == WATER_CLASS_SEA && z > 0) wc = WATER_CLASS_CANAL; + /* Zero map array and terminate animation */ + DoClearSquare(tile); + + /* Maybe change to water */ switch (wc) { case WATER_CLASS_SEA: MakeSea(tile); break; case WATER_CLASS_CANAL: MakeCanal(tile, o, Random()); break; case WATER_CLASS_RIVER: MakeRiver(tile, Random()); break; - default: DoClearSquare(tile); break; + default: break; } + + MarkTileDirtyByTile(tile); } static CommandCost RemoveShipDepot(TileIndex tile, DoCommandFlag flags) @@ -175,8 +179,6 @@ MakeWaterKeepingClass(tile, GetTileOwner(tile)); MakeWaterKeepingClass(tile2, GetTileOwner(tile2)); - MarkTileDirtyByTile(tile); - MarkTileDirtyByTile(tile2); } return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_CLEAR_DEPOT_SHIP]); @@ -269,8 +271,6 @@ DoClearSquare(tile); MakeWaterKeepingClass(tile + delta, GetTileOwner(tile)); MakeWaterKeepingClass(tile - delta, GetTileOwner(tile)); - MarkTileDirtyByTile(tile - delta); - MarkTileDirtyByTile(tile + delta); MarkCanalsAndRiversAroundDirty(tile - delta); MarkCanalsAndRiversAroundDirty(tile + delta); }
--- a/src/waypoint_cmd.cpp +++ b/src/waypoint_cmd.cpp @@ -349,7 +349,6 @@ * buoy was placed. Otherwise one could plant a buoy on a canal edge, * remove it and flood the land (if the canal edge is at level 0) */ MakeWaterKeepingClass(tile, GetTileOwner(tile)); - MarkTileDirtyByTile(tile); wp->rect.AfterRemoveTile(wp, tile);