Skip to content

Commit 2050499

Browse files
committed
Fix CanBeBuiltOn not being checked on flushing building foundation on placement
1 parent 710a251 commit 2050499

2 files changed

Lines changed: 18 additions & 0 deletions

File tree

docs/Whats-New.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,7 @@ HideLightFlashEffects=false ; boolean
318318
- Fixed the bug that weapon cannot used to intercept on gound bullet if it's projectile has `AG=no` (by NetsuNegi)
319319
- Fixed the bug that if there's a tank in tank bunker, tank bunker use auto death by vanish will cause tank get stuck and game will crash quickly (by NetsuNegi)
320320
- Fixed `ROF.RandomDelay` incorrectly defaulting to 0 (no delay) instead of random value in range 0-2 (by Starkku)
321+
- Fixed an oversight that prevented units deploying into buildings from deploying on top of `CanBeBuiltOn` TerrainTypes (by Starkku)
321322
Vanilla fixes:
322323
- Fixed preplaced aircraft outside visible map being incorrectly flagged as crashing under certain conditions (by Starkku)
323324

src/Ext/TerrainType/Hooks.Passable.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,3 +147,20 @@ DEFINE_HOOK(0x5FD2B6, OverlayClass_Unlimbo_SkipTerrainCheck, 0x9)
147147

148148
return Unlimbo;
149149
}
150+
151+
// Buildable-upon TerrainTypes Hook #5 -> Ignore when flushing building foundations for placement.
152+
DEFINE_HOOK(0x45EF3A, BuildingTypeClass_FlushForPlacement_BuildableTerrain, 0x7)
153+
{
154+
enum { Disallow = 0x45F00B, Continue = 0x45EF4A };
155+
156+
GET(ObjectClass* const, pObject, ESI);
157+
158+
if (auto const pTerrain = abstract_cast<TerrainClass*>(pObject))
159+
{
160+
if (!TerrainTypeExt::ExtMap.Find(pTerrain->Type)->CanBeBuiltOn)
161+
return Disallow;
162+
}
163+
164+
return Continue;
165+
}
166+

0 commit comments

Comments
 (0)