[server] Update main

This commit is contained in:
RD42 2023-11-14 22:24:57 +08:00
parent 3c4a1b8bcc
commit 94acb826cb
2 changed files with 35 additions and 1 deletions

View File

@ -5,7 +5,9 @@ CNetGame *pNetGame = NULL;
CConsole *pConsole = NULL; CConsole *pConsole = NULL;
CPlugins *pPlugins = NULL; CPlugins *pPlugins = NULL;
FILE *pLogFile; FILE *pLogFile;
bool bQuitApp = false;
BOOL bGameModeFinished=FALSE;
bool bLogQueries; bool bLogQueries;
int iMaxNpc = 0; int iMaxNpc = 0;
@ -260,6 +262,35 @@ int main (int argc, char** argv)
pNetGame = new CNetGame(); pNetGame = new CNetGame();
pNetGame->Init(true); pNetGame->Init(true);
// Start the rcon server
PCHAR szBindAddress = pConsole->GetStringVariable("rcon_bind");
if (!szBindAddress || szBindAddress[0] == 0)
szBindAddress = pConsole->GetStringVariable("bind");
if (!szBindAddress || szBindAddress[0] == 0)
szBindAddress = NULL;
// While the app is running...
while (!bQuitApp)
{
pNetGame->Process();
if(TRUE == bGameModeFinished) {
pNetGame->ShutdownForGameModeRestart();
bGameModeFinished = FALSE;
}
if(sub_44E9D0() - unnamed_4 > iConnSeedTime)
{
unnamed_3 = rand();
unnamed_4 = sub_44E9D0();
}
SLEEP(iSleep);
}
delete pNetGame;
delete pPlugins;
delete pConsole; delete pConsole;

View File

@ -19,10 +19,13 @@
#ifdef WIN32 #ifdef WIN32
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#define SLEEP(x) { Sleep(x); }
#include <windows.h> #include <windows.h>
#include <time.h> #include <time.h>
#else #else
#define SLEEP(x) { usleep(x * 1000); }
#ifndef stricmp #ifndef stricmp
#define stricmp strcasecmp #define stricmp strcasecmp
#endif #endif