SGPropertyNode::Type moves to simgear::props namespace
This commit is contained in:
parent
e342d879e8
commit
4cc3084256
15 changed files with 304 additions and 291 deletions
|
@ -97,6 +97,8 @@ void FGAIMultiplayer::unbind() {
|
|||
|
||||
void FGAIMultiplayer::update(double dt)
|
||||
{
|
||||
using namespace simgear::props;
|
||||
|
||||
if (dt <= 0)
|
||||
return;
|
||||
|
||||
|
@ -200,19 +202,19 @@ void FGAIMultiplayer::update(double dt)
|
|||
{
|
||||
//cout << "Found " << pIt->second->getPath() << ":";
|
||||
switch ((*firstPropIt)->type) {
|
||||
case SGPropertyNode::INT:
|
||||
case SGPropertyNode::BOOL:
|
||||
case SGPropertyNode::LONG:
|
||||
case INT:
|
||||
case BOOL:
|
||||
case LONG:
|
||||
pIt->second->setIntValue((*firstPropIt)->int_value);
|
||||
//cout << "Int: " << (*firstPropIt)->int_value << "\n";
|
||||
break;
|
||||
case SGPropertyNode::FLOAT:
|
||||
case SGPropertyNode::DOUBLE:
|
||||
case FLOAT:
|
||||
case DOUBLE:
|
||||
pIt->second->setFloatValue((*firstPropIt)->float_value);
|
||||
//cout << "Flo: " << (*firstPropIt)->float_value << "\n";
|
||||
break;
|
||||
case SGPropertyNode::STRING:
|
||||
case SGPropertyNode::UNSPECIFIED:
|
||||
case STRING:
|
||||
case UNSPECIFIED:
|
||||
pIt->second->setStringValue((*firstPropIt)->string_value);
|
||||
//cout << "Str: " << (*firstPropIt)->string_value << "\n";
|
||||
break;
|
||||
|
@ -274,23 +276,23 @@ void FGAIMultiplayer::update(double dt)
|
|||
int ival;
|
||||
float val;
|
||||
switch ((*prevPropIt)->type) {
|
||||
case SGPropertyNode::INT:
|
||||
case SGPropertyNode::BOOL:
|
||||
case SGPropertyNode::LONG:
|
||||
case INT:
|
||||
case BOOL:
|
||||
case LONG:
|
||||
ival = (int) (0.5+(1-tau)*((double) (*prevPropIt)->int_value) +
|
||||
tau*((double) (*nextPropIt)->int_value));
|
||||
pIt->second->setIntValue(ival);
|
||||
//cout << "Int: " << ival << "\n";
|
||||
break;
|
||||
case SGPropertyNode::FLOAT:
|
||||
case SGPropertyNode::DOUBLE:
|
||||
case FLOAT:
|
||||
case DOUBLE:
|
||||
val = (1-tau)*(*prevPropIt)->float_value +
|
||||
tau*(*nextPropIt)->float_value;
|
||||
//cout << "Flo: " << val << "\n";
|
||||
pIt->second->setFloatValue(val);
|
||||
break;
|
||||
case SGPropertyNode::STRING:
|
||||
case SGPropertyNode::UNSPECIFIED:
|
||||
case STRING:
|
||||
case UNSPECIFIED:
|
||||
//cout << "Str: " << (*nextPropIt)->string_value << "\n";
|
||||
pIt->second->setStringValue((*nextPropIt)->string_value);
|
||||
break;
|
||||
|
@ -387,19 +389,19 @@ void FGAIMultiplayer::update(double dt)
|
|||
if (pIt != mPropertyMap.end())
|
||||
{
|
||||
switch ((*firstPropIt)->type) {
|
||||
case SGPropertyNode::INT:
|
||||
case SGPropertyNode::BOOL:
|
||||
case SGPropertyNode::LONG:
|
||||
case INT:
|
||||
case BOOL:
|
||||
case LONG:
|
||||
pIt->second->setIntValue((*firstPropIt)->int_value);
|
||||
//cout << "Int: " << (*firstPropIt)->int_value << "\n";
|
||||
break;
|
||||
case SGPropertyNode::FLOAT:
|
||||
case SGPropertyNode::DOUBLE:
|
||||
case FLOAT:
|
||||
case DOUBLE:
|
||||
pIt->second->setFloatValue((*firstPropIt)->float_value);
|
||||
//cout << "Flo: " << (*firstPropIt)->float_value << "\n";
|
||||
break;
|
||||
case SGPropertyNode::STRING:
|
||||
case SGPropertyNode::UNSPECIFIED:
|
||||
case STRING:
|
||||
case UNSPECIFIED:
|
||||
pIt->second->setStringValue((*firstPropIt)->string_value);
|
||||
//cout << "Str: " << (*firstPropIt)->string_value << "\n";
|
||||
break;
|
||||
|
|
|
@ -353,7 +353,7 @@ void FGRouteMgr::update_mirror() {
|
|||
|
||||
bool FGRouteMgr::near_ground() {
|
||||
SGPropertyNode *gear = fgGetNode( "/gear/gear/wow", false );
|
||||
if ( !gear || gear->getType() == SGPropertyNode::NONE )
|
||||
if ( !gear || gear->getType() == simgear::props::NONE )
|
||||
return fgGetBool( "/sim/presets/onground", true );
|
||||
|
||||
if ( fgGetDouble("/position/altitude-agl-ft", 300.0)
|
||||
|
|
|
@ -390,6 +390,7 @@ action_callback (puObject *object)
|
|||
static void
|
||||
copy_to_pui (SGPropertyNode *node, puObject *object)
|
||||
{
|
||||
using namespace simgear::props;
|
||||
GUIInfo *info = (GUIInfo *)object->getUserData();
|
||||
if (!info) {
|
||||
SG_LOG(SG_GENERAL, SG_ALERT, "dialog: widget without GUIInfo!");
|
||||
|
@ -409,13 +410,13 @@ copy_to_pui (SGPropertyNode *node, puObject *object)
|
|||
}
|
||||
|
||||
switch (node->getType()) {
|
||||
case SGPropertyNode::BOOL:
|
||||
case SGPropertyNode::INT:
|
||||
case SGPropertyNode::LONG:
|
||||
case BOOL:
|
||||
case INT:
|
||||
case LONG:
|
||||
object->setValue(node->getIntValue());
|
||||
break;
|
||||
case SGPropertyNode::FLOAT:
|
||||
case SGPropertyNode::DOUBLE:
|
||||
case FLOAT:
|
||||
case DOUBLE:
|
||||
object->setValue(node->getFloatValue());
|
||||
break;
|
||||
default:
|
||||
|
@ -429,18 +430,19 @@ copy_to_pui (SGPropertyNode *node, puObject *object)
|
|||
static void
|
||||
copy_from_pui (puObject *object, SGPropertyNode *node)
|
||||
{
|
||||
using namespace simgear::props;
|
||||
// puText objects are immutable, so should not be copied out
|
||||
if (object->getType() & PUCLASS_TEXT)
|
||||
return;
|
||||
|
||||
switch (node->getType()) {
|
||||
case SGPropertyNode::BOOL:
|
||||
case SGPropertyNode::INT:
|
||||
case SGPropertyNode::LONG:
|
||||
case BOOL:
|
||||
case INT:
|
||||
case LONG:
|
||||
node->setIntValue(object->getIntegerValue());
|
||||
break;
|
||||
case SGPropertyNode::FLOAT:
|
||||
case SGPropertyNode::DOUBLE:
|
||||
case FLOAT:
|
||||
case DOUBLE:
|
||||
node->setFloatValue(object->getFloatValue());
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -44,24 +44,25 @@ typedef string stdString; // puObject has a "string" member
|
|||
|
||||
static string getValueTypeString(const SGPropertyNode *node)
|
||||
{
|
||||
using namespace simgear::props;
|
||||
string result;
|
||||
|
||||
SGPropertyNode::Type type = node->getType();
|
||||
if (type == SGPropertyNode::UNSPECIFIED)
|
||||
Type type = node->getType();
|
||||
if (type == UNSPECIFIED)
|
||||
result = "unspecified";
|
||||
else if (type == SGPropertyNode::NONE)
|
||||
else if (type == NONE)
|
||||
result = "none";
|
||||
else if (type == SGPropertyNode::BOOL)
|
||||
else if (type == BOOL)
|
||||
result = "bool";
|
||||
else if (type == SGPropertyNode::INT)
|
||||
else if (type == INT)
|
||||
result = "int";
|
||||
else if (type == SGPropertyNode::LONG)
|
||||
else if (type == LONG)
|
||||
result = "long";
|
||||
else if (type == SGPropertyNode::FLOAT)
|
||||
else if (type == FLOAT)
|
||||
result = "float";
|
||||
else if (type == SGPropertyNode::DOUBLE)
|
||||
else if (type == DOUBLE)
|
||||
result = "double";
|
||||
else if (type == SGPropertyNode::STRING)
|
||||
else if (type == STRING)
|
||||
result = "string";
|
||||
|
||||
return result;
|
||||
|
@ -70,11 +71,12 @@ static string getValueTypeString(const SGPropertyNode *node)
|
|||
|
||||
static void dumpProperties(const SGPropertyNode *node)
|
||||
{
|
||||
using namespace simgear::props;
|
||||
cout << node->getPath() << '/' << endl;
|
||||
for (int i = 0; i < node->nChildren(); i++) {
|
||||
const SGPropertyNode *c = node->getChild(i);
|
||||
SGPropertyNode::Type type = c->getType();
|
||||
if (type == SGPropertyNode::ALIAS || c->nChildren())
|
||||
Type type = c->getType();
|
||||
if (type == ALIAS || c->nChildren())
|
||||
continue;
|
||||
|
||||
int index = c->getIndex();
|
||||
|
@ -84,21 +86,21 @@ static void dumpProperties(const SGPropertyNode *node)
|
|||
cout << " = ";
|
||||
|
||||
switch (c->getType()) {
|
||||
case SGPropertyNode::DOUBLE:
|
||||
case SGPropertyNode::FLOAT:
|
||||
case DOUBLE:
|
||||
case FLOAT:
|
||||
cout << std::setprecision(15) << c->getDoubleValue();
|
||||
break;
|
||||
case SGPropertyNode::LONG:
|
||||
case SGPropertyNode::INT:
|
||||
case LONG:
|
||||
case INT:
|
||||
cout << c->getLongValue();
|
||||
break;
|
||||
case SGPropertyNode::BOOL:
|
||||
case BOOL:
|
||||
cout << (c->getBoolValue() ? "true" : "false");
|
||||
break;
|
||||
case SGPropertyNode::STRING:
|
||||
case STRING:
|
||||
cout << '"' << c->getStringValue() << '"';
|
||||
break;
|
||||
case SGPropertyNode::NONE:
|
||||
case NONE:
|
||||
break;
|
||||
default:
|
||||
cout << '\'' << c->getStringValue() << '\'';
|
||||
|
@ -232,7 +234,7 @@ void PropertyList::handle_select(puObject *list_box)
|
|||
}
|
||||
|
||||
// it is a regular property
|
||||
if (child->getType() == SGPropertyNode::BOOL && mod_ctrl) {
|
||||
if (child->getType() == simgear::props::BOOL && mod_ctrl) {
|
||||
child->setBoolValue(!child->getBoolValue());
|
||||
prop_list->update(true);
|
||||
} else
|
||||
|
@ -299,6 +301,7 @@ void PropertyList::update(bool restore_pos)
|
|||
|
||||
void PropertyList::updateTextForEntry(NodeData& data)
|
||||
{
|
||||
using namespace simgear::props;
|
||||
SGPropertyNode *node = data.node;
|
||||
stdString name = node->getDisplayName(true);
|
||||
stdString type = getValueTypeString(node);
|
||||
|
@ -312,8 +315,8 @@ void PropertyList::updateTextForEntry(NodeData& data)
|
|||
line << '/';
|
||||
|
||||
if (!children || (_verbose && node->hasValue())) {
|
||||
if (node->getType() == SGPropertyNode::STRING
|
||||
|| node->getType() == SGPropertyNode::UNSPECIFIED)
|
||||
if (node->getType() == STRING
|
||||
|| node->getType() == UNSPECIFIED)
|
||||
sanitize(value);
|
||||
|
||||
line << " = '" << value << "' (" << type;
|
||||
|
|
|
@ -109,11 +109,11 @@ FGMarkerBeacon::init ()
|
|||
audio_vol = node->getChild("volume", 0, true);
|
||||
serviceable = node->getChild("serviceable", 0, true);
|
||||
|
||||
if (power_btn->getType() == SGPropertyNode::NONE)
|
||||
if (power_btn->getType() == simgear::props::NONE)
|
||||
power_btn->setBoolValue( true );
|
||||
if (audio_btn->getType() == SGPropertyNode::NONE)
|
||||
if (audio_btn->getType() == simgear::props::NONE)
|
||||
audio_btn->setBoolValue( true );
|
||||
if (serviceable->getType() == SGPropertyNode::NONE)
|
||||
if (serviceable->getType() == simgear::props::NONE)
|
||||
serviceable->setBoolValue( true );
|
||||
|
||||
morse.init();
|
||||
|
|
|
@ -133,15 +133,15 @@ static bool
|
|||
compare_values (SGPropertyNode * value1, SGPropertyNode * value2)
|
||||
{
|
||||
switch (value1->getType()) {
|
||||
case SGPropertyNode::BOOL:
|
||||
case simgear::props::BOOL:
|
||||
return (value1->getBoolValue() == value2->getBoolValue());
|
||||
case SGPropertyNode::INT:
|
||||
case simgear::props::INT:
|
||||
return (value1->getIntValue() == value2->getIntValue());
|
||||
case SGPropertyNode::LONG:
|
||||
case simgear::props::LONG:
|
||||
return (value1->getLongValue() == value2->getLongValue());
|
||||
case SGPropertyNode::FLOAT:
|
||||
case simgear::props::FLOAT:
|
||||
return (value1->getFloatValue() == value2->getFloatValue());
|
||||
case SGPropertyNode::DOUBLE:
|
||||
case simgear::props::DOUBLE:
|
||||
return (value1->getDoubleValue() == value2->getDoubleValue());
|
||||
default:
|
||||
return !strcmp(value1->getStringValue(), value2->getStringValue());
|
||||
|
@ -1224,7 +1224,7 @@ do_set_cursor (const SGPropertyNode * arg)
|
|||
}
|
||||
|
||||
SGPropertyNode *cursor = const_cast<SGPropertyNode *>(arg)->getNode("cursor", true);
|
||||
if (cursor->getType() != SGPropertyNode::NONE)
|
||||
if (cursor->getType() != simgear::props::NONE)
|
||||
fgSetMouseCursor(cursor->getIntValue());
|
||||
|
||||
cursor->setIntValue(fgGetMouseCursor());
|
||||
|
|
|
@ -533,7 +533,7 @@ fgTie (const char * name, T * obj, int index,
|
|||
class FGMakeUpperCase : public SGPropertyChangeListener {
|
||||
public:
|
||||
void valueChanged(SGPropertyNode *node) {
|
||||
if (node->getType() != SGPropertyNode::STRING)
|
||||
if (node->getType() != simgear::props::STRING)
|
||||
return;
|
||||
|
||||
char *s = const_cast<char *>(node->getStringValue());
|
||||
|
|
|
@ -894,16 +894,17 @@ static void fgIdleFunction ( void ) {
|
|||
|
||||
static void upper_case_property(const char *name)
|
||||
{
|
||||
using namespace simgear::props;
|
||||
SGPropertyNode *p = fgGetNode(name, false);
|
||||
if (!p) {
|
||||
p = fgGetNode(name, true);
|
||||
p->setStringValue("");
|
||||
} else {
|
||||
SGPropertyNode::Type t = p->getType();
|
||||
if (t == SGPropertyNode::NONE || t == SGPropertyNode::UNSPECIFIED)
|
||||
Type t = p->getType();
|
||||
if (t == NONE || t == UNSPECIFIED)
|
||||
p->setStringValue("");
|
||||
else
|
||||
assert(t == SGPropertyNode::STRING);
|
||||
assert(t == STRING);
|
||||
}
|
||||
p->addChangeListener(new FGMakeUpperCase);
|
||||
}
|
||||
|
|
|
@ -119,7 +119,7 @@ struct FGPropertyData {
|
|||
unsigned id;
|
||||
|
||||
// While the type isn't transmitted, it is needed for the destructor
|
||||
SGPropertyNode::Type type;
|
||||
simgear::props::Type type;
|
||||
union {
|
||||
int int_value;
|
||||
float float_value;
|
||||
|
@ -127,7 +127,7 @@ struct FGPropertyData {
|
|||
};
|
||||
|
||||
~FGPropertyData() {
|
||||
if ((type == SGPropertyNode::STRING) || (type == SGPropertyNode::UNSPECIFIED))
|
||||
if ((type == simgear::props::STRING) || (type == simgear::props::UNSPECIFIED))
|
||||
{
|
||||
delete [] string_value;
|
||||
}
|
||||
|
|
|
@ -60,171 +60,169 @@ const char sMULTIPLAYMGR_HID[] = MULTIPLAYTXMGR_HID;
|
|||
// A static map of protocol property id values to property paths,
|
||||
// This should be extendable dynamically for every specific aircraft ...
|
||||
// For now only that static list
|
||||
FGMultiplayMgr::IdPropertyList
|
||||
const FGMultiplayMgr::sIdPropertyList[] = {
|
||||
{100, "surface-positions/left-aileron-pos-norm", SGPropertyNode::FLOAT},
|
||||
{101, "surface-positions/right-aileron-pos-norm", SGPropertyNode::FLOAT},
|
||||
{102, "surface-positions/elevator-pos-norm", SGPropertyNode::FLOAT},
|
||||
{103, "surface-positions/rudder-pos-norm", SGPropertyNode::FLOAT},
|
||||
{104, "surface-positions/flap-pos-norm", SGPropertyNode::FLOAT},
|
||||
{105, "surface-positions/speedbrake-pos-norm", SGPropertyNode::FLOAT},
|
||||
{106, "gear/tailhook/position-norm", SGPropertyNode::FLOAT},
|
||||
{107, "gear/launchbar/position-norm", SGPropertyNode::FLOAT},
|
||||
{108, "gear/launchbar/state", SGPropertyNode::STRING},
|
||||
{109, "gear/launchbar/holdback-position-norm", SGPropertyNode::FLOAT},
|
||||
{110, "canopy/position-norm", SGPropertyNode::FLOAT},
|
||||
{111, "surface-positions/wing-pos-norm", SGPropertyNode::FLOAT},
|
||||
{112, "surface-positions/wing-fold-pos-norm", SGPropertyNode::FLOAT},
|
||||
const FGMultiplayMgr::IdPropertyList
|
||||
FGMultiplayMgr::sIdPropertyList[] = {
|
||||
{100, "surface-positions/left-aileron-pos-norm", simgear::props::FLOAT},
|
||||
{101, "surface-positions/right-aileron-pos-norm", simgear::props::FLOAT},
|
||||
{102, "surface-positions/elevator-pos-norm", simgear::props::FLOAT},
|
||||
{103, "surface-positions/rudder-pos-norm", simgear::props::FLOAT},
|
||||
{104, "surface-positions/flap-pos-norm", simgear::props::FLOAT},
|
||||
{105, "surface-positions/speedbrake-pos-norm", simgear::props::FLOAT},
|
||||
{106, "gear/tailhook/position-norm", simgear::props::FLOAT},
|
||||
{107, "gear/launchbar/position-norm", simgear::props::FLOAT},
|
||||
{108, "gear/launchbar/state", simgear::props::STRING},
|
||||
{109, "gear/launchbar/holdback-position-norm", simgear::props::FLOAT},
|
||||
{110, "canopy/position-norm", simgear::props::FLOAT},
|
||||
{111, "surface-positions/wing-pos-norm", simgear::props::FLOAT},
|
||||
{112, "surface-positions/wing-fold-pos-norm", simgear::props::FLOAT},
|
||||
|
||||
{200, "gear/gear[0]/compression-norm", SGPropertyNode::FLOAT},
|
||||
{201, "gear/gear[0]/position-norm", SGPropertyNode::FLOAT},
|
||||
{210, "gear/gear[1]/compression-norm", SGPropertyNode::FLOAT},
|
||||
{211, "gear/gear[1]/position-norm", SGPropertyNode::FLOAT},
|
||||
{220, "gear/gear[2]/compression-norm", SGPropertyNode::FLOAT},
|
||||
{221, "gear/gear[2]/position-norm", SGPropertyNode::FLOAT},
|
||||
{230, "gear/gear[3]/compression-norm", SGPropertyNode::FLOAT},
|
||||
{231, "gear/gear[3]/position-norm", SGPropertyNode::FLOAT},
|
||||
{240, "gear/gear[4]/compression-norm", SGPropertyNode::FLOAT},
|
||||
{241, "gear/gear[4]/position-norm", SGPropertyNode::FLOAT},
|
||||
{200, "gear/gear[0]/compression-norm", simgear::props::FLOAT},
|
||||
{201, "gear/gear[0]/position-norm", simgear::props::FLOAT},
|
||||
{210, "gear/gear[1]/compression-norm", simgear::props::FLOAT},
|
||||
{211, "gear/gear[1]/position-norm", simgear::props::FLOAT},
|
||||
{220, "gear/gear[2]/compression-norm", simgear::props::FLOAT},
|
||||
{221, "gear/gear[2]/position-norm", simgear::props::FLOAT},
|
||||
{230, "gear/gear[3]/compression-norm", simgear::props::FLOAT},
|
||||
{231, "gear/gear[3]/position-norm", simgear::props::FLOAT},
|
||||
{240, "gear/gear[4]/compression-norm", simgear::props::FLOAT},
|
||||
{241, "gear/gear[4]/position-norm", simgear::props::FLOAT},
|
||||
|
||||
{300, "engines/engine[0]/n1", SGPropertyNode::FLOAT},
|
||||
{301, "engines/engine[0]/n2", SGPropertyNode::FLOAT},
|
||||
{302, "engines/engine[0]/rpm", SGPropertyNode::FLOAT},
|
||||
{310, "engines/engine[1]/n1", SGPropertyNode::FLOAT},
|
||||
{311, "engines/engine[1]/n2", SGPropertyNode::FLOAT},
|
||||
{312, "engines/engine[1]/rpm", SGPropertyNode::FLOAT},
|
||||
{320, "engines/engine[2]/n1", SGPropertyNode::FLOAT},
|
||||
{321, "engines/engine[2]/n2", SGPropertyNode::FLOAT},
|
||||
{322, "engines/engine[2]/rpm", SGPropertyNode::FLOAT},
|
||||
{330, "engines/engine[3]/n1", SGPropertyNode::FLOAT},
|
||||
{331, "engines/engine[3]/n2", SGPropertyNode::FLOAT},
|
||||
{332, "engines/engine[3]/rpm", SGPropertyNode::FLOAT},
|
||||
{340, "engines/engine[4]/n1", SGPropertyNode::FLOAT},
|
||||
{341, "engines/engine[4]/n2", SGPropertyNode::FLOAT},
|
||||
{342, "engines/engine[4]/rpm", SGPropertyNode::FLOAT},
|
||||
{350, "engines/engine[5]/n1", SGPropertyNode::FLOAT},
|
||||
{351, "engines/engine[5]/n2", SGPropertyNode::FLOAT},
|
||||
{352, "engines/engine[5]/rpm", SGPropertyNode::FLOAT},
|
||||
{360, "engines/engine[6]/n1", SGPropertyNode::FLOAT},
|
||||
{361, "engines/engine[6]/n2", SGPropertyNode::FLOAT},
|
||||
{362, "engines/engine[6]/rpm", SGPropertyNode::FLOAT},
|
||||
{370, "engines/engine[7]/n1", SGPropertyNode::FLOAT},
|
||||
{371, "engines/engine[7]/n2", SGPropertyNode::FLOAT},
|
||||
{372, "engines/engine[7]/rpm", SGPropertyNode::FLOAT},
|
||||
{380, "engines/engine[8]/n1", SGPropertyNode::FLOAT},
|
||||
{381, "engines/engine[8]/n2", SGPropertyNode::FLOAT},
|
||||
{382, "engines/engine[8]/rpm", SGPropertyNode::FLOAT},
|
||||
{390, "engines/engine[9]/n1", SGPropertyNode::FLOAT},
|
||||
{391, "engines/engine[9]/n2", SGPropertyNode::FLOAT},
|
||||
{392, "engines/engine[9]/rpm", SGPropertyNode::FLOAT},
|
||||
{300, "engines/engine[0]/n1", simgear::props::FLOAT},
|
||||
{301, "engines/engine[0]/n2", simgear::props::FLOAT},
|
||||
{302, "engines/engine[0]/rpm", simgear::props::FLOAT},
|
||||
{310, "engines/engine[1]/n1", simgear::props::FLOAT},
|
||||
{311, "engines/engine[1]/n2", simgear::props::FLOAT},
|
||||
{312, "engines/engine[1]/rpm", simgear::props::FLOAT},
|
||||
{320, "engines/engine[2]/n1", simgear::props::FLOAT},
|
||||
{321, "engines/engine[2]/n2", simgear::props::FLOAT},
|
||||
{322, "engines/engine[2]/rpm", simgear::props::FLOAT},
|
||||
{330, "engines/engine[3]/n1", simgear::props::FLOAT},
|
||||
{331, "engines/engine[3]/n2", simgear::props::FLOAT},
|
||||
{332, "engines/engine[3]/rpm", simgear::props::FLOAT},
|
||||
{340, "engines/engine[4]/n1", simgear::props::FLOAT},
|
||||
{341, "engines/engine[4]/n2", simgear::props::FLOAT},
|
||||
{342, "engines/engine[4]/rpm", simgear::props::FLOAT},
|
||||
{350, "engines/engine[5]/n1", simgear::props::FLOAT},
|
||||
{351, "engines/engine[5]/n2", simgear::props::FLOAT},
|
||||
{352, "engines/engine[5]/rpm", simgear::props::FLOAT},
|
||||
{360, "engines/engine[6]/n1", simgear::props::FLOAT},
|
||||
{361, "engines/engine[6]/n2", simgear::props::FLOAT},
|
||||
{362, "engines/engine[6]/rpm", simgear::props::FLOAT},
|
||||
{370, "engines/engine[7]/n1", simgear::props::FLOAT},
|
||||
{371, "engines/engine[7]/n2", simgear::props::FLOAT},
|
||||
{372, "engines/engine[7]/rpm", simgear::props::FLOAT},
|
||||
{380, "engines/engine[8]/n1", simgear::props::FLOAT},
|
||||
{381, "engines/engine[8]/n2", simgear::props::FLOAT},
|
||||
{382, "engines/engine[8]/rpm", simgear::props::FLOAT},
|
||||
{390, "engines/engine[9]/n1", simgear::props::FLOAT},
|
||||
{391, "engines/engine[9]/n2", simgear::props::FLOAT},
|
||||
{392, "engines/engine[9]/rpm", simgear::props::FLOAT},
|
||||
|
||||
{800, "rotors/main/rpm", SGPropertyNode::FLOAT},
|
||||
{801, "rotors/tail/rpm", SGPropertyNode::FLOAT},
|
||||
{810, "rotors/main/blade[0]/position-deg", SGPropertyNode::FLOAT},
|
||||
{811, "rotors/main/blade[1]/position-deg", SGPropertyNode::FLOAT},
|
||||
{812, "rotors/main/blade[2]/position-deg", SGPropertyNode::FLOAT},
|
||||
{813, "rotors/main/blade[3]/position-deg", SGPropertyNode::FLOAT},
|
||||
{820, "rotors/main/blade[0]/flap-deg", SGPropertyNode::FLOAT},
|
||||
{821, "rotors/main/blade[1]/flap-deg", SGPropertyNode::FLOAT},
|
||||
{822, "rotors/main/blade[2]/flap-deg", SGPropertyNode::FLOAT},
|
||||
{823, "rotors/main/blade[3]/flap-deg", SGPropertyNode::FLOAT},
|
||||
{830, "rotors/tail/blade[0]/position-deg", SGPropertyNode::FLOAT},
|
||||
{831, "rotors/tail/blade[1]/position-deg", SGPropertyNode::FLOAT},
|
||||
{800, "rotors/main/rpm", simgear::props::FLOAT},
|
||||
{801, "rotors/tail/rpm", simgear::props::FLOAT},
|
||||
{810, "rotors/main/blade[0]/position-deg", simgear::props::FLOAT},
|
||||
{811, "rotors/main/blade[1]/position-deg", simgear::props::FLOAT},
|
||||
{812, "rotors/main/blade[2]/position-deg", simgear::props::FLOAT},
|
||||
{813, "rotors/main/blade[3]/position-deg", simgear::props::FLOAT},
|
||||
{820, "rotors/main/blade[0]/flap-deg", simgear::props::FLOAT},
|
||||
{821, "rotors/main/blade[1]/flap-deg", simgear::props::FLOAT},
|
||||
{822, "rotors/main/blade[2]/flap-deg", simgear::props::FLOAT},
|
||||
{823, "rotors/main/blade[3]/flap-deg", simgear::props::FLOAT},
|
||||
{830, "rotors/tail/blade[0]/position-deg", simgear::props::FLOAT},
|
||||
{831, "rotors/tail/blade[1]/position-deg", simgear::props::FLOAT},
|
||||
|
||||
{900, "sim/hitches/aerotow/tow/length", SGPropertyNode::FLOAT},
|
||||
{901, "sim/hitches/aerotow/tow/elastic-constant", SGPropertyNode::FLOAT},
|
||||
{902, "sim/hitches/aerotow/tow/weight-per-m-kg-m", SGPropertyNode::FLOAT},
|
||||
{903, "sim/hitches/aerotow/tow/dist", SGPropertyNode::FLOAT},
|
||||
{904, "sim/hitches/aerotow/tow/connected-to-property-node", SGPropertyNode::BOOL},
|
||||
{905, "sim/hitches/aerotow/tow/connected-to-ai-or-mp-callsign", SGPropertyNode::STRING},
|
||||
{906, "sim/hitches/aerotow/tow/brake-force", SGPropertyNode::FLOAT},
|
||||
{907, "sim/hitches/aerotow/tow/end-force-x", SGPropertyNode::FLOAT},
|
||||
{908, "sim/hitches/aerotow/tow/end-force-y", SGPropertyNode::FLOAT},
|
||||
{909, "sim/hitches/aerotow/tow/end-force-z", SGPropertyNode::FLOAT},
|
||||
{930, "sim/hitches/aerotow/is-slave", SGPropertyNode::BOOL},
|
||||
{931, "sim/hitches/aerotow/speed-in-tow-direction", SGPropertyNode::FLOAT},
|
||||
{932, "sim/hitches/aerotow/open", SGPropertyNode::BOOL},
|
||||
{933, "sim/hitches/aerotow/local-pos-x", SGPropertyNode::FLOAT},
|
||||
{934, "sim/hitches/aerotow/local-pos-y", SGPropertyNode::FLOAT},
|
||||
{935, "sim/hitches/aerotow/local-pos-z", SGPropertyNode::FLOAT},
|
||||
{900, "sim/hitches/aerotow/tow/length", simgear::props::FLOAT},
|
||||
{901, "sim/hitches/aerotow/tow/elastic-constant", simgear::props::FLOAT},
|
||||
{902, "sim/hitches/aerotow/tow/weight-per-m-kg-m", simgear::props::FLOAT},
|
||||
{903, "sim/hitches/aerotow/tow/dist", simgear::props::FLOAT},
|
||||
{904, "sim/hitches/aerotow/tow/connected-to-property-node", simgear::props::BOOL},
|
||||
{905, "sim/hitches/aerotow/tow/connected-to-ai-or-mp-callsign", simgear::props::STRING},
|
||||
{906, "sim/hitches/aerotow/tow/brake-force", simgear::props::FLOAT},
|
||||
{907, "sim/hitches/aerotow/tow/end-force-x", simgear::props::FLOAT},
|
||||
{908, "sim/hitches/aerotow/tow/end-force-y", simgear::props::FLOAT},
|
||||
{909, "sim/hitches/aerotow/tow/end-force-z", simgear::props::FLOAT},
|
||||
{930, "sim/hitches/aerotow/is-slave", simgear::props::BOOL},
|
||||
{931, "sim/hitches/aerotow/speed-in-tow-direction", simgear::props::FLOAT},
|
||||
{932, "sim/hitches/aerotow/open", simgear::props::BOOL},
|
||||
{933, "sim/hitches/aerotow/local-pos-x", simgear::props::FLOAT},
|
||||
{934, "sim/hitches/aerotow/local-pos-y", simgear::props::FLOAT},
|
||||
{935, "sim/hitches/aerotow/local-pos-z", simgear::props::FLOAT},
|
||||
|
||||
{1001, "controls/flight/slats", SGPropertyNode::FLOAT},
|
||||
{1002, "controls/flight/speedbrake", SGPropertyNode::FLOAT},
|
||||
{1003, "controls/flight/spoilers", SGPropertyNode::FLOAT},
|
||||
{1004, "controls/gear/gear-down", SGPropertyNode::FLOAT},
|
||||
{1005, "controls/lighting/nav-lights", SGPropertyNode::FLOAT},
|
||||
{1006, "controls/armament/station[0]/jettison-all", SGPropertyNode::BOOL},
|
||||
{1001, "controls/flight/slats", simgear::props::FLOAT},
|
||||
{1002, "controls/flight/speedbrake", simgear::props::FLOAT},
|
||||
{1003, "controls/flight/spoilers", simgear::props::FLOAT},
|
||||
{1004, "controls/gear/gear-down", simgear::props::FLOAT},
|
||||
{1005, "controls/lighting/nav-lights", simgear::props::FLOAT},
|
||||
{1006, "controls/armament/station[0]/jettison-all", simgear::props::BOOL},
|
||||
|
||||
{1100, "sim/model/variant", SGPropertyNode::INT},
|
||||
{1101, "sim/model/livery/file", SGPropertyNode::STRING},
|
||||
{1100, "sim/model/variant", simgear::props::INT},
|
||||
{1101, "sim/model/livery/file", simgear::props::STRING},
|
||||
|
||||
{1200, "environment/wildfire/data", SGPropertyNode::STRING},
|
||||
{10001, "sim/multiplay/transmission-freq-hz", simgear::props::STRING},
|
||||
{10002, "sim/multiplay/chat", simgear::props::STRING},
|
||||
|
||||
{10001, "sim/multiplay/transmission-freq-hz", SGPropertyNode::STRING},
|
||||
{10002, "sim/multiplay/chat", SGPropertyNode::STRING},
|
||||
{10100, "sim/multiplay/generic/string[0]", simgear::props::STRING},
|
||||
{10101, "sim/multiplay/generic/string[1]", simgear::props::STRING},
|
||||
{10102, "sim/multiplay/generic/string[2]", simgear::props::STRING},
|
||||
{10103, "sim/multiplay/generic/string[3]", simgear::props::STRING},
|
||||
{10104, "sim/multiplay/generic/string[4]", simgear::props::STRING},
|
||||
{10105, "sim/multiplay/generic/string[5]", simgear::props::STRING},
|
||||
{10106, "sim/multiplay/generic/string[6]", simgear::props::STRING},
|
||||
{10107, "sim/multiplay/generic/string[7]", simgear::props::STRING},
|
||||
{10108, "sim/multiplay/generic/string[8]", simgear::props::STRING},
|
||||
{10109, "sim/multiplay/generic/string[9]", simgear::props::STRING},
|
||||
{10110, "sim/multiplay/generic/string[10]", simgear::props::STRING},
|
||||
{10111, "sim/multiplay/generic/string[11]", simgear::props::STRING},
|
||||
{10112, "sim/multiplay/generic/string[12]", simgear::props::STRING},
|
||||
{10113, "sim/multiplay/generic/string[13]", simgear::props::STRING},
|
||||
{10114, "sim/multiplay/generic/string[14]", simgear::props::STRING},
|
||||
{10115, "sim/multiplay/generic/string[15]", simgear::props::STRING},
|
||||
{10116, "sim/multiplay/generic/string[16]", simgear::props::STRING},
|
||||
{10117, "sim/multiplay/generic/string[17]", simgear::props::STRING},
|
||||
{10118, "sim/multiplay/generic/string[18]", simgear::props::STRING},
|
||||
{10119, "sim/multiplay/generic/string[19]", simgear::props::STRING},
|
||||
|
||||
{10100, "sim/multiplay/generic/string[0]", SGPropertyNode::STRING},
|
||||
{10101, "sim/multiplay/generic/string[1]", SGPropertyNode::STRING},
|
||||
{10102, "sim/multiplay/generic/string[2]", SGPropertyNode::STRING},
|
||||
{10103, "sim/multiplay/generic/string[3]", SGPropertyNode::STRING},
|
||||
{10104, "sim/multiplay/generic/string[4]", SGPropertyNode::STRING},
|
||||
{10105, "sim/multiplay/generic/string[5]", SGPropertyNode::STRING},
|
||||
{10106, "sim/multiplay/generic/string[6]", SGPropertyNode::STRING},
|
||||
{10107, "sim/multiplay/generic/string[7]", SGPropertyNode::STRING},
|
||||
{10108, "sim/multiplay/generic/string[8]", SGPropertyNode::STRING},
|
||||
{10109, "sim/multiplay/generic/string[9]", SGPropertyNode::STRING},
|
||||
{10110, "sim/multiplay/generic/string[10]", SGPropertyNode::STRING},
|
||||
{10111, "sim/multiplay/generic/string[11]", SGPropertyNode::STRING},
|
||||
{10112, "sim/multiplay/generic/string[12]", SGPropertyNode::STRING},
|
||||
{10113, "sim/multiplay/generic/string[13]", SGPropertyNode::STRING},
|
||||
{10114, "sim/multiplay/generic/string[14]", SGPropertyNode::STRING},
|
||||
{10115, "sim/multiplay/generic/string[15]", SGPropertyNode::STRING},
|
||||
{10116, "sim/multiplay/generic/string[16]", SGPropertyNode::STRING},
|
||||
{10117, "sim/multiplay/generic/string[17]", SGPropertyNode::STRING},
|
||||
{10118, "sim/multiplay/generic/string[18]", SGPropertyNode::STRING},
|
||||
{10119, "sim/multiplay/generic/string[19]", SGPropertyNode::STRING},
|
||||
{10200, "sim/multiplay/generic/float[0]", simgear::props::FLOAT},
|
||||
{10201, "sim/multiplay/generic/float[1]", simgear::props::FLOAT},
|
||||
{10202, "sim/multiplay/generic/float[2]", simgear::props::FLOAT},
|
||||
{10203, "sim/multiplay/generic/float[3]", simgear::props::FLOAT},
|
||||
{10204, "sim/multiplay/generic/float[4]", simgear::props::FLOAT},
|
||||
{10205, "sim/multiplay/generic/float[5]", simgear::props::FLOAT},
|
||||
{10206, "sim/multiplay/generic/float[6]", simgear::props::FLOAT},
|
||||
{10207, "sim/multiplay/generic/float[7]", simgear::props::FLOAT},
|
||||
{10208, "sim/multiplay/generic/float[8]", simgear::props::FLOAT},
|
||||
{10209, "sim/multiplay/generic/float[9]", simgear::props::FLOAT},
|
||||
{10210, "sim/multiplay/generic/float[10]", simgear::props::FLOAT},
|
||||
{10211, "sim/multiplay/generic/float[11]", simgear::props::FLOAT},
|
||||
{10212, "sim/multiplay/generic/float[12]", simgear::props::FLOAT},
|
||||
{10213, "sim/multiplay/generic/float[13]", simgear::props::FLOAT},
|
||||
{10214, "sim/multiplay/generic/float[14]", simgear::props::FLOAT},
|
||||
{10215, "sim/multiplay/generic/float[15]", simgear::props::FLOAT},
|
||||
{10216, "sim/multiplay/generic/float[16]", simgear::props::FLOAT},
|
||||
{10217, "sim/multiplay/generic/float[17]", simgear::props::FLOAT},
|
||||
{10218, "sim/multiplay/generic/float[18]", simgear::props::FLOAT},
|
||||
{10219, "sim/multiplay/generic/float[19]", simgear::props::FLOAT},
|
||||
|
||||
{10200, "sim/multiplay/generic/float[0]", SGPropertyNode::FLOAT},
|
||||
{10201, "sim/multiplay/generic/float[1]", SGPropertyNode::FLOAT},
|
||||
{10202, "sim/multiplay/generic/float[2]", SGPropertyNode::FLOAT},
|
||||
{10203, "sim/multiplay/generic/float[3]", SGPropertyNode::FLOAT},
|
||||
{10204, "sim/multiplay/generic/float[4]", SGPropertyNode::FLOAT},
|
||||
{10205, "sim/multiplay/generic/float[5]", SGPropertyNode::FLOAT},
|
||||
{10206, "sim/multiplay/generic/float[6]", SGPropertyNode::FLOAT},
|
||||
{10207, "sim/multiplay/generic/float[7]", SGPropertyNode::FLOAT},
|
||||
{10208, "sim/multiplay/generic/float[8]", SGPropertyNode::FLOAT},
|
||||
{10209, "sim/multiplay/generic/float[9]", SGPropertyNode::FLOAT},
|
||||
{10210, "sim/multiplay/generic/float[10]", SGPropertyNode::FLOAT},
|
||||
{10211, "sim/multiplay/generic/float[11]", SGPropertyNode::FLOAT},
|
||||
{10212, "sim/multiplay/generic/float[12]", SGPropertyNode::FLOAT},
|
||||
{10213, "sim/multiplay/generic/float[13]", SGPropertyNode::FLOAT},
|
||||
{10214, "sim/multiplay/generic/float[14]", SGPropertyNode::FLOAT},
|
||||
{10215, "sim/multiplay/generic/float[15]", SGPropertyNode::FLOAT},
|
||||
{10216, "sim/multiplay/generic/float[16]", SGPropertyNode::FLOAT},
|
||||
{10217, "sim/multiplay/generic/float[17]", SGPropertyNode::FLOAT},
|
||||
{10218, "sim/multiplay/generic/float[18]", SGPropertyNode::FLOAT},
|
||||
{10219, "sim/multiplay/generic/float[19]", SGPropertyNode::FLOAT},
|
||||
|
||||
{10300, "sim/multiplay/generic/int[0]", SGPropertyNode::INT},
|
||||
{10301, "sim/multiplay/generic/int[1]", SGPropertyNode::INT},
|
||||
{10302, "sim/multiplay/generic/int[2]", SGPropertyNode::INT},
|
||||
{10303, "sim/multiplay/generic/int[3]", SGPropertyNode::INT},
|
||||
{10304, "sim/multiplay/generic/int[4]", SGPropertyNode::INT},
|
||||
{10305, "sim/multiplay/generic/int[5]", SGPropertyNode::INT},
|
||||
{10306, "sim/multiplay/generic/int[6]", SGPropertyNode::INT},
|
||||
{10307, "sim/multiplay/generic/int[7]", SGPropertyNode::INT},
|
||||
{10308, "sim/multiplay/generic/int[8]", SGPropertyNode::INT},
|
||||
{10309, "sim/multiplay/generic/int[9]", SGPropertyNode::INT},
|
||||
{10310, "sim/multiplay/generic/int[10]", SGPropertyNode::INT},
|
||||
{10311, "sim/multiplay/generic/int[11]", SGPropertyNode::INT},
|
||||
{10312, "sim/multiplay/generic/int[12]", SGPropertyNode::INT},
|
||||
{10313, "sim/multiplay/generic/int[13]", SGPropertyNode::INT},
|
||||
{10314, "sim/multiplay/generic/int[14]", SGPropertyNode::INT},
|
||||
{10315, "sim/multiplay/generic/int[15]", SGPropertyNode::INT},
|
||||
{10316, "sim/multiplay/generic/int[16]", SGPropertyNode::INT},
|
||||
{10317, "sim/multiplay/generic/int[17]", SGPropertyNode::INT},
|
||||
{10318, "sim/multiplay/generic/int[18]", SGPropertyNode::INT},
|
||||
{10319, "sim/multiplay/generic/int[19]", SGPropertyNode::INT},
|
||||
{10300, "sim/multiplay/generic/int[0]", simgear::props::INT},
|
||||
{10301, "sim/multiplay/generic/int[1]", simgear::props::INT},
|
||||
{10302, "sim/multiplay/generic/int[2]", simgear::props::INT},
|
||||
{10303, "sim/multiplay/generic/int[3]", simgear::props::INT},
|
||||
{10304, "sim/multiplay/generic/int[4]", simgear::props::INT},
|
||||
{10305, "sim/multiplay/generic/int[5]", simgear::props::INT},
|
||||
{10306, "sim/multiplay/generic/int[6]", simgear::props::INT},
|
||||
{10307, "sim/multiplay/generic/int[7]", simgear::props::INT},
|
||||
{10308, "sim/multiplay/generic/int[8]", simgear::props::INT},
|
||||
{10309, "sim/multiplay/generic/int[9]", simgear::props::INT},
|
||||
{10310, "sim/multiplay/generic/int[10]", simgear::props::INT},
|
||||
{10311, "sim/multiplay/generic/int[11]", simgear::props::INT},
|
||||
{10312, "sim/multiplay/generic/int[12]", simgear::props::INT},
|
||||
{10313, "sim/multiplay/generic/int[13]", simgear::props::INT},
|
||||
{10314, "sim/multiplay/generic/int[14]", simgear::props::INT},
|
||||
{10315, "sim/multiplay/generic/int[15]", simgear::props::INT},
|
||||
{10316, "sim/multiplay/generic/int[16]", simgear::props::INT},
|
||||
{10317, "sim/multiplay/generic/int[17]", simgear::props::INT},
|
||||
{10318, "sim/multiplay/generic/int[18]", simgear::props::INT},
|
||||
{10319, "sim/multiplay/generic/int[19]", simgear::props::INT}
|
||||
};
|
||||
|
||||
const unsigned
|
||||
|
@ -270,6 +268,7 @@ namespace
|
|||
{
|
||||
bool verifyProperties(const xdr_data_t* data, const xdr_data_t* end)
|
||||
{
|
||||
using namespace simgear::props;
|
||||
const xdr_data_t* xdr = data;
|
||||
while (xdr < end) {
|
||||
unsigned id = XDR_decode_uint32(*xdr);
|
||||
|
@ -280,13 +279,13 @@ namespace
|
|||
xdr++;
|
||||
// How we decode the remainder of the property depends on the type
|
||||
switch (plist->type) {
|
||||
case SGPropertyNode::INT:
|
||||
case SGPropertyNode::BOOL:
|
||||
case SGPropertyNode::LONG:
|
||||
case INT:
|
||||
case BOOL:
|
||||
case LONG:
|
||||
xdr++;
|
||||
break;
|
||||
case SGPropertyNode::FLOAT:
|
||||
case SGPropertyNode::DOUBLE:
|
||||
case FLOAT:
|
||||
case DOUBLE:
|
||||
{
|
||||
float val = XDR_decode_float(*xdr);
|
||||
if (osg::isNaN(val))
|
||||
|
@ -294,8 +293,8 @@ namespace
|
|||
xdr++;
|
||||
break;
|
||||
}
|
||||
case SGPropertyNode::STRING:
|
||||
case SGPropertyNode::UNSPECIFIED:
|
||||
case STRING:
|
||||
case UNSPECIFIED:
|
||||
{
|
||||
// String is complicated. It consists of
|
||||
// The length of the string
|
||||
|
@ -567,21 +566,21 @@ FGMultiplayMgr::SendMyPosition(const FGExternalMotionData& motionInfo)
|
|||
xdr_data_t id = XDR_encode_uint32((*it)->id);
|
||||
// The actual data representation depends on the type
|
||||
switch ((*it)->type) {
|
||||
case SGPropertyNode::INT:
|
||||
case SGPropertyNode::BOOL:
|
||||
case SGPropertyNode::LONG:
|
||||
case simgear::props::INT:
|
||||
case simgear::props::BOOL:
|
||||
case simgear::props::LONG:
|
||||
*ptr++ = id;
|
||||
*ptr++ = XDR_encode_uint32((*it)->int_value);
|
||||
//cout << "Prop:" << (*it)->id << " " << (*it)->type << " "<< (*it)->int_value << "\n";
|
||||
break;
|
||||
case SGPropertyNode::FLOAT:
|
||||
case SGPropertyNode::DOUBLE:
|
||||
case simgear::props::FLOAT:
|
||||
case simgear::props::DOUBLE:
|
||||
*ptr++ = id;
|
||||
*ptr++ = XDR_encode_float((*it)->float_value);
|
||||
//cout << "Prop:" << (*it)->id << " " << (*it)->type << " "<< (*it)->float_value << "\n";
|
||||
break;
|
||||
case SGPropertyNode::STRING:
|
||||
case SGPropertyNode::UNSPECIFIED:
|
||||
case simgear::props::STRING:
|
||||
case simgear::props::UNSPECIFIED:
|
||||
{
|
||||
// String is complicated. It consists of
|
||||
// The length of the string
|
||||
|
@ -864,7 +863,7 @@ FGMultiplayMgr::ProcessPosMsg(const FGMultiplayMgr::MsgBuf& Msg,
|
|||
}
|
||||
while (xdr < Msg.propsRecvdEnd()) {
|
||||
FGPropertyData* pData = new FGPropertyData;
|
||||
SGPropertyNode::Type type = SGPropertyNode::UNSPECIFIED;
|
||||
simgear::props::Type type = simgear::props::UNSPECIFIED;
|
||||
|
||||
// First element is always the ID
|
||||
pData->id = XDR_decode_uint32(*xdr);
|
||||
|
@ -879,21 +878,21 @@ FGMultiplayMgr::ProcessPosMsg(const FGMultiplayMgr::MsgBuf& Msg,
|
|||
pData->type = plist->type;
|
||||
// How we decode the remainder of the property depends on the type
|
||||
switch (pData->type) {
|
||||
case SGPropertyNode::INT:
|
||||
case SGPropertyNode::BOOL:
|
||||
case SGPropertyNode::LONG:
|
||||
case simgear::props::INT:
|
||||
case simgear::props::BOOL:
|
||||
case simgear::props::LONG:
|
||||
pData->int_value = XDR_decode_uint32(*xdr);
|
||||
xdr++;
|
||||
//cout << pData->int_value << "\n";
|
||||
break;
|
||||
case SGPropertyNode::FLOAT:
|
||||
case SGPropertyNode::DOUBLE:
|
||||
case simgear::props::FLOAT:
|
||||
case simgear::props::DOUBLE:
|
||||
pData->float_value = XDR_decode_float(*xdr);
|
||||
xdr++;
|
||||
//cout << pData->float_value << "\n";
|
||||
break;
|
||||
case SGPropertyNode::STRING:
|
||||
case SGPropertyNode::UNSPECIFIED:
|
||||
case simgear::props::STRING:
|
||||
case simgear::props::UNSPECIFIED:
|
||||
{
|
||||
// String is complicated. It consists of
|
||||
// The length of the string
|
||||
|
|
|
@ -58,7 +58,7 @@ public:
|
|||
struct IdPropertyList {
|
||||
unsigned id;
|
||||
const char* name;
|
||||
SGPropertyNode::Type type;
|
||||
simgear::props::Type type;
|
||||
};
|
||||
static const IdPropertyList sIdPropertyList[];
|
||||
static const unsigned numProperties;
|
||||
|
|
|
@ -119,7 +119,7 @@ bool FGMultiplay::open() {
|
|||
* or receive data over the network
|
||||
******************************************************************/
|
||||
bool FGMultiplay::process() {
|
||||
|
||||
using namespace simgear::props;
|
||||
if (get_direction() == SG_IO_OUT) {
|
||||
|
||||
// check if we have left initialization phase. That will not provide
|
||||
|
@ -202,17 +202,17 @@ bool FGMultiplay::process() {
|
|||
pData->type = it->second->getType();
|
||||
|
||||
switch (pData->type) {
|
||||
case SGPropertyNode::INT:
|
||||
case SGPropertyNode::LONG:
|
||||
case SGPropertyNode::BOOL:
|
||||
case INT:
|
||||
case LONG:
|
||||
case BOOL:
|
||||
pData->int_value = it->second->getIntValue();
|
||||
break;
|
||||
case SGPropertyNode::FLOAT:
|
||||
case SGPropertyNode::DOUBLE:
|
||||
case FLOAT:
|
||||
case DOUBLE:
|
||||
pData->float_value = it->second->getFloatValue();
|
||||
break;
|
||||
case SGPropertyNode::STRING:
|
||||
case SGPropertyNode::UNSPECIFIED:
|
||||
case STRING:
|
||||
case UNSPECIFIED:
|
||||
{
|
||||
// FIXME: We assume unspecified are strings for the moment.
|
||||
|
||||
|
|
|
@ -118,6 +118,8 @@ PropsChannel::collectIncomingData( const char* s, int n )
|
|||
static string
|
||||
getValueTypeString( const SGPropertyNode *node )
|
||||
{
|
||||
using namespace simgear::props;
|
||||
|
||||
string result;
|
||||
|
||||
if ( node == NULL )
|
||||
|
@ -125,22 +127,22 @@ getValueTypeString( const SGPropertyNode *node )
|
|||
return "unknown";
|
||||
}
|
||||
|
||||
SGPropertyNode::Type type = node->getType();
|
||||
if ( type == SGPropertyNode::UNSPECIFIED ) {
|
||||
Type type = node->getType();
|
||||
if ( type == UNSPECIFIED ) {
|
||||
result = "unspecified";
|
||||
} else if ( type == SGPropertyNode::NONE ) {
|
||||
} else if ( type == NONE ) {
|
||||
result = "none";
|
||||
} else if ( type == SGPropertyNode::BOOL ) {
|
||||
} else if ( type == BOOL ) {
|
||||
result = "bool";
|
||||
} else if ( type == SGPropertyNode::INT ) {
|
||||
} else if ( type == INT ) {
|
||||
result = "int";
|
||||
} else if ( type == SGPropertyNode::LONG ) {
|
||||
} else if ( type == LONG ) {
|
||||
result = "long";
|
||||
} else if ( type == SGPropertyNode::FLOAT ) {
|
||||
} else if ( type == FLOAT ) {
|
||||
result = "float";
|
||||
} else if ( type == SGPropertyNode::DOUBLE ) {
|
||||
} else if ( type == DOUBLE ) {
|
||||
result = "double";
|
||||
} else if ( type == SGPropertyNode::STRING ) {
|
||||
} else if ( type == STRING ) {
|
||||
result = "string";
|
||||
}
|
||||
|
||||
|
|
|
@ -177,24 +177,25 @@ static SGPropertyNode* findnode(naContext c, naRef* vec, int len)
|
|||
// nil if it doesn't exist.
|
||||
static naRef f_getprop(naContext c, naRef me, int argc, naRef* args)
|
||||
{
|
||||
using namespace simgear::props;
|
||||
const SGPropertyNode* p = findnode(c, args, argc);
|
||||
if(!p) return naNil();
|
||||
|
||||
switch(p->getType()) {
|
||||
case SGPropertyNode::BOOL: case SGPropertyNode::INT:
|
||||
case SGPropertyNode::LONG: case SGPropertyNode::FLOAT:
|
||||
case SGPropertyNode::DOUBLE:
|
||||
case BOOL: case INT:
|
||||
case LONG: case FLOAT:
|
||||
case DOUBLE:
|
||||
return naNum(p->getDoubleValue());
|
||||
|
||||
case SGPropertyNode::STRING:
|
||||
case SGPropertyNode::UNSPECIFIED:
|
||||
case STRING:
|
||||
case UNSPECIFIED:
|
||||
{
|
||||
naRef nastr = naNewString(c);
|
||||
const char* val = p->getStringValue();
|
||||
naStr_fromdata(nastr, (char*)val, strlen(val));
|
||||
return nastr;
|
||||
}
|
||||
case SGPropertyNode::ALIAS: // <--- FIXME, recurse?
|
||||
case ALIAS: // <--- FIXME, recurse?
|
||||
default:
|
||||
return naNil();
|
||||
}
|
||||
|
@ -1060,23 +1061,24 @@ void FGNasalListener::childRemoved(SGPropertyNode*, SGPropertyNode* child)
|
|||
|
||||
bool FGNasalListener::changed(SGPropertyNode* node)
|
||||
{
|
||||
SGPropertyNode::Type type = node->getType();
|
||||
if(type == SGPropertyNode::NONE) return false;
|
||||
if(type == SGPropertyNode::UNSPECIFIED) return true;
|
||||
using namespace simgear::props;
|
||||
Type type = node->getType();
|
||||
if(type == NONE) return false;
|
||||
if(type == UNSPECIFIED) return true;
|
||||
|
||||
bool result;
|
||||
switch(type) {
|
||||
case SGPropertyNode::BOOL:
|
||||
case SGPropertyNode::INT:
|
||||
case SGPropertyNode::LONG:
|
||||
case BOOL:
|
||||
case INT:
|
||||
case LONG:
|
||||
{
|
||||
long l = node->getLongValue();
|
||||
result = l != _last_int;
|
||||
_last_int = l;
|
||||
return result;
|
||||
}
|
||||
case SGPropertyNode::FLOAT:
|
||||
case SGPropertyNode::DOUBLE:
|
||||
case FLOAT:
|
||||
case DOUBLE:
|
||||
{
|
||||
double d = node->getDoubleValue();
|
||||
result = d != _last_float;
|
||||
|
|
|
@ -58,18 +58,19 @@ naRef FGNasalSys::propNodeGhost(SGPropertyNode* handle)
|
|||
|
||||
static naRef f_getType(naContext c, naRef me, int argc, naRef* args)
|
||||
{
|
||||
using namespace simgear::props;
|
||||
NODEARG();
|
||||
const char* t = "unknown";
|
||||
switch((*node)->getType()) {
|
||||
case SGPropertyNode::NONE: t = "NONE"; break;
|
||||
case SGPropertyNode::ALIAS: t = "ALIAS"; break;
|
||||
case SGPropertyNode::BOOL: t = "BOOL"; break;
|
||||
case SGPropertyNode::INT: t = "INT"; break;
|
||||
case SGPropertyNode::LONG: t = "LONG"; break;
|
||||
case SGPropertyNode::FLOAT: t = "FLOAT"; break;
|
||||
case SGPropertyNode::DOUBLE: t = "DOUBLE"; break;
|
||||
case SGPropertyNode::STRING: t = "STRING"; break;
|
||||
case SGPropertyNode::UNSPECIFIED: t = "UNSPECIFIED"; break;
|
||||
case NONE: t = "NONE"; break;
|
||||
case ALIAS: t = "ALIAS"; break;
|
||||
case BOOL: t = "BOOL"; break;
|
||||
case INT: t = "INT"; break;
|
||||
case LONG: t = "LONG"; break;
|
||||
case FLOAT: t = "FLOAT"; break;
|
||||
case DOUBLE: t = "DOUBLE"; break;
|
||||
case STRING: t = "STRING"; break;
|
||||
case UNSPECIFIED: t = "UNSPECIFIED"; break;
|
||||
}
|
||||
return NASTR(t);
|
||||
}
|
||||
|
@ -142,14 +143,15 @@ static naRef f_getIndex(naContext c, naRef me, int argc, naRef* args)
|
|||
|
||||
static naRef f_getValue(naContext c, naRef me, int argc, naRef* args)
|
||||
{
|
||||
using namespace simgear::props;
|
||||
NODEARG();
|
||||
switch((*node)->getType()) {
|
||||
case SGPropertyNode::BOOL: case SGPropertyNode::INT:
|
||||
case SGPropertyNode::LONG: case SGPropertyNode::FLOAT:
|
||||
case SGPropertyNode::DOUBLE:
|
||||
case BOOL: case INT:
|
||||
case LONG: case FLOAT:
|
||||
case DOUBLE:
|
||||
return naNum((*node)->getDoubleValue());
|
||||
case SGPropertyNode::STRING:
|
||||
case SGPropertyNode::UNSPECIFIED:
|
||||
case STRING:
|
||||
case UNSPECIFIED:
|
||||
return NASTR((*node)->getStringValue());
|
||||
default:
|
||||
return naNil();
|
||||
|
|
Loading…
Reference in a new issue