Skip to content

Commit 23ba9a3

Browse files
committed
Fix the bug that infantry ignored Passengers and SizeLimit when entering buildings
1 parent 6171fe0 commit 23ba9a3

File tree

4 files changed

+13
-0
lines changed

4 files changed

+13
-0
lines changed

CREDITS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,7 @@ This page lists all the individual contributions to the project by their author.
386386
- Separate the AirstrikeClass pointer between the attacker/aircraft and the target to avoid erroneous overwriting issues
387387
- Fix the bug that buildings will always be tinted as airstrike owner
388388
- Fix the bug that `AllowAirstrike=no` cannot completely prevent air strikes from being launched against it
389+
- Fix the bug that infantry ignored `Passengers` and `SizeLimit` when entering buildings
389390
- **Apollo** - Translucent SHP drawing patches
390391
- **ststl**:
391392
- Customizable `ShowTimer` priority of superweapons

docs/Fixed-or-Improved-Logics.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ This page describes all ingame logics that are fixed or improved in Phobos witho
222222
- Fixed the bug that buildings will always be tinted as airstrike owner.
223223
- Fixed the bug that `AllowAirstrike=no` cannot completely prevent air strikes from being launched against it.
224224
- Fixed the issue where computer players did not search for new enemies after defeating them or forming alliances with them.
225+
- Fixed the bug that infantry ignored `Passengers` and `SizeLimit` when entering buildings.
225226

226227
## Fixes / interactions with other extensions
227228

docs/Whats-New.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,7 @@ Vanilla fixes:
392392
- Separated the AirstrikeClass pointer between the attacker/aircraft and the target to avoid erroneous overwriting issues (by NetsuNegi)
393393
- Fixed the bug that buildings will always be tinted as airstrike owner (by NetsuNegi)
394394
- Fixed the issue where computer players did not search for new enemies after defeating them or forming alliances with them (by FlyStar)
395+
- Fixed the bug that infantry ignored `Passengers` and `SizeLimit` when entering buildings (by NetsuNegi)
395396
396397
Phobos fixes:
397398
- Fixed the bug that `AllowAirstrike=no` cannot completely prevent air strikes from being launched against it (by NetsuNegi)

src/Misc/Hooks.BugFixes.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1856,6 +1856,16 @@ DEFINE_HOOK(0x44DBCF, BuildingClass_Mission_Unload_LeaveBioReactorSound, 0x6)
18561856
return 0;
18571857
}
18581858

1859+
DEFINE_HOOK(0x51A2AD, InfantryClass_UpdatePosition_EnterBuilding_CheckSize, 0x9)
1860+
{
1861+
enum { CannotEnter = 0x51A4BF };
1862+
1863+
GET(InfantryClass*, pThis, ESI);
1864+
GET(BuildingClass*, pDestination, EDI);
1865+
1866+
return pDestination->Passengers.NumPassengers + 1 <= pDestination->Type->Passengers && static_cast<int>(pThis->GetTechnoType()->Size) <= pDestination->Type->SizeLimit ? 0 : CannotEnter;
1867+
}
1868+
18591869
DEFINE_HOOK(0x710352, FootClass_ImbueLocomotor_ResetUnloadingHarvester, 0x7)
18601870
{
18611871
GET(FootClass*, pTarget, ESI);

0 commit comments

Comments
 (0)