fix for uneditable closed slots

https://forum.megaglest.org/index.php?topic=9620.0
This commit is contained in:
titiger 2014-12-22 03:08:19 +01:00
parent 48db19c34b
commit f62efc64bf
5 changed files with 9 additions and 6 deletions

View File

@ -144,6 +144,7 @@ public:
static const char *folder_path_tutorials;
static const char *NETWORK_SLOT_UNCONNECTED_SLOTNAME;
static const char *NETWORK_SLOT_CLOSED_SLOTNAME;
static const char *folder_path_screenshots;

View File

@ -44,6 +44,7 @@ const char *GameConstants::folder_path_tilesets = "tilesets";
const char *GameConstants::folder_path_tutorials = "tutorials";
const char *GameConstants::NETWORK_SLOT_UNCONNECTED_SLOTNAME = "???";
const char *GameConstants::NETWORK_SLOT_CLOSED_SLOTNAME = "Closed";
const char *GameConstants::folder_path_screenshots = "screens/";

View File

@ -5060,7 +5060,7 @@ int glestMain(int argc, char** argv) {
gameSettings->setFactionControl(i, ct);
gameSettings->setStartLocationIndex(i, i);
gameSettings->setResourceMultiplierIndex(i, 10);
gameSettings->setNetworkPlayerName(i, "Closed");
gameSettings->setNetworkPlayerName(i, GameConstants::NETWORK_SLOT_CLOSED_SLOTNAME);
}
ControlType ct= ctHuman;

View File

@ -2314,7 +2314,7 @@ void MenuStateConnectedGame::loadGameSettings(GameSettings *gameSettings) {
gameSettings->setFactionTypeName(slotIndex, factionFiles[listBoxFactions[i].getSelectedItemIndex()]);
gameSettings->setNetworkPlayerStatuses(slotIndex, npst_None);
gameSettings->setNetworkPlayerName(slotIndex, "Closed");
gameSettings->setNetworkPlayerName(slotIndex, GameConstants::NETWORK_SLOT_CLOSED_SLOTNAME);
closedCount++;
}
@ -2897,15 +2897,16 @@ void MenuStateConnectedGame::update() {
hasOpenSlot=true;
}
if(displayedGamesettings.getFactionControl(i)==ctNetwork &&
displayedGamesettings.getNetworkPlayerNameByPlayerIndex(i)!= GameConstants::NETWORK_SLOT_UNCONNECTED_SLOTNAME){
displayedGamesettings.getNetworkPlayerNameByPlayerIndex(i)!= GameConstants::NETWORK_SLOT_UNCONNECTED_SLOTNAME &&
displayedGamesettings.getNetworkPlayerNameByPlayerIndex(i)!= GameConstants::NETWORK_SLOT_CLOSED_SLOTNAME ){
listBoxControls[i].setEditable(false);
if(clientInterface->getPlayerIndex()!=(int)i){
hasOtherPlayer=true;
}
}
else
if(clientInterface->getPlayerIndex()==(int)i)
else if(clientInterface->getPlayerIndex()==(int)i){
listBoxControls[i].setEditable(false);
}
else {
listBoxControls[i].setEditable(true);
}

View File

@ -3730,7 +3730,7 @@ void MenuStateCustomGame::loadGameSettings(GameSettings *gameSettings,bool force
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] i = %d, factionFiles[listBoxFactions[i].getSelectedItemIndex()] [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,i,factionFiles[listBoxFactions[i].getSelectedItemIndex()].c_str());
gameSettings->setFactionTypeName(slotIndex, factionFiles[listBoxFactions[i].getSelectedItemIndex()]);
gameSettings->setNetworkPlayerName(slotIndex, "Closed");
gameSettings->setNetworkPlayerName(slotIndex, GameConstants::NETWORK_SLOT_CLOSED_SLOTNAME);
gameSettings->setNetworkPlayerUUID(slotIndex,"");
gameSettings->setNetworkPlayerPlatform(slotIndex,"");