[server] Implement CObjectPool ctor/dtor

This commit is contained in:
RD42 2024-01-05 23:17:39 +08:00
parent 0542a9e8fe
commit 16540743b8
3 changed files with 56 additions and 1 deletions

View File

@ -8,6 +8,7 @@
#define MAX_PLAYERS 1000 #define MAX_PLAYERS 1000
#define MAX_VEHICLES 2000 #define MAX_VEHICLES 2000
#define MAX_OBJECTS 1000
#define MAX_MENUS 128 #define MAX_MENUS 128
#define MAX_TEXT_DRAWS 2048 #define MAX_TEXT_DRAWS 2048
#define MAX_GANG_ZONES 1024 #define MAX_GANG_ZONES 1024

View File

@ -0,0 +1,42 @@
#include "main.h"
CObjectPool::CObjectPool()
{
for(WORD wObjectID = 0; wObjectID != MAX_OBJECTS; wObjectID++) {
field_7A21A0[wObjectID] = 0;
field_7A3140[wObjectID] = 0;
field_3D0900[wObjectID] = 0;
for (int i = 0; i < MAX_PLAYERS; i++)
{
field_0[i][wObjectID] = 0;
field_3D18A0[i][wObjectID] = 0;
}
}
}
CObjectPool::~CObjectPool()
{
for(WORD wObjectID = 0; wObjectID != MAX_OBJECTS; wObjectID++) {
if(!Delete(wObjectID) && field_3D0900[wObjectID])
{
// Try delete it for individuals
for (PLAYERID playerId = 0; playerId < MAX_PLAYERS; playerId++)
{
DeleteForPlayer(playerId, wObjectID);
}
}
}
}
BOOL CObjectPool::Delete(WORD wObjectID)
{
// TODO: CObjectPool::Delete W .text:004657A0 L .text:080C89A0
return FALSE;
}
BOOL CObjectPool::DeleteForPlayer(PLAYERID playerId, WORD wObjectID)
{
// TODO: CObjectPool::DeleteForPlayer W .text:004656B0 L .text:080C88E0
return FALSE;
}

View File

@ -5,7 +5,19 @@
class CObjectPool // size: WL 8012000 class CObjectPool // size: WL 8012000
{ {
private: private:
char _gap0[8012000];
int field_0[1000][1000];
int field_3D0900[1000];
int field_3D18A0[1000][1000];
int field_7A21A0[1000];
int field_7A3140[1000];
public:
CObjectPool();
~CObjectPool();
BOOL Delete(WORD wObjectID);
BOOL DeleteForPlayer(PLAYERID playerId, WORD wObjectID);
}; };
#endif #endif