1
0
Fork 0

Improve scenario dialog

Support optional name for scenarios.
Add explicit scenario enable/disable switch.
This commit is contained in:
ThorstenB 2012-04-30 19:22:00 +02:00
parent 9c7051d2ce
commit 4b1d51a801
2 changed files with 31 additions and 11 deletions

View file

@ -30,7 +30,7 @@
<empty><stretch>true</stretch></empty>
<text>
<label>AI Scenario Select</label>
<label>AI Scenario Selection</label>
</text>
<empty><stretch>true</stretch></empty>
@ -49,8 +49,24 @@
<hrule/>
<checkbox>
<halign>left</halign>
<label>Enable AI scenarios</label>
<name>enable-ai-scenarios</name>
<property>/sim/ai/scenarios-enabled</property>
<binding>
<command>dialog-apply</command>
<object-name>enable-ai-scenarios</object-name>
</binding>
</checkbox>
<text><label/></text>
<text>
<label>Choose active scenario(s) for the next program start</label>
<enable>
<property>/sim/ai/scenarios-enabled</property>
</enable>
</text>
<hrule/>
@ -120,8 +136,12 @@
var scenarioN = rootN.getNode("scenario");
if( scenarioN == nil ) return;
var descriptionN = rootN.getNode("description");
if( descriptionN == nil )
var descriptionN = scenarioN.getNode("description");
var nameN = rootN.getNode("name");
if( (descriptionN == nil)and(nameN == nil) )
{
descriptionN = scenarioN.getNode("description");
nameN = scenarioN.getNode("name");
}
var description = descriptionN != nil ? descriptionN.getValue() : "";
var propertyRoot = props.globals.getNode("sim/gui/dialogs/scenario",1).getChild( "scenario", nr, 1 );
propertyRoot.getNode("selected",1).setBoolValue(isEnabledScenario(file));
@ -131,8 +151,12 @@
group.getNode("layout",1).setValue("hbox");
var cb = group.getNode("checkbox",1);
cb.getNode("property",1).setValue(propertyRoot.getNode("selected").getPath());
cb.getNode("label",1).setValue(file);
var label = string.replace(file, "_", " ");
if (nameN != nil)
label = nameN.getValue();
cb.getNode("label",1).setValue(label);
cb.getNode("name",1).setValue(file);
cb.getNode("enable/property",1).setValue("/sim/ai/scenarios-enabled");
group.getNode("empty",1).getNode("stretch",1).setValue("true");
}

View file

@ -63,7 +63,7 @@ Started September 2000 by David Megginson, david@megginson.com
<season type="string" preserve="y">summer</season>
</startup>
<rendering>
<materials-file>Materials/default/materials.xml</materials-file>
<materials-file>Materials/default/materials.xml</materials-file>
<rembrandt type="bool">false</rembrandt>
<show-buffers type="bool" userarchive="y">true</show-buffers>
<ambient-occlusion type="bool" userarchive="y">false</ambient-occlusion>
@ -748,13 +748,9 @@ Started September 2000 by David Megginson, david@megginson.com
<ai>
<enabled type="bool">true</enabled>
<scenarios-enabled type="bool" userarchive="y">true</scenarios-enabled>
<scenario>nimitz_demo</scenario>
<groundnet-cache type="bool">true</groundnet-cache>
<!-- <scenario>balloon_demo</scenario> -->
<!-- <scenario>aircraft_demo</scenario> -->
<!-- <scenario>refueling_demo</scenario> -->
<!-- <scenario>lead_aircraft</scenario> -->
<!-- <scenario>vinson_demo</scenario> -->
<groundnet-cache type="bool">true</groundnet-cache>
</ai>
<multiplay preserve="y">