mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Don't Destroy if we didn't Init
This commit is contained in:
parent
898b4ce4b9
commit
1426392ae7
|
@ -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()
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue