2010-04-09 09:45:25 +00:00
|
|
|
<?xml version="1.0"?>
|
|
|
|
<!--
|
|
|
|
This file is part of FlightGear, the free flight simulator
|
|
|
|
http://www.flightgear.org/
|
|
|
|
|
|
|
|
Copyright (C) 2010 Torsten Dreyer, Torsten (at) t3r _dot_ de
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License as
|
|
|
|
published by the Free Software Foundation; either version 2 of the
|
|
|
|
License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful, but
|
|
|
|
WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
General Public License for more details.
|
|
|
|
-->
|
|
|
|
|
|
|
|
<PropertyList>
|
|
|
|
<name>scenario</name>
|
|
|
|
<modal>false</modal>
|
|
|
|
<layout>vbox</layout>
|
|
|
|
<resizable>false</resizable>
|
|
|
|
<default-padding>3</default-padding>
|
|
|
|
|
|
|
|
<group>
|
|
|
|
<layout>hbox</layout>
|
|
|
|
<default-padding>1</default-padding>
|
|
|
|
|
|
|
|
<empty><stretch>true</stretch></empty>
|
|
|
|
|
|
|
|
<text>
|
2012-05-01 09:10:37 +00:00
|
|
|
<label>AI Traffic and Scenario Settings</label>
|
2010-04-09 09:45:25 +00:00
|
|
|
</text>
|
|
|
|
|
|
|
|
<empty><stretch>true</stretch></empty>
|
|
|
|
|
|
|
|
<button>
|
|
|
|
<legend></legend>
|
|
|
|
<key>Esc</key>
|
|
|
|
<pref-width>16</pref-width>
|
|
|
|
<pref-height>16</pref-height>
|
|
|
|
<border>2</border>
|
|
|
|
<binding>
|
|
|
|
<command>dialog-close</command>
|
|
|
|
</binding>
|
|
|
|
</button>
|
|
|
|
</group>
|
|
|
|
|
2024-01-17 15:25:49 +00:00
|
|
|
<group>
|
|
|
|
<layout>hbox</layout>
|
|
|
|
<hrule>
|
|
|
|
<stretch>true</stretch>
|
|
|
|
</hrule>
|
|
|
|
<text>
|
|
|
|
<label>Timetable-Based AI Traffic</label>
|
|
|
|
<halign>center</halign>
|
|
|
|
</text>
|
|
|
|
<hrule>
|
|
|
|
<stretch>true</stretch>
|
|
|
|
</hrule>
|
|
|
|
</group>
|
2010-04-09 09:45:25 +00:00
|
|
|
|
2015-05-03 16:13:50 +00:00
|
|
|
<group>
|
2020-04-09 21:40:41 +00:00
|
|
|
<layout>vbox</layout>
|
2012-05-01 09:10:37 +00:00
|
|
|
<halign>left</halign>
|
2015-05-03 16:13:50 +00:00
|
|
|
|
|
|
|
<checkbox>
|
|
|
|
<halign>left</halign>
|
|
|
|
<label>Enable AI traffic</label>
|
|
|
|
<name>enable-ai-traffic</name>
|
|
|
|
<property>/sim/traffic-manager/enabled</property>
|
|
|
|
<live>true</live>
|
2017-06-18 09:36:59 +00:00
|
|
|
<binding>
|
|
|
|
<command>dialog-apply</command>
|
2020-04-09 21:40:41 +00:00
|
|
|
<object-name>enable-ai-traffic</object-name>
|
2017-06-18 09:36:59 +00:00
|
|
|
</binding>
|
|
|
|
</checkbox>
|
|
|
|
|
2020-04-09 21:40:41 +00:00
|
|
|
<group>
|
|
|
|
<layout>vbox</layout>
|
|
|
|
<visible>
|
|
|
|
<not-equals>
|
|
|
|
<property>/sim/traffic-manager/enabled</property>
|
|
|
|
<value>0</value>
|
|
|
|
</not-equals>
|
|
|
|
</visible>
|
|
|
|
<checkbox>
|
|
|
|
<name>enable-ai-wake</name>
|
|
|
|
<halign>left</halign>
|
|
|
|
<label>Enable AI aerodynamic wake</label>
|
2017-06-18 09:36:59 +00:00
|
|
|
<property>/fdm/ai-wake/enabled</property>
|
2020-04-09 21:40:41 +00:00
|
|
|
<binding>
|
|
|
|
<command>dialog-apply</command>
|
|
|
|
<object-name>enable-ai-wake</object-name>
|
|
|
|
</binding>
|
|
|
|
</checkbox>
|
|
|
|
|
|
|
|
<group>
|
|
|
|
<layout>hbox</layout>
|
|
|
|
<visible>
|
|
|
|
<not-equals>
|
|
|
|
<property>/fdm/ai-wake/enabled</property>
|
|
|
|
<value>0</value>
|
|
|
|
</not-equals>
|
|
|
|
</visible>
|
|
|
|
<text>
|
|
|
|
<halign>left</halign>
|
|
|
|
<label>Max. radius of interaction (nm)</label>
|
|
|
|
</text>
|
|
|
|
|
|
|
|
<input>
|
|
|
|
<property>/fdm/ai-wake/max-radius-nm</property>
|
|
|
|
<enable>
|
|
|
|
<property>/fdm/ai-wake/enabled</property>
|
|
|
|
</enable>
|
|
|
|
<binding>
|
|
|
|
<command>dialog-apply</command>
|
|
|
|
</binding>
|
|
|
|
</input>
|
|
|
|
</group>
|
|
|
|
</group>
|
2017-06-18 09:36:59 +00:00
|
|
|
</group>
|
|
|
|
|
2024-01-17 15:25:49 +00:00
|
|
|
<group>
|
|
|
|
<layout>hbox</layout>
|
|
|
|
<hrule>
|
|
|
|
<stretch>true</stretch>
|
|
|
|
</hrule>
|
|
|
|
<text>
|
|
|
|
<label>Scenarios</label>
|
|
|
|
<halign>center</halign>
|
|
|
|
</text>
|
|
|
|
<hrule>
|
|
|
|
<stretch>true</stretch>
|
|
|
|
</hrule>
|
|
|
|
</group>
|
2010-12-27 20:19:31 +00:00
|
|
|
|
2010-04-09 09:45:25 +00:00
|
|
|
<group>
|
|
|
|
<layout>hbox</layout>
|
|
|
|
|
2015-05-03 16:13:50 +00:00
|
|
|
<!-- only for a gap -->
|
|
|
|
<group>
|
|
|
|
<layout>vbox</layout>
|
|
|
|
<default-padding>1</default-padding>
|
|
|
|
<text>
|
2020-04-09 21:40:41 +00:00
|
|
|
<label></label>
|
2015-05-03 16:13:50 +00:00
|
|
|
</text>
|
|
|
|
</group>
|
|
|
|
|
2010-04-09 09:45:25 +00:00
|
|
|
<group>
|
2020-04-09 21:40:41 +00:00
|
|
|
<name>column0</name>
|
|
|
|
<layout>vbox</layout>
|
|
|
|
</group>
|
|
|
|
|
|
|
|
<group>
|
2010-04-09 09:45:25 +00:00
|
|
|
<layout>vbox</layout>
|
2020-04-09 21:40:41 +00:00
|
|
|
<name>column1</name>
|
2010-04-09 09:45:25 +00:00
|
|
|
</group>
|
|
|
|
|
|
|
|
<group>
|
|
|
|
<layout>vbox</layout>
|
2020-04-09 21:40:41 +00:00
|
|
|
<name>column2</name>
|
2010-04-09 09:45:25 +00:00
|
|
|
</group>
|
|
|
|
|
|
|
|
</group>
|
|
|
|
|
2010-12-27 20:19:31 +00:00
|
|
|
<hrule/>
|
2010-04-09 09:45:25 +00:00
|
|
|
|
|
|
|
<group>
|
|
|
|
<layout>hbox</layout>
|
|
|
|
<halign>center</halign>
|
|
|
|
|
|
|
|
<button>
|
2013-04-02 17:01:59 +00:00
|
|
|
<legend>Close</legend>
|
2010-04-09 09:45:25 +00:00
|
|
|
<key>Esc</key>
|
|
|
|
<binding>
|
|
|
|
<command>dialog-close</command>
|
|
|
|
</binding>
|
|
|
|
</button>
|
|
|
|
|
|
|
|
<empty><stretch>true</stretch></empty>
|
|
|
|
</group>
|
|
|
|
|
|
|
|
<nasal>
|
|
|
|
<open><![CDATA[
|
|
|
|
var dlg_root = cmdarg();
|
|
|
|
|
|
|
|
var isEnabledScenario = func(scenario) {
|
|
|
|
foreach( var n; props.globals.getNode("sim/ai",1).getChildren("scenario") )
|
|
|
|
if( n.getValue() == scenario )
|
|
|
|
return 1;
|
|
|
|
return 0;
|
|
|
|
};
|
|
|
|
|
2020-04-09 21:40:41 +00:00
|
|
|
var processScenario = func(nr, col, rootN) {
|
2010-04-09 09:45:25 +00:00
|
|
|
var descriptionN = rootN.getNode("description");
|
2012-04-30 17:22:00 +00:00
|
|
|
var nameN = rootN.getNode("name");
|
2010-04-09 09:45:25 +00:00
|
|
|
var description = descriptionN != nil ? descriptionN.getValue() : "";
|
2019-02-03 11:36:56 +00:00
|
|
|
var scenarioId = rootN.getNode("id").getValue();
|
|
|
|
|
2010-04-09 09:45:25 +00:00
|
|
|
var propertyRoot = props.globals.getNode("sim/gui/dialogs/scenario",1).getChild( "scenario", nr, 1 );
|
2019-02-03 11:36:56 +00:00
|
|
|
propertyRoot.getNode("selected",1).setBoolValue(isEnabledScenario(scenarioId));
|
|
|
|
propertyRoot.getNode("name",1).setValue(scenarioId);
|
2010-04-09 09:45:25 +00:00
|
|
|
|
2020-04-09 21:40:41 +00:00
|
|
|
var group = gui.findElementByName( dlg_root, "column"~math.mod(col,3) ).getChild("group", nr, 1 );
|
2010-04-09 09:45:25 +00:00
|
|
|
group.getNode("layout",1).setValue("hbox");
|
|
|
|
var cb = group.getNode("checkbox",1);
|
|
|
|
cb.getNode("property",1).setValue(propertyRoot.getNode("selected").getPath());
|
2019-02-03 11:36:56 +00:00
|
|
|
var label = nameN.getValue();
|
|
|
|
|
2012-04-30 17:22:00 +00:00
|
|
|
cb.getNode("label",1).setValue(label);
|
2019-02-03 11:36:56 +00:00
|
|
|
cb.getNode("name",1).setValue(scenarioId);
|
2013-04-02 17:01:59 +00:00
|
|
|
|
|
|
|
var applyBind = cb.addChild("binding", 0);
|
|
|
|
applyBind.getNode("command", 1).setValue("dialog-apply");
|
|
|
|
|
|
|
|
var bind = cb.addChild("binding", 1);
|
|
|
|
bind.getNode("command", 1).setValue("load-scenario");
|
2019-02-03 11:36:56 +00:00
|
|
|
bind.getNode("name", 1).setValue(scenarioId);
|
2013-04-02 17:01:59 +00:00
|
|
|
bind.getNode("load-property", 1).setValue(propertyRoot.getNode("selected").getPath());
|
|
|
|
|
|
|
|
#cb.getNode("enable/property",1).setValue("/sim/ai/scenarios-enabled");
|
|
|
|
|
2010-04-09 09:45:25 +00:00
|
|
|
group.getNode("empty",1).getNode("stretch",1).setValue("true");
|
|
|
|
}
|
|
|
|
|
|
|
|
var path = getprop("/sim/fg-root") ~ "/AI";
|
2020-04-09 21:40:41 +00:00
|
|
|
scenarios = [];
|
2020-06-05 10:39:20 +00:00
|
|
|
|
2020-04-09 21:40:41 +00:00
|
|
|
foreach(var s; props.globals.getNode("sim/ai/scenarios",1).getChildren("scenario")){
|
|
|
|
append(scenarios, s);
|
|
|
|
}
|
|
|
|
# sort the scenarios into alpha order.
|
|
|
|
scenarios = sort (scenarios, func (a,b) {cmp(a.getNode("name").getValue(), b.getNode("name").getValue());});
|
|
|
|
|
|
|
|
# display in three columns top-to-bottom
|
|
|
|
ssz = size(scenarios);
|
|
|
|
colsz = math.round(ssz/3);
|
|
|
|
coli = 0;
|
|
|
|
col = 0;
|
|
|
|
|
|
|
|
for(i=0;i<size(scenarios);i += 1) {
|
|
|
|
processScenario( i, col, scenarios[i]);
|
|
|
|
coli += 1;
|
2024-01-17 15:25:49 +00:00
|
|
|
if (coli >= colsz){
|
2020-04-09 21:40:41 +00:00
|
|
|
coli = 0;
|
|
|
|
col += 1;
|
|
|
|
}
|
|
|
|
}
|
2010-04-09 09:45:25 +00:00
|
|
|
]]></open>
|
|
|
|
|
|
|
|
<close><![CDATA[
|
|
|
|
]]></close>
|
|
|
|
|
|
|
|
</nasal>
|
|
|
|
</PropertyList>
|
|
|
|
|