mirror of
https://github.com/glest/glest-source.git
synced 2025-08-23 08:22:50 +02:00
- Fix reload game to not replace human players
This commit is contained in:
@@ -3823,6 +3823,34 @@ void MenuStateCustomGame::saveGameSettingsToFile(std::string fileName) {
|
|||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] Line: %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] Line: %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MenuStateCustomGame::KeepCurrentHumanPlayerSlots(GameSettings &gameSettings) {
|
||||||
|
//look for human players
|
||||||
|
for(int index = 0; index < GameConstants::maxPlayers; ++index) {
|
||||||
|
ControlType ct= static_cast<ControlType>(listBoxControls[index].getSelectedItemIndex());
|
||||||
|
if(ct == ctHuman) {
|
||||||
|
|
||||||
|
bool foundControlType = false;
|
||||||
|
for(int index2 = 0; index2 < GameConstants::maxPlayers; ++index2) {
|
||||||
|
ControlType ctFile = static_cast<ControlType>(gameSettings.getFactionControl(index2));
|
||||||
|
if(ctFile == ctHuman) {
|
||||||
|
ControlType ctUI = static_cast<ControlType>(listBoxControls[index2].getSelectedItemIndex());
|
||||||
|
if(ctUI != ctNetwork && ctUI != ctNetworkUnassigned) {
|
||||||
|
foundControlType = true;
|
||||||
|
//printf("Human found in file [%d]\n",index2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//printf("Human found in UI [%d] and file [%d]\n",index,foundControlType);
|
||||||
|
|
||||||
|
if(foundControlType == false) {
|
||||||
|
gameSettings.setFactionControl(index,ctHuman);
|
||||||
|
}
|
||||||
|
gameSettings.setNetworkPlayerName(index,getHumanPlayerName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
GameSettings MenuStateCustomGame::loadGameSettingsFromFile(std::string fileName) {
|
GameSettings MenuStateCustomGame::loadGameSettingsFromFile(std::string fileName) {
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] Line: %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] Line: %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
@@ -3833,10 +3861,7 @@ GameSettings MenuStateCustomGame::loadGameSettingsFromFile(std::string fileName)
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
CoreData::getInstance().loadGameSettingsFromFile(fileName, &gameSettings);
|
CoreData::getInstance().loadGameSettingsFromFile(fileName, &gameSettings);
|
||||||
|
KeepCurrentHumanPlayerSlots(gameSettings);
|
||||||
for(int i = 0; i < GameConstants::maxPlayers; ++i) {
|
|
||||||
gameSettings.setNetworkPlayerName(i,"");
|
|
||||||
}
|
|
||||||
|
|
||||||
// correct game settings for headless:
|
// correct game settings for headless:
|
||||||
if(this->headlessServerMode == true) {
|
if(this->headlessServerMode == true) {
|
||||||
|
@@ -309,6 +309,7 @@ private:
|
|||||||
void cleanupThread(SimpleTaskThread **thread);
|
void cleanupThread(SimpleTaskThread **thread);
|
||||||
void simpleTaskForMasterServer(BaseThread *callingThread);
|
void simpleTaskForMasterServer(BaseThread *callingThread);
|
||||||
void simpleTaskForClients(BaseThread *callingThread);
|
void simpleTaskForClients(BaseThread *callingThread);
|
||||||
|
void KeepCurrentHumanPlayerSlots(GameSettings &gameSettings);
|
||||||
};
|
};
|
||||||
|
|
||||||
}}//end namespace
|
}}//end namespace
|
||||||
|
Reference in New Issue
Block a user