- initial work for a headless server. Currently this code allows you to launch a server with the commandline option: --masterserver-mode

The first client that connects to the server is the administrator and is able to change most settings and launch the game. Still lots of work to do but this is a start.
This commit is contained in:
Mark Vejvoda
2011-09-24 07:46:56 +00:00
parent 4d31968966
commit 4df997d0ca
19 changed files with 1149 additions and 40 deletions

View File

@@ -1151,8 +1151,28 @@ void Game::render() {
renderFps++;
totalRenderFps++;
NetworkManager &networkManager= NetworkManager::getInstance();
if(networkManager.getNetworkRole() != nrServer || gameSettings.getMasterserver_admin() == -1) {
renderWorker();
}
else {
// In masterserver mode quit game if no network players left
ServerInterface *server = NetworkManager::getInstance().getServerInterface();
int connectedClients=0;
for(int i = 0; i < world.getFactionCount(); ++i) {
Faction *faction = world.getFaction(i);
ConnectionSlot *slot = server->getSlot(faction->getStartLocationIndex());
if(slot != NULL && slot->isConnected() == true) {
connectedClients++;
}
}
if(connectedClients == 0) {
quitTriggeredIndicator = true;
}
}
}
void Game::renderWorker() {
Chrono chrono;

View File

@@ -78,6 +78,7 @@ private:
vector<pair<string,int32> > factionCRCList;
int aiAcceptSwitchTeamPercentChance;
int masterserver_admin;
public:
@@ -114,6 +115,7 @@ public:
techCRC = 0;
factionCRCList.clear();
aiAcceptSwitchTeamPercentChance = 30;
masterserver_admin = -1;
}
// default copy constructor will do fine, and will maintain itself ;)
@@ -237,6 +239,9 @@ public:
int getAiAcceptSwitchTeamPercentChance() const { return aiAcceptSwitchTeamPercentChance;}
void setAiAcceptSwitchTeamPercentChance(int value) { aiAcceptSwitchTeamPercentChance = value; }
int getMasterserver_admin() const { return masterserver_admin;}
void setMasterserver_admin(int value) { masterserver_admin = value; }
string toString() const {
string result = "";
@@ -282,6 +287,7 @@ public:
}
result += "aiAcceptSwitchTeamPercentChance = " + intToStr(aiAcceptSwitchTeamPercentChance) + "\n";
result += "masterserver_admin = " + intToStr(masterserver_admin) + "\n";
return result;
}

View File

