2013-12-03 12:07:37 +01:00
|
|
|
/////////////////////////////////////////////////
|
|
|
|
// Launcher to launch Danbias server or client //
|
|
|
|
/////////////////////////////////////////////////
|
2013-12-04 11:32:43 +01:00
|
|
|
#define NOMINMAX
|
2013-12-03 12:07:37 +01:00
|
|
|
#include <Windows.h>
|
|
|
|
|
2013-12-06 10:38:43 +01:00
|
|
|
//#define DANBIAS_SERVER
|
|
|
|
#define DANBIAS_CLIENT
|
2013-12-03 12:07:37 +01:00
|
|
|
|
|
|
|
|
|
|
|
#if defined(DANBIAS_SERVER)
|
2013-12-04 11:37:26 +01:00
|
|
|
#include "IDanBiasServer.h"
|
2013-12-03 12:07:37 +01:00
|
|
|
#elif defined(DANBIAS_CLIENT)
|
|
|
|
#include "DanBiasGame.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
int WINAPI WinMain( HINSTANCE hinst, HINSTANCE prevInst, PSTR cmdLine, int cmdShow)
|
|
|
|
{
|
|
|
|
#if defined(DANBIAS_SERVER)
|
|
|
|
if(SetDllDirectory(L"..\\DLL") == FALSE)
|
|
|
|
{
|
|
|
|
return cmdShow;
|
|
|
|
}
|
|
|
|
// Server starter code goes here
|
|
|
|
DanBias::DanBiasServerDesc desc;
|
|
|
|
desc.port = 0;
|
|
|
|
|
|
|
|
if( DanBias::DanBiasServer::Initiate(desc) == DanBias::DanBiasServerReturn_Sucess)
|
|
|
|
{
|
|
|
|
DanBias::DanBiasServer::Run();
|
|
|
|
DanBias::DanBiasServer::Release();
|
|
|
|
}
|
|
|
|
#elif defined(DANBIAS_CLIENT)
|
2013-12-04 11:32:43 +01:00
|
|
|
if(SetDllDirectory(L"..\\DLL") == FALSE)
|
|
|
|
{
|
|
|
|
return cmdShow;
|
|
|
|
}
|
2013-12-03 12:07:37 +01:00
|
|
|
// Game client starter code goes here
|
2013-12-04 11:32:43 +01:00
|
|
|
DanBias::DanBiasGameDesc gameDesc;
|
|
|
|
gameDesc.port = 1;
|
|
|
|
gameDesc.hinst = hinst;
|
|
|
|
gameDesc.nCmdShow = cmdShow;
|
|
|
|
|
|
|
|
if( DanBias::DanBiasGame::Initiate(gameDesc) == DanBias::DanBiasClientReturn_Sucess)
|
|
|
|
{
|
|
|
|
DanBias::DanBiasGame::Run();
|
|
|
|
DanBias::DanBiasGame::Release();
|
|
|
|
}
|
2013-12-03 12:07:37 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
return cmdShow;
|
|
|
|
}
|