summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2010-08-27 20:46:36 +0000
committerfrosch <frosch@openttd.org>2010-08-27 20:46:36 +0000
commit4901d42140f1a8742bfde617eaef794f25710167 (patch)
treeb006892ef34d82514fdca39f4f5aa423ec69ff50 /src
parentd7c843a22e0d7333e906b5bdab54054b39248c0d (diff)
downloadopenttd-4901d42140f1a8742bfde617eaef794f25710167.tar.xz
(svn r20636) -Codechange: Move MarkTileDirtyByTile() and DeleteAnimatedTile() into MakeWaterKeepingClass().
Diffstat (limited to 'src')
-rw-r--r--src/industry_cmd.cpp6
-rw-r--r--src/station_cmd.cpp4
-rw-r--r--src/water_cmd.cpp14
-rw-r--r--src/waypoint_cmd.cpp1
4 files changed, 8 insertions, 17 deletions
diff --git a/src/industry_cmd.cpp b/src/industry_cmd.cpp
index 8aa4ef7d9..013de136f 100644
--- a/src/industry_cmd.cpp
+++ b/src/industry_cmd.cpp
@@ -145,12 +145,6 @@ Industry::~Industry()
/* 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);
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp
index 39a98453c..9ef27c6f7 100644
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -2492,13 +2492,12 @@ static CommandCost RemoveDock(TileIndex tile, DoCommandFlag flags)
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 @@ void DeleteOilRig(TileIndex tile)
Station *st = Station::GetByTile(tile);
MakeWaterKeepingClass(tile, OWNER_NONE);
- MarkTileDirtyByTile(tile);
st->dock_tile = INVALID_TILE;
st->airport.Clear();
diff --git a/src/water_cmd.cpp b/src/water_cmd.cpp
index cb96e89ba..fcd834052 100644
--- a/src/water_cmd.cpp
+++ b/src/water_cmd.cpp
@@ -136,8 +136,6 @@ CommandCost CmdBuildShipDepot(TileIndex tile, DoCommandFlag flags, uint32 p1, ui
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 @@ void MakeWaterKeepingClass(TileIndex tile, Owner o)
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 @@ static CommandCost RemoveShipDepot(TileIndex tile, DoCommandFlag flags)
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 @@ static CommandCost RemoveLock(TileIndex tile, DoCommandFlag flags)
DoClearSquare(tile);
MakeWaterKeepingClass(tile + delta, GetTileOwner(tile));
MakeWaterKeepingClass(tile - delta, GetTileOwner(tile));
- MarkTileDirtyByTile(tile - delta);
- MarkTileDirtyByTile(tile + delta);
MarkCanalsAndRiversAroundDirty(tile - delta);
MarkCanalsAndRiversAroundDirty(tile + delta);
}
diff --git a/src/waypoint_cmd.cpp b/src/waypoint_cmd.cpp
index 9a0954aef..9733ac951 100644
--- a/src/waypoint_cmd.cpp
+++ b/src/waypoint_cmd.cpp
@@ -349,7 +349,6 @@ CommandCost RemoveBuoy(TileIndex tile, DoCommandFlag flags)
* 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);