shared team options in scenarios

now you can enable sharedTeamUnits and sharedTeamResources in scenarios

to do so use this two xml tags:
	<shared-team-units value="false"/>
	<shared-team-resources value="false"/>
put them in the <scenario> node
This commit is contained in:
titison 2015-01-12 17:21:29 +01:00
parent 0616483452
commit 848b84f149
4 changed files with 48 additions and 0 deletions

View File

@ -4565,6 +4565,9 @@ void MenuStateConnectedGame::setupUIFromGameSettings(GameSettings *gameSettings,
listBoxFogOfWar.setSelectedItemIndex(0);
}
checkBoxAllowTeamUnitSharing.setValue(scenarioInfo.allowTeamUnitSharing);
checkBoxAllowTeamResourceSharing.setValue(scenarioInfo.allowTeamResourceSharing);
if(originalFOWValue != listBoxFogOfWar.getSelectedItemIndex()) {
cleanupMapPreviewTexture();
}

View File

@ -3994,6 +3994,8 @@ void MenuStateCustomGame::setupUIFromGameSettings(const GameSettings &gameSettin
else {
listBoxFogOfWar.setSelectedItemIndex(0);
}
checkBoxAllowTeamUnitSharing.setValue(scenarioInfo.allowTeamUnitSharing);
checkBoxAllowTeamResourceSharing.setValue(scenarioInfo.allowTeamResourceSharing);
}
setupMapList(gameSettings.getScenario());
setupTechList(gameSettings.getScenario(),false);
@ -4691,6 +4693,9 @@ void MenuStateCustomGame::processScenario() {
listBoxFogOfWar.setSelectedItemIndex(0);
}
checkBoxAllowTeamUnitSharing.setValue(scenarioInfo.allowTeamUnitSharing);
checkBoxAllowTeamResourceSharing.setValue(scenarioInfo.allowTeamResourceSharing);
setupTechList(scenarioInfo.name, false);
listBoxTechTree.setSelectedItem(formatString(scenarioInfo.techTreeName));
reloadFactions(false,scenarioInfo.name);

View File

@ -392,6 +392,22 @@ void Scenario::loadScenarioInfo(string file, ScenarioInfo *scenarioInfo, bool is
scenarioInfo->fogOfWar_exploredFlag = false;
}
if(scenarioNode->hasChild("shared-team-units") == true) {
scenarioInfo->allowTeamUnitSharing=scenarioNode->getChild("shared-team-units")->getAttribute("value")->getBoolValue();
//printf("\nallowTeamUnitSharing is set to [%B]\n",scenarioInfo->allowTeamUnitSharing);
}
else {
scenarioInfo->allowTeamUnitSharing = false;
}
if(scenarioNode->hasChild("shared-team-resources") == true) {
scenarioInfo->allowTeamResourceSharing=scenarioNode->getChild("shared-team-resources")->getAttribute("value")->getBoolValue();
//printf("\nallowTeamResourceSharing is set to [%B]\n",scenarioInfo->allowTeamResourceSharing);
}
else {
scenarioInfo->allowTeamResourceSharing = false;
}
scenarioInfo->file = file;
scenarioInfo->name = extractFileFromDirectoryPath(file);
scenarioInfo->name = cutLastExt(scenarioInfo->name);
@ -541,6 +557,24 @@ void Scenario::loadGameSettings(const vector<string> &dirList,
gameSettings->setFlagTypes1(valueFlags1);
}
if(scenarioInfo->allowTeamUnitSharing == true) {
valueFlags1 |= ft1_allow_shared_team_units;
gameSettings->setFlagTypes1(valueFlags1);
}
else {
valueFlags1 &= ~ft1_allow_shared_team_units;
gameSettings->setFlagTypes1(valueFlags1);
}
if(scenarioInfo->allowTeamResourceSharing == true) {
valueFlags1 |= ft1_allow_shared_team_resources;
gameSettings->setFlagTypes1(valueFlags1);
}
else {
valueFlags1 &= ~ft1_allow_shared_team_resources;
gameSettings->setFlagTypes1(valueFlags1);
}
gameSettings->setPathFinderType(static_cast<PathFinderType>(Config::getInstance().getInt("ScenarioPathFinderType",intToStr(pfBasic).c_str())));
}

View File

@ -68,6 +68,9 @@ public:
fogOfWar = false;
fogOfWar_exploredFlag = false;
allowTeamUnitSharing = false;
allowTeamResourceSharing = false;
file = "";
name = "";
namei18n = "";
@ -91,6 +94,9 @@ public:
bool fogOfWar;
bool fogOfWar_exploredFlag;
bool allowTeamUnitSharing;
bool allowTeamResourceSharing;
string file;
string name;
string namei18n;