Don't Destroy if we didn't Init

This commit is contained in:
Learath 2020-05-16 23:04:14 +03:00
parent 898b4ce4b9
commit 1426392ae7
2 changed files with 8 additions and 4 deletions

View file

@ -7,7 +7,7 @@
#ifdef CONF_ANTIBOT
CAntibot::CAntibot()
: m_pGameServer(0)
: m_pServer(0), m_pConsole(0), m_pGameServer(0), m_Initialized(false)
{
}
CAntibot::~CAntibot()
@ -15,7 +15,8 @@ CAntibot::~CAntibot()
if(m_pGameServer && m_RoundData.m_Map.m_pTiles)
free(m_RoundData.m_Map.m_pTiles);
AntibotDestroy();
if(m_Initialized)
AntibotDestroy();
}
void CAntibot::Send(int ClientID, const void *pData, int Size, int Flags, void *pUser)
{
@ -61,6 +62,8 @@ void CAntibot::Init()
m_Data.m_pfnSend = Send;
m_Data.m_pUser = this;
AntibotInit(&m_Data);
m_Initialized = true;
}
void CAntibot::RoundStart(IGameServer *pGameServer)
{
@ -112,8 +115,8 @@ void CAntibot::OnEngineClientMessage(int ClientID, const void *pData, int Size,
AntibotOnEngineClientMessage(ClientID, pData, Size, Flags);
}
#else
CAntibot::CAntibot() :
m_pGameServer(0)
CAntibot::CAntibot()
: m_pServer(0), m_pConsole(0), m_pGameServer(0), m_Initialized(false)
{
}
CAntibot::~CAntibot()

View file

@ -16,6 +16,7 @@ class CAntibot : public IEngineAntibot
CAntibotData m_Data;
CAntibotRoundData m_RoundData;
bool m_Initialized;
void Update();
static void Send(int ClientID, const void *pData, int Size, int Flags, void *pUser);