L L4D2node

CNavMesh::RegisterAvoidanceObstacle

0x00740ac0 · 285 bytes · __thiscall

_ZN8CNavMesh25RegisterAvoidanceObstacleEP21INavAvoidanceObstacle

Decompiled

undefined (2 params)

/* CNavMesh::RegisterAvoidanceObstacle(INavAvoidanceObstacle*) */

void __thiscall CNavMesh::RegisterAvoidanceObstacle(CNavMesh *this,INavAvoidanceObstacle *param_1)

{
  int iVar1;
  int iVar2;
  void *pvVar3;
  int iVar4;
  int iVar5;
  
  CUtlVector<INavAvoidanceObstacle*,CUtlMemory<INavAvoidanceObstacle*,int>>::FindAndFastRemove
            ((CUtlVector<INavAvoidanceObstacle*,CUtlMemory<INavAvoidanceObstacle*,int>> *)
             (this + 0x59c),&param_1);
  iVar1 = *(int *)(this + 0x5a8);
  iVar5 = *(int *)(this + 0x5a0);
  iVar4 = iVar1 + 1;
  if (iVar5 < iVar4) {
    iVar2 = *(int *)(this + 0x5a4);
    if (-1 < iVar2) {
      if (iVar2 == 0) {
        if (iVar5 == 0) {
          if (iVar4 < 9) {
            iVar2 = 8;
            goto LAB_00740b77;
          }
          iVar5 = 8;
        }
        do {
          iVar2 = iVar5 * 2;
          if (iVar4 <= iVar2) break;
          iVar2 = iVar5 * 4;
          iVar5 = iVar2;
        } while (iVar2 < iVar4);
      }
      else {
        for (iVar2 = (iVar1 / iVar2 + 1) * iVar2; iVar2 < iVar4; iVar2 = (iVar2 + iVar4) / 2) {
        }
      }
LAB_00740b77:
      *(int *)(this + 0x5a0) = iVar2;
      if (*(void **)(this + 0x59c) == (void *)0x0) {
        pvVar3 = malloc(iVar2 << 2);
        *(void **)(this + 0x59c) = pvVar3;
      }
      else {
        pvVar3 = realloc(*(void **)(this + 0x59c),iVar2 << 2);
        *(void **)(this + 0x59c) = pvVar3;
        iVar4 = *(int *)(this + 0x5a8) + 1;
      }
      goto LAB_00740afa;
    }
  }
  pvVar3 = *(void **)(this + 0x59c);
LAB_00740afa:
  *(int *)(this + 0x5a8) = iVar4;
  iVar5 = iVar1 * 4;
  iVar4 = (iVar4 - iVar1) + -1;
  *(void **)(this + 0x5ac) = pvVar3;
  if (0 < iVar4) {
    _V_memmove((void *)((int)pvVar3 + iVar5 + 4),(void *)((int)pvVar3 + iVar5),iVar4 * 4);
    pvVar3 = *(void **)(this + 0x59c);
  }
  if ((undefined4 *)(iVar5 + (int)pvVar3) != (undefined4 *)0x0) {
    *(undefined4 *)(iVar5 + (int)pvVar3) = param_1;
  }
  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)