Refer to property types using props:: namespace
BOOL, FLOAT etc. conflict with typedefs in windows.h.
This commit is contained in:
parent
ddb6551a91
commit
7d6c567fde
9 changed files with 127 additions and 127 deletions
|
@ -97,7 +97,7 @@ void FGAIMultiplayer::unbind() {
|
||||||
|
|
||||||
void FGAIMultiplayer::update(double dt)
|
void FGAIMultiplayer::update(double dt)
|
||||||
{
|
{
|
||||||
using namespace simgear::props;
|
using namespace simgear;
|
||||||
|
|
||||||
if (dt <= 0)
|
if (dt <= 0)
|
||||||
return;
|
return;
|
||||||
|
@ -202,19 +202,19 @@ void FGAIMultiplayer::update(double dt)
|
||||||
{
|
{
|
||||||
//cout << "Found " << pIt->second->getPath() << ":";
|
//cout << "Found " << pIt->second->getPath() << ":";
|
||||||
switch ((*firstPropIt)->type) {
|
switch ((*firstPropIt)->type) {
|
||||||
case INT:
|
case props::INT:
|
||||||
case BOOL:
|
case props::BOOL:
|
||||||
case LONG:
|
case props::LONG:
|
||||||
pIt->second->setIntValue((*firstPropIt)->int_value);
|
pIt->second->setIntValue((*firstPropIt)->int_value);
|
||||||
//cout << "Int: " << (*firstPropIt)->int_value << "\n";
|
//cout << "Int: " << (*firstPropIt)->int_value << "\n";
|
||||||
break;
|
break;
|
||||||
case FLOAT:
|
case props::FLOAT:
|
||||||
case DOUBLE:
|
case props::DOUBLE:
|
||||||
pIt->second->setFloatValue((*firstPropIt)->float_value);
|
pIt->second->setFloatValue((*firstPropIt)->float_value);
|
||||||
//cout << "Flo: " << (*firstPropIt)->float_value << "\n";
|
//cout << "Flo: " << (*firstPropIt)->float_value << "\n";
|
||||||
break;
|
break;
|
||||||
case STRING:
|
case props::STRING:
|
||||||
case UNSPECIFIED:
|
case props::UNSPECIFIED:
|
||||||
pIt->second->setStringValue((*firstPropIt)->string_value);
|
pIt->second->setStringValue((*firstPropIt)->string_value);
|
||||||
//cout << "Str: " << (*firstPropIt)->string_value << "\n";
|
//cout << "Str: " << (*firstPropIt)->string_value << "\n";
|
||||||
break;
|
break;
|
||||||
|
@ -276,23 +276,23 @@ void FGAIMultiplayer::update(double dt)
|
||||||
int ival;
|
int ival;
|
||||||
float val;
|
float val;
|
||||||
switch ((*prevPropIt)->type) {
|
switch ((*prevPropIt)->type) {
|
||||||
case INT:
|
case props::INT:
|
||||||
case BOOL:
|
case props::BOOL:
|
||||||
case LONG:
|
case props::LONG:
|
||||||
ival = (int) (0.5+(1-tau)*((double) (*prevPropIt)->int_value) +
|
ival = (int) (0.5+(1-tau)*((double) (*prevPropIt)->int_value) +
|
||||||
tau*((double) (*nextPropIt)->int_value));
|
tau*((double) (*nextPropIt)->int_value));
|
||||||
pIt->second->setIntValue(ival);
|
pIt->second->setIntValue(ival);
|
||||||
//cout << "Int: " << ival << "\n";
|
//cout << "Int: " << ival << "\n";
|
||||||
break;
|
break;
|
||||||
case FLOAT:
|
case props::FLOAT:
|
||||||
case DOUBLE:
|
case props::DOUBLE:
|
||||||
val = (1-tau)*(*prevPropIt)->float_value +
|
val = (1-tau)*(*prevPropIt)->float_value +
|
||||||
tau*(*nextPropIt)->float_value;
|
tau*(*nextPropIt)->float_value;
|
||||||
//cout << "Flo: " << val << "\n";
|
//cout << "Flo: " << val << "\n";
|
||||||
pIt->second->setFloatValue(val);
|
pIt->second->setFloatValue(val);
|
||||||
break;
|
break;
|
||||||
case STRING:
|
case props::STRING:
|
||||||
case UNSPECIFIED:
|
case props::UNSPECIFIED:
|
||||||
//cout << "Str: " << (*nextPropIt)->string_value << "\n";
|
//cout << "Str: " << (*nextPropIt)->string_value << "\n";
|
||||||
pIt->second->setStringValue((*nextPropIt)->string_value);
|
pIt->second->setStringValue((*nextPropIt)->string_value);
|
||||||
break;
|
break;
|
||||||
|
@ -389,19 +389,19 @@ void FGAIMultiplayer::update(double dt)
|
||||||
if (pIt != mPropertyMap.end())
|
if (pIt != mPropertyMap.end())
|
||||||
{
|
{
|
||||||
switch ((*firstPropIt)->type) {
|
switch ((*firstPropIt)->type) {
|
||||||
case INT:
|
case props::INT:
|
||||||
case BOOL:
|
case props::BOOL:
|
||||||
case LONG:
|
case props::LONG:
|
||||||
pIt->second->setIntValue((*firstPropIt)->int_value);
|
pIt->second->setIntValue((*firstPropIt)->int_value);
|
||||||
//cout << "Int: " << (*firstPropIt)->int_value << "\n";
|
//cout << "Int: " << (*firstPropIt)->int_value << "\n";
|
||||||
break;
|
break;
|
||||||
case FLOAT:
|
case props::FLOAT:
|
||||||
case DOUBLE:
|
case props::DOUBLE:
|
||||||
pIt->second->setFloatValue((*firstPropIt)->float_value);
|
pIt->second->setFloatValue((*firstPropIt)->float_value);
|
||||||
//cout << "Flo: " << (*firstPropIt)->float_value << "\n";
|
//cout << "Flo: " << (*firstPropIt)->float_value << "\n";
|
||||||
break;
|
break;
|
||||||
case STRING:
|
case props::STRING:
|
||||||
case UNSPECIFIED:
|
case props::UNSPECIFIED:
|
||||||
pIt->second->setStringValue((*firstPropIt)->string_value);
|
pIt->second->setStringValue((*firstPropIt)->string_value);
|
||||||
//cout << "Str: " << (*firstPropIt)->string_value << "\n";
|
//cout << "Str: " << (*firstPropIt)->string_value << "\n";
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -390,7 +390,7 @@ action_callback (puObject *object)
|
||||||
static void
|
static void
|
||||||
copy_to_pui (SGPropertyNode *node, puObject *object)
|
copy_to_pui (SGPropertyNode *node, puObject *object)
|
||||||
{
|
{
|
||||||
using namespace simgear::props;
|
using namespace simgear;
|
||||||
GUIInfo *info = (GUIInfo *)object->getUserData();
|
GUIInfo *info = (GUIInfo *)object->getUserData();
|
||||||
if (!info) {
|
if (!info) {
|
||||||
SG_LOG(SG_GENERAL, SG_ALERT, "dialog: widget without GUIInfo!");
|
SG_LOG(SG_GENERAL, SG_ALERT, "dialog: widget without GUIInfo!");
|
||||||
|
@ -410,13 +410,13 @@ copy_to_pui (SGPropertyNode *node, puObject *object)
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (node->getType()) {
|
switch (node->getType()) {
|
||||||
case BOOL:
|
case props::BOOL:
|
||||||
case INT:
|
case props::INT:
|
||||||
case LONG:
|
case props::LONG:
|
||||||
object->setValue(node->getIntValue());
|
object->setValue(node->getIntValue());
|
||||||
break;
|
break;
|
||||||
case FLOAT:
|
case props::FLOAT:
|
||||||
case DOUBLE:
|
case props::DOUBLE:
|
||||||
object->setValue(node->getFloatValue());
|
object->setValue(node->getFloatValue());
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -430,19 +430,19 @@ copy_to_pui (SGPropertyNode *node, puObject *object)
|
||||||
static void
|
static void
|
||||||
copy_from_pui (puObject *object, SGPropertyNode *node)
|
copy_from_pui (puObject *object, SGPropertyNode *node)
|
||||||
{
|
{
|
||||||
using namespace simgear::props;
|
using namespace simgear;
|
||||||
// puText objects are immutable, so should not be copied out
|
// puText objects are immutable, so should not be copied out
|
||||||
if (object->getType() & PUCLASS_TEXT)
|
if (object->getType() & PUCLASS_TEXT)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
switch (node->getType()) {
|
switch (node->getType()) {
|
||||||
case BOOL:
|
case props::BOOL:
|
||||||
case INT:
|
case props::INT:
|
||||||
case LONG:
|
case props::LONG:
|
||||||
node->setIntValue(object->getIntegerValue());
|
node->setIntValue(object->getIntegerValue());
|
||||||
break;
|
break;
|
||||||
case FLOAT:
|
case props::FLOAT:
|
||||||
case DOUBLE:
|
case props::DOUBLE:
|
||||||
node->setFloatValue(object->getFloatValue());
|
node->setFloatValue(object->getFloatValue());
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -44,29 +44,29 @@ typedef string stdString; // puObject has a "string" member
|
||||||
|
|
||||||
static string getValueTypeString(const SGPropertyNode *node)
|
static string getValueTypeString(const SGPropertyNode *node)
|
||||||
{
|
{
|
||||||
using namespace simgear::props;
|
using namespace simgear;
|
||||||
string result;
|
string result;
|
||||||
|
|
||||||
Type type = node->getType();
|
props::Type type = node->getType();
|
||||||
if (type == UNSPECIFIED)
|
if (type == props::UNSPECIFIED)
|
||||||
result = "unspecified";
|
result = "unspecified";
|
||||||
else if (type == NONE)
|
else if (type == props::NONE)
|
||||||
result = "none";
|
result = "none";
|
||||||
else if (type == BOOL)
|
else if (type == props::BOOL)
|
||||||
result = "bool";
|
result = "bool";
|
||||||
else if (type == INT)
|
else if (type == props::INT)
|
||||||
result = "int";
|
result = "int";
|
||||||
else if (type == LONG)
|
else if (type == props::LONG)
|
||||||
result = "long";
|
result = "long";
|
||||||
else if (type == FLOAT)
|
else if (type == props::FLOAT)
|
||||||
result = "float";
|
result = "float";
|
||||||
else if (type == DOUBLE)
|
else if (type == props::DOUBLE)
|
||||||
result = "double";
|
result = "double";
|
||||||
else if (type == STRING)
|
else if (type == props::STRING)
|
||||||
result = "string";
|
result = "string";
|
||||||
else if (type == VEC3D)
|
else if (type == props::VEC3D)
|
||||||
result = "vec3d";
|
result = "vec3d";
|
||||||
else if (type == VEC4D)
|
else if (type == props::VEC4D)
|
||||||
result = "vec4d";
|
result = "vec4d";
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@ -75,12 +75,12 @@ static string getValueTypeString(const SGPropertyNode *node)
|
||||||
|
|
||||||
static void dumpProperties(const SGPropertyNode *node)
|
static void dumpProperties(const SGPropertyNode *node)
|
||||||
{
|
{
|
||||||
using namespace simgear::props;
|
using namespace simgear;
|
||||||
cout << node->getPath() << '/' << endl;
|
cout << node->getPath() << '/' << endl;
|
||||||
for (int i = 0; i < node->nChildren(); i++) {
|
for (int i = 0; i < node->nChildren(); i++) {
|
||||||
const SGPropertyNode *c = node->getChild(i);
|
const SGPropertyNode *c = node->getChild(i);
|
||||||
Type type = c->getType();
|
props::Type type = c->getType();
|
||||||
if (type == ALIAS || c->nChildren())
|
if (type == props::ALIAS || c->nChildren())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
int index = c->getIndex();
|
int index = c->getIndex();
|
||||||
|
@ -90,25 +90,25 @@ static void dumpProperties(const SGPropertyNode *node)
|
||||||
cout << " = ";
|
cout << " = ";
|
||||||
|
|
||||||
switch (c->getType()) {
|
switch (c->getType()) {
|
||||||
case DOUBLE:
|
case props::DOUBLE:
|
||||||
case FLOAT:
|
case props::FLOAT:
|
||||||
case VEC3D:
|
case props::VEC3D:
|
||||||
case VEC4D:
|
case props::VEC4D:
|
||||||
{
|
{
|
||||||
streamsize precision = cout.precision(15);
|
streamsize precision = cout.precision(15);
|
||||||
c->printOn(cout);
|
c->printOn(cout);
|
||||||
cout.precision(precision);
|
cout.precision(precision);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case LONG:
|
case props::LONG:
|
||||||
case INT:
|
case props::INT:
|
||||||
case BOOL:
|
case props::BOOL:
|
||||||
c->printOn(cout);
|
c->printOn(cout);
|
||||||
break;
|
break;
|
||||||
case STRING:
|
case props::STRING:
|
||||||
cout << '"' << c->getStringValue() << '"';
|
cout << '"' << c->getStringValue() << '"';
|
||||||
break;
|
break;
|
||||||
case NONE:
|
case props::NONE:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
cout << '\'' << c->getStringValue() << '\'';
|
cout << '\'' << c->getStringValue() << '\'';
|
||||||
|
@ -309,7 +309,7 @@ void PropertyList::update(bool restore_pos)
|
||||||
|
|
||||||
void PropertyList::updateTextForEntry(NodeData& data)
|
void PropertyList::updateTextForEntry(NodeData& data)
|
||||||
{
|
{
|
||||||
using namespace simgear::props;
|
using namespace simgear;
|
||||||
SGPropertyNode *node = data.node;
|
SGPropertyNode *node = data.node;
|
||||||
stdString name = node->getDisplayName(true);
|
stdString name = node->getDisplayName(true);
|
||||||
stdString type = getValueTypeString(node);
|
stdString type = getValueTypeString(node);
|
||||||
|
@ -323,8 +323,8 @@ void PropertyList::updateTextForEntry(NodeData& data)
|
||||||
line << '/';
|
line << '/';
|
||||||
|
|
||||||
if (!children || (_verbose && node->hasValue())) {
|
if (!children || (_verbose && node->hasValue())) {
|
||||||
if (node->getType() == STRING
|
if (node->getType() == props::STRING
|
||||||
|| node->getType() == UNSPECIFIED)
|
|| node->getType() == props::UNSPECIFIED)
|
||||||
sanitize(value);
|
sanitize(value);
|
||||||
|
|
||||||
line << " = '" << value << "' (" << type;
|
line << " = '" << value << "' (" << type;
|
||||||
|
|
|
@ -894,17 +894,17 @@ static void fgIdleFunction ( void ) {
|
||||||
|
|
||||||
static void upper_case_property(const char *name)
|
static void upper_case_property(const char *name)
|
||||||
{
|
{
|
||||||
using namespace simgear::props;
|
using namespace simgear;
|
||||||
SGPropertyNode *p = fgGetNode(name, false);
|
SGPropertyNode *p = fgGetNode(name, false);
|
||||||
if (!p) {
|
if (!p) {
|
||||||
p = fgGetNode(name, true);
|
p = fgGetNode(name, true);
|
||||||
p->setStringValue("");
|
p->setStringValue("");
|
||||||
} else {
|
} else {
|
||||||
Type t = p->getType();
|
props::Type t = p->getType();
|
||||||
if (t == NONE || t == UNSPECIFIED)
|
if (t == props::NONE || t == props::UNSPECIFIED)
|
||||||
p->setStringValue("");
|
p->setStringValue("");
|
||||||
else
|
else
|
||||||
assert(t == STRING);
|
assert(t == props::STRING);
|
||||||
}
|
}
|
||||||
p->addChangeListener(new FGMakeUpperCase);
|
p->addChangeListener(new FGMakeUpperCase);
|
||||||
}
|
}
|
||||||
|
|
|
@ -268,7 +268,7 @@ namespace
|
||||||
{
|
{
|
||||||
bool verifyProperties(const xdr_data_t* data, const xdr_data_t* end)
|
bool verifyProperties(const xdr_data_t* data, const xdr_data_t* end)
|
||||||
{
|
{
|
||||||
using namespace simgear::props;
|
using namespace simgear;
|
||||||
const xdr_data_t* xdr = data;
|
const xdr_data_t* xdr = data;
|
||||||
while (xdr < end) {
|
while (xdr < end) {
|
||||||
unsigned id = XDR_decode_uint32(*xdr);
|
unsigned id = XDR_decode_uint32(*xdr);
|
||||||
|
@ -279,13 +279,13 @@ namespace
|
||||||
xdr++;
|
xdr++;
|
||||||
// How we decode the remainder of the property depends on the type
|
// How we decode the remainder of the property depends on the type
|
||||||
switch (plist->type) {
|
switch (plist->type) {
|
||||||
case INT:
|
case props::INT:
|
||||||
case BOOL:
|
case props::BOOL:
|
||||||
case LONG:
|
case props::LONG:
|
||||||
xdr++;
|
xdr++;
|
||||||
break;
|
break;
|
||||||
case FLOAT:
|
case props::FLOAT:
|
||||||
case DOUBLE:
|
case props::DOUBLE:
|
||||||
{
|
{
|
||||||
float val = XDR_decode_float(*xdr);
|
float val = XDR_decode_float(*xdr);
|
||||||
if (osg::isNaN(val))
|
if (osg::isNaN(val))
|
||||||
|
@ -293,8 +293,8 @@ namespace
|
||||||
xdr++;
|
xdr++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case STRING:
|
case props::STRING:
|
||||||
case UNSPECIFIED:
|
case props::UNSPECIFIED:
|
||||||
{
|
{
|
||||||
// String is complicated. It consists of
|
// String is complicated. It consists of
|
||||||
// The length of the string
|
// The length of the string
|
||||||
|
|
|
@ -119,7 +119,7 @@ bool FGMultiplay::open() {
|
||||||
* or receive data over the network
|
* or receive data over the network
|
||||||
******************************************************************/
|
******************************************************************/
|
||||||
bool FGMultiplay::process() {
|
bool FGMultiplay::process() {
|
||||||
using namespace simgear::props;
|
using namespace simgear;
|
||||||
if (get_direction() == SG_IO_OUT) {
|
if (get_direction() == SG_IO_OUT) {
|
||||||
|
|
||||||
// check if we have left initialization phase. That will not provide
|
// check if we have left initialization phase. That will not provide
|
||||||
|
@ -202,17 +202,17 @@ bool FGMultiplay::process() {
|
||||||
pData->type = it->second->getType();
|
pData->type = it->second->getType();
|
||||||
|
|
||||||
switch (pData->type) {
|
switch (pData->type) {
|
||||||
case INT:
|
case props::INT:
|
||||||
case LONG:
|
case props::LONG:
|
||||||
case BOOL:
|
case props::BOOL:
|
||||||
pData->int_value = it->second->getIntValue();
|
pData->int_value = it->second->getIntValue();
|
||||||
break;
|
break;
|
||||||
case FLOAT:
|
case props::FLOAT:
|
||||||
case DOUBLE:
|
case props::DOUBLE:
|
||||||
pData->float_value = it->second->getFloatValue();
|
pData->float_value = it->second->getFloatValue();
|
||||||
break;
|
break;
|
||||||
case STRING:
|
case props::STRING:
|
||||||
case UNSPECIFIED:
|
case props::UNSPECIFIED:
|
||||||
{
|
{
|
||||||
// FIXME: We assume unspecified are strings for the moment.
|
// FIXME: We assume unspecified are strings for the moment.
|
||||||
|
|
||||||
|
|
|
@ -118,7 +118,7 @@ PropsChannel::collectIncomingData( const char* s, int n )
|
||||||
static string
|
static string
|
||||||
getValueTypeString( const SGPropertyNode *node )
|
getValueTypeString( const SGPropertyNode *node )
|
||||||
{
|
{
|
||||||
using namespace simgear::props;
|
using namespace simgear;
|
||||||
|
|
||||||
string result;
|
string result;
|
||||||
|
|
||||||
|
@ -127,22 +127,22 @@ getValueTypeString( const SGPropertyNode *node )
|
||||||
return "unknown";
|
return "unknown";
|
||||||
}
|
}
|
||||||
|
|
||||||
Type type = node->getType();
|
props::Type type = node->getType();
|
||||||
if ( type == UNSPECIFIED ) {
|
if ( type == props::UNSPECIFIED ) {
|
||||||
result = "unspecified";
|
result = "unspecified";
|
||||||
} else if ( type == NONE ) {
|
} else if ( type == props::NONE ) {
|
||||||
result = "none";
|
result = "none";
|
||||||
} else if ( type == BOOL ) {
|
} else if ( type == props::BOOL ) {
|
||||||
result = "bool";
|
result = "bool";
|
||||||
} else if ( type == INT ) {
|
} else if ( type == props::INT ) {
|
||||||
result = "int";
|
result = "int";
|
||||||
} else if ( type == LONG ) {
|
} else if ( type == props::LONG ) {
|
||||||
result = "long";
|
result = "long";
|
||||||
} else if ( type == FLOAT ) {
|
} else if ( type == props::FLOAT ) {
|
||||||
result = "float";
|
result = "float";
|
||||||
} else if ( type == DOUBLE ) {
|
} else if ( type == props::DOUBLE ) {
|
||||||
result = "double";
|
result = "double";
|
||||||
} else if ( type == STRING ) {
|
} else if ( type == props::STRING ) {
|
||||||
result = "string";
|
result = "string";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -177,25 +177,25 @@ static SGPropertyNode* findnode(naContext c, naRef* vec, int len)
|
||||||
// nil if it doesn't exist.
|
// nil if it doesn't exist.
|
||||||
static naRef f_getprop(naContext c, naRef me, int argc, naRef* args)
|
static naRef f_getprop(naContext c, naRef me, int argc, naRef* args)
|
||||||
{
|
{
|
||||||
using namespace simgear::props;
|
using namespace simgear;
|
||||||
const SGPropertyNode* p = findnode(c, args, argc);
|
const SGPropertyNode* p = findnode(c, args, argc);
|
||||||
if(!p) return naNil();
|
if(!p) return naNil();
|
||||||
|
|
||||||
switch(p->getType()) {
|
switch(p->getType()) {
|
||||||
case BOOL: case INT:
|
case props::BOOL: case props::INT:
|
||||||
case LONG: case FLOAT:
|
case props::LONG: case props::FLOAT:
|
||||||
case DOUBLE:
|
case props::DOUBLE:
|
||||||
return naNum(p->getDoubleValue());
|
return naNum(p->getDoubleValue());
|
||||||
|
|
||||||
case STRING:
|
case props::STRING:
|
||||||
case UNSPECIFIED:
|
case props::UNSPECIFIED:
|
||||||
{
|
{
|
||||||
naRef nastr = naNewString(c);
|
naRef nastr = naNewString(c);
|
||||||
const char* val = p->getStringValue();
|
const char* val = p->getStringValue();
|
||||||
naStr_fromdata(nastr, (char*)val, strlen(val));
|
naStr_fromdata(nastr, (char*)val, strlen(val));
|
||||||
return nastr;
|
return nastr;
|
||||||
}
|
}
|
||||||
case ALIAS: // <--- FIXME, recurse?
|
case props::ALIAS: // <--- FIXME, recurse?
|
||||||
default:
|
default:
|
||||||
return naNil();
|
return naNil();
|
||||||
}
|
}
|
||||||
|
@ -1061,24 +1061,24 @@ void FGNasalListener::childRemoved(SGPropertyNode*, SGPropertyNode* child)
|
||||||
|
|
||||||
bool FGNasalListener::changed(SGPropertyNode* node)
|
bool FGNasalListener::changed(SGPropertyNode* node)
|
||||||
{
|
{
|
||||||
using namespace simgear::props;
|
using namespace simgear;
|
||||||
Type type = node->getType();
|
props::Type type = node->getType();
|
||||||
if(type == NONE) return false;
|
if(type == props::NONE) return false;
|
||||||
if(type == UNSPECIFIED) return true;
|
if(type == props::UNSPECIFIED) return true;
|
||||||
|
|
||||||
bool result;
|
bool result;
|
||||||
switch(type) {
|
switch(type) {
|
||||||
case BOOL:
|
case props::BOOL:
|
||||||
case INT:
|
case props::INT:
|
||||||
case LONG:
|
case props::LONG:
|
||||||
{
|
{
|
||||||
long l = node->getLongValue();
|
long l = node->getLongValue();
|
||||||
result = l != _last_int;
|
result = l != _last_int;
|
||||||
_last_int = l;
|
_last_int = l;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
case FLOAT:
|
case props::FLOAT:
|
||||||
case DOUBLE:
|
case props::DOUBLE:
|
||||||
{
|
{
|
||||||
double d = node->getDoubleValue();
|
double d = node->getDoubleValue();
|
||||||
result = d != _last_float;
|
result = d != _last_float;
|
||||||
|
|
|
@ -58,21 +58,21 @@ naRef FGNasalSys::propNodeGhost(SGPropertyNode* handle)
|
||||||
|
|
||||||
static naRef f_getType(naContext c, naRef me, int argc, naRef* args)
|
static naRef f_getType(naContext c, naRef me, int argc, naRef* args)
|
||||||
{
|
{
|
||||||
using namespace simgear::props;
|
using namespace simgear;
|
||||||
NODEARG();
|
NODEARG();
|
||||||
const char* t = "unknown";
|
const char* t = "unknown";
|
||||||
switch((*node)->getType()) {
|
switch((*node)->getType()) {
|
||||||
case NONE: t = "NONE"; break;
|
case props::NONE: t = "NONE"; break;
|
||||||
case ALIAS: t = "ALIAS"; break;
|
case props::ALIAS: t = "ALIAS"; break;
|
||||||
case BOOL: t = "BOOL"; break;
|
case props::BOOL: t = "BOOL"; break;
|
||||||
case INT: t = "INT"; break;
|
case props::INT: t = "INT"; break;
|
||||||
case LONG: t = "LONG"; break;
|
case props::LONG: t = "LONG"; break;
|
||||||
case FLOAT: t = "FLOAT"; break;
|
case props::FLOAT: t = "FLOAT"; break;
|
||||||
case DOUBLE: t = "DOUBLE"; break;
|
case props::DOUBLE: t = "DOUBLE"; break;
|
||||||
case STRING: t = "STRING"; break;
|
case props::STRING: t = "STRING"; break;
|
||||||
case UNSPECIFIED: t = "UNSPECIFIED"; break;
|
case props::UNSPECIFIED: t = "UNSPECIFIED"; break;
|
||||||
case VEC3D: t = "VEC3D"; break;
|
case props::VEC3D: t = "VEC3D"; break;
|
||||||
case VEC4D: t = "VEC4D"; break;
|
case props::VEC4D: t = "VEC4D"; break;
|
||||||
}
|
}
|
||||||
return NASTR(t);
|
return NASTR(t);
|
||||||
}
|
}
|
||||||
|
@ -157,19 +157,19 @@ naRef makeVectorFromVec(naContext c, const T& vec)
|
||||||
|
|
||||||
static naRef f_getValue(naContext c, naRef me, int argc, naRef* args)
|
static naRef f_getValue(naContext c, naRef me, int argc, naRef* args)
|
||||||
{
|
{
|
||||||
using namespace simgear::props;
|
using namespace simgear;
|
||||||
NODEARG();
|
NODEARG();
|
||||||
switch((*node)->getType()) {
|
switch((*node)->getType()) {
|
||||||
case BOOL: case INT:
|
case props::BOOL: case props::INT:
|
||||||
case LONG: case FLOAT:
|
case props::LONG: case props::FLOAT:
|
||||||
case DOUBLE:
|
case props::DOUBLE:
|
||||||
return naNum((*node)->getDoubleValue());
|
return naNum((*node)->getDoubleValue());
|
||||||
case STRING:
|
case props::STRING:
|
||||||
case UNSPECIFIED:
|
case props::UNSPECIFIED:
|
||||||
return NASTR((*node)->getStringValue());
|
return NASTR((*node)->getStringValue());
|
||||||
case VEC3D:
|
case props::VEC3D:
|
||||||
return makeVectorFromVec(c, (*node)->getValue<SGVec3d>());
|
return makeVectorFromVec(c, (*node)->getValue<SGVec3d>());
|
||||||
case VEC4D:
|
case props::VEC4D:
|
||||||
return makeVectorFromVec(c, (*node)->getValue<SGVec4d>());
|
return makeVectorFromVec(c, (*node)->getValue<SGVec4d>());
|
||||||
default:
|
default:
|
||||||
return naNil();
|
return naNil();
|
||||||
|
|
Loading…
Reference in a new issue