From c8709a962390f2750e395227a0e861dadc83d5ce Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Sun, 17 Mar 2024 10:38:58 +0000 Subject: [PATCH] Add edge flood behaviour for land ground objects with no foundations --- docs/newgrf-additions-nml.html | 2 +- docs/newgrf-additions.html | 2 +- src/water_cmd.cpp | 5 +++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/docs/newgrf-additions-nml.html b/docs/newgrf-additions-nml.html index 5147aee695..58ab7cbd8c 100644 --- a/docs/newgrf-additions-nml.html +++ b/docs/newgrf-additions-nml.html @@ -304,7 +304,7 @@ use_land_ground0 or 1 Sets whether to use the underlying ground as the object ground sprite, ignoring the ground sprite provided in the sprite layout.
When enabled, the ground sprite will be bare ground, grass, snow, desert, etc. as if it were a clear ground tile.
- In edge foundation mode, the ground may be coast/shore when flooded. + In edge foundation mode, or when foundations are disabled, the ground may be coast/shore when flooded. edge_foundation_mode[mode0, mode1, mode2, mode3] Enables edge foundation mode for the object.
diff --git a/docs/newgrf-additions.html b/docs/newgrf-additions.html index c4ea4873eb..860f59630b 100644 --- a/docs/newgrf-additions.html +++ b/docs/newgrf-additions.html @@ -583,7 +583,7 @@

Object uses land ground sprite (mappable property: object_use_land_ground)

This property sets whether to use the underlying ground as the object ground sprite, ignoring the ground sprite provided in the sprite layout.
When enabled, the ground sprite will be bare ground, grass, snow, desert, etc. as if it were a clear ground tile.
- In edge foundation mode, the ground may be coast/shore when flooded.
+ In edge foundation mode, or when foundations are disabled, the ground may be coast/shore when flooded.
The property length is 1 byte. 0 is disabled (default). 1 is enabled.

This is indicated by the feature name: action0_object_use_land_ground, version 1

Enable object edge foundation mode (mappable property: object_edge_foundation_mode)

diff --git a/src/water_cmd.cpp b/src/water_cmd.cpp index bc54a23bd4..c4a485389b 100644 --- a/src/water_cmd.cpp +++ b/src/water_cmd.cpp @@ -1247,6 +1247,11 @@ void DoFloodTile(TileIndex target) SetObjectGroundTypeDensity(target, OBJECT_GROUND_SHORE, 3); MarkTileDirtyByTile(target, VMDF_NOT_MAP_MODE); flooded = true; + } else if ((spec->ctrl_flags & OBJECT_CTRL_FLAG_USE_LAND_GROUND) && (spec->flags & OBJECT_FLAG_HAS_NO_FOUNDATION)) { + SetWaterClass(target, WATER_CLASS_SEA); + SetObjectGroundTypeDensity(target, OBJECT_GROUND_SHORE, 3); + MarkTileDirtyByTile(target, VMDF_NOT_MAP_MODE); + flooded = true; } break; }