@@ -102,6 +102,7 @@ const char *GAME_ARGS[] = {
"--autostart-lastgame",
"--connecthost",
"--starthost",
"--masterserver-mode",
"--load-scenario",
"--preview-map",
"--version",
@@ -145,6 +146,7 @@ enum GAME_ARG_TYPE {
GAME_ARG_AUTOSTART_LASTGAME,
GAME_ARG_CLIENT,
GAME_ARG_SERVER,
GAME_ARG_MASTERSERVER_MODE,
GAME_ARG_LOADSCENARIO,
GAME_ARG_PREVIEW_MAP,
GAME_ARG_VERSION,
@@ -1010,6 +1012,7 @@ void printParameterHelp(const char *argv0, bool foundInvalidArgs) {
printf("\n%s\t\tAutomatically starts a game with the last game settings you played.",GAME_ARGS[GAME_ARG_AUTOSTART_LASTGAME]);
printf("\n%s=x\t\t\tAuto connects to a network server at IP or hostname x",GAME_ARGS[GAME_ARG_CLIENT]);
printf("\n%s\t\t\tAuto creates a network server.",GAME_ARGS[GAME_ARG_SERVER]);
printf("\n%s\t\t\tRuns as a masterserver.",GAME_ARGS[GAME_ARG_MASTERSERVER_MODE]);
printf("\n%s=x\t\tAuto loads the specified scenario by scenario name.",GAME_ARGS[GAME_ARG_LOADSCENARIO]);
printf("\n%s=x\t\tAuto Preview the specified map by map name.",GAME_ARGS[GAME_ARG_PREVIEW_MAP]);
printf("\n%s\t\t\tdisplays the version string of this program.",GAME_ARGS[GAME_ARG_VERSION]);
@@ -3125,6 +3128,9 @@ int glestMain(int argc, char** argv) {
if(hasCommandArgument(argc, argv,GAME_ARGS[GAME_ARG_SERVER]) == true) {
program->initServer(mainWindow,false,true);
}
else if(hasCommandArgument(argc, argv,string(GAME_ARGS[GAME_ARG_MASTERSERVER_MODE])) == true) {
program->initServer(mainWindow,false,true,true);
}
else if(hasCommandArgument(argc, argv,string(GAME_ARGS[GAME_ARG_AUTOSTART_LASTGAME])) == true) {
program->initServer(mainWindow,true,false);
}

View File

@@ -181,13 +181,14 @@ void Program::initNormal(WindowGl *window){
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
}
void Program::initServer(WindowGl *window, bool autostart,bool openNetworkSlots) {
void Program::initServer(WindowGl *window, bool autostart,bool openNetworkSlots,
bool masterserverMode) {
MainMenu* mainMenu= NULL;
init(window);
mainMenu= new MainMenu(this);
setState(mainMenu);
mainMenu->setState(new MenuStateCustomGame(this, mainMenu, openNetworkSlots, false, autostart));
mainMenu->setState(new MenuStateCustomGame(this, mainMenu, openNetworkSlots, false, autostart, NULL, masterserverMode));
}
void Program::initServer(WindowGl *window, GameSettings *settings) {

View File

@@ -152,7 +152,7 @@ public:
GraphicMessageBox * getMsgBox() { return &msgBox; }
void initNormal(WindowGl *window);
void initServer(WindowGl *window,bool autostart=false,bool openNetworkSlots=false);
void initServer(WindowGl *window,bool autostart=false,bool openNetworkSlots=false,bool masterserverMode=false);
void initServer(WindowGl *window, GameSettings *settings);
void initClient(WindowGl *window, const Ip &serverIp);
void initScenario(WindowGl *window, string autoloadScenarioName);

View File

@@ -94,6 +94,7 @@ void MainMenu::render() {
canRender();
incrementFps();
if(state->isMasterserverMode() == false) {
renderer.clearBuffers();
//3d
@@ -113,6 +114,7 @@ void MainMenu::render() {
renderer.swapBuffers();
}
}
//syncronus update
void MainMenu::update(){

View File

@@ -139,6 +139,7 @@ public:
virtual void keyPress(SDL_KeyboardEvent c){};
virtual void keyUp(SDL_KeyboardEvent key){};
virtual bool isMasterserverMode() const {return false;}
const Camera *getCamera() const {return &camera;}
virtual bool isInSpecialKeyCaptureEvent() { return false; }

File diff suppressed because it is too large Load Diff

View File

@@ -145,6 +145,10 @@ private:
vector<string> tilesetFiles;
vector<string> factionFiles;
vector<string> playerSortedMaps[GameConstants::maxPlayers+1];
vector<string> formattedPlayerSortedMaps[GameConstants::maxPlayers+1];
vector<string> formattedMapFiles;
GraphicMessageBox ftpMessageBox;
FTPClientThread *ftpClientThread;
FTPMessageType ftpMissingDataType;
@@ -174,6 +178,8 @@ private:
GraphicLabel labelAISwitchTeamAcceptPercent;
GraphicListBox listBoxAISwitchTeamAcceptPercent;
GraphicButton buttonPlayNow;
public:
MenuStateConnectedGame(Program *program, MainMenu *mainMenu, JoinMenu joinMenuInfo=jmSimple, bool openNetworkSlots= false);
@@ -208,6 +214,14 @@ private:
int32 getNetworkPlayerStatus();
void cleanupMapPreviewTexture();
void mouseClickAdmin(int x, int y, MouseButton mouseButton);
string getCurrentMapFile();
void loadGameSettings(GameSettings *gameSettings);
void reloadFactions(bool keepExistingSelectedItem);
void PlayNow(bool saveGame);
bool isMasterserverAdmin();
void broadCastGameSettingsToMasterserver();
};
}}//end namespace

View File

@@ -47,9 +47,17 @@ struct FormatString {
// class MenuStateCustomGame
// =====================================================
MenuStateCustomGame::MenuStateCustomGame(Program *program, MainMenu *mainMenu, bool openNetworkSlots,bool parentMenuIsMasterserver, bool autostart, GameSettings *settings) :
MenuStateCustomGame::MenuStateCustomGame(Program *program, MainMenu *mainMenu,
bool openNetworkSlots,bool parentMenuIsMasterserver, bool autostart,
GameSettings *settings, bool masterserverMode) :
MenuState(program, mainMenu, "new-game")
{
this->masterserverMode = masterserverMode;
this->lastMasterServerSettingsUpdateCount = 0;
this->masterserverModeMinimalResources = true;
//printf("this->masterserverMode = %d [%d]\n",this->masterserverMode,masterserverMode);
forceWaitForShutdown = true;
this->autostart = autostart;
this->autoStartSettings = settings;
@@ -1374,6 +1382,11 @@ void MenuStateCustomGame::mouseMove(int x, int y, const MouseState *ms){
listBoxAdvanced.mouseMove(x, y);
}
bool MenuStateCustomGame::isMasterserverMode() const {
//return (this->masterserverMode == true && this->masterserverModeMinimalResources == true);
return false;
}
void MenuStateCustomGame::render() {
try {
Renderer &renderer= Renderer::getInstance();
@@ -1521,7 +1534,6 @@ void MenuStateCustomGame::render() {
renderer.renderListBox(&listBoxTechTree);
renderer.renderListBox(&listBoxAdvanced);
if(listBoxPublishServer.getEditable())
{
renderer.renderListBox(&listBoxPublishServer);
@@ -1727,6 +1739,22 @@ void MenuStateCustomGame::update() {
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took msecs: %lld\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) chrono.start();
if(this->masterserverMode == true && serverInterface->getGameSettingsUpdateCount() > lastMasterServerSettingsUpdateCount &&
serverInterface->getGameSettings() != NULL) {
const GameSettings *settings = serverInterface->getGameSettings();
lastMasterServerSettingsUpdateCount = serverInterface->getGameSettingsUpdateCount();
//printf("#2 custom menu got map [%s]\n",settings->getMap().c_str());
setupUIFromGameSettings(*settings);
}
if(this->masterserverMode == true && serverInterface->getMasterserverAdminRequestLaunch() == true) {
safeMutex.ReleaseLock();
PlayNow(false);
return;
}
// handle setting changes from clients
SwitchSetupRequest ** switchSetupRequests = serverInterface->getSwitchSetupRequests();
//!!!
@@ -2042,9 +2070,11 @@ void MenuStateCustomGame::update() {
needToPublishDelayed=false;
}
}
if(!needToPublishDelayed){
if(needToPublishDelayed == false || masterserverMode == true) {
bool broadCastSettings = (difftime(time(NULL),lastSetChangedGameSettings) >= 2);
//printf("broadCastSettings = %d\n",broadCastSettings);
if(broadCastSettings == true) {
needToBroadcastServerSettings=true;
}
@@ -2210,6 +2240,9 @@ void MenuStateCustomGame::simpleTask(BaseThread *callingThread) {
std::map<string,string> newPublishToServerInfo = publishToServerInfo;
publishToServerInfo.clear();
bool broadCastSettings = needToBroadcastServerSettings;
//printf("simpleTask broadCastSettings = %d\n",broadCastSettings);
needToBroadcastServerSettings = false;
bool hasClientConnection = false;
@@ -2284,6 +2317,9 @@ void MenuStateCustomGame::simpleTask(BaseThread *callingThread) {
}
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__);
//printf("simpleTask broadCastSettings = %d hasClientConnection = %d\n",broadCastSettings,hasClientConnection);
GameSettings gameSettings;
loadGameSettings(&gameSettings);
@@ -2352,6 +2388,16 @@ void MenuStateCustomGame::loadGameSettings(GameSettings *gameSettings,bool force
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__);
if(this->masterserverMode == true && serverInterface->getGameSettingsUpdateCount() > lastMasterServerSettingsUpdateCount &&
serverInterface->getGameSettings() != NULL) {
const GameSettings *settings = serverInterface->getGameSettings();
lastMasterServerSettingsUpdateCount = serverInterface->getGameSettingsUpdateCount();
//printf("#1 custom menu got map [%s]\n",settings->getMap().c_str());
setupUIFromGameSettings(*settings);
}
// Test flags values
//gameSettings->setFlagTypes1(ft1_show_map_resources);
//
@@ -2579,6 +2625,37 @@ void MenuStateCustomGame::loadGameSettings(GameSettings *gameSettings,bool force
gameSettings->setMapCRC(lastCheckedCRCMapValue);
}
}
//printf("this->masterserverMode = %d\n",this->masterserverMode);
if(this->masterserverMode == true) {
time_t clientConnectedTime = 0;
//printf("mapInfo.players [%d]\n",mapInfo.players);
for(int i= 0; i < mapInfo.players; ++i) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__);
if(listBoxControls[i].getSelectedItemIndex() == ctNetwork) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__);
if( serverInterface->getSlot(i) != NULL && serverInterface->getSlot(i)->isConnected()) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__);
//printf("slot = %d serverInterface->getSlot(i)->getConnectedTime() = %d\n",i,serverInterface->getSlot(i)->getConnectedTime());
if(clientConnectedTime == 0 || serverInterface->getSlot(i)->getConnectedTime() < clientConnectedTime) {
clientConnectedTime = serverInterface->getSlot(i)->getConnectedTime();
gameSettings->setMasterserver_admin(serverInterface->getSlot(i)->getSessionKey());
//printf("slot = %d, admin key [%d]\n",i,gameSettings->getMasterserver_admin());
}
}
}
}
}
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__);
}
@@ -2750,7 +2827,7 @@ void MenuStateCustomGame::setupUIFromGameSettings(const GameSettings &gameSettin
listBoxMapFilter.setSelectedItemIndex(gameSettings.getMapFilterIndex());
listBoxMap.setItems(formattedPlayerSortedMaps[gameSettings.getMapFilterIndex()]);
printf("In [%s::%s line %d] map [%s]\n",__FILE__,__FUNCTION__,__LINE__,gameSettings.getMap().c_str());
//printf("In [%s::%s line %d] map [%s]\n",__FILE__,__FUNCTION__,__LINE__,gameSettings.getMap().c_str());
string mapFile = gameSettings.getMap();
mapFile = formatString(mapFile);

View File

@@ -167,9 +167,14 @@ private:
vector<pair<string,int32> > factionCRCList;
bool forceWaitForShutdown;
bool masterserverMode;
bool masterserverModeMinimalResources;
int lastMasterServerSettingsUpdateCount;
public:
MenuStateCustomGame(Program *program, MainMenu *mainMenu ,bool openNetworkSlots= false, bool parentMenuIsMasterserver=false, bool autostart=false,GameSettings *settings=NULL);
MenuStateCustomGame(Program *program, MainMenu *mainMenu ,
bool openNetworkSlots= false, bool parentMenuIsMasterserver=false,
bool autostart=false,GameSettings *settings=NULL,bool masterserverMode=false);
virtual ~MenuStateCustomGame();
void mouseClick(int x, int y, MouseButton mouseButton);
@@ -184,6 +189,7 @@ public:
virtual void simpleTask(BaseThread *callingThread);
virtual bool isInSpecialKeyCaptureEvent();
virtual bool isMasterserverMode() const;
private:

View File

@@ -1247,4 +1247,30 @@ string ClientInterface::getHumanPlayerName(int index) {
return result;
}
void ClientInterface::setGameSettings(GameSettings *serverGameSettings) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] START\n",__FILE__,__FUNCTION__);
//MutexSafeWrapper safeMutex(&serverSynchAccessor,string(__FILE__) + "_" + intToStr(__LINE__));
gameSettings = *serverGameSettings;
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] END\n",__FILE__,__FUNCTION__);
}
void ClientInterface::broadcastGameSetup(const GameSettings *gameSettings) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__);
//MutexSafeWrapper safeMutex(&serverSynchAccessor,string(__FILE__) + "_" + intToStr(__LINE__));
NetworkMessageLaunch networkMessageLaunch(gameSettings, nmtBroadCastSetup);
//broadcastMessage(&networkMessageLaunch);
sendMessage(&networkMessageLaunch);
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__);
}
void ClientInterface::broadcastGameStart(const GameSettings *gameSettings) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__);
//MutexSafeWrapper safeMutex(&serverSynchAccessor,string(__FILE__) + "_" + intToStr(__LINE__));
NetworkMessageLaunch networkMessageLaunch(gameSettings, nmtLaunch);
//broadcastMessage(&networkMessageLaunch);
sendMessage(&networkMessageLaunch);
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__);
}
}}//end namespace

