From 5cd459179d0c1d43b3cda2209106c9cadc5ec872 Mon Sep 17 00:00:00 2001 From: RD42 <42702181+dashr9230@users.noreply.github.com> Date: Sat, 21 Sep 2024 22:33:41 +0800 Subject: [PATCH] [server] Implement/match `n_GangZoneDestroy(...)` --- server/gangzonepool.h | 5 +++++ server/netgame.h | 1 + server/scrcustom.cpp | 7 +++++-- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/server/gangzonepool.h b/server/gangzonepool.h index d8be82b..5ae4814 100644 --- a/server/gangzonepool.h +++ b/server/gangzonepool.h @@ -22,6 +22,11 @@ public: void FlashForAll(WORD wZone, DWORD dwColor); void StopFlashForPlayer(PLAYERID playerId, WORD wZone); void StopFlashForAll(WORD wZone); + BOOL GetSlotState(WORD wZone) + { + if (wZone >= MAX_GANG_ZONES) return FALSE; + return m_bSlotState[wZone]; + }; }; //---------------------------------------------------- diff --git a/server/netgame.h b/server/netgame.h index 40ba930..9b2ac11 100644 --- a/server/netgame.h +++ b/server/netgame.h @@ -85,6 +85,7 @@ public: RakServerInterface * GetRakServer() { return m_pRak; }; CGameMode * GetGameMode() { return m_pGameMode; }; CFilterScripts * GetFilterScripts() { return m_pFilterScripts; }; + CGangZonePool * GetGangZonePool() { return m_pGangZonePool; }; CActorPool * GetActorPool() { return m_pActorPool; }; void MasterServerAnnounce(float fElapsedTime); diff --git a/server/scrcustom.cpp b/server/scrcustom.cpp index a2ce642..b8a6544 100644 --- a/server/scrcustom.cpp +++ b/server/scrcustom.cpp @@ -590,10 +590,13 @@ static cell AMX_NATIVE_CALL n_GangZoneCreate(AMX *amx, cell *params) return 0; } +// native GangZoneDestroy(zone) static cell AMX_NATIVE_CALL n_GangZoneDestroy(AMX *amx, cell *params) { - // TODO: GangZoneDestroy - return 0; + CGangZonePool *pGangZonePool = pNetGame->GetGangZonePool(); + if (!pGangZonePool || !pGangZonePool->GetSlotState(params[1])) return 0; + pGangZonePool->Delete(params[1]); + return 1; } static cell AMX_NATIVE_CALL n_GangZoneShowForPlayer(AMX *amx, cell *params)