Skip to content

Commit 7990138

Browse files
authored
Revert revert building chown unfix
1 parent bed263a commit 7990138

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/Misc/Hooks.BugFixes.cpp

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -791,22 +791,28 @@ DEFINE_HOOK(0x6D9781, Tactical_RenderLayers_DrawInfoTipAndSpiedSelection, 0x5)
791791
}
792792
#pragma endregion DrawInfoTipAndSpiedSelection
793793

794-
#include <intrin.h>
795794
bool __fastcall BuildingClass_SetOwningHouse_Wrapper(BuildingClass* pThis, void*, HouseClass* pHouse, bool announce)
796795
{
797796
// Fix : Suppress capture EVA event if ConsideredVehicle=yes
798797
if(announce) announce = !pThis->IsStrange();
799798

800799
bool res = reinterpret_cast<bool(__thiscall*)(BuildingClass*, HouseClass*, bool)>(0x448260)(pThis, pHouse, announce);
801-
// TODO: something goes wrong in TAction 36, fix it later
802-
DWORD const caller =(DWORD) _ReturnAddress();
803-
if(caller > 0x6E0C91 || caller < 0x6E0B60)
800+
804801
if (res && (pThis->Type->Powered || pThis->Type->PoweredSpecial))
805-
reinterpret_cast<void(__thiscall*)(BuildingClass*)>(0x4549B0)(pThis);
802+
{
803+
bool on = pThis->IsPowerOnline();
804+
if (on != pThis->WasOnline)
805+
{
806+
reinterpret_cast<void(__thiscall*)(BuildingClass*)>(0x4549B0)(pThis);
807+
pThis->WasOnline = on;
808+
}
809+
}
806810
return res;
807811
}
808812

809813
DEFINE_FUNCTION_JUMP(VTABLE, 0x7E4290, BuildingClass_SetOwningHouse_Wrapper);
814+
DEFINE_JUMP(LJMP, 0x6E0BD4, 0x6E0BFE);
815+
DEFINE_JUMP(LJMP, 0x6E0C1D, 0x6E0C8B);//Simplify TAction 36
810816

811817
// Fix a glitch related to incorrect target setting for missiles
812818
// Author: Belonit

0 commit comments

Comments
 (0)