From ce2fc485922a985531dfb18b2e2b3157a72d6cd5 Mon Sep 17 00:00:00 2001 From: RD42 <42702181+dashr9230@users.noreply.github.com> Date: Sat, 25 Nov 2023 23:10:24 +0800 Subject: [PATCH] [server] Add CTextDrawPool ctor/dtor --- server/main.h | 1 + server/textdrawpool.cpp | 30 ++++++++++++++++++++++++++++++ server/textdrawpool.h | 10 +++++++++- 3 files changed, 40 insertions(+), 1 deletion(-) diff --git a/server/main.h b/server/main.h index c32c3cd..49c4b05 100644 --- a/server/main.h +++ b/server/main.h @@ -8,6 +8,7 @@ #define MAX_PLAYERS 1000 #define MAX_VEHICLES 2000 +#define MAX_TEXT_DRAWS 2048 #define DEFAULT_MAX_PLAYERS 50 #define DEFAULT_LISTEN_PORT 8192 diff --git a/server/textdrawpool.cpp b/server/textdrawpool.cpp index e69de29..7394f3c 100644 --- a/server/textdrawpool.cpp +++ b/server/textdrawpool.cpp @@ -0,0 +1,30 @@ + +#include "main.h" + +CTextDrawPool::CTextDrawPool() +{ + for (WORD wText = 0; wText < MAX_TEXT_DRAWS; wText++) + { + field_0[wText] = 0; + field_2000[wText] = 0; + field_4000[wText] = 0; + } +} + +CTextDrawPool::~CTextDrawPool() +{ + for (WORD wText = 0; wText < MAX_TEXT_DRAWS; wText++) + { + if(field_2000[wText]) + { + free(field_2000[wText]); + field_2000[wText] = NULL; + } + if(field_4000[wText]) + { + free(field_4000[wText]); + field_4000[wText] = NULL; + } + } +} + diff --git a/server/textdrawpool.h b/server/textdrawpool.h index bec4eab..812aebf 100644 --- a/server/textdrawpool.h +++ b/server/textdrawpool.h @@ -5,7 +5,15 @@ class CTextDrawPool // size: WL 2072576 { private: - char _gap0[2072576]; + + int field_0[2048]; + int field_2000[2048]; + int field_4000[2048]; + char gap6000[2048000]; + +public: + CTextDrawPool(); + ~CTextDrawPool(); }; #endif