MONSTERAI_FindNearestUnit's third parameter points to a BOOL (dword), not a bool
Ghidra v1802 · 84ad4ea
The callee stores a full dword through the pointer: 005ddf77 MOV ECX,dword ptr [EBP+0x8]; 005ddf7a MOV dword ptr [ECX],0x1 (the only store, after 005ddf71 CMP dword ptr [EBP-0x24],0x4 / JGE). Every caller passes the address of a dword local it zeroed as a dword first: 005e68f9 LEA EAX,[EBP-0x10] with 005e6902 MOV dword ptr [EBP-0x10],0x0 (_PlayerNpcInteraction); 005e73a9 LEA EAX,[EBP-0x8] / 005e73b1 MOV dword ptr [EBP-0x8],0x0 (AITHINK_Fn1_NpcStationary); 005ee4f9 LEA ECX,[EBP-0x8] / 005ee501 MOV dword ptr [EBP-0x8],0x0 (AITHINK_Fn1_Wussie); also 005e7698 (JarJar) and 005e7e62 (Navi). Type only; names unchanged. Recompiled with VC8 on main 14f0227: 005ddf20 becomes a byte match, no function lost.
Changes 1, applied together
Set prototype
win 0x005ddf20signatureD2UnitStrc * MONSTERAI_FindNearestUnit(SGAMEDATA * pGame, D2UnitStrc * pUnit, bool * pbIsClose)→D2UnitStrc * MONSTERAI_FindNearestUnit(SGAMEDATA * pGame, D2UnitStrc * pUnit, BOOL * pbIsClose)convention__fastcall