Merge branch 'torsten/proplist'
This commit is contained in:
commit
3872fce782
8 changed files with 36 additions and 21 deletions
|
@ -40,6 +40,8 @@
|
|||
using std::cout;
|
||||
using std::endl;
|
||||
|
||||
using simgear::PropertyList;
|
||||
|
||||
FGPeriodicalValue::FGPeriodicalValue( SGPropertyNode_ptr root )
|
||||
{
|
||||
SGPropertyNode_ptr minNode = root->getChild( "min" );
|
||||
|
@ -1003,13 +1005,13 @@ void FGXMLAutopilotGroup::reinit()
|
|||
|
||||
void FGXMLAutopilotGroup::init()
|
||||
{
|
||||
vector<SGPropertyNode_ptr> autopilotNodes = fgGetNode( "/sim/systems", true )->getChildren("autopilot");
|
||||
PropertyList autopilotNodes = fgGetNode( "/sim/systems", true )->getChildren("autopilot");
|
||||
if( autopilotNodes.size() == 0 ) {
|
||||
SG_LOG( SG_ALL, SG_WARN, "No autopilot configuration specified for this model!");
|
||||
return;
|
||||
}
|
||||
|
||||
for( vector<SGPropertyNode_ptr>::size_type i = 0; i < autopilotNodes.size(); i++ ) {
|
||||
for( PropertyList::size_type i = 0; i < autopilotNodes.size(); i++ ) {
|
||||
SGPropertyNode_ptr pathNode = autopilotNodes[i]->getNode( "path" );
|
||||
if( pathNode == NULL ) {
|
||||
SG_LOG( SG_ALL, SG_WARN, "No autopilot configuration file specified for this autopilot!");
|
||||
|
|
|
@ -122,7 +122,7 @@ class FGXMLAutoInputList : public std::vector<FGXMLAutoInput_ptr> {
|
|||
class FGXMLAutoComponent : public SGReferenced {
|
||||
|
||||
private:
|
||||
std::vector <SGPropertyNode_ptr> output_list;
|
||||
simgear::PropertyList output_list;
|
||||
|
||||
SGSharedPtr<const SGCondition> _condition;
|
||||
SGPropertyNode_ptr enable_prop;
|
||||
|
@ -201,7 +201,8 @@ public:
|
|||
// helpful for things like flight directors which position
|
||||
// their vbars from the autopilot computations.
|
||||
if ( honor_passive && passive_mode->getBoolValue() ) return;
|
||||
for( std::vector <SGPropertyNode_ptr>::iterator it = output_list.begin(); it != output_list.end(); ++it)
|
||||
for( simgear::PropertyList::iterator it = output_list.begin();
|
||||
it != output_list.end(); ++it)
|
||||
(*it)->setDoubleValue( clamp( value ) );
|
||||
}
|
||||
|
||||
|
@ -212,7 +213,8 @@ public:
|
|||
// helpful for things like flight directors which position
|
||||
// their vbars from the autopilot computations.
|
||||
if ( honor_passive && passive_mode->getBoolValue() ) return;
|
||||
for( std::vector <SGPropertyNode_ptr>::iterator it = output_list.begin(); it != output_list.end(); ++it)
|
||||
for( simgear::PropertyList::iterator it = output_list.begin();
|
||||
it != output_list.end(); ++it)
|
||||
(*it)->setBoolValue( value ); // don't use clamp here, bool is clamped anyway
|
||||
}
|
||||
|
||||
|
|
|
@ -32,10 +32,12 @@
|
|||
|
||||
#include <simgear/math/SGMath.hxx>
|
||||
|
||||
using simgear::PropertyList;
|
||||
|
||||
void FGCommonInput::read_bindings (const SGPropertyNode * node, binding_list_t * binding_list, int modifiers, const string & module )
|
||||
{
|
||||
SG_LOG(SG_INPUT, SG_DEBUG, "Reading all bindings");
|
||||
vector<SGPropertyNode_ptr> bindings = node->getChildren("binding");
|
||||
PropertyList bindings = node->getChildren("binding");
|
||||
static string nasal = "nasal";
|
||||
for (unsigned int i = 0; i < bindings.size(); i++) {
|
||||
const char *cmd = bindings[i]->getStringValue("command");
|
||||
|
|
|
@ -35,6 +35,8 @@
|
|||
#include <simgear/props/props_io.hxx>
|
||||
#include <Main/globals.hxx>
|
||||
|
||||
using simgear::PropertyList;
|
||||
|
||||
FGDeviceConfigurationMap::FGDeviceConfigurationMap( const char * relative_path, SGPropertyNode_ptr aBase, const char * aChildname ) :
|
||||
base(aBase),
|
||||
childname(aChildname)
|
||||
|
@ -45,10 +47,10 @@ FGDeviceConfigurationMap::FGDeviceConfigurationMap( const char * relative_path,
|
|||
int index = 1000;
|
||||
scan_dir( path, &index);
|
||||
|
||||
vector<SGPropertyNode_ptr> childNodes = base->getChildren(childname);
|
||||
PropertyList childNodes = base->getChildren(childname);
|
||||
for (int k = (int)childNodes.size() - 1; k >= 0; k--) {
|
||||
SGPropertyNode *n = childNodes[k];
|
||||
vector<SGPropertyNode_ptr> names = n->getChildren("name");
|
||||
PropertyList names = n->getChildren("name");
|
||||
if (names.size() ) // && (n->getChildren("axis").size() || n->getChildren("button").size()))
|
||||
for (unsigned int j = 0; j < names.size(); j++)
|
||||
(*this)[names[j]->getStringValue()] = n;
|
||||
|
|
|
@ -29,6 +29,8 @@
|
|||
#include <simgear/io/sg_file.hxx>
|
||||
#include <Scripting/NasalSys.hxx>
|
||||
|
||||
using simgear::PropertyList;
|
||||
|
||||
FGEventSetting::FGEventSetting( SGPropertyNode_ptr base ) :
|
||||
value(0.0)
|
||||
{
|
||||
|
@ -93,8 +95,8 @@ FGInputEvent::FGInputEvent( FGInputDevice * aDevice, SGPropertyNode_ptr node ) :
|
|||
|
||||
read_bindings( node, bindings, KEYMOD_NONE, device->GetNasalModule() );
|
||||
|
||||
vector<SGPropertyNode_ptr> settingNodes = node->getChildren("setting");
|
||||
for( vector<SGPropertyNode_ptr>::iterator it = settingNodes.begin(); it != settingNodes.end(); it++ )
|
||||
PropertyList settingNodes = node->getChildren("setting");
|
||||
for( PropertyList::iterator it = settingNodes.begin(); it != settingNodes.end(); it++ )
|
||||
settings.push_back( new FGEventSetting( *it ) );
|
||||
}
|
||||
|
||||
|
@ -235,8 +237,8 @@ void FGInputDevice::Configure( SGPropertyNode_ptr aDeviceNode )
|
|||
|
||||
nasalModule = string("__event:") + GetName();
|
||||
|
||||
vector<SGPropertyNode_ptr> eventNodes = deviceNode->getChildren( "event" );
|
||||
for( vector<SGPropertyNode_ptr>::iterator it = eventNodes.begin(); it != eventNodes.end(); it++ )
|
||||
PropertyList eventNodes = deviceNode->getChildren( "event" );
|
||||
for( PropertyList::iterator it = eventNodes.begin(); it != eventNodes.end(); it++ )
|
||||
AddHandledEvent( FGInputEvent::NewObject( this, *it ) );
|
||||
|
||||
debugEvents = deviceNode->getBoolValue("debug-events", debugEvents );
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
#include <Main/fg_props.hxx>
|
||||
#include <Scripting/NasalSys.hxx>
|
||||
|
||||
using simgear::PropertyList;
|
||||
|
||||
FGJoystickInput::axis::axis ()
|
||||
: last_value(9999999),
|
||||
tolerance(0.002),
|
||||
|
@ -166,7 +168,7 @@ void FGJoystickInput::postinit()
|
|||
string module = str.str();
|
||||
nasalsys->createModule(module.c_str(), module.c_str(), "", 0);
|
||||
|
||||
vector<SGPropertyNode_ptr> nasal = js_node->getChildren("nasal");
|
||||
PropertyList nasal = js_node->getChildren("nasal");
|
||||
unsigned int j;
|
||||
for (j = 0; j < nasal.size(); j++) {
|
||||
nasal[j]->setStringValue("module", module.c_str());
|
||||
|
@ -176,7 +178,7 @@ void FGJoystickInput::postinit()
|
|||
//
|
||||
// Initialize the axes.
|
||||
//
|
||||
vector<SGPropertyNode_ptr> axes = js_node->getChildren("axis");
|
||||
PropertyList axes = js_node->getChildren("axis");
|
||||
size_t nb_axes = axes.size();
|
||||
for (j = 0; j < nb_axes; j++ ) {
|
||||
const SGPropertyNode * axis_node = axes[j];
|
||||
|
@ -219,7 +221,7 @@ void FGJoystickInput::postinit()
|
|||
//
|
||||
// Initialize the buttons.
|
||||
//
|
||||
vector<SGPropertyNode_ptr> buttons = js_node->getChildren("button");
|
||||
PropertyList buttons = js_node->getChildren("button");
|
||||
char buf[32];
|
||||
for (j = 0; j < buttons.size() && j < nbuttons; j++) {
|
||||
const SGPropertyNode * button_node = buttons[j];
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
#include <Scripting/NasalSys.hxx>
|
||||
#include <plib/pu.h>
|
||||
|
||||
using simgear::PropertyList;
|
||||
|
||||
static int getModifiers ()
|
||||
{
|
||||
return fgGetKeyModifiers() >> 1;
|
||||
|
@ -94,13 +96,13 @@ void FGKeyboardInput::postinit()
|
|||
}
|
||||
|
||||
FGNasalSys *nasalsys = (FGNasalSys *)globals->get_subsystem("nasal");
|
||||
vector<SGPropertyNode_ptr> nasal = key_nodes->getChildren("nasal");
|
||||
PropertyList nasal = key_nodes->getChildren("nasal");
|
||||
for (unsigned int j = 0; j < nasal.size(); j++) {
|
||||
nasal[j]->setStringValue("module", module.c_str());
|
||||
nasalsys->handleCommand(nasal[j]);
|
||||
}
|
||||
|
||||
vector<SGPropertyNode_ptr> keys = key_nodes->getChildren("key");
|
||||
PropertyList keys = key_nodes->getChildren("key");
|
||||
for (unsigned int i = 0; i < keys.size(); i++) {
|
||||
int index = keys[i]->getIndex();
|
||||
SG_LOG(SG_INPUT, SG_DEBUG, "Binding key " << index);
|
||||
|
|
|
@ -58,6 +58,7 @@ using std::string;
|
|||
|
||||
#include "jsinput.h"
|
||||
|
||||
using simgear::PropertyList;
|
||||
|
||||
bool confirmAnswer() {
|
||||
char answer;
|
||||
|
@ -136,8 +137,8 @@ int main( int argc, char *argv[] ) {
|
|||
cout << e.getFormattedMessage ();
|
||||
}
|
||||
|
||||
vector<SGPropertyNode_ptr> axes = templatetree->getChildren("axis");
|
||||
for(vector<SGPropertyNode_ptr>::iterator iter = axes.begin(); iter != axes.end(); iter++) {
|
||||
PropertyList axes = templatetree->getChildren("axis");
|
||||
for(PropertyList::iterator iter = axes.begin(); iter != axes.end(); iter++) {
|
||||
cout << "Move the control you wish to use for " << (*iter)->getStringValue("desc")
|
||||
<< " " << (*iter)->getStringValue("direction") << endl;
|
||||
cout << "Pressing a button skips this axis" << endl;
|
||||
|
@ -164,8 +165,8 @@ int main( int argc, char *argv[] ) {
|
|||
cout << endl;
|
||||
}
|
||||
|
||||
vector<SGPropertyNode_ptr> buttons = templatetree->getChildren("button");
|
||||
for(vector<SGPropertyNode_ptr>::iterator iter = buttons.begin(); iter != buttons.end(); iter++) {
|
||||
PropertyList buttons = templatetree->getChildren("button");
|
||||
for(PropertyList::iterator iter = buttons.begin(); iter != buttons.end(); iter++) {
|
||||
cout << "Press the button you wish to use for " << (*iter)->getStringValue("desc") << endl;
|
||||
cout << "Moving a joystick axis skips this button" << endl;
|
||||
fflush( stdout );
|
||||
|
|
Loading…
Reference in a new issue