Tweaks for run-time scenario toggling.
This commit is contained in:
parent
8f1df6c358
commit
295ae6a650
1 changed files with 11 additions and 0 deletions
|
@ -303,6 +303,16 @@ FGAIManager::processThermal( double dt, FGAIThermal* thermal ) {
|
||||||
bool FGAIManager::loadScenarioCommand(const SGPropertyNode* args)
|
bool FGAIManager::loadScenarioCommand(const SGPropertyNode* args)
|
||||||
{
|
{
|
||||||
std::string name = args->getStringValue("name");
|
std::string name = args->getStringValue("name");
|
||||||
|
if (args->hasChild("load-property")) {
|
||||||
|
// slightly ugly, to simplify life in the dialogs, make load allow
|
||||||
|
// loading or unloading based on a bool property.
|
||||||
|
bool loadIt = fgGetBool(args->getStringValue("load-property"));
|
||||||
|
if (!loadIt) {
|
||||||
|
// user actually wants to unload, fine.
|
||||||
|
return unloadScenario(name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (_scenarios.find(name) != _scenarios.end()) {
|
if (_scenarios.find(name) != _scenarios.end()) {
|
||||||
SG_LOG(SG_AI, SG_WARN, "scenario '" << name << "' already loaded");
|
SG_LOG(SG_AI, SG_WARN, "scenario '" << name << "' already loaded");
|
||||||
return false;
|
return false;
|
||||||
|
@ -315,6 +325,7 @@ bool FGAIManager::loadScenarioCommand(const SGPropertyNode* args)
|
||||||
for (; root->hasChild("scenario", index); ++index) {}
|
for (; root->hasChild("scenario", index); ++index) {}
|
||||||
|
|
||||||
SGPropertyNode* scenarioNode = root->getChild("scenario", index, true);
|
SGPropertyNode* scenarioNode = root->getChild("scenario", index, true);
|
||||||
|
scenarioNode->setAttribute(SGPropertyNode::USERARCHIVE, true);
|
||||||
scenarioNode->setStringValue(name);
|
scenarioNode->setStringValue(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue