Type and name the pet-type parameter of PLAYERPETS_RemoveConflictingPetsByGroup and PETS_UpdatePetData
Ghidra v1809 · 6c26878
In both functions the generic nParam is the pet type index: PLAYERPETS_RemoveConflictingPetsByGroup bounds-checks it against sgptDataTable->nTxtPetTypeSize (+0xbf0), indexes pTxtPetType[nParam].group and compares it with the ePetType loop variable; PETS_UpdatePetData bounds-checks it against the same size (CMP ESI,[ECX+0xbf0] at 0x005749cd) and uses it to index pPlayerData->pPets->pPetList. The caller of the first, SKILL_ResummonPet, pushes ESI, which it compares with nTxtPetTypeSize just before (0x00575dc1-ce). ePetType is a 4-byte enum, so the width is kept; generic nParam renamed nPetType. Callers of PETS_UpdatePetData (_oldSaveGameLoadingPart8, LoadMerc) were not checked.
Changes 4, applied together
Retype variable
win 0x00575720 Stack[0x4]typeint32_t→ePetTypeRename variable
win 0x00575720 Stack[0x4]namenParam→nPetTypeRetype variable
win 0x005749b0 EDXtypeint32_t→ePetTypeRename variable
win 0x005749b0 EDXnamenParam→nPetType