From 7f97bd273f722e92b69690f3f9bd925b1027a201 Mon Sep 17 00:00:00 2001 From: RD42 <42702181+dashr9230@users.noreply.github.com> Date: Sat, 27 Apr 2024 18:25:01 +0800 Subject: [PATCH] [server] Implement and match `n_GetActorPoolSize(...)` --- server/actorpool.cpp | 2 +- server/actorpool.h | 4 +++- server/netgame.h | 1 + server/scrcustom.cpp | 12 ++++++++++-- 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/server/actorpool.cpp b/server/actorpool.cpp index c86ad7f..2d06bac 100644 --- a/server/actorpool.cpp +++ b/server/actorpool.cpp @@ -9,7 +9,7 @@ CActorPool::CActorPool() field_FA0[ActorID] = 0; field_1F40[ActorID] = 0; } - field_2EE0 = 0; + m_iPoolSize = 0; } CActorPool::~CActorPool() diff --git a/server/actorpool.h b/server/actorpool.h index f9c7c4a..7125234 100644 --- a/server/actorpool.h +++ b/server/actorpool.h @@ -8,12 +8,14 @@ private: int field_0[1000]; int field_FA0[1000]; int field_1F40[1000]; - int field_2EE0; + int m_iPoolSize; public: CActorPool(); ~CActorPool(); BOOL Delete(ACTORID ActorID); + + int GetPoolSize() { return m_iPoolSize; }; }; #endif diff --git a/server/netgame.h b/server/netgame.h index e790cc9..6a0e139 100644 --- a/server/netgame.h +++ b/server/netgame.h @@ -82,6 +82,7 @@ public: RakServerInterface * GetRakServer() { return m_pRak; }; CGameMode * GetGameMode() { return m_pGameMode; }; CFilterScripts * GetFilterScripts() { return m_pFilterScripts; }; + CActorPool * GetActorPool() { return m_pActorPool; }; char *GetNextScriptFile(); void LoadAllFilterscripts(); diff --git a/server/scrcustom.cpp b/server/scrcustom.cpp index 0bf9a1a..b0082b8 100644 --- a/server/scrcustom.cpp +++ b/server/scrcustom.cpp @@ -33,12 +33,20 @@ static cell AMX_NATIVE_CALL n_GetVehiclePoolSize(AMX *amx, cell *params) return -1; } +//---------------------------------------------------------------------------------- +// native GetActorPoolSize() static cell AMX_NATIVE_CALL n_GetActorPoolSize(AMX *amx, cell *params) { - // TODO: GetActorPoolSize - return 0; + if(!pNetGame) return -1; + CActorPool *pActorPool = pNetGame->GetActorPool(); + if(pActorPool) { + return pActorPool->GetPoolSize(); + } + return -1; } +//---------------------------------------------------------------------------------- + static cell AMX_NATIVE_CALL n_print(AMX *amx, cell *params) { // TODO: print