[saco] Implement CPlayerPool ctor

This commit is contained in:
RD42 2024-02-06 22:20:05 +08:00
parent 125a453d53
commit c6b1f81352
6 changed files with 58 additions and 1 deletions

View File

@ -3,12 +3,14 @@
#include <windows.h>
#define MAX_PLAYERS 1004
#define MAX_VEHICLES 2000
#define PLAYER_PED_SLOTS 210
//-----------------------------------------------------------
typedef unsigned short VEHICLEID;
typedef unsigned short PLAYERID;
typedef struct _VECTOR {
float X,Y,Z;

View File

@ -33,6 +33,7 @@ void CNetGame::InitPools()
{
m_pPools = (NETGAME_POOLS *)calloc(1, sizeof(NETGAME_POOLS));
m_pPools->pPlayerPool = new CPlayerPool();
m_pPools->pVehiclePool = new CVehiclePool();
}

View File

@ -27,7 +27,8 @@ struct struc_41
typedef struct _NETGAME_POOLS {
CVehiclePool *pVehiclePool;
char _gap0[32];
CPlayerPool *pPlayerPool;
char _gap0[28];
} NETGAME_POOLS;
class CNetGame // size: 994

20
saco/net/playerpool.cpp Normal file
View File

@ -0,0 +1,20 @@
#include "../main.h"
//----------------------------------------------------
CPlayerPool::CPlayerPool()
{
// loop through and initialize all net players to null and slot states to false
for(PLAYERID playerId = 0; playerId < MAX_PLAYERS; playerId++) {
field_1F8A[playerId] = 0;
field_2A[playerId] = 0;
}
//field_26 = new sub_10004C50(); // TODO: sub_10004C50()
field_0 = 0;
field_22 = 0;
field_4 = 0;
field_2F3A = 0;
}
//----------------------------------------------------

27
saco/net/playerpool.h Normal file
View File

@ -0,0 +1,27 @@
#pragma once
#include <string>
//----------------------------------------------------
class CPlayerPool
{
private:
int field_0;
short field_4;
std::string field_6;
int field_22;
int field_26;
int field_2A[MAX_PLAYERS];
char _gapFDA[4016];
int field_1F8A[MAX_PLAYERS];
int field_2F3A;
public:
CPlayerPool();
};
//----------------------------------------------------

View File

@ -252,6 +252,12 @@
<File
RelativePath=".\net\netrpc.h">
</File>
<File
RelativePath=".\net\playerpool.cpp">
</File>
<File
RelativePath=".\net\playerpool.h">
</File>
<File
RelativePath=".\net\scriptrpc.cpp">
</File>