[saco] Match FUNC_10004120; the counter is a free function whose loop index and bound are both locals declared ahead of the early return

This commit is contained in:
ricardoofnl
2026-09-05 09:36:20 +07:00
parent 8163d2e5ee
commit 3a04674340
+40
View File
@@ -9,6 +9,8 @@ extern CNetGame *pNetGame;
DWORD dword_100FE0A4 = -1;
DWORD dword_100FE0A8 = 30;
DWORD dword_100FE0AC = 30;
DWORD dword_101189A0;
DWORD dword_101189A4;
//----------------------------------------------------------
@@ -607,3 +609,41 @@ void CLocalPlayer::FUNC_10003FC0()
pGame->DisplayGameText("Stay within the ~r~world boundries", 1000, 5);
}
}
//----------------------------------------------------
// counts the spawned players, recomputed once every 30 calls
int FUNC_10004120()
{
CPlayerPool *pPlayerPool = pNetGame->GetPlayerPool();
WORD i = 0;
if(dword_101189A4)
{
dword_101189A4--;
return dword_101189A0;
}
int iCount = 0;
dword_101189A4 = 30;
dword_101189A0 = 0;
if(pPlayerPool)
{
int iMax = pPlayerPool->field_2F3A;
for(; i <= iMax; i++)
{
if(pPlayerPool->GetSlotState(i))
{
CRemotePlayer *pRemotePlayer = pPlayerPool->GetAt(i);
if(pRemotePlayer->m_pPlayerPed && pRemotePlayer->field_10A)
dword_101189A0 = ++iCount;
}
}
}
return iCount;
}