View File

@@ -109,6 +109,12 @@ public:
virtual int getHumanPlayerIndex() const {return playerIndex;}
int getServerFTPPort() const { return serverFTPPort; }
int getSessionKey() const { return sessionKey; }
void setGameSettings(GameSettings *serverGameSettings);
void broadcastGameSetup(const GameSettings *gameSettings);
void broadcastGameStart(const GameSettings *gameSettings);
protected:
Mutex * getServerSynchAccessor() { return NULL; }

View File

@@ -555,6 +555,51 @@ void ConnectionSlot::update(bool checkForNewClients,int lockedSlotIndex) {
}
break;
case nmtLaunch:
case nmtBroadCastSetup:
{
if(this->serverInterface->getGameSettings() == NULL ||
sessionKey != this->serverInterface->getGameSettings()->getMasterserver_admin()) {
string playerNameStr = name;
string sErr = "Client has invalid admin sessionid for player [" + playerNameStr + "]";
printf("%s\n",sErr.c_str());
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] %s\n",__FILE__,__FUNCTION__,__LINE__,sErr.c_str());
close();
return;
}
NetworkMessageLaunch networkMessageLaunch;
if(receiveMessage(&networkMessageLaunch)) {
if(networkMessageLaunch.getMessageType() == nmtLaunch) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Lined: %d] got nmtLaunch\n",__FILE__,__FUNCTION__,__LINE__);
}
else if(networkMessageLaunch.getMessageType() == nmtBroadCastSetup) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Lined: %d] got nmtBroadCastSetup\n",__FILE__,__FUNCTION__,__LINE__);
}
else {
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Lined: %d] got networkMessageLaunch.getMessageType() = %d\n",__FILE__,__FUNCTION__,__LINE__,networkMessageLaunch.getMessageType());
char szBuf[1024]="";
snprintf(szBuf,1023,"In [%s::%s Line: %d] Invalid networkMessageLaunch.getMessageType() = %d",__FILE__,__FUNCTION__,__LINE__,networkMessageLaunch.getMessageType());
throw runtime_error(szBuf);
}
GameSettings gameSettings;
networkMessageLaunch.buildGameSettings(&gameSettings);
//printf("Connection slot got networkMessageLaunch.getMessageType() = %d, got map [%s]\n",networkMessageLaunch.getMessageType(),gameSettings.getMap().c_str());
this->serverInterface->setGameSettings(&gameSettings,false);
this->serverInterface->broadcastGameSetup(&gameSettings);
if(networkMessageLaunch.getMessageType() == nmtLaunch) {
this->serverInterface->setMasterserverAdminRequestLaunch(true);
}
}
}
break;
//process datasynch messages
case nmtSynchNetworkGameDataStatus:
{

View File

@@ -183,6 +183,9 @@ public:
string getNetworkPlayerLanguage() const { return playerLanguage; }
time_t getConnectedTime() const { return connectedTime; }
int getSessionKey() const { return sessionKey; }
protected:
Mutex * getServerSynchAccessor();

View File

@@ -231,6 +231,7 @@ NetworkMessageLaunch::NetworkMessageLaunch() {
data.factionCRCList[i] = 0;
}
data.aiAcceptSwitchTeamPercentChance = 0;
data.masterserver_admin = -1;
}
NetworkMessageLaunch::NetworkMessageLaunch(const GameSettings *gameSettings,int8 messageType) {
@@ -281,6 +282,7 @@ NetworkMessageLaunch::NetworkMessageLaunch(const GameSettings *gameSettings,int8
}
data.aiAcceptSwitchTeamPercentChance = gameSettings->getAiAcceptSwitchTeamPercentChance();
data.masterserver_admin = gameSettings->getMasterserver_admin();
}
void NetworkMessageLaunch::buildGameSettings(GameSettings *gameSettings) const {
@@ -327,6 +329,7 @@ void NetworkMessageLaunch::buildGameSettings(GameSettings *gameSettings) const {
}
gameSettings->setAiAcceptSwitchTeamPercentChance(data.aiAcceptSwitchTeamPercentChance);
gameSettings->setMasterserver_admin(data.masterserver_admin);
}
vector<pair<string,int32> > NetworkMessageLaunch::getFactionCRCList() const {

View File

@@ -234,6 +234,7 @@ private:
uint32 flagTypes1;
int8 aiAcceptSwitchTeamPercentChance;
int32 masterserver_admin;
};
private:

