PARTY_AddUnitToParty is __fastcall (pGame ECX, nPartyId DX, pUnit Stack[0x4]); ESI is no parameter
Resubmission of #559, approved and then stale because the parameter count of a custom-storage function changes. Storage for each parameter: pGame ECX:4, nPartyId DX:2, pUnit Stack[0x4]:4 - exactly what __fastcall assigns, so the custom storage can be dropped; nLine (ESI:4) goes. Evidence as before: RET 4 at 005403b2 and 0054043f; the entry reads ECX (00540325 MOV EBX,ECX) and DX (00540358 CMP word ptr [EAX],DX) before writing them; both callers load ECX and EDX and push one dword (005a5aa5, 005a5ab0). ESI is only saved (005403b8 PUSH ESI), overwritten (005403cf MOV ESI,EAX) before any read and restored (00540434 POP ESI). Recompiled with VC8 SP1 (oracle, tree 3dba660): PARTY_AddUnitToParty goes from OUR-11 (similarity 0.396) to OUR-4 (0.785), its caller PARTYSCREEN_AcceptPartyInvite (005a5a30) from OUR+7 to the original's instruction count; no function lost.
Changes 1, applied together
Set prototype
win 0x00540320signatureint PARTY_AddUnitToParty(SGAMEDATA * pGame, int16_t nPartyId, D2UnitStrc * pUnit, int32_t nLine)→int PARTY_AddUnitToParty(SGAMEDATA * pGame, int16_t nPartyId, D2UnitStrc * pUnit)convention__stdcall→__fastcall