CTeamplayRules::RecountTeams
0x004d16e0 · 479 bytes · __thiscall
_ZN14CTeamplayRules12RecountTeamsEv
Decompiled
undefined (1 param)
/* CTeamplayRules::RecountTeams() */
void __thiscall CTeamplayRules::RecountTeams(CTeamplayRules *this)
{
char *pcVar1;
CBaseEntity *this_00;
int iVar2;
int iVar3;
int iVar4;
undefined4 *puVar5;
int in_GS_OFFSET;
byte bVar6;
char local_220 [512];
int local_20;
bVar6 = 0;
num_teams = 0;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
V_strncpy(local_220,(char *)(this + 0x3b),0x200);
pcVar1 = strtok(local_220,";");
while ((pcVar1 != (char *)0x0 && (*pcVar1 != '\0'))) {
iVar3 = (**(code **)(*(int *)this + 0x1b0))(this,pcVar1);
if (iVar3 < 0) {
V_strncpy((char *)(&team_names + num_teams * 4),pcVar1,0x10);
num_teams = num_teams + 1;
}
pcVar1 = strtok((char *)0x0,";");
}
if (num_teams < 2) {
num_teams = 0;
this[0x3a] = (CTeamplayRules)0x0;
}
iVar4 = 1;
puVar5 = &team_scores;
for (iVar3 = 0x20; iVar3 != 0; iVar3 = iVar3 + -1) {
*puVar5 = 0;
puVar5 = puVar5 + (uint)bVar6 * -2 + 1;
}
if (0 < *(int *)(gpGlobals + 0x14)) {
LAB_004d17fd:
do {
this_00 = (CBaseEntity *)UTIL_PlayerByIndex(iVar4);
if (this_00 != (CBaseEntity *)0x0) {
pcVar1 = (char *)CBaseEntity::TeamID(this_00);
iVar2 = (**(code **)(*(int *)this + 0x1b0))(this,pcVar1);
iVar3 = num_teams;
if (iVar2 < 0) {
if (this[0x3a] != (CTeamplayRules)0x0) goto LAB_004d17ec;
puVar5 = &team_scores + num_teams;
num_teams = num_teams + 1;
*puVar5 = 0;
V_strncpy((char *)(&team_names + iVar3 * 4),pcVar1,0x10);
iVar2 = iVar3;
if (iVar3 < 0) {
iVar4 = iVar4 + 1;
if (*(int *)(gpGlobals + 0x14) < iVar4) break;
goto LAB_004d17fd;
}
}
(&team_scores)[iVar2] = (&team_scores)[iVar2] + *(int *)(this_00 + 0x1f5c);
}
LAB_004d17ec:
iVar4 = iVar4 + 1;
} while (iVar4 <= *(int *)(gpGlobals + 0x14));
}
if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
return;
}
/* WARNING: Subroutine does not return */
__stack_chk_fail();
}
SourceMod gamedata
paste intoaddons/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.
Signatures + Functions block. The plugin uses
DHookCreateFromConf - DHooks reads return type, this-type,
calling convention, and argument types straight from the gamedata. Less
boilerplate in the plugin, types travel with the gamedata.
Gamedata KeyValues
DHooks plugin example
Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.