2023-11-24 23:35:01 +08:00
|
|
|
|
|
|
|
#include "main.h"
|
|
|
|
|
|
|
|
CGangZonePool::CGangZonePool()
|
|
|
|
{
|
|
|
|
for (WORD wZone = 0; wZone < MAX_GANG_ZONES; wZone++)
|
|
|
|
{
|
2024-09-21 21:56:34 +08:00
|
|
|
m_bSlotState[wZone] = FALSE;
|
2023-11-24 23:35:01 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-09-21 21:56:34 +08:00
|
|
|
WORD CGangZonePool::New(float fMinX, float fMinY, float fMaxX, float fMaxY)
|
|
|
|
{
|
|
|
|
WORD wZone = 0;
|
|
|
|
while (wZone < MAX_GANG_ZONES)
|
|
|
|
{
|
|
|
|
if (!m_bSlotState[wZone]) break;
|
|
|
|
wZone++;
|
|
|
|
}
|
|
|
|
if (wZone == MAX_GANG_ZONES) return 0xFFFF;
|
|
|
|
m_fGangZone[wZone][0] = fMinX;
|
|
|
|
m_fGangZone[wZone][1] = fMinY;
|
|
|
|
m_fGangZone[wZone][2] = fMaxX;
|
|
|
|
m_fGangZone[wZone][3] = fMaxY;
|
|
|
|
m_bSlotState[wZone] = TRUE;
|
|
|
|
return wZone;
|
|
|
|
}
|
2024-09-21 22:00:57 +08:00
|
|
|
|
|
|
|
void CGangZonePool::Delete(WORD wZone)
|
|
|
|
{
|
|
|
|
m_bSlotState[wZone] = FALSE;
|
|
|
|
RakNet::BitStream bsParams;
|
|
|
|
bsParams.Write(wZone);
|
|
|
|
pNetGame->BroadcastData(RPC_ScrRemoveGangZone, &bsParams, INVALID_PLAYER_ID, 2);
|
|
|
|
}
|
|
|
|
|