Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CREDITS.md
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,7 @@ This page lists all the individual contributions to the project by their author.
- Fix an issue that technos head to building's dock even they are not going to dock
- Fix an issue that the jumpjet vehicles cannot stop correctly after going berserk
- Attack and damage technos underground
- Fix an issue that infantry walking through a cell containing a tree would cause it to be impassable to other houses
- **solar-III (凤九歌)**
- Target scanning delay customization (documentation)
- Skip target scanning function calling for unarmed technos (documentation)
Expand Down
1 change: 1 addition & 0 deletions docs/Fixed-or-Improved-Logics.md
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ This page describes all ingame logics that are fixed or improved in Phobos witho
- `DeployingAnim` using unit drawer now also tint accordingly with the unit.
- Fixed an issue that jumpjets in air can not correctly spawn missiles.
- Fixed an issue that the currently hovered planning node not update up-to-date, such as using hotkeys to select technos.
- Fixed an issue that infantry walking through a cell containing a tree would cause it to be impassable to other houses.

## Fixes / interactions with other extensions

Expand Down
1 change: 1 addition & 0 deletions docs/Whats-New.md
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,7 @@ Vanilla fixes:
- Fixed an issue that jumpjet infantries' shadow is always drawn even if they are cloaked (by TaranDahl)
- Fixed an issue that technos head to building's dock even they are not going to dock (by TaranDahl)
- Fixed an issue that the jumpjet vehicles cannot stop correctly after going berserk (by TaranDahl)
- Fixed an issue that infantry walking through a cell containing a tree would cause it to be impassable to other houses (by TaranDahl)

Phobos fixes:
- Fixed the bug that `AllowAirstrike=no` cannot completely prevent air strikes from being launched against it (by NetsuNegi)
Expand Down
1 change: 1 addition & 0 deletions src/Ext/Cell/Body.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ void CellExt::ExtData::Serialize(T& Stm)
Stm
.Process(this->RadSites)
.Process(this->RadLevels)
.Process(this->InfantryCount)
;
}

Expand Down
1 change: 1 addition & 0 deletions src/Ext/Cell/Body.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class CellExt
public:
std::vector<RadSiteClass*> RadSites {};
std::vector<RadLevel> RadLevels { };
int InfantryCount{ 0 };

ExtData(CellClass* OwnerObject) : Extension<CellClass>(OwnerObject)
{ }
Expand Down
30 changes: 29 additions & 1 deletion src/Misc/Hooks.BugFixes.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <AircraftClass.h>
#include <AircraftClass.h>
#include <AircraftTrackerClass.h>
#include <AnimClass.h>
#include <BuildingClass.h>
Expand Down Expand Up @@ -29,6 +29,7 @@
#include <Ext/AnimType/Body.h>
#include <Ext/SWType/Body.h>
#include <Ext/WarheadType/Body.h>
#include <Ext/Cell/Body.h>

#include <Utilities/Macro.h>
#include <Utilities/Debug.h>
Expand Down Expand Up @@ -2671,3 +2672,30 @@ DEFINE_HOOK(0x74431F, UnitClass_ReadyToNextMission_HuntCheck, 0x6)
GET(UnitClass*, pThis, ESI);
return pThis->GetCurrentMission() != Mission::Hunt ? 0 : 0x744329;
}

#pragma region InfBlockTreeFix

DEFINE_HOOK(0x52182A, InfantryClass_MarkAllOccupationBits_SetOwnerIdx, 0x6)
{
GET(CellClass*, pCell, ESI);
CellExt::ExtMap.Find(pCell)->InfantryCount++;
return 0;
}

DEFINE_HOOK(0x5218C2, InfantryClass_UnmarkAllOccupationBits_ResetOwnerIdx, 0x6)
{
enum { Reset = 0x5218CC, NoReset = 0x5218D3 };

GET(CellClass*, pCell, ESI);
GET(DWORD, newFlag, ECX);

pCell->OccupationFlags = newFlag;
auto pExt = CellExt::ExtMap.Find(pCell);
pExt->InfantryCount--;

// Vanilla check only the flag to decide if the InfantryOwnerIndex should be reset.
// But the tree take one of the flag bit. So if a infantry walk through a cell with a tree, the InfantryOwnerIndex won't be reset.
return (newFlag & 0x1C) == 0 || pExt->InfantryCount == 0 ? Reset : NoReset;
}

#pragma endregion