View File

@@ -57,6 +57,7 @@ ServerInterface::ServerInterface(bool publishEnabled) :GameNetworkInterface() {
ftpServer = NULL;
inBroadcastMessage = false;
lastGlobalLagCheckTime = 0;
masterserverAdminRequestLaunch = false;
maxFrameCountLagAllowed = Config::getInstance().getInt("MaxFrameCountLagAllowed", intToStr(maxFrameCountLagAllowed).c_str());
maxFrameCountLagAllowedEver = Config::getInstance().getInt("MaxFrameCountLagAllowedEver", intToStr(maxFrameCountLagAllowedEver).c_str());
@@ -1696,8 +1697,8 @@ void ServerInterface::setGameSettings(GameSettings *serverGameSettings, bool wai
}
}
gameSettingsUpdateCount++;
}
gameSettingsUpdateCount++;
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] END\n",__FILE__,__FUNCTION__);
}

View File

@@ -79,6 +79,8 @@ private:
Mutex inBroadcastMessageThreadAccessor;
bool inBroadcastMessage;
bool masterserverAdminRequestLaunch;
public:
ServerInterface(bool publishEnabled);
virtual ~ServerInterface();
@@ -118,6 +120,12 @@ public:
bool launchGame(const GameSettings *gameSettings);
void setGameSettings(GameSettings *serverGameSettings, bool waitForClientAck);
void broadcastGameSetup(const GameSettings *gameSettings);
int getGameSettingsUpdateCount() const { return gameSettingsUpdateCount; }
bool getMasterserverAdminRequestLaunch() const { return masterserverAdminRequestLaunch; }
void setMasterserverAdminRequestLaunch(bool value) { masterserverAdminRequestLaunch = value; }
void updateListen();
virtual bool getConnectHasHandshaked() const
{
@@ -183,6 +191,7 @@ private:
int64 getNextEventId();
void processTextMessageQueue();
void processBroadCastMessageQueue();
protected:
void signalClientsToRecieveData(std::map<PLATFORM_SOCKET,bool> & socketTriggeredList, std::map<int,ConnectionSlotEvent> & eventList, std::map<int,bool> & mapSlotSignalledList);
void checkForCompletedClients(std::map<int,bool> & mapSlotSignalledList,std::vector <string> &errorMsgList,std::map<int,ConnectionSlotEvent> &eventList);