summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-08-27 22:29:13 +0000
committerrubidium <rubidium@openttd.org>2010-08-27 22:29:13 +0000
commit50769995c7934e8a12d7da1e28aa84b5264f3e59 (patch)
treef986f9d458f24245dabad68884476ca5afe65a5b
parent536bb704b7bd4d15302e6e2f0200184af151cb73 (diff)
downloadopenttd-50769995c7934e8a12d7da1e28aa84b5264f3e59.tar.xz
(svn r20640) -Add: support for water under objects
-rw-r--r--src/object_cmd.cpp5
-rw-r--r--src/water_cmd.cpp3
2 files changed, 7 insertions, 1 deletions
diff --git a/src/object_cmd.cpp b/src/object_cmd.cpp
index 5c39529c8..262f9142f 100644
--- a/src/object_cmd.cpp
+++ b/src/object_cmd.cpp
@@ -19,6 +19,7 @@
#include "genworld.h"
#include "autoslope.h"
#include "functions.h"
+#include "water.h"
#include "window_func.h"
#include "company_gui.h"
#include "cheat_type.h"
@@ -316,7 +317,7 @@ static CommandCost ClearTile_Object(TileIndex tile, DoCommandFlag flags)
}
if (flags & DC_EXEC) {
- TILE_AREA_LOOP(tile_cur, ta) DoClearSquare(tile_cur);
+ TILE_AREA_LOOP(tile_cur, ta) MakeWaterKeepingClass(tile_cur, GetTileOwner(tile_cur));
delete o;
}
@@ -356,6 +357,8 @@ static void GetTileDesc_Object(TileIndex tile, TileDesc *td)
static void TileLoop_Object(TileIndex tile)
{
+ if (IsTileOnWater(tile)) TileLoop_Water(tile);
+
if (!IsCompanyHQ(tile)) return;
/* HQ accepts passenger and mail; but we have to divide the values
diff --git a/src/water_cmd.cpp b/src/water_cmd.cpp
index fcd834052..6f24956b1 100644
--- a/src/water_cmd.cpp
+++ b/src/water_cmd.cpp
@@ -499,6 +499,8 @@ static bool IsWateredTile(TileIndex tile, Direction from)
return IsTileOnWater(tile);
}
+ case MP_OBJECT: return IsTileOnWater(tile);
+
case MP_TUNNELBRIDGE: return GetTunnelBridgeTransportType(tile) == TRANSPORT_WATER && ReverseDiagDir(GetTunnelBridgeDirection(tile)) == DirToDiagDir(from);
default: return false;
@@ -935,6 +937,7 @@ FloodingBehaviour GetFloodingBehaviour(TileIndex tile)
/* FALL THROUGH */
case MP_STATION:
case MP_INDUSTRY:
+ case MP_OBJECT:
return (GetWaterClass(tile) == WATER_CLASS_SEA) ? FLOOD_ACTIVE : FLOOD_NONE;
case MP_RAILWAY: