Skip to content

Commit 72c9b03

Browse files
authored
[Minor] Fix the issue where infantry get stuck in their current cell during movement (#1640)
1 parent 3d66793 commit 72c9b03

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

src/Misc/Hooks.BugFixes.cpp

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1877,14 +1877,32 @@ DEFINE_HOOK(0x73C43F, UnitClass_DrawAsVXL_Shadow_IsLocomotorFix2, 0x6)
18771877
return SkipGameCode;
18781878
}
18791879

1880+
namespace RemoveCellContentTemp
1881+
{
1882+
bool CheckBeforeUnmark = false;
1883+
}
1884+
1885+
DEFINE_HOOK(0x737F74, UnitClass_ReceiveDamage_NowDead_MarkUp, 0x6)
1886+
{
1887+
enum { SkipGameCode = 0x737F80 };
1888+
1889+
GET(UnitClass*, pThis, ESI);
1890+
1891+
RemoveCellContentTemp::CheckBeforeUnmark = true;
1892+
pThis->Mark(MarkType::Up);
1893+
RemoveCellContentTemp::CheckBeforeUnmark = false;
1894+
1895+
return SkipGameCode;
1896+
}
1897+
18801898
DEFINE_HOOK(0x47EAF7, CellClass_RemoveContent_BeforeUnmarkOccupationBits, 0x7)
18811899
{
18821900
enum { ContinueCheck = 0x47EAFE, DontUnmark = 0x47EB8F };
18831901

18841902
GET(CellClass*, pCell, EDI);
18851903
GET_STACK(bool, onBridge, STACK_OFFSET(0x14, 0x8));
18861904

1887-
if (onBridge ? pCell->AltObject : pCell->FirstObject)
1905+
if (RemoveCellContentTemp::CheckBeforeUnmark && (onBridge ? pCell->AltObject : pCell->FirstObject))
18881906
return DontUnmark;
18891907

18901908
GET(ObjectClass*, pContent, ESI);

0 commit comments

Comments
 (0)