1
0
forked from 0ad/0ad

Call enet_initialize (see previous commit message). Fixes #509.

This was SVN commit r7681.
This commit is contained in:
Ykkrosh 2010-07-03 19:31:14 +00:00
parent 3ff0ccc1fa
commit 56b836f58d
3 changed files with 26 additions and 0 deletions

View File

@ -67,3 +67,14 @@ ENetPacket* CNetHost::CreatePacket(const CNetMessage* message)
return packet;
}
void CNetHost::Initialize()
{
int ret = enet_initialize();
debug_assert(ret == 0);
}
void CNetHost::Deinitialize()
{
enet_deinitialize();
}

View File

@ -57,6 +57,17 @@ public:
* @return NULL on failure
*/
static ENetPacket* CreatePacket(const CNetMessage* message);
/**
* Initialize ENet.
* This must be called before any other networking code.
*/
static void Initialize();
/**
* Deinitialize ENet.
*/
static void Deinitialize();
};
#endif // NETHOST_H

View File

@ -618,6 +618,8 @@ void Shutdown(int UNUSED(flags))
TIMER_BEGIN(L"shutdown misc");
timer_DisplayClientTotals();
CNetHost::Deinitialize();
// should be last, since the above use them
SAFE_DELETE(g_Logger);
delete &g_Profiler;
@ -700,6 +702,8 @@ void Init(const CmdLineArgs& args, int flags)
// and fonts are set later in InitPs())
g_Console = new CConsole();
CNetHost::Initialize();
if(setup_vmode)
InitSDL();