From 16540743b8f4103a14cfbaeec3cf59f649f1b917 Mon Sep 17 00:00:00 2001 From: RD42 <42702181+dashr9230@users.noreply.github.com> Date: Fri, 5 Jan 2024 23:17:39 +0800 Subject: [PATCH] [server] Implement CObjectPool ctor/dtor --- server/main.h | 1 + server/objectpool.cpp | 42 ++++++++++++++++++++++++++++++++++++++++++ server/objectpool.h | 14 +++++++++++++- 3 files changed, 56 insertions(+), 1 deletion(-) diff --git a/server/main.h b/server/main.h index a75d51f..b86656b 100644 --- a/server/main.h +++ b/server/main.h @@ -8,6 +8,7 @@ #define MAX_PLAYERS 1000 #define MAX_VEHICLES 2000 +#define MAX_OBJECTS 1000 #define MAX_MENUS 128 #define MAX_TEXT_DRAWS 2048 #define MAX_GANG_ZONES 1024 diff --git a/server/objectpool.cpp b/server/objectpool.cpp index e69de29..e06cb7c 100644 --- a/server/objectpool.cpp +++ b/server/objectpool.cpp @@ -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; +} diff --git a/server/objectpool.h b/server/objectpool.h index 6e45771..a4b9a98 100644 --- a/server/objectpool.h +++ b/server/objectpool.h @@ -5,7 +5,19 @@ class CObjectPool // size: WL 8012000 { 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