summaryrefslogtreecommitdiff
path: root/src/clear_cmd.cpp
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-10-30 11:13:12 +0100
committerErich Eckner <git@eckner.net>2022-01-16 21:58:15 +0100
commit0c5ba5b7bf9a9dfa78c026f4da656940a460f47d (patch)
treed2a44494bbd70425b8f9e0e22b8c4e4dd8223001 /src/clear_cmd.cpp
parent523901887827768d6bff347ddb57787b295cc9e1 (diff)
downloadopenttd-0c5ba5b7bf9a9dfa78c026f4da656940a460f47d.tar.xz
underground patch applied
Diffstat (limited to 'src/clear_cmd.cpp')
-rw-r--r--src/clear_cmd.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/clear_cmd.cpp b/src/clear_cmd.cpp
index 17711a626..5fc5829f9 100644
--- a/src/clear_cmd.cpp
+++ b/src/clear_cmd.cpp
@@ -12,6 +12,7 @@
#include "command_func.h"
#include "landscape.h"
#include "genworld.h"
+#include "layer_func.h"
#include "viewport_func.h"
#include "water.h"
#include "core/random_func.hpp"
@@ -99,8 +100,28 @@ static void DrawClearLandFence(const TileInfo *ti)
EndSpriteCombine();
}
+static void DrawUndergroundTile_Clear(TileInfo *ti)
+{
+
+}
+
static void DrawTile_Clear(TileInfo *ti)
{
+ uint base_tile = TopTile(ti->tile);
+ uint underground_tile = DownTile(base_tile);
+
+ bool self_underground = IsUnderground(ti->tile);
+
+ bool have_canalization = IsTileType(base_tile, MP_HOUSE);
+ bool have_underground = !IsTileType(underground_tile, MP_CLEAR);
+
+ if (self_underground && !have_canalization)
+ DrawGroundSprite(SPR_FLAT_BARE_LAND + SlopeToSpriteOffset(ti->tileh), PAL_NONE);
+
+ if (self_underground && have_canalization)
+ DrawGroundSprite(SPR_FLAT_GRASS_TILE + SlopeToSpriteOffset(ti->tileh), PAL_NONE);
+
+ if (!self_underground)
switch (GetClearGround(ti->tile)) {
case CLEAR_GRASS:
DrawClearLandTile(ti, GetClearDensity(ti->tile));
@@ -125,6 +146,9 @@ static void DrawTile_Clear(TileInfo *ti)
break;
}
+ if (!self_underground && have_underground)
+ DrawGroundSprite(SPR_FLAT_BARE_LAND + SlopeToSpriteOffset(ti->tileh), PAL_NONE);
+
DrawBridgeMiddle(ti);
}