[saco] Implement CObjectPool ctor

This commit is contained in:
RD42 2024-02-12 20:10:26 +08:00
parent 1cb324b4fe
commit 05309cad36
7 changed files with 36 additions and 1 deletions

View File

@ -5,6 +5,7 @@
#define MAX_PLAYERS 1004 #define MAX_PLAYERS 1004
#define MAX_VEHICLES 2000 #define MAX_VEHICLES 2000
#define MAX_OBJECTS 1000
#define PLAYER_PED_SLOTS 210 #define PLAYER_PED_SLOTS 210
//----------------------------------------------------------- //-----------------------------------------------------------

View File

@ -32,6 +32,7 @@ typedef struct _GAME_SETTINGS {
#include "net/netrpc.h" #include "net/netrpc.h"
#include "net/vehiclepool.h" #include "net/vehiclepool.h"
#include "net/pickuppool.h" #include "net/pickuppool.h"
#include "net/objectpool.h"
#include "net/netgame.h" #include "net/netgame.h"
#include "net/scriptrpc.h" #include "net/scriptrpc.h"

View File

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

View File

@ -29,7 +29,8 @@ typedef struct _NETGAME_POOLS {
CVehiclePool *pVehiclePool; CVehiclePool *pVehiclePool;
CPlayerPool *pPlayerPool; CPlayerPool *pPlayerPool;
CPickupPool *pPickupPool; CPickupPool *pPickupPool;
char _gap0[24]; CObjectPool *pObjectPool;
char _gap0[20];
} NETGAME_POOLS; } NETGAME_POOLS;
class CNetGame // size: 994 class CNetGame // size: 994

12
saco/net/objectpool.cpp Normal file
View File

@ -0,0 +1,12 @@
#include "../main.h"
CObjectPool::CObjectPool()
{
for(WORD wObjectID = 0; wObjectID < MAX_OBJECTS; wObjectID++)
{
field_4[wObjectID] = 0;
field_FA4[wObjectID] = 0;
}
field_0 = 0;
};

13
saco/net/objectpool.h Normal file
View File

@ -0,0 +1,13 @@
#pragma once
class CObjectPool
{
private:
int field_0;
int field_4[MAX_OBJECTS];
int field_FA4[MAX_OBJECTS];
public:
CObjectPool();
};

View File

@ -258,6 +258,12 @@
<File <File
RelativePath=".\net\netrpc.h"> RelativePath=".\net\netrpc.h">
</File> </File>
<File
RelativePath=".\net\objectpool.cpp">
</File>
<File
RelativePath=".\net\objectpool.h">
</File>
<File <File
RelativePath=".\net\pickuppool.cpp"> RelativePath=".\net\pickuppool.cpp">
</File> </File>