L L4D2node

CBaseCombatCharacter::AddClassRelationship

0x005f76f0 · 230 bytes · __thiscall

_ZN20CBaseCombatCharacter20AddClassRelationshipE7Class_T13Disposition_ti

Decompiled

undefined (4 params)

/* CBaseCombatCharacter::AddClassRelationship(Class_T, Disposition_t, int) */

void __thiscall
CBaseCombatCharacter::AddClassRelationship
          (CBaseCombatCharacter *this,int param_2,int param_3,int param_4)

{
  int iVar1;
  int iVar2;
  int *piVar3;
  int iVar4;
  int iVar5;
  int *piVar6;
  
  iVar5 = *(int *)(this + 0x1854) + -1;
  if (iVar5 < 0) {
LAB_005f7756:
    iVar4 = CUtlVector<Relationship_t,CUtlMemory<Relationship_t,int>>::InsertBefore
                      ((CUtlVector<Relationship_t,CUtlMemory<Relationship_t,int>> *)(this + 0x1848),
                       *(int *)(this + 0x1854));
    iVar4 = iVar4 * 0x10;
    *(int *)(*(int *)(this + 0x1848) + 4 + iVar4) = param_2;
    *(undefined4 *)(*(int *)(this + 0x1848) + iVar4) = 0xffffffff;
    *(int *)(*(int *)(this + 0x1848) + 8 + iVar4) = param_3;
    iVar5 = 0;
    if (param_4 != -0x80000000) {
      iVar5 = param_4;
    }
    *(int *)(iVar4 + *(int *)(this + 0x1848) + 0xc) = iVar5;
  }
  else {
    iVar4 = iVar5 * 0x10;
    iVar1 = *(int *)(this + 0x1848);
    piVar6 = (int *)(iVar1 + iVar4);
    if (piVar6[1] != param_2) {
      piVar3 = (int *)(iVar1 + -0xc + iVar4);
      do {
        iVar5 = iVar5 + -1;
        if (iVar5 == -1) goto LAB_005f7756;
        iVar4 = (-4 - iVar1) + (int)piVar3;
        piVar6 = piVar3 + -1;
        iVar2 = *piVar3;
        piVar3 = piVar3 + -4;
      } while (iVar2 != param_2);
    }
    piVar6[2] = param_3;
    if (param_4 != -0x80000000) {
      *(int *)(*(int *)(this + 0x1848) + 0xc + iVar4) = param_4;
      return;
    }
  }
  return;
}

SourceMod gamedata

paste into addons/sourcemod/gamedata/<your_plugin>.txt
used as the SourceMod key — change to fit your plugin's convention
SourceMod library name (server / engine / matchmaking)

Just a Signatures{} block, ready to drop into a gamedata file. Wire it up in your plugin however you like - SDKCall, DHooks, raw memory ops, or anything else.



        

        

          

Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.

Return-type handling cheatsheet (DHookReturn)