mirror of
https://github.com/dashr9230/SA-MP.git
synced 2024-12-22 22:47:29 +08:00
[bot] Implement CNetGame destructor
* Implements CScriptTimers destructor * Implements `CScriptTimers::FreeMem` * Implements CPlayerPool destructor * Implements `CPlayerPool::Delete` * Implements `CNetGame::sub_415EA0` * Implements CVehiclePool destructor * Implements `CVehiclePool::Delete` * Implements ` CNetGame::sub_415EC0`
This commit is contained in:
parent
98f93f88bb
commit
a3810144d1
@ -3,12 +3,12 @@
|
||||
|
||||
char unnamed_2[63];
|
||||
char unnamed_5[1000][24];
|
||||
int unnamed_6[1000];
|
||||
BOOL unnamed_6[MAX_PLAYERS];
|
||||
char unnamed_9;
|
||||
char unnamed_1[68];
|
||||
char unnamed_3[1000][68];
|
||||
char unnamed_8[1000];
|
||||
int unnamed_7[2000];
|
||||
BOOL unnamed_7[MAX_VEHICLES];
|
||||
char unnamed_4[1000][63];
|
||||
|
||||
//----------------------------------------------------
|
||||
@ -27,39 +27,9 @@ CNetGame::~CNetGame()
|
||||
UnRegisterScriptRPCs(m_pRakClient); // Unregister server-side scripting RPCs.
|
||||
RakNetworkFactory::DestroyRakClientInterface(m_pRakClient);
|
||||
SAFE_DELETE(m_pGameMode);
|
||||
|
||||
// TODO: ~CNetGame (W: 00416D50 L: 080ACFDE)
|
||||
/*
|
||||
if ( this->field_38A )
|
||||
{
|
||||
v4 = (void *)this->field_38A;
|
||||
if ( v4 )
|
||||
{
|
||||
sub_80B8160(v4);
|
||||
operator delete(v4);
|
||||
}
|
||||
this->field_38A = 0;
|
||||
}
|
||||
if ( this->field_4 )
|
||||
{
|
||||
v3 = (void *)this->field_4;
|
||||
if ( v3 )
|
||||
{
|
||||
sub_80B1FF8(v3);
|
||||
operator delete(v3);
|
||||
}
|
||||
this->field_4 = 0;
|
||||
}
|
||||
if ( this->field_8 )
|
||||
{
|
||||
v2 = (void *)this->field_8;
|
||||
if ( v2 )
|
||||
{
|
||||
sub_80B9470(v2);
|
||||
operator delete(v2);
|
||||
}
|
||||
this->field_8 = 0;
|
||||
}*/
|
||||
SAFE_DELETE(m_pScriptTimers);
|
||||
SAFE_DELETE(m_pPlayerPool);
|
||||
SAFE_DELETE(m_pVehiclePool);
|
||||
}
|
||||
|
||||
//----------------------------------------------------
|
||||
@ -171,3 +141,20 @@ void CNetGame::Process()
|
||||
}
|
||||
|
||||
//----------------------------------------------------
|
||||
|
||||
void CNetGame::sub_415EA0(PLAYERID playerId, BOOL a2)
|
||||
{
|
||||
if(playerId < MAX_PLAYERS)
|
||||
{
|
||||
unnamed_6[playerId] = a2;
|
||||
}
|
||||
}
|
||||
|
||||
void CNetGame::sub_415EC0(VEHICLEID VehicleID, BOOL a2)
|
||||
{
|
||||
if(VehicleID < MAX_VEHICLES)
|
||||
{
|
||||
unnamed_7[VehicleID] = a2;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -60,6 +60,8 @@ public:
|
||||
void Init(PCHAR szHostOrIp,int iPort,PCHAR szPlayerName,PCHAR szPass,PCHAR szNpcMode);
|
||||
void Process();
|
||||
|
||||
void sub_415EA0(PLAYERID playerId, BOOL a2);
|
||||
void sub_415EC0(VEHICLEID VehicleID, BOOL a2);
|
||||
};
|
||||
|
||||
//----------------------------------------------------
|
||||
|
@ -1,6 +1,8 @@
|
||||
|
||||
#include "../main.h"
|
||||
|
||||
extern CNetGame *pNetGame;
|
||||
|
||||
//----------------------------------------------------
|
||||
|
||||
CPlayerPool::CPlayerPool()
|
||||
@ -10,10 +12,28 @@ CPlayerPool::CPlayerPool()
|
||||
|
||||
// loop through and initialize all net players to null and slot states to false
|
||||
for(PLAYERID playerId = 0; playerId < MAX_PLAYERS; playerId++) {
|
||||
field_0[playerId] = 0;
|
||||
m_bPlayerSlotState[playerId] = FALSE;
|
||||
field_7167[playerId] = 0;
|
||||
field_810B[playerId] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------
|
||||
|
||||
CPlayerPool::~CPlayerPool()
|
||||
{
|
||||
for(PLAYERID playerId = 0; playerId < MAX_PLAYERS; playerId++) {
|
||||
Delete(playerId,0);
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------
|
||||
|
||||
BOOL CPlayerPool::Delete(PLAYERID playerId, BYTE byteReason)
|
||||
{
|
||||
m_bPlayerSlotState[playerId] = FALSE;
|
||||
pNetGame->sub_415EA0(playerId, FALSE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
//----------------------------------------------------
|
||||
|
@ -4,7 +4,7 @@
|
||||
class CPlayerPool // size: 41035
|
||||
{
|
||||
private:
|
||||
int field_0[1000];
|
||||
BOOL m_bPlayerSlotState[MAX_PLAYERS];
|
||||
char _gapFA0[2];
|
||||
CHAR m_szLocalPlayerName[MAX_PLAYER_NAME+1];
|
||||
char gapFBB[25000];
|
||||
@ -19,4 +19,8 @@ public:
|
||||
void SetLocalPlayerName(PCHAR szName) { strcpy(m_szLocalPlayerName,szName); };
|
||||
|
||||
CPlayerPool();
|
||||
~CPlayerPool();
|
||||
|
||||
BOOL Delete(PLAYERID playerId, BYTE byteReason);
|
||||
|
||||
};
|
@ -1,5 +1,6 @@
|
||||
|
||||
#include "../main.h"
|
||||
extern CNetGame *pNetGame;
|
||||
|
||||
//----------------------------------------------------
|
||||
|
||||
@ -12,3 +13,20 @@ CVehiclePool::CVehiclePool()
|
||||
}
|
||||
|
||||
//----------------------------------------------------
|
||||
|
||||
CVehiclePool::~CVehiclePool()
|
||||
{
|
||||
for(VEHICLEID VehicleID = 0; VehicleID < MAX_VEHICLES; VehicleID++) {
|
||||
Delete(VehicleID);
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------
|
||||
|
||||
BOOL CVehiclePool::Delete(VEHICLEID VehicleID)
|
||||
{
|
||||
pNetGame->sub_415EC0(VehicleID, FALSE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
//----------------------------------------------------
|
||||
|
@ -8,4 +8,7 @@ private:
|
||||
|
||||
public:
|
||||
CVehiclePool();
|
||||
~CVehiclePool();
|
||||
|
||||
BOOL Delete(VEHICLEID VehicleID);
|
||||
};
|
||||
|
@ -1,7 +1,36 @@
|
||||
|
||||
#include "main.h"
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
CScriptTimers::CScriptTimers()
|
||||
{
|
||||
m_dwTimerCount = 0;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
CScriptTimers::~CScriptTimers()
|
||||
{
|
||||
DwordTimerMap::iterator itor;
|
||||
for (itor = m_Timers.begin(); itor != m_Timers.end(); itor++)
|
||||
{
|
||||
FreeMem(itor->second);
|
||||
SAFE_DELETE(itor->second);
|
||||
}
|
||||
m_Timers.clear();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
void CScriptTimers::FreeMem(ScriptTimer_s* Timer)
|
||||
{
|
||||
if (Timer->cellParams != NULL)
|
||||
{
|
||||
free(Timer->cellParams);
|
||||
Timer->cellParams = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
|
@ -4,7 +4,8 @@
|
||||
|
||||
struct ScriptTimer_s
|
||||
{
|
||||
char _gap0[283];
|
||||
char _gap0[279];
|
||||
void* cellParams;
|
||||
};
|
||||
|
||||
typedef std::map<DWORD, ScriptTimer_s*> DwordTimerMap;
|
||||
@ -18,7 +19,9 @@ private:
|
||||
DWORD m_dwTimerCount;
|
||||
public:
|
||||
CScriptTimers();
|
||||
~CScriptTimers();
|
||||
|
||||
void FreeMem(ScriptTimer_s* Timer);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user