summaryrefslogtreecommitdiff
path: root/src/water_cmd.cpp
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/water_cmd.cpp
parentd7c843a22e0d7333e906b5bdab54054b39248c0d (diff)
downloadopenttd-4901d42140f1a8742bfde617eaef794f25710167.tar.xz
(svn r20636) -Codechange: Move MarkTileDirtyByTile() and DeleteAnimatedTile() into MakeWaterKeepingClass().
Diffstat (limited to 'src/water_cmd.cpp')
-rw-r--r--src/water_cmd.cpp14
1 files changed, 7 insertions, 7 deletions
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);
}