From 61f4bcaacd42a5d9388e114358ee847bec8e6050 Mon Sep 17 00:00:00 2001 From: Titus Tscharntke Date: Wed, 3 Oct 2012 22:16:12 +0000 Subject: [PATCH] try to fix the headless server show itself connected --- source/glest_game/menu/menu_state_custom_game.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/source/glest_game/menu/menu_state_custom_game.cpp b/source/glest_game/menu/menu_state_custom_game.cpp index da1345b2f..e1239004f 100644 --- a/source/glest_game/menu/menu_state_custom_game.cpp +++ b/source/glest_game/menu/menu_state_custom_game.cpp @@ -3178,6 +3178,12 @@ void MenuStateCustomGame::loadGameSettings(GameSettings *gameSettings,bool force if(ct != ctClosed) { int slotIndex = factionCount; + + if (ct == ctHuman && this->headlessServerMode == true) { + // switch slot to network, because no human in headless mode + ct = ctNetwork; + } + gameSettings->setFactionControl(slotIndex, ct); if(ct == ctHuman) { if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] i = %d, slotIndex = %d, getHumanPlayerName(i) [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,i,slotIndex,getHumanPlayerName(i).c_str()); @@ -3218,7 +3224,6 @@ void MenuStateCustomGame::loadGameSettings(GameSettings *gameSettings,bool force gameSettings->setTeam(slotIndex, listBoxTeams[i].getSelectedItemIndex()); gameSettings->setStartLocationIndex(slotIndex, i); - if(listBoxControls[i].getSelectedItemIndex() == ctNetwork || listBoxControls[i].getSelectedItemIndex() == ctNetworkUnassigned) { if(serverInterface->getSlot(i) != NULL && serverInterface->getSlot(i)->isConnected()) {