Cope with SGPropertyNode::getStringValue() now returning std::string by value.
This is by Lars Toenning <dev@ltoenning.de>, Roman Ludwicki <romek21@op.pl> and SDeAstis <salvatore.deastis@gmail.com>, in 2021 Hackathon. Also cope with removal of SGPropertyNode::getName() - use getNameString() instead.
This commit is contained in:
parent
4bcfe6cd64
commit
82f967ab92
121 changed files with 501 additions and 500 deletions
|
@ -260,7 +260,7 @@ void FGAIBase::readFromScenario(SGPropertyNode* scFileNode)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
setPath(scFileNode->getStringValue("model",
|
setPath(scFileNode->getStringValue("model",
|
||||||
fgGetString("/sim/multiplay/default-model", default_model)));
|
fgGetString("/sim/multiplay/default-model", default_model).c_str()).c_str());
|
||||||
|
|
||||||
setFallbackModelIndex(scFileNode->getIntValue("fallback-model-index", 0));
|
setFallbackModelIndex(scFileNode->getIntValue("fallback-model-index", 0));
|
||||||
|
|
||||||
|
|
|
@ -173,7 +173,7 @@ void FGAICarrier::update(double dt) {
|
||||||
|
|
||||||
//automatic turn into wind with a target wind of 25 kts otd
|
//automatic turn into wind with a target wind of 25 kts otd
|
||||||
//SG_LOG(SG_AI, SG_ALERT, "AICarrier: MPControl " << MPControl << " AIControl " << AIControl);
|
//SG_LOG(SG_AI, SG_ALERT, "AICarrier: MPControl " << MPControl << " AIControl " << AIControl);
|
||||||
if (strcmp(_ai_latch_node->getStringValue(), "")) {
|
if (_ai_latch_node->getStringValue() != "") {
|
||||||
SG_LOG(SG_AI, SG_DEBUG, "FGAICarrier::update(): not updating because ai-latch=" << _ai_latch_node->getStringValue());
|
SG_LOG(SG_AI, SG_DEBUG, "FGAICarrier::update(): not updating because ai-latch=" << _ai_latch_node->getStringValue());
|
||||||
}
|
}
|
||||||
else if (!_MPControl && _AIControl){
|
else if (!_MPControl && _AIControl){
|
||||||
|
|
|
@ -455,8 +455,8 @@ void FGAIMultiplayer::update(double dt)
|
||||||
//
|
//
|
||||||
bool motion_logging = false;
|
bool motion_logging = false;
|
||||||
{
|
{
|
||||||
const char* callsign = mLogRawSpeedMultiplayer->getStringValue();
|
string callsign = mLogRawSpeedMultiplayer->getStringValue();
|
||||||
if (callsign && callsign[0] && this->_callsign == callsign)
|
if (!callsign.empty() && this->_callsign == callsign)
|
||||||
{
|
{
|
||||||
motion_logging = true;
|
motion_logging = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,10 +118,10 @@ void PerformanceDB::load(const SGPath& filename)
|
||||||
SGPropertyNode * node = root.getNode("performancedb");
|
SGPropertyNode * node = root.getNode("performancedb");
|
||||||
for (int i = 0; i < node->nChildren(); i++) {
|
for (int i = 0; i < node->nChildren(); i++) {
|
||||||
SGPropertyNode * db_node = node->getChild(i);
|
SGPropertyNode * db_node = node->getChild(i);
|
||||||
if (!strcmp(db_node->getName(), "aircraft")) {
|
if (db_node->getNameString() == "aircraft") {
|
||||||
PerformanceData* data = NULL;
|
PerformanceData* data = NULL;
|
||||||
if (db_node->hasChild("base")) {
|
if (db_node->hasChild("base")) {
|
||||||
const string& baseName = db_node->getStringValue("base");
|
std::string baseName = db_node->getStringValue("base");
|
||||||
PerformanceData* baseData = _db[baseName];
|
PerformanceData* baseData = _db[baseName];
|
||||||
if (!baseData) {
|
if (!baseData) {
|
||||||
SG_LOG(SG_AI, SG_ALERT,
|
SG_LOG(SG_AI, SG_ALERT,
|
||||||
|
@ -136,21 +136,21 @@ void PerformanceDB::load(const SGPath& filename)
|
||||||
}
|
}
|
||||||
|
|
||||||
data->initFromProps(db_node);
|
data->initFromProps(db_node);
|
||||||
const string& name = db_node->getStringValue("type", "heavy_jet");
|
std::string name = db_node->getStringValue("type", "heavy_jet");
|
||||||
registerPerformanceData(name, data);
|
registerPerformanceData(name, data);
|
||||||
} else if (!strcmp(db_node->getName(), "alias")) {
|
} else if (db_node->getNameString() == "alias") {
|
||||||
const string& alias(db_node->getStringValue("alias"));
|
std::string alias = db_node->getStringValue("alias");
|
||||||
if (alias.empty()) {
|
if (alias.empty()) {
|
||||||
SG_LOG(SG_AI, SG_ALERT, "performance DB alias entry with no <alias> definition");
|
SG_LOG(SG_AI, SG_ALERT, "performance DB alias entry with no <alias> definition");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto matchNode : db_node->getChildren("match")) {
|
for (auto matchNode : db_node->getChildren("match")) {
|
||||||
const string& match(matchNode->getStringValue());
|
std::string match = matchNode->getStringValue();
|
||||||
_aliases.push_back(StringPair(match, alias));
|
_aliases.push_back(StringPair(match, alias));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
SG_LOG(SG_AI, SG_ALERT, "unrecognized performance DB entry:" << db_node->getName());
|
SG_LOG(SG_AI, SG_ALERT, "unrecognized performance DB entry:" << db_node->getNameString());
|
||||||
}
|
}
|
||||||
} // of nodes iteration
|
} // of nodes iteration
|
||||||
}
|
}
|
||||||
|
|
|
@ -625,8 +625,8 @@ void FGSubmodelMgr::setData(int id, const string& path, bool serviceable, const
|
||||||
if (sm->contents_node != 0)
|
if (sm->contents_node != 0)
|
||||||
sm->contents = sm->contents_node->getDoubleValue();
|
sm->contents = sm->contents_node->getDoubleValue();
|
||||||
|
|
||||||
const char *trigger_path = entry_node->getStringValue("trigger", 0);
|
string trigger_path = entry_node->getStringValue("trigger", "");
|
||||||
if (trigger_path) {
|
if (!trigger_path.empty()) {
|
||||||
sm->trigger_node = fgGetNode(trigger_path, true);
|
sm->trigger_node = fgGetNode(trigger_path, true);
|
||||||
sm->trigger_node->setBoolValue(sm->trigger_node->getBoolValue());
|
sm->trigger_node->setBoolValue(sm->trigger_node->getBoolValue());
|
||||||
}
|
}
|
||||||
|
|
|
@ -225,9 +225,9 @@ string ATISEncoder::processTokens( SGPropertyNode_ptr node )
|
||||||
|
|
||||||
string ATISEncoder::processToken( SGPropertyNode_ptr token )
|
string ATISEncoder::processToken( SGPropertyNode_ptr token )
|
||||||
{
|
{
|
||||||
HandlerMap::iterator it = handlerMap.find( token->getName());
|
HandlerMap::iterator it = handlerMap.find( token->getNameString());
|
||||||
if( it == handlerMap.end() ) {
|
if( it == handlerMap.end() ) {
|
||||||
SG_LOG(SG_ATC, SG_WARN, "ATISEncoder: unknown token: " << token->getName() );
|
SG_LOG(SG_ATC, SG_WARN, "ATISEncoder: unknown token: " << token->getNameString() );
|
||||||
return EMPTY;
|
return EMPTY;
|
||||||
}
|
}
|
||||||
handler_t h = it->second;
|
handler_t h = it->second;
|
||||||
|
|
|
@ -104,7 +104,7 @@ ATISInformationProvider::CloudEntries MetarPropertiesATISInformationProvider::ge
|
||||||
using simgear::PropertyList;
|
using simgear::PropertyList;
|
||||||
PropertyList layers = _metar->getNode("clouds", true )->getChildren("layer");
|
PropertyList layers = _metar->getNode("clouds", true )->getChildren("layer");
|
||||||
for( PropertyList::iterator it = layers.begin(); it != layers.end(); ++it ) {
|
for( PropertyList::iterator it = layers.begin(); it != layers.end(); ++it ) {
|
||||||
const char * coverage = (*it)->getStringValue("coverage","clear");
|
std::string coverage = (*it)->getStringValue("coverage", "clear");
|
||||||
double elevation = (*it)->getDoubleValue("elevation-ft", -9999 );
|
double elevation = (*it)->getDoubleValue("elevation-ft", -9999 );
|
||||||
if( elevation > 0 ) {
|
if( elevation > 0 ) {
|
||||||
reply[elevation] = coverage;
|
reply[elevation] = coverage;
|
||||||
|
|
|
@ -44,7 +44,7 @@
|
||||||
|
|
||||||
using std::string;
|
using std::string;
|
||||||
|
|
||||||
static SGPropertyNode *getNamedNode(SGPropertyNode *prop, const char *name)
|
static SGPropertyNode *getNamedNode(SGPropertyNode *prop, const std::string& name)
|
||||||
{
|
{
|
||||||
SGPropertyNode* p;
|
SGPropertyNode* p;
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ static SGPropertyNode *getNamedNode(SGPropertyNode *prop, const char *name)
|
||||||
if ((p = getNamedNode(prop->getChild(i), name)))
|
if ((p = getNamedNode(prop->getChild(i), name)))
|
||||||
return p;
|
return p;
|
||||||
|
|
||||||
if (!strcmp(prop->getStringValue("name"), name))
|
if (prop->getStringValue("name") == name)
|
||||||
return prop;
|
return prop;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -137,18 +137,18 @@ static bool ReadFGReplayData2(
|
||||||
ret->raw_data.resize(0);
|
ret->raw_data.resize(0);
|
||||||
for (auto data: config->getChildren("data"))
|
for (auto data: config->getChildren("data"))
|
||||||
{
|
{
|
||||||
const char* data_type = data->getStringValue();
|
std::string data_type = data->getStringValue();
|
||||||
SG_LOG(SG_SYSTEMS, SG_BULK, "in.tellg()=" << in.tellg() << " data_type=" << data_type);
|
SG_LOG(SG_SYSTEMS, SG_BULK, "in.tellg()=" << in.tellg() << " data_type=" << data_type);
|
||||||
uint32_t length;
|
uint32_t length;
|
||||||
readRaw(in, length);
|
readRaw(in, length);
|
||||||
SG_LOG(SG_SYSTEMS, SG_DEBUG, "length=" << length);
|
SG_LOG(SG_SYSTEMS, SG_DEBUG, "length=" << length);
|
||||||
if (!in) break;
|
if (!in) break;
|
||||||
if (load_signals && !strcmp(data_type, "signals"))
|
if (load_signals && data_type == "signals")
|
||||||
{
|
{
|
||||||
ret->raw_data.resize(length);
|
ret->raw_data.resize(length);
|
||||||
in.read(&ret->raw_data.front(), ret->raw_data.size());
|
in.read(&ret->raw_data.front(), ret->raw_data.size());
|
||||||
}
|
}
|
||||||
else if (load_multiplayer && !strcmp(data_type, "multiplayer"))
|
else if (load_multiplayer && data_type == "multiplayer")
|
||||||
{
|
{
|
||||||
/* Multiplayer information is a vector of vectors. */
|
/* Multiplayer information is a vector of vectors. */
|
||||||
ret->multiplayer_messages.clear();
|
ret->multiplayer_messages.clear();
|
||||||
|
@ -168,7 +168,7 @@ static bool ReadFGReplayData2(
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (load_extra_properties && !strcmp(data_type, "extra-properties"))
|
else if (load_extra_properties && data_type == "extra-properties")
|
||||||
{
|
{
|
||||||
ReadFGReplayDataExtraProperties(in, ret, length);
|
ReadFGReplayDataExtraProperties(in, ret, length);
|
||||||
}
|
}
|
||||||
|
@ -439,14 +439,14 @@ static void writeFrame2(FGReplayData* r, std::ostream& out, SGPropertyNode_ptr c
|
||||||
{
|
{
|
||||||
for (auto data: config->getChildren("data"))
|
for (auto data: config->getChildren("data"))
|
||||||
{
|
{
|
||||||
const char* data_type = data->getStringValue();
|
std::string data_type = data->getStringValue();
|
||||||
if (!strcmp(data_type, "signals"))
|
if (data_type == "signals")
|
||||||
{
|
{
|
||||||
uint32_t signals_size = r->raw_data.size();
|
uint32_t signals_size = r->raw_data.size();
|
||||||
writeRaw(out, signals_size);
|
writeRaw(out, signals_size);
|
||||||
out.write(&r->raw_data.front(), r->raw_data.size());
|
out.write(&r->raw_data.front(), r->raw_data.size());
|
||||||
}
|
}
|
||||||
else if (!strcmp(data_type, "multiplayer"))
|
else if (data_type == "multiplayer")
|
||||||
{
|
{
|
||||||
uint32_t length = 0;
|
uint32_t length = 0;
|
||||||
for (auto message: r->multiplayer_messages)
|
for (auto message: r->multiplayer_messages)
|
||||||
|
@ -463,7 +463,7 @@ static void writeFrame2(FGReplayData* r, std::ostream& out, SGPropertyNode_ptr c
|
||||||
out.write(&message->front(), message_size);
|
out.write(&message->front(), message_size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!strcmp(data_type, "extra-properties"))
|
else if (data_type == "extra-properties")
|
||||||
{
|
{
|
||||||
uint32_t length = r->extra_properties.size();
|
uint32_t length = r->extra_properties.size();
|
||||||
SG_LOG(SG_SYSTEMS, SG_DEBUG, "data_type=" << data_type << " out.tellp()=" << out.tellp()
|
SG_LOG(SG_SYSTEMS, SG_DEBUG, "data_type=" << data_type << " out.tellp()=" << out.tellp()
|
||||||
|
@ -493,19 +493,19 @@ bool continuousWriteFrame(Continuous& continuous, FGReplayData* r, std::ostream&
|
||||||
bool has_extra_properties = false;
|
bool has_extra_properties = false;
|
||||||
for (auto data: config->getChildren("data"))
|
for (auto data: config->getChildren("data"))
|
||||||
{
|
{
|
||||||
const char* data_type = data->getStringValue();
|
std::string data_type = data->getStringValue();
|
||||||
if (!strcmp(data_type, "signals"))
|
if (data_type == "signals")
|
||||||
{
|
{
|
||||||
has_signals = true;
|
has_signals = true;
|
||||||
}
|
}
|
||||||
else if (!strcmp(data_type, "multiplayer"))
|
else if (data_type == "multiplayer")
|
||||||
{
|
{
|
||||||
if (!r->multiplayer_messages.empty())
|
if (!r->multiplayer_messages.empty())
|
||||||
{
|
{
|
||||||
has_multiplayer = true;
|
has_multiplayer = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!strcmp(data_type, "extra-properties"))
|
else if (data_type == "extra-properties")
|
||||||
{
|
{
|
||||||
if (!r->extra_properties.empty())
|
if (!r->extra_properties.empty())
|
||||||
{
|
{
|
||||||
|
|
|
@ -83,7 +83,7 @@ static void s_RecordPropertyDiffs(
|
||||||
{
|
{
|
||||||
assert(a);
|
assert(a);
|
||||||
assert(b);
|
assert(b);
|
||||||
assert(!strcmp(a->getName(), b->getName()));
|
assert(a->getNameString() == b->getNameString());
|
||||||
assert(a->getPath() == b->getPath());
|
assert(a->getPath() == b->getPath());
|
||||||
assert(a->getIndex() == b->getIndex());
|
assert(a->getIndex() == b->getIndex());
|
||||||
|
|
||||||
|
@ -96,9 +96,9 @@ static void s_RecordPropertyDiffs(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// If values differ, write a's value to out and change b's value to a's value.
|
// If values differ, write a's value to out and change b's value to a's value.
|
||||||
const char* a_value = a->getStringValue();
|
const std::string a_value = a->getStringValue();
|
||||||
const char* b_value = b->getStringValue();
|
const std::string b_value = b->getStringValue();
|
||||||
if (strcmp(a_value, b_value)) {
|
if (a_value != b_value) {
|
||||||
// Values are different so write out node <a> and update b.
|
// Values are different so write out node <a> and update b.
|
||||||
SG_LOG(SG_SYSTEMS, SG_DEBUG, "recording property change:"
|
SG_LOG(SG_SYSTEMS, SG_DEBUG, "recording property change:"
|
||||||
<< a->getPath()
|
<< a->getPath()
|
||||||
|
@ -114,7 +114,7 @@ static void s_RecordPropertyDiffs(
|
||||||
int bn = b->nChildren();
|
int bn = b->nChildren();
|
||||||
for (int i=0; i<bn; ++i) {
|
for (int i=0; i<bn; ++i) {
|
||||||
SGPropertyNode* bc = b->getChild(i);
|
SGPropertyNode* bc = b->getChild(i);
|
||||||
SGPropertyNode* ac = a->getChild(bc->getName(), bc->getIndex(), false /*create*/);
|
SGPropertyNode* ac = a->getChild(bc->getNameString(), bc->getIndex(), false /*create*/);
|
||||||
if (!ac) {
|
if (!ac) {
|
||||||
// Child node is in b but not in a; we write out special
|
// Child node is in b but not in a; we write out special
|
||||||
// information about the deleted node and remove from b.
|
// information about the deleted node and remove from b.
|
||||||
|
@ -129,7 +129,7 @@ static void s_RecordPropertyDiffs(
|
||||||
int an = a->nChildren();
|
int an = a->nChildren();
|
||||||
for (int i=0; i<an; ++i) {
|
for (int i=0; i<an; ++i) {
|
||||||
SGPropertyNode* ac = a->getChild(i);
|
SGPropertyNode* ac = a->getChild(i);
|
||||||
SGPropertyNode* bc = b->getChild(ac->getName(), ac->getIndex(), true /*create*/);
|
SGPropertyNode* bc = b->getChild(ac->getNameString(), ac->getIndex(), true /*create*/);
|
||||||
// Recurse.
|
// Recurse.
|
||||||
s_RecordPropertyDiffs(out, ac, bc, path_exclude_prefixes);
|
s_RecordPropertyDiffs(out, ac, bc, path_exclude_prefixes);
|
||||||
}
|
}
|
||||||
|
@ -282,7 +282,7 @@ FGFlightRecorder::reinit(SGPropertyNode_ptr ConfigNode)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// set name of active flight recorder type
|
// set name of active flight recorder type
|
||||||
const char* pRecorderName =
|
const std::string pRecorderName =
|
||||||
m_ConfigNode->getStringValue("name",
|
m_ConfigNode->getStringValue("name",
|
||||||
"aircraft-specific flight recorder");
|
"aircraft-specific flight recorder");
|
||||||
SG_LOG(SG_SYSTEMS, SG_INFO, "FlightRecorder: Using custom recorder configuration: " << pRecorderName);
|
SG_LOG(SG_SYSTEMS, SG_INFO, "FlightRecorder: Using custom recorder configuration: " << pRecorderName);
|
||||||
|
@ -357,8 +357,8 @@ FGFlightRecorder::getDefault(void)
|
||||||
// set name of active flight recorder type
|
// set name of active flight recorder type
|
||||||
SG_LOG(SG_SYSTEMS, SG_INFO, "FlightRecorder: No custom configuration. Loading generic default recorder.");
|
SG_LOG(SG_SYSTEMS, SG_INFO, "FlightRecorder: No custom configuration. Loading generic default recorder.");
|
||||||
|
|
||||||
const char* Path = m_RecorderNode->getStringValue("default-config",NULL);
|
const std::string Path = m_RecorderNode->getStringValue("default-config", "");
|
||||||
if (!Path)
|
if (Path.empty())
|
||||||
{
|
{
|
||||||
SG_LOG(SG_SYSTEMS, SG_ALERT, "FlightRecorder: No default flight recorder specified! Check defaults.xml!");
|
SG_LOG(SG_SYSTEMS, SG_ALERT, "FlightRecorder: No default flight recorder specified! Check defaults.xml!");
|
||||||
}
|
}
|
||||||
|
@ -423,13 +423,13 @@ FGFlightRecorder::processSignalList(const char* pSignalType, TSignalList& Signal
|
||||||
{
|
{
|
||||||
SignalNode = SignalListNode->getChild("signal",Index,false);
|
SignalNode = SignalListNode->getChild("signal",Index,false);
|
||||||
if (SignalNode.valid()&&
|
if (SignalNode.valid()&&
|
||||||
(0==strcmp(pSignalType, SignalNode->getStringValue("type","float"))))
|
(std::string(pSignalType) == SignalNode->getStringValue("type", "float")))
|
||||||
{
|
{
|
||||||
string PropertyPath = SignalNode->getStringValue("property","");
|
string PropertyPath = SignalNode->getStringValue("property", "");
|
||||||
if (!PropertyPath.empty())
|
if (!PropertyPath.empty())
|
||||||
{
|
{
|
||||||
PropertyPath = PropPrefix + PropertyPath;
|
PropertyPath = PropPrefix + PropertyPath;
|
||||||
const char* pInterpolation = SignalNode->getStringValue("interpolation","linear");
|
const std::string pInterpolation = SignalNode->getStringValue("interpolation", "linear");
|
||||||
|
|
||||||
// Check if current signal has a "%i" place holder. Otherwise count is 1.
|
// Check if current signal has a "%i" place holder. Otherwise count is 1.
|
||||||
string::size_type IndexPos = PropertyPath.find("%i");
|
string::size_type IndexPos = PropertyPath.find("%i");
|
||||||
|
@ -462,17 +462,17 @@ FGFlightRecorder::processSignalList(const char* pSignalType, TSignalList& Signal
|
||||||
Capture.Signal = fgGetNode(PPath.c_str(),true);
|
Capture.Signal = fgGetNode(PPath.c_str(),true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (0==strcmp(pInterpolation,"discrete"))
|
if (pInterpolation == "discrete")
|
||||||
Capture.Interpolation = discrete;
|
Capture.Interpolation = discrete;
|
||||||
else
|
else
|
||||||
if ((0==strcmp(pInterpolation,"angular"))||
|
if ((pInterpolation == "angular")||
|
||||||
(0==strcmp(pInterpolation,"angular-rad")))
|
(pInterpolation == "angular-rad"))
|
||||||
Capture.Interpolation = angular_rad;
|
Capture.Interpolation = angular_rad;
|
||||||
else
|
else
|
||||||
if (0==strcmp(pInterpolation,"angular-deg"))
|
if (pInterpolation == "angular-deg")
|
||||||
Capture.Interpolation = angular_deg;
|
Capture.Interpolation = angular_deg;
|
||||||
else
|
else
|
||||||
if (0==strcmp(pInterpolation,"linear"))
|
if (pInterpolation == "linear")
|
||||||
Capture.Interpolation = linear;
|
Capture.Interpolation = linear;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -198,8 +198,8 @@ static void popupTip(const char* message, int delay)
|
||||||
|
|
||||||
SGPath makeSavePath(FGTapeType type, SGPath* path_timeless)
|
SGPath makeSavePath(FGTapeType type, SGPath* path_timeless)
|
||||||
{
|
{
|
||||||
const char* tape_directory = fgGetString("/sim/replay/tape-directory", "");
|
std::string tape_directory = fgGetString("/sim/replay/tape-directory", "");
|
||||||
const char* aircraftType = fgGetString("/sim/aircraft", "unknown");
|
std::string aircraftType = fgGetString("/sim/aircraft", "unknown");
|
||||||
if (path_timeless) *path_timeless = "";
|
if (path_timeless) *path_timeless = "";
|
||||||
SGPath path = SGPath(tape_directory);
|
SGPath path = SGPath(tape_directory);
|
||||||
path.append(aircraftType);
|
path.append(aircraftType);
|
||||||
|
@ -296,10 +296,10 @@ static void loadMessages(FGReplayInternal& self)
|
||||||
|
|
||||||
for (auto it = msgs.begin(); it != msgs.end();++it)
|
for (auto it = msgs.begin(); it != msgs.end();++it)
|
||||||
{
|
{
|
||||||
const char* msgText = (*it)->getStringValue("text", "");
|
std::string msgText = (*it)->getStringValue("text", "");
|
||||||
const double msgTime = (*it)->getDoubleValue("time", -1.0);
|
const double msgTime = (*it)->getDoubleValue("time", -1.0);
|
||||||
const char* msgSpeaker = (*it)->getStringValue("speaker", "pilot");
|
std::string msgSpeaker = (*it)->getStringValue("speaker", "pilot");
|
||||||
if (msgText[0] != 0 && msgTime >= 0)
|
if (!msgText.empty() && msgTime >= 0)
|
||||||
{
|
{
|
||||||
FGReplayMessages data;
|
FGReplayMessages data;
|
||||||
data.sim_time = msgTime;
|
data.sim_time = msgTime;
|
||||||
|
@ -605,7 +605,7 @@ static bool saveRawReplayData(
|
||||||
for (auto data: meta->getNode("meta")->getChildren("data"))
|
for (auto data: meta->getNode("meta")->getChildren("data"))
|
||||||
{
|
{
|
||||||
SG_LOG(SG_SYSTEMS, SG_DEBUG, "data->getStringValue()=" << data->getStringValue());
|
SG_LOG(SG_SYSTEMS, SG_DEBUG, "data->getStringValue()=" << data->getStringValue());
|
||||||
if (!strcmp(data->getStringValue(), "multiplayer"))
|
if (data->getStringValue() == "multiplayer")
|
||||||
{
|
{
|
||||||
uint32_t length = 0;
|
uint32_t length = 0;
|
||||||
for (auto message: frame->multiplayer_messages)
|
for (auto message: frame->multiplayer_messages)
|
||||||
|
@ -1622,19 +1622,20 @@ static void indexContinuousRecording(FGReplayInternal& self, const void* data, s
|
||||||
}
|
}
|
||||||
if (length)
|
if (length)
|
||||||
{
|
{
|
||||||
stats[data->getStringValue()].num_frames += 1;
|
std::string data_type = data->getStringValue();
|
||||||
stats[data->getStringValue()].bytes += length;
|
stats[data_type].num_frames += 1;
|
||||||
if (!strcmp(data->getStringValue(), "signals"))
|
stats[data_type].bytes += length;
|
||||||
|
if (data_type == "signals")
|
||||||
{
|
{
|
||||||
frameinfo.has_signals = true;
|
frameinfo.has_signals = true;
|
||||||
}
|
}
|
||||||
else if (!strcmp(data->getStringValue(), "multiplayer"))
|
else if (data_type == "multiplayer")
|
||||||
{
|
{
|
||||||
frameinfo.has_multiplayer = true;
|
frameinfo.has_multiplayer = true;
|
||||||
++self.m_continuous->m_num_frames_multiplayer;
|
++self.m_continuous->m_num_frames_multiplayer;
|
||||||
self.m_continuous->m_in_multiplayer = true;
|
self.m_continuous->m_in_multiplayer = true;
|
||||||
}
|
}
|
||||||
else if (!strcmp(data->getStringValue(), "extra-properties"))
|
else if (data_type == "extra-properties")
|
||||||
{
|
{
|
||||||
frameinfo.has_extra_properties = true;
|
frameinfo.has_extra_properties = true;
|
||||||
++self.m_continuous->m_num_frames_extra_properties;
|
++self.m_continuous->m_num_frames_extra_properties;
|
||||||
|
@ -2012,7 +2013,7 @@ FGReplayInternal::loadTape(
|
||||||
bool multiplayer = false;
|
bool multiplayer = false;
|
||||||
for (auto data: meta_meta.getChildren("data"))
|
for (auto data: meta_meta.getChildren("data"))
|
||||||
{
|
{
|
||||||
if (!strcmp(data->getStringValue(), "multiplayer"))
|
if (data->getStringValue() == "multiplayer")
|
||||||
{
|
{
|
||||||
multiplayer = true;
|
multiplayer = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -167,7 +167,7 @@ Autopilot::Autopilot( SGPropertyNode_ptr rootNode, SGPropertyNode_ptr configNode
|
||||||
for( int i = 0; i < count; ++i )
|
for( int i = 0; i < count; ++i )
|
||||||
{
|
{
|
||||||
SGPropertyNode_ptr node = configNode->getChild(i);
|
SGPropertyNode_ptr node = configNode->getChild(i);
|
||||||
string childName = node->getName();
|
string childName = node->getNameString();
|
||||||
if( childName == "property"
|
if( childName == "property"
|
||||||
|| childName == "property-root" )
|
|| childName == "property-root" )
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -187,7 +187,7 @@ void FGXMLAutopilotGroupImplementation::initFrom( SGPropertyNode_ptr rootNode,
|
||||||
|
|
||||||
void FGXMLAutopilotGroup::addAutopilotFromFile( const std::string& name,
|
void FGXMLAutopilotGroup::addAutopilotFromFile( const std::string& name,
|
||||||
SGPropertyNode_ptr apNode,
|
SGPropertyNode_ptr apNode,
|
||||||
const char* path )
|
const std::string& path )
|
||||||
{
|
{
|
||||||
SGPath config = globals->resolve_maybe_aircraft_path(path);
|
SGPath config = globals->resolve_maybe_aircraft_path(path);
|
||||||
if( config.isNull() )
|
if( config.isNull() )
|
||||||
|
|
|
@ -36,7 +36,7 @@ public:
|
||||||
|
|
||||||
static FGXMLAutopilotGroup * createInstance(const std::string& nodeName);
|
static FGXMLAutopilotGroup * createInstance(const std::string& nodeName);
|
||||||
|
|
||||||
void addAutopilotFromFile( const std::string & name, SGPropertyNode_ptr apNode, const char * path );
|
void addAutopilotFromFile( const std::string & name, SGPropertyNode_ptr apNode, const std::string& path );
|
||||||
virtual void addAutopilot( const std::string & name, SGPropertyNode_ptr apNode, SGPropertyNode_ptr config ) = 0;
|
virtual void addAutopilot( const std::string & name, SGPropertyNode_ptr apNode, SGPropertyNode_ptr config ) = 0;
|
||||||
virtual void removeAutopilot( const std::string & name ) = 0;
|
virtual void removeAutopilot( const std::string & name ) = 0;
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ bool Component::configure( SGPropertyNode& prop_root,
|
||||||
for( int i = 0; i < cfg.nChildren(); ++i )
|
for( int i = 0; i < cfg.nChildren(); ++i )
|
||||||
{
|
{
|
||||||
SGPropertyNode_ptr child = cfg.getChild(i);
|
SGPropertyNode_ptr child = cfg.getChild(i);
|
||||||
std::string cname(child->getName());
|
std::string cname(child->getNameString());
|
||||||
|
|
||||||
if( !configure(*child, cname, prop_root)
|
if( !configure(*child, cname, prop_root)
|
||||||
&& cname != "params" ) // 'params' is usually used to specify parameters
|
&& cname != "params" ) // 'params' is usually used to specify parameters
|
||||||
|
|
|
@ -903,7 +903,7 @@ bool DigitalFilter::configure( SGPropertyNode& prop_root,
|
||||||
for( int i = 0; i < cfg.nChildren(); ++i )
|
for( int i = 0; i < cfg.nChildren(); ++i )
|
||||||
{
|
{
|
||||||
SGPropertyNode_ptr child = cfg.getChild(i);
|
SGPropertyNode_ptr child = cfg.getChild(i);
|
||||||
std::string cname(child->getName());
|
std::string cname(child->getNameString());
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
if (!ok) ok = _implementation->configure(*child, cname, prop_root);
|
if (!ok) ok = _implementation->configure(*child, cname, prop_root);
|
||||||
if (!ok) ok = configure(*child, cname, prop_root);
|
if (!ok) ok = configure(*child, cname, prop_root);
|
||||||
|
|
|
@ -383,7 +383,7 @@ bool FlipFlopImplementation::configure( SGPropertyNode& prop_root,
|
||||||
for( int i = 0; i < cfg.nChildren(); ++i )
|
for( int i = 0; i < cfg.nChildren(); ++i )
|
||||||
{
|
{
|
||||||
SGPropertyNode_ptr child = cfg.getChild(i);
|
SGPropertyNode_ptr child = cfg.getChild(i);
|
||||||
string cname(child->getName());
|
string cname(child->getNameString());
|
||||||
|
|
||||||
if( configure(*child, cname, prop_root) )
|
if( configure(*child, cname, prop_root) )
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -154,13 +154,13 @@ void InputValue::parse( SGPropertyNode& prop_root,
|
||||||
if( !valueNode )
|
if( !valueNode )
|
||||||
{
|
{
|
||||||
// no <value>, <prop> or <expression> element, use text node
|
// no <value>, <prop> or <expression> element, use text node
|
||||||
const char * textnode = cfg.getStringValue();
|
std::string textnode = cfg.getStringValue();
|
||||||
char * endp = NULL;
|
char * endp = NULL;
|
||||||
// try to convert to a double value. If the textnode does not start with a number
|
// try to convert to a double value. If the textnode does not start with a number
|
||||||
// endp will point to the beginning of the string. We assume this should be
|
// endp will point to the beginning of the string. We assume this should be
|
||||||
// a property name
|
// a property name
|
||||||
_value = strtod( textnode, &endp );
|
_value = strtod( textnode.c_str(), &endp );
|
||||||
if( endp == textnode )
|
if( endp == textnode.c_str() )
|
||||||
_property = prop_root.getNode(textnode, true);
|
_property = prop_root.getNode(textnode, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -131,7 +131,7 @@ static string formatPropertyValue(SGPropertyNode* nd, const string& format)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (format.find('s') != string::npos) {
|
if (format.find('s') != string::npos) {
|
||||||
::snprintf(buf, 512, format.c_str(), nd->getStringValue());
|
::snprintf(buf, 512, format.c_str(), nd->getStringValue().c_str());
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -466,8 +466,8 @@ NavDisplay::NavDisplay(SGPropertyNode *node) :
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* id = symbol->getStringValue("id");
|
string id = symbol->getStringValue("id", "");
|
||||||
if (id && strlen(id)) {
|
if (!id.empty()) {
|
||||||
definitionDict[id] = def;
|
definitionDict[id] = def;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -481,8 +481,8 @@ NavDisplay::NavDisplay(SGPropertyNode *node) :
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* id = rule->getStringValue("symbol");
|
string id = rule->getStringValue("symbol", "");
|
||||||
if (id && strlen(id) && (definitionDict.find(id) != definitionDict.end())) {
|
if (!id.empty() && (definitionDict.find(id) != definitionDict.end())) {
|
||||||
r->setDefinition(definitionDict[id]);
|
r->setDefinition(definitionDict[id]);
|
||||||
} else {
|
} else {
|
||||||
SG_LOG(SG_INSTR, SG_WARN, "symbol rule has missing/unknown definition id:" << id);
|
SG_LOG(SG_INSTR, SG_WARN, "symbol rule has missing/unknown definition id:" << id);
|
||||||
|
@ -1305,11 +1305,11 @@ void NavDisplay::computePositionedState(FGPositioned* pos, string_set& states)
|
||||||
static string mapAINodeToType(SGPropertyNode* model)
|
static string mapAINodeToType(SGPropertyNode* model)
|
||||||
{
|
{
|
||||||
// assume all multiplayer items are aircraft for the moment. Not ideal.
|
// assume all multiplayer items are aircraft for the moment. Not ideal.
|
||||||
if (!strcmp(model->getName(), "multiplayer")) {
|
if (model->getNameString() == "multiplayer") {
|
||||||
return "ai-aircraft";
|
return "ai-aircraft";
|
||||||
}
|
}
|
||||||
|
|
||||||
return string("ai-") + model->getName();
|
return string("ai-") + model->getNameString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void NavDisplay::processAI()
|
void NavDisplay::processAI()
|
||||||
|
@ -1464,7 +1464,7 @@ void NavDisplay::processCustomSymbols()
|
||||||
string_set ss;
|
string_set ss;
|
||||||
computeCustomSymbolStates(symNode, ss);
|
computeCustomSymbolStates(symNode, ss);
|
||||||
SymbolRuleVector rules;
|
SymbolRuleVector rules;
|
||||||
findRules(symNode->getName(), ss, rules);
|
findRules(symNode->getNameString(), ss, rules);
|
||||||
if (rules.empty()) {
|
if (rules.empty()) {
|
||||||
return; // no rules matched, we can skip this item
|
return; // no rules matched, we can skip this item
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,7 +89,7 @@ bool CockpitDisplayManager::build (SGPropertyNode* config_props)
|
||||||
{
|
{
|
||||||
for ( int i = 0; i < config_props->nChildren(); ++i ) {
|
for ( int i = 0; i < config_props->nChildren(); ++i ) {
|
||||||
SGPropertyNode *node = config_props->getChild(i);
|
SGPropertyNode *node = config_props->getChild(i);
|
||||||
std::string name = node->getName();
|
std::string name = node->getNameString();
|
||||||
|
|
||||||
std::ostringstream subsystemname;
|
std::ostringstream subsystemname;
|
||||||
subsystemname << "instrument-" << i << '-'
|
subsystemname << "instrument-" << i << '-'
|
||||||
|
|
|
@ -92,7 +92,7 @@ inline static osg::Vec3 fromPolar(double fi, double r)
|
||||||
return osg::Vec3(sin(fi * SGD_DEGREES_TO_RADIANS) * r, cos(fi * SGD_DEGREES_TO_RADIANS) * r, 0);
|
return osg::Vec3(sin(fi * SGD_DEGREES_TO_RADIANS) * r, cos(fi * SGD_DEGREES_TO_RADIANS) * r, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GroundRadar::createTexture(const char* texture_name)
|
void GroundRadar::createTexture(const std::string& texture_name)
|
||||||
{
|
{
|
||||||
setSize(TextureHalfSize + TextureHalfSize);
|
setSize(TextureHalfSize + TextureHalfSize);
|
||||||
allocRT();
|
allocRT();
|
||||||
|
|
|
@ -52,7 +52,7 @@ public:
|
||||||
virtual void update (double dt);
|
virtual void update (double dt);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void createTexture(const char* texture_name);
|
void createTexture(const std::string& texture_name);
|
||||||
|
|
||||||
void addRunwayVertices(const FGRunwayBase* aRunway, double aTowerLat, double aTowerLon, double aScale, osg::Vec3Array* aVertices);
|
void addRunwayVertices(const FGRunwayBase* aRunway, double aTowerLat, double aTowerLon, double aScale, osg::Vec3Array* aVertices);
|
||||||
osg::Geometry *addPavementGeometry(const FGPavement* aPavement, double aTowerLat, double aTowerLon, double aScale);
|
osg::Geometry *addPavementGeometry(const FGPavement* aPavement, double aTowerLat, double aTowerLon, double aScale);
|
||||||
|
|
|
@ -1205,7 +1205,7 @@ FGTextLayer::Chunk::getValue () const
|
||||||
sprintf(_buf, _fmt.c_str(), _text.c_str());
|
sprintf(_buf, _fmt.c_str(), _text.c_str());
|
||||||
return _buf;
|
return _buf;
|
||||||
case TEXT_VALUE:
|
case TEXT_VALUE:
|
||||||
sprintf(_buf, _fmt.c_str(), _node->getStringValue());
|
sprintf(_buf, _fmt.c_str(), _node->getStringValue().c_str());
|
||||||
break;
|
break;
|
||||||
case DOUBLE_VALUE:
|
case DOUBLE_VALUE:
|
||||||
double d = _offs + _node->getFloatValue() * _mult;
|
double d = _offs + _node->getFloatValue() * _mult;
|
||||||
|
|
|
@ -115,7 +115,7 @@ readTexture (const SGPropertyNode * node)
|
||||||
node->getFloatValue("y1"),
|
node->getFloatValue("y1"),
|
||||||
node->getFloatValue("x2", 1.0),
|
node->getFloatValue("x2", 1.0),
|
||||||
node->getFloatValue("y2", 1.0));
|
node->getFloatValue("y2", 1.0));
|
||||||
SG_LOG(SG_COCKPIT, SG_DEBUG, "Read texture " << node->getName());
|
SG_LOG(SG_COCKPIT, SG_DEBUG, "Read texture " << node->getNameString());
|
||||||
return texture;
|
return texture;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -255,7 +255,7 @@ readTransformation (const SGPropertyNode * node, float w_scale, float h_scale)
|
||||||
{
|
{
|
||||||
FGPanelTransformation * t = new FGPanelTransformation;
|
FGPanelTransformation * t = new FGPanelTransformation;
|
||||||
|
|
||||||
string name = node->getName();
|
string name = node->getNameString();
|
||||||
string type = node->getStringValue("type");
|
string type = node->getStringValue("type");
|
||||||
string propName = node->getStringValue("property", "");
|
string propName = node->getStringValue("property", "");
|
||||||
SGPropertyNode * target = 0;
|
SGPropertyNode * target = 0;
|
||||||
|
@ -454,7 +454,7 @@ readLayer (const SGPropertyNode * node, float w_scale, float h_scale)
|
||||||
layer = new FGGroupLayer();
|
layer = new FGGroupLayer();
|
||||||
for (int i = 0; i < node->nChildren(); i++) {
|
for (int i = 0; i < node->nChildren(); i++) {
|
||||||
const SGPropertyNode * child = node->getChild(i);
|
const SGPropertyNode * child = node->getChild(i);
|
||||||
if (!strcmp(child->getName(), "layer"))
|
if (child->getNameString() == "layer")
|
||||||
((FGGroupLayer *)layer)->addLayer(readLayer(child, w_scale, h_scale));
|
((FGGroupLayer *)layer)->addLayer(readLayer(child, w_scale, h_scale));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -483,12 +483,12 @@ readLayer (const SGPropertyNode * node, float w_scale, float h_scale)
|
||||||
int nChunks = chunk_group->nChildren();
|
int nChunks = chunk_group->nChildren();
|
||||||
for (int i = 0; i < nChunks; i++) {
|
for (int i = 0; i < nChunks; i++) {
|
||||||
const SGPropertyNode * node = chunk_group->getChild(i);
|
const SGPropertyNode * node = chunk_group->getChild(i);
|
||||||
if (!strcmp(node->getName(), "chunk")) {
|
if (node->getNameString() == "chunk") {
|
||||||
FGTextLayer::Chunk * chunk = readTextChunk(node);
|
FGTextLayer::Chunk * chunk = readTextChunk(node);
|
||||||
if (chunk != 0)
|
if (chunk != 0)
|
||||||
tlayer->addChunk(chunk);
|
tlayer->addChunk(chunk);
|
||||||
} else {
|
} else {
|
||||||
SG_LOG( SG_COCKPIT, SG_INFO, "Skipping " << node->getName()
|
SG_LOG( SG_COCKPIT, SG_INFO, "Skipping " << node->getNameString()
|
||||||
<< " in chunks" );
|
<< " in chunks" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -501,7 +501,7 @@ readLayer (const SGPropertyNode * node, float w_scale, float h_scale)
|
||||||
layer = new FGSwitchLayer();
|
layer = new FGSwitchLayer();
|
||||||
for (int i = 0; i < node->nChildren(); i++) {
|
for (int i = 0; i < node->nChildren(); i++) {
|
||||||
const SGPropertyNode * child = node->getChild(i);
|
const SGPropertyNode * child = node->getChild(i);
|
||||||
if (!strcmp(child->getName(), "layer"))
|
if (child->getNameString() == "layer")
|
||||||
((FGGroupLayer *)layer)->addLayer(readLayer(child, w_scale, h_scale));
|
((FGGroupLayer *)layer)->addLayer(readLayer(child, w_scale, h_scale));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -542,12 +542,12 @@ readLayer (const SGPropertyNode * node, float w_scale, float h_scale)
|
||||||
int nTransformations = trans_group->nChildren();
|
int nTransformations = trans_group->nChildren();
|
||||||
for (int i = 0; i < nTransformations; i++) {
|
for (int i = 0; i < nTransformations; i++) {
|
||||||
const SGPropertyNode * node = trans_group->getChild(i);
|
const SGPropertyNode * node = trans_group->getChild(i);
|
||||||
if (!strcmp(node->getName(), "transformation")) {
|
if (node->getNameString() == "transformation") {
|
||||||
FGPanelTransformation * t = readTransformation(node, w_scale, h_scale);
|
FGPanelTransformation * t = readTransformation(node, w_scale, h_scale);
|
||||||
if (t != 0)
|
if (t != 0)
|
||||||
layer->addTransformation(t);
|
layer->addTransformation(t);
|
||||||
} else {
|
} else {
|
||||||
SG_LOG( SG_COCKPIT, SG_INFO, "Skipping " << node->getName()
|
SG_LOG( SG_COCKPIT, SG_INFO, "Skipping " << node->getNameString()
|
||||||
<< " in transformations" );
|
<< " in transformations" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -611,12 +611,12 @@ readInstrument (const SGPropertyNode * node, const SGPath& path)
|
||||||
int nActions = action_group->nChildren();
|
int nActions = action_group->nChildren();
|
||||||
for (int i = 0; i < nActions; i++) {
|
for (int i = 0; i < nActions; i++) {
|
||||||
const SGPropertyNode * node = action_group->getChild(i);
|
const SGPropertyNode * node = action_group->getChild(i);
|
||||||
if (!strcmp(node->getName(), "action")) {
|
if (node->getNameString() == "action") {
|
||||||
FGPanelAction * action = readAction(node, w_scale, h_scale);
|
FGPanelAction * action = readAction(node, w_scale, h_scale);
|
||||||
if (action != 0)
|
if (action != 0)
|
||||||
instrument->addAction(action);
|
instrument->addAction(action);
|
||||||
} else {
|
} else {
|
||||||
SG_LOG( SG_COCKPIT, SG_INFO, "Skipping " << node->getName()
|
SG_LOG( SG_COCKPIT, SG_INFO, "Skipping " << node->getNameString()
|
||||||
<< " in actions" );
|
<< " in actions" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -630,12 +630,12 @@ readInstrument (const SGPropertyNode * node, const SGPath& path)
|
||||||
int nLayers = layer_group->nChildren();
|
int nLayers = layer_group->nChildren();
|
||||||
for (int i = 0; i < nLayers; i++) {
|
for (int i = 0; i < nLayers; i++) {
|
||||||
const SGPropertyNode * node = layer_group->getChild(i);
|
const SGPropertyNode * node = layer_group->getChild(i);
|
||||||
if (!strcmp(node->getName(), "layer")) {
|
if (node->getNameString() == "layer") {
|
||||||
FGInstrumentLayer * layer = readLayer(node, w_scale, h_scale);
|
FGInstrumentLayer * layer = readLayer(node, w_scale, h_scale);
|
||||||
if (layer != 0)
|
if (layer != 0)
|
||||||
instrument->addLayer(layer);
|
instrument->addLayer(layer);
|
||||||
} else {
|
} else {
|
||||||
SG_LOG( SG_COCKPIT, SG_INFO, "Skipping " << node->getName()
|
SG_LOG( SG_COCKPIT, SG_INFO, "Skipping " << node->getNameString()
|
||||||
<< " in layers" );
|
<< " in layers" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -741,11 +741,11 @@ readPanel (const SGPropertyNode * root, const SGPath& path)
|
||||||
int nInstruments = instrument_group->nChildren();
|
int nInstruments = instrument_group->nChildren();
|
||||||
for (int i = 0; i < nInstruments; i++) {
|
for (int i = 0; i < nInstruments; i++) {
|
||||||
const SGPropertyNode * node = instrument_group->getChild(i);
|
const SGPropertyNode * node = instrument_group->getChild(i);
|
||||||
if (!strcmp(node->getName(), "instrument")) {
|
if (node->getNameString() == "instrument") {
|
||||||
FGPanelInstrument * instrument = readInstrument(node, path);
|
FGPanelInstrument * instrument = readInstrument(node, path);
|
||||||
if (instrument != 0)
|
if (instrument != 0)
|
||||||
panel->addInstrument(instrument);
|
panel->addInstrument(instrument);
|
||||||
} else if (!strcmp(node->getName(), "special-instrument")) {
|
} else if (node->getNameString() == "special-instrument") {
|
||||||
//cout << "Special instrument found in instruments section!\n";
|
//cout << "Special instrument found in instruments section!\n";
|
||||||
const string name = node->getStringValue("name");
|
const string name = node->getStringValue("name");
|
||||||
if (name == "KLN89 GPS") {
|
if (name == "KLN89 GPS") {
|
||||||
|
@ -791,7 +791,7 @@ readPanel (const SGPropertyNode * root, const SGPath& path)
|
||||||
SG_LOG( SG_COCKPIT, SG_WARN, "Unknown special instrument found" );
|
SG_LOG( SG_COCKPIT, SG_WARN, "Unknown special instrument found" );
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
SG_LOG( SG_COCKPIT, SG_WARN, "Skipping " << node->getName()
|
SG_LOG( SG_COCKPIT, SG_WARN, "Skipping " << node->getNameString()
|
||||||
<< " in instruments section" );
|
<< " in instruments section" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,7 +96,7 @@ wxRadarBg::wxRadarBg(SGPropertyNode *node) :
|
||||||
branch = "/instrumentation/" + _name;
|
branch = "/instrumentation/" + _name;
|
||||||
_Instrument = fgGetNode(branch.c_str(), _num, true);
|
_Instrument = fgGetNode(branch.c_str(), _num, true);
|
||||||
|
|
||||||
const char *tacan_source = node->getStringValue("tacan-source", "/instrumentation/tacan");
|
string tacan_source = node->getStringValue("tacan-source", "/instrumentation/tacan");
|
||||||
_Tacan = fgGetNode(tacan_source, true);
|
_Tacan = fgGetNode(tacan_source, true);
|
||||||
|
|
||||||
_font_node = _Instrument->getNode("font", true);
|
_font_node = _Instrument->getNode("font", true);
|
||||||
|
@ -596,8 +596,8 @@ wxRadarBg::update_data(const SGPropertyNode *ac, double altitude, double heading
|
||||||
callsign->setAlignment(osgText::Text::LEFT_BOTTOM_BASE_LINE);
|
callsign->setAlignment(osgText::Text::LEFT_BOTTOM_BASE_LINE);
|
||||||
callsign->setLineSpacing(_font_spacing);
|
callsign->setLineSpacing(_font_spacing);
|
||||||
|
|
||||||
const char *identity = ac->getStringValue("transponder-id");
|
string identity = ac->getStringValue("transponder-id", "");
|
||||||
if (!identity[0])
|
if (identity.empty())
|
||||||
identity = ac->getStringValue("callsign");
|
identity = ac->getStringValue("callsign");
|
||||||
|
|
||||||
stringstream text;
|
stringstream text;
|
||||||
|
@ -730,7 +730,7 @@ wxRadarBg::update_aircraft()
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
double echo_radius, sigma;
|
double echo_radius, sigma;
|
||||||
const string name = model->getName();
|
const string name = model->getNameString();
|
||||||
|
|
||||||
//cout << "name "<<name << endl;
|
//cout << "name "<<name << endl;
|
||||||
if (name == "aircraft" || name == "tanker")
|
if (name == "aircraft" || name == "tanker")
|
||||||
|
|
|
@ -115,7 +115,7 @@ double FGClouds::buildCloud(SGPropertyNode *cloud_def_root, SGPropertyNode *box_
|
||||||
|
|
||||||
for(int i = 0; i < box_def->nChildren() ; i++) {
|
for(int i = 0; i < box_def->nChildren() ; i++) {
|
||||||
SGPropertyNode *abox = box_def->getChild(i);
|
SGPropertyNode *abox = box_def->getChild(i);
|
||||||
if( strcmp(abox->getName(), "box") == 0) {
|
if( abox->getNameString() == "box" ) {
|
||||||
|
|
||||||
string type = abox->getStringValue("type", "cu-small");
|
string type = abox->getStringValue("type", "cu-small");
|
||||||
cld_def = cloud_def_root->getChild(type.c_str());
|
cld_def = cloud_def_root->getChild(type.c_str());
|
||||||
|
@ -212,7 +212,7 @@ void FGClouds::buildLayer(int iLayer, const string& name, double coverage) {
|
||||||
|
|
||||||
for(int i = 0; i < layer_def->nChildren() ; i++) {
|
for(int i = 0; i < layer_def->nChildren() ; i++) {
|
||||||
SGPropertyNode *acloud = layer_def->getChild(i);
|
SGPropertyNode *acloud = layer_def->getChild(i);
|
||||||
if( strcmp(acloud->getName(), "cloud") == 0) {
|
if( acloud->getNameString() == "cloud" ) {
|
||||||
string cloud_name = acloud->getStringValue("name");
|
string cloud_name = acloud->getStringValue("name");
|
||||||
tCloudVariety[CloudVarietyCount].name = cloud_name;
|
tCloudVariety[CloudVarietyCount].name = cloud_name;
|
||||||
double count = acloud->getDoubleValue("count", 1.0);
|
double count = acloud->getDoubleValue("count", 1.0);
|
||||||
|
|
|
@ -519,7 +519,7 @@ void FGExternalPipe::update_property( double dt ) {
|
||||||
// Send requested property values to fdm
|
// Send requested property values to fdm
|
||||||
for ( unsigned int i = 0; i < nodes.size(); i++ ) {
|
for ( unsigned int i = 0; i < nodes.size(); i++ ) {
|
||||||
sprintf( cmd, "set %s %s", property_names[i].c_str(),
|
sprintf( cmd, "set %s %s", property_names[i].c_str(),
|
||||||
nodes[i]->getStringValue() );
|
nodes[i]->getStringValue().c_str() );
|
||||||
// cout << " sending " << cmd << endl;
|
// cout << " sending " << cmd << endl;
|
||||||
result = write_property( pd1, cmd );
|
result = write_property( pd1, cmd );
|
||||||
}
|
}
|
||||||
|
|
|
@ -922,7 +922,7 @@ void FGFDMExec::BuildPropertyCatalog(struct PropertyCatalogStructure* pcs)
|
||||||
|
|
||||||
for (int i=0; i<pcs->node->nChildren(); i++) {
|
for (int i=0; i<pcs->node->nChildren(); i++) {
|
||||||
string access="";
|
string access="";
|
||||||
pcsNew->base_string = pcs->base_string + "/" + pcs->node->getChild(i)->getName();
|
pcsNew->base_string = pcs->base_string + "/" + pcs->node->getChild(i)->getNameString();
|
||||||
int node_idx = pcs->node->getChild(i)->getIndex();
|
int node_idx = pcs->node->getChild(i)->getIndex();
|
||||||
if (node_idx != 0) {
|
if (node_idx != 0) {
|
||||||
pcsNew->base_string = CreateIndexedPropertyName(pcsNew->base_string, node_idx);
|
pcsNew->base_string = CreateIndexedPropertyName(pcsNew->base_string, node_idx);
|
||||||
|
|
|
@ -112,14 +112,14 @@ bool FGPropertyNode::HasNode (const string &path)
|
||||||
|
|
||||||
string FGPropertyNode::GetName( void ) const
|
string FGPropertyNode::GetName( void ) const
|
||||||
{
|
{
|
||||||
return string( getName() );
|
return getNameString();
|
||||||
}
|
}
|
||||||
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
string FGPropertyNode::GetPrintableName( void ) const
|
string FGPropertyNode::GetPrintableName( void ) const
|
||||||
{
|
{
|
||||||
string temp_string(getName());
|
string temp_string(getNameString());
|
||||||
size_t initial_location=0;
|
size_t initial_location=0;
|
||||||
size_t found_location;
|
size_t found_location;
|
||||||
|
|
||||||
|
|
|
@ -130,7 +130,7 @@ void FGDeadBand::Debug(int from)
|
||||||
cout << " GAIN: " << gain << endl;
|
cout << " GAIN: " << gain << endl;
|
||||||
|
|
||||||
for (auto node: OutputNodes)
|
for (auto node: OutputNodes)
|
||||||
cout << " OUTPUT: " << node->getName() << endl;
|
cout << " OUTPUT: " << node->getNameString() << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (debug_lvl & 2 ) { // Instantiation/Destruction notification
|
if (debug_lvl & 2 ) { // Instantiation/Destruction notification
|
||||||
|
|
|
@ -121,7 +121,7 @@ void FGFCSFunction::Debug(int from)
|
||||||
if (!InputNodes.empty())
|
if (!InputNodes.empty())
|
||||||
cout << " INPUT: " << InputNodes[0]->GetName() << endl;
|
cout << " INPUT: " << InputNodes[0]->GetName() << endl;
|
||||||
for (auto node: OutputNodes)
|
for (auto node: OutputNodes)
|
||||||
cout << " OUTPUT: " << node->getName() << endl;
|
cout << " OUTPUT: " << node->getNameString() << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (debug_lvl & 2 ) { // Instantiation/Destruction notification
|
if (debug_lvl & 2 ) { // Instantiation/Destruction notification
|
||||||
|
|
|
@ -224,7 +224,7 @@ void FGFilter::Debug(int from)
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto node: OutputNodes)
|
for (auto node: OutputNodes)
|
||||||
cout << " OUTPUT: " << node->getName() << endl;
|
cout << " OUTPUT: " << node->getNameString() << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (debug_lvl & 2 ) { // Instantiation/Destruction notification
|
if (debug_lvl & 2 ) { // Instantiation/Destruction notification
|
||||||
|
|
|
@ -198,7 +198,7 @@ void FGGain::Debug(int from)
|
||||||
cout << " GAIN: " << Gain->GetName() << endl;
|
cout << " GAIN: " << Gain->GetName() << endl;
|
||||||
|
|
||||||
for (auto node: OutputNodes)
|
for (auto node: OutputNodes)
|
||||||
cout << " OUTPUT: " << node->getName() << endl;
|
cout << " OUTPUT: " << node->getNameString() << endl;
|
||||||
|
|
||||||
if (Type == "AEROSURFACE_SCALE") {
|
if (Type == "AEROSURFACE_SCALE") {
|
||||||
cout << " In/Out Mapping:" << endl;
|
cout << " In/Out Mapping:" << endl;
|
||||||
|
|
|
@ -190,7 +190,7 @@ void FGKinemat::Debug(int from)
|
||||||
cout << " " << Detents[i] << " " << TransitionTimes[i] << endl;
|
cout << " " << Detents[i] << " " << TransitionTimes[i] << endl;
|
||||||
}
|
}
|
||||||
for (auto node: OutputNodes)
|
for (auto node: OutputNodes)
|
||||||
cout << " OUTPUT: " << node->getName() << endl;
|
cout << " OUTPUT: " << node->getNameString() << endl;
|
||||||
if (!DoScale) cout << " NOSCALE" << endl;
|
if (!DoScale) cout << " NOSCALE" << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -237,7 +237,7 @@ void FGPID::Debug(int from)
|
||||||
cout << " INPUT: " << InputNodes[0]->GetNameWithSign() << endl;
|
cout << " INPUT: " << InputNodes[0]->GetNameWithSign() << endl;
|
||||||
|
|
||||||
for (auto node: OutputNodes)
|
for (auto node: OutputNodes)
|
||||||
cout << " OUTPUT: " << node->getName() << endl;
|
cout << " OUTPUT: " << node->getNameString() << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (debug_lvl & 2 ) { // Instantiation/Destruction notification
|
if (debug_lvl & 2 ) { // Instantiation/Destruction notification
|
||||||
|
|
|
@ -334,7 +334,7 @@ void FGSensor::Debug(int from)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (auto node: OutputNodes)
|
for (auto node: OutputNodes)
|
||||||
cout << " OUTPUT: " << node->getName() << endl;
|
cout << " OUTPUT: " << node->getNameString() << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (debug_lvl & 2 ) { // Instantiation/Destruction notification
|
if (debug_lvl & 2 ) { // Instantiation/Destruction notification
|
||||||
|
|
|
@ -204,7 +204,7 @@ void FGSwitch::Debug(int from)
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
for (auto node: OutputNodes)
|
for (auto node: OutputNodes)
|
||||||
cout << " OUTPUT: " << node->getName() << endl;
|
cout << " OUTPUT: " << node->getNameString() << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (debug_lvl & 2 ) { // Instantiation/Destruction notification
|
if (debug_lvl & 2 ) { // Instantiation/Destruction notification
|
||||||
|
|
|
@ -57,10 +57,10 @@ FGLaRCsim::FGLaRCsim( double dt ) {
|
||||||
aero = fgGetNode("/sim/aero", true);
|
aero = fgGetNode("/sim/aero", true);
|
||||||
uiuc_type = fgGetNode("/sim/uiuc-type", true);
|
uiuc_type = fgGetNode("/sim/uiuc-type", true);
|
||||||
|
|
||||||
ls_toplevel_init( 0.0, (char *)(aero->getStringValue()) );
|
ls_toplevel_init( 0.0, (char *)(aero->getStringValue().c_str()) );
|
||||||
|
|
||||||
lsic=new LaRCsimIC; //this needs to be brought up after LaRCsim is
|
lsic=new LaRCsimIC; //this needs to be brought up after LaRCsim is
|
||||||
if ( !strcmp(aero->getStringValue(), "c172") ) {
|
if ( aero->getStringValue() == "c172" ) {
|
||||||
copy_to_LaRCsim(); // initialize all of LaRCsim's vars
|
copy_to_LaRCsim(); // initialize all of LaRCsim's vars
|
||||||
|
|
||||||
//this should go away someday -- formerly done in fg_init.cxx
|
//this should go away someday -- formerly done in fg_init.cxx
|
||||||
|
@ -71,7 +71,7 @@ FGLaRCsim::FGLaRCsim( double dt ) {
|
||||||
I_xz = 0.000000E+00;
|
I_xz = 0.000000E+00;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !strcmp(aero->getStringValue(), "basic") ) {
|
if ( aero->getStringValue() == "basic" ) {
|
||||||
copy_to_LaRCsim(); // initialize all of LaRCsim's vars
|
copy_to_LaRCsim(); // initialize all of LaRCsim's vars
|
||||||
|
|
||||||
//this should go away someday -- formerly done in fg_init.cxx
|
//this should go away someday -- formerly done in fg_init.cxx
|
||||||
|
@ -119,7 +119,7 @@ void FGLaRCsim::update( double dt ) {
|
||||||
int multiloop = _calc_multiloop(dt);
|
int multiloop = _calc_multiloop(dt);
|
||||||
|
|
||||||
// if flying c172-larcsim, do the following
|
// if flying c172-larcsim, do the following
|
||||||
if ( !strcmp(aero->getStringValue(), "c172") ) {
|
if ( aero->getStringValue() == "c172" ) {
|
||||||
// set control inputs
|
// set control inputs
|
||||||
// cout << "V_calibrated_kts = " << V_calibrated_kts << '\n';
|
// cout << "V_calibrated_kts = " << V_calibrated_kts << '\n';
|
||||||
eng.set_IAS( V_calibrated_kts );
|
eng.set_IAS( V_calibrated_kts );
|
||||||
|
@ -190,7 +190,7 @@ void FGLaRCsim::update( double dt ) {
|
||||||
}
|
}
|
||||||
// done with c172-larcsim if-block
|
// done with c172-larcsim if-block
|
||||||
|
|
||||||
if ( !strcmp(aero->getStringValue(), "basic") ) {
|
if ( aero->getStringValue() == "basic" ) {
|
||||||
// set control inputs
|
// set control inputs
|
||||||
// cout << "V_calibrated_kts = " << V_calibrated_kts << '\n';
|
// cout << "V_calibrated_kts = " << V_calibrated_kts << '\n';
|
||||||
eng.set_IAS( V_calibrated_kts );
|
eng.set_IAS( V_calibrated_kts );
|
||||||
|
@ -277,7 +277,7 @@ void FGLaRCsim::update( double dt ) {
|
||||||
|
|
||||||
// IO360.cxx for the C172 thrust is broken (not sure why).
|
// IO360.cxx for the C172 thrust is broken (not sure why).
|
||||||
// So force C172 to use engine model in c172_engine.c instead of the IO360.cxx.
|
// So force C172 to use engine model in c172_engine.c instead of the IO360.cxx.
|
||||||
// if ( !strcmp(aero->getStringValue(), "c172") ) {
|
// if ( aero->getStringValue() == "c172" ) {
|
||||||
// Use_External_Engine = 1;
|
// Use_External_Engine = 1;
|
||||||
// } else {
|
// } else {
|
||||||
// Use_External_Engine = 0;
|
// Use_External_Engine = 0;
|
||||||
|
@ -318,7 +318,7 @@ void FGLaRCsim::update( double dt ) {
|
||||||
|
|
||||||
// if flying uiuc, set some properties and over-ride some previous ones
|
// if flying uiuc, set some properties and over-ride some previous ones
|
||||||
#ifdef ENABLE_UIUC_MODEL
|
#ifdef ENABLE_UIUC_MODEL
|
||||||
if ( !strcmp(aero->getStringValue(), "uiuc")) {
|
if ( aero->getStringValue() == "uiuc" ) {
|
||||||
|
|
||||||
// surface positions and other general properties
|
// surface positions and other general properties
|
||||||
fgSetDouble("/surface-positions/flight/rudder-pos-norm", fgGetDouble("/controls/flight/rudder"));
|
fgSetDouble("/surface-positions/flight/rudder-pos-norm", fgGetDouble("/controls/flight/rudder"));
|
||||||
|
@ -377,10 +377,10 @@ void FGLaRCsim::update( double dt ) {
|
||||||
// make the engine cranking and running sounds when fgfs starts up
|
// make the engine cranking and running sounds when fgfs starts up
|
||||||
fgSetDouble("/engines/engine/cranking", 1);
|
fgSetDouble("/engines/engine/cranking", 1);
|
||||||
fgSetDouble("/engines/engine/running", 1);
|
fgSetDouble("/engines/engine/running", 1);
|
||||||
if ( !strcmp(uiuc_type->getStringValue(), "uiuc-prop")) {
|
if ( uiuc_type->getStringValue() == "uiuc-prop" ) {
|
||||||
// uiuc prop driven airplane, e.g. Wright Flyer
|
// uiuc prop driven airplane, e.g. Wright Flyer
|
||||||
}
|
}
|
||||||
else if ( !strcmp(uiuc_type->getStringValue(), "uiuc-jet")) {
|
else if ( uiuc_type->getStringValue() == "uiuc-jet" ) {
|
||||||
// uiuc jet aircraft, e.g. a4d
|
// uiuc jet aircraft, e.g. a4d
|
||||||
// used for setting the sound
|
// used for setting the sound
|
||||||
fgSetDouble("/engines/engine/n1", (75 + (globals->get_controls()->get_throttle( 0 ) * 100.0 )/400));
|
fgSetDouble("/engines/engine/n1", (75 + (globals->get_controls()->get_throttle( 0 ) * 100.0 )/400));
|
||||||
|
@ -388,15 +388,15 @@ void FGLaRCsim::update( double dt ) {
|
||||||
// used for setting the instruments
|
// used for setting the instruments
|
||||||
fgSetDouble("/engines/engine[0]/n1", (50 + (globals->get_controls()->get_throttle( 0 ) * 50)));
|
fgSetDouble("/engines/engine[0]/n1", (50 + (globals->get_controls()->get_throttle( 0 ) * 50)));
|
||||||
}
|
}
|
||||||
else if ( !strcmp(uiuc_type->getStringValue(), "uiuc-sailplane")) {
|
else if ( uiuc_type->getStringValue() == "uiuc-sailplane" ) {
|
||||||
// uiuc sailplane, e.g. asw20
|
// uiuc sailplane, e.g. asw20
|
||||||
fgSetDouble("/engines/engine/cranking", 0);
|
fgSetDouble("/engines/engine/cranking", 0);
|
||||||
}
|
}
|
||||||
else if ( !strcmp(uiuc_type->getStringValue(), "uiuc-hangglider")) {
|
else if ( uiuc_type->getStringValue() == "uiuc-hangglider" ) {
|
||||||
// uiuc hang glider, e.g. airwave
|
// uiuc hang glider, e.g. airwave
|
||||||
fgSetDouble("/engines/engine/cranking", 0);
|
fgSetDouble("/engines/engine/cranking", 0);
|
||||||
}
|
}
|
||||||
else if ( !strcmp(uiuc_type->getStringValue(), "uiuc-ornithopter")) {
|
else if ( uiuc_type->getStringValue() == "uiuc-ornithopter" ) {
|
||||||
// flapping wings
|
// flapping wings
|
||||||
fgSetDouble("/canopy/position-norm", 0);
|
fgSetDouble("/canopy/position-norm", 0);
|
||||||
fgSetDouble("/wing-phase/position-norm", sin(flapper_phi - 3 * LS_PI / 2));
|
fgSetDouble("/wing-phase/position-norm", sin(flapper_phi - 3 * LS_PI / 2));
|
||||||
|
@ -759,7 +759,7 @@ bool FGLaRCsim::copy_from_LaRCsim() {
|
||||||
// cout << "climb rate = " << -V_down * 60 << endl;
|
// cout << "climb rate = " << -V_down * 60 << endl;
|
||||||
|
|
||||||
#ifdef ENABLE_UIUC_MODEL
|
#ifdef ENABLE_UIUC_MODEL
|
||||||
if (!strcmp(aero->getStringValue(), "uiuc") && aircraft_) {
|
if (aero->getStringValue() == "uiuc" && aircraft_) {
|
||||||
if (pilot_elev_no) {
|
if (pilot_elev_no) {
|
||||||
globals->get_controls()->set_elevator(Long_control);
|
globals->get_controls()->set_elevator(Long_control);
|
||||||
globals->get_controls()->set_elevator_trim(Long_trim);
|
globals->get_controls()->set_elevator_trim(Long_trim);
|
||||||
|
|
|
@ -281,15 +281,14 @@ void Hitch::findBestAIObject(bool doit,bool running_as_autoconnect)
|
||||||
_towEndIsConnectedToProperty=false;
|
_towEndIsConnectedToProperty=false;
|
||||||
SGPropertyNode * ainode = fgGetNode("/ai/models",false);
|
SGPropertyNode * ainode = fgGetNode("/ai/models",false);
|
||||||
if(!ainode) return;
|
if(!ainode) return;
|
||||||
char myCallsign[256]="***********";
|
std::string myCallsign = "***********";
|
||||||
if (running_as_autoconnect)
|
if (running_as_autoconnect)
|
||||||
{
|
{
|
||||||
//get own callsign
|
//get own callsign
|
||||||
SGPropertyNode *cs=fgGetNode("/sim/multiplay/callsign",false);
|
SGPropertyNode *cs=fgGetNode("/sim/multiplay/callsign",false);
|
||||||
if (cs)
|
if (cs)
|
||||||
{
|
{
|
||||||
strncpy(myCallsign,cs->getStringValue(),256);
|
myCallsign = cs->getStringValue();
|
||||||
myCallsign[255]=0;
|
|
||||||
}
|
}
|
||||||
//reset tow length for search radius. Lentgh will be later copied from master
|
//reset tow length for search radius. Lentgh will be later copied from master
|
||||||
_towLength=_winchInitialTowLength;
|
_towLength=_winchInitialTowLength;
|
||||||
|
@ -299,8 +298,8 @@ void Hitch::findBestAIObject(bool doit,bool running_as_autoconnect)
|
||||||
for (int i=0;i<ainode->nChildren();i++)
|
for (int i=0;i<ainode->nChildren();i++)
|
||||||
{
|
{
|
||||||
SGPropertyNode * n=ainode->getChild(i);
|
SGPropertyNode * n=ainode->getChild(i);
|
||||||
_nodeIsMultiplayer = strncmp("multiplayer",n->getName(),11)==0;
|
_nodeIsMultiplayer = strncmp("multiplayer", n->getNameString().c_str(), 11) == 0;
|
||||||
_nodeIsAiAircraft = strncmp("aircraft",n->getName(),8)==0;
|
_nodeIsAiAircraft = strncmp("aircraft", n->getNameString().c_str(), 8) == 0;
|
||||||
if (!(_nodeIsMultiplayer || _nodeIsAiAircraft))
|
if (!(_nodeIsMultiplayer || _nodeIsAiAircraft))
|
||||||
continue;
|
continue;
|
||||||
if (running_as_autoconnect)
|
if (running_as_autoconnect)
|
||||||
|
@ -308,7 +307,7 @@ void Hitch::findBestAIObject(bool doit,bool running_as_autoconnect)
|
||||||
if (!_nodeIsMultiplayer)
|
if (!_nodeIsMultiplayer)
|
||||||
continue;
|
continue;
|
||||||
if(n->getBoolValue("sim/hitches/aerotow/open",true)) continue;
|
if(n->getBoolValue("sim/hitches/aerotow/open",true)) continue;
|
||||||
if(strncmp(myCallsign,n->getStringValue("sim/hitches/aerotow/tow/connected-to-ai-or-mp-callsign"),255)!=0)
|
if (myCallsign != n->getStringValue("sim/hitches/aerotow/tow/connected-to-ai-or-mp-callsign"))
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
double pos[3];
|
double pos[3];
|
||||||
|
@ -565,7 +564,7 @@ void Hitch::integrate (float dt)
|
||||||
{
|
{
|
||||||
std::stringstream message;
|
std::stringstream message;
|
||||||
message<<"Could not lock hitch (tow length is insufficient) on hitch "
|
message<<"Could not lock hitch (tow length is insufficient) on hitch "
|
||||||
<<_node->getName()<<" "<<_node->getIndex()<<"!";
|
<<_node->getNameString()<<" "<<_node->getIndex()<<"!";
|
||||||
fgSetString("/sim/messages/pilot", message.str().c_str());
|
fgSetString("/sim/messages/pilot", message.str().c_str());
|
||||||
_open=true;
|
_open=true;
|
||||||
return;
|
return;
|
||||||
|
@ -576,7 +575,7 @@ void Hitch::integrate (float dt)
|
||||||
if (_node->getBoolValue("broken",false)&&_open)
|
if (_node->getBoolValue("broken",false)&&_open)
|
||||||
message<<"Oh no, the tow is broken";
|
message<<"Oh no, the tow is broken";
|
||||||
else
|
else
|
||||||
message<<(_open?"Opened hitch ":"Locked hitch ")<<_node->getName()<<" "<<_node->getIndex()<<"!";
|
message<<(_open?"Opened hitch ":"Locked hitch ")<<_node->getNameString()<<" "<<_node->getIndex()<<"!";
|
||||||
fgSetString("/sim/messages/pilot", message.str().c_str());
|
fgSetString("/sim/messages/pilot", message.str().c_str());
|
||||||
_oldOpen=_open;
|
_oldOpen=_open;
|
||||||
}
|
}
|
||||||
|
@ -599,23 +598,21 @@ void Hitch::integrate (float dt)
|
||||||
if (_node)
|
if (_node)
|
||||||
{
|
{
|
||||||
//_towEndNode=fgGetNode(_node->getStringValue("tow/node"), false);
|
//_towEndNode=fgGetNode(_node->getStringValue("tow/node"), false);
|
||||||
char towNode[256];
|
std::string towNode = _node->getStringValue("tow/node");
|
||||||
strncpy(towNode,_node->getStringValue("tow/node"),256);
|
|
||||||
towNode[255]=0;
|
|
||||||
_towEndNode=fgGetNode("ai/models")->getNode(towNode, false);
|
_towEndNode=fgGetNode("ai/models")->getNode(towNode, false);
|
||||||
//AI and multiplayer objects seem to change node?
|
//AI and multiplayer objects seem to change node?
|
||||||
//Check if we have the right one by callsign
|
//Check if we have the right one by callsign
|
||||||
if (_nodeIsMultiplayer || _nodeIsAiAircraft)
|
if (_nodeIsMultiplayer || _nodeIsAiAircraft)
|
||||||
{
|
{
|
||||||
char MPcallsign[256]="";
|
std::string MPcallsign = "";
|
||||||
const char *MPc;
|
std::string MPc =_node->getStringValue("tow/connected-to-ai-or-mp-callsign");
|
||||||
MPc=_node->getStringValue("tow/connected-to-ai-or-mp-callsign");
|
if (!MPc.empty())
|
||||||
if (MPc)
|
|
||||||
{
|
{
|
||||||
strncpy(MPcallsign,MPc,256);
|
MPcallsign = MPc;
|
||||||
MPcallsign[255]=0;
|
|
||||||
}
|
}
|
||||||
if (((_towEndNode)&&(strncmp(_towEndNode->getStringValue("callsign"),MPcallsign,255)!=0))||!_towEndNode)
|
if ((_towEndNode
|
||||||
|
&& _towEndNode->getStringValue("callsign") != MPcallsign)
|
||||||
|
|| !_towEndNode)
|
||||||
{
|
{
|
||||||
_timeToNextReConnectTry-=dt;
|
_timeToNextReConnectTry-=dt;
|
||||||
if((_timeToNextReConnectTry<0)||(_timeToNextReConnectTry>10))
|
if((_timeToNextReConnectTry<0)||(_timeToNextReConnectTry>10))
|
||||||
|
@ -627,13 +624,17 @@ void Hitch::integrate (float dt)
|
||||||
for (int i=0;i<ainode->nChildren();i++)
|
for (int i=0;i<ainode->nChildren();i++)
|
||||||
{
|
{
|
||||||
SGPropertyNode * n=ainode->getChild(i);
|
SGPropertyNode * n=ainode->getChild(i);
|
||||||
if(_nodeIsMultiplayer?strncmp("multiplayer",n->getName(),11)==0:strncmp("aircraft",n->getName(),8))
|
if (_nodeIsMultiplayer
|
||||||
if (strcmp(n->getStringValue("callsign"),MPcallsign)==0)//found
|
? strncmp("multiplayer", n->getNameString().c_str(), 11) == 0
|
||||||
|
: strncmp("aircraft", n->getNameString().c_str(), 8)
|
||||||
|
) {
|
||||||
|
if (n->getStringValue("callsign") == MPcallsign)//found
|
||||||
{
|
{
|
||||||
_towEndNode=n;
|
_towEndNode=n;
|
||||||
//_node->setStringValue("tow/node",n->getPath());
|
//_node->setStringValue("tow/node",n->getPath());
|
||||||
_node->setStringValue("tow/node",n->getDisplayName());
|
_node->setStringValue("tow/node",n->getDisplayName());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,14 +81,14 @@ CanvasWidget::CanvasWidget( int x, int y,
|
||||||
SGPropertyNode *load = nasal->getNode("load");
|
SGPropertyNode *load = nasal->getNode("load");
|
||||||
if( load )
|
if( load )
|
||||||
{
|
{
|
||||||
const char *s = load->getStringValue();
|
const std::string s = load->getStringValue();
|
||||||
// avoid crash FLIGHTGEAR-5FQ
|
// avoid crash FLIGHTGEAR-5FQ
|
||||||
if (!s) {
|
if (s.empty()) {
|
||||||
SG_LOG(SG_GUI, SG_ALERT, "Empty 'load' script for Canvas widget:" << cprops->getStringValue("name"));
|
SG_LOG(SG_GUI, SG_ALERT, "Empty 'load' script for Canvas widget:" << cprops->getStringValue("name"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
nas->handleCommand(module.c_str(), file.c_str(), s, cprops);
|
nas->handleCommand(module.c_str(), file.c_str(), s.c_str(), cprops);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -106,7 +106,7 @@ WeatherScenariosModel::WeatherScenariosModel(QObject *pr) :
|
||||||
int nChildren = scenarios->nChildren();
|
int nChildren = scenarios->nChildren();
|
||||||
for (int i = 0; i < nChildren; i++) {
|
for (int i = 0; i < nChildren; i++) {
|
||||||
SGPropertyNode_ptr scenario = scenarios->getChild(i);
|
SGPropertyNode_ptr scenario = scenarios->getChild(i);
|
||||||
if (strcmp(scenario->getName(), "scenario") != 0) {
|
if (scenario->getNameString() != "scenario") {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -164,7 +164,7 @@ FGFontCache::get(SGPropertyNode *node)
|
||||||
if (!node)
|
if (!node)
|
||||||
return get("Helvetica.txf", 15.0, 0.0);
|
return get("Helvetica.txf", 15.0, 0.0);
|
||||||
|
|
||||||
const char *name = node->getStringValue("name", "Helvetica.txf");
|
std::string name = node->getStringValue("name", "Helvetica.txf");
|
||||||
float size = node->getFloatValue("size", 15.0);
|
float size = node->getFloatValue("size", 15.0);
|
||||||
float slant = node->getFloatValue("slant", 0.0);
|
float slant = node->getFloatValue("slant", 0.0);
|
||||||
|
|
||||||
|
|
|
@ -254,7 +254,7 @@ void GUIInfo::apply_format(SGPropertyNode* n)
|
||||||
else if (fmt_type == f_DOUBLE)
|
else if (fmt_type == f_DOUBLE)
|
||||||
snprintf(buf, FORMAT_BUFSIZE, format.c_str(), n->getDoubleValue());
|
snprintf(buf, FORMAT_BUFSIZE, format.c_str(), n->getDoubleValue());
|
||||||
else
|
else
|
||||||
snprintf(buf, FORMAT_BUFSIZE, format.c_str(), n->getStringValue());
|
snprintf(buf, FORMAT_BUFSIZE, format.c_str(), n->getStringValue().c_str());
|
||||||
|
|
||||||
buf[FORMAT_BUFSIZE] = '\0';
|
buf[FORMAT_BUFSIZE] = '\0';
|
||||||
text = buf;
|
text = buf;
|
||||||
|
@ -686,8 +686,8 @@ FGPUIDialog::FGPUIDialog(SGPropertyNode* props) : FGDialog(props),
|
||||||
_nasal_close = nasal->getNode("close");
|
_nasal_close = nasal->getNode("close");
|
||||||
SGPropertyNode* open = nasal->getNode("open");
|
SGPropertyNode* open = nasal->getNode("open");
|
||||||
if (open) {
|
if (open) {
|
||||||
const char* s = open->getStringValue();
|
string s = open->getStringValue();
|
||||||
nas->createModule(_module.c_str(), _module.c_str(), s, strlen(s), props);
|
nas->createModule(_module.c_str(), _module.c_str(), s.c_str(), s.length(), props);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
display(props);
|
display(props);
|
||||||
|
@ -703,8 +703,8 @@ FGPUIDialog::~FGPUIDialog()
|
||||||
auto nas = globals->get_subsystem<FGNasalSys>();
|
auto nas = globals->get_subsystem<FGNasalSys>();
|
||||||
if (nas) {
|
if (nas) {
|
||||||
if (_nasal_close) {
|
if (_nasal_close) {
|
||||||
const char* s = _nasal_close->getStringValue();
|
string s = _nasal_close->getStringValue();
|
||||||
nas->createModule(_module.c_str(), _module.c_str(), s, strlen(s), _props);
|
nas->createModule(_module.c_str(), _module.c_str(), s.c_str(), s.length(), _props);
|
||||||
}
|
}
|
||||||
nas->deleteModule(_module.c_str());
|
nas->deleteModule(_module.c_str());
|
||||||
}
|
}
|
||||||
|
@ -890,7 +890,7 @@ FGPUIDialog::makeObject(SGPropertyNode* props, int parentWidth, int parentHeight
|
||||||
int height = props->getIntValue("height", parentHeight);
|
int height = props->getIntValue("height", parentHeight);
|
||||||
int x = props->getIntValue("x", (parentWidth - width) / 2);
|
int x = props->getIntValue("x", (parentWidth - width) / 2);
|
||||||
int y = props->getIntValue("y", (parentHeight - height) / 2);
|
int y = props->getIntValue("y", (parentHeight - height) / 2);
|
||||||
string type = props->getName();
|
string type = props->getNameString();
|
||||||
|
|
||||||
if (type.empty())
|
if (type.empty())
|
||||||
type = "dialog";
|
type = "dialog";
|
||||||
|
@ -989,11 +989,11 @@ FGPUIDialog::makeObject(SGPropertyNode* props, int parentWidth, int parentHeight
|
||||||
|
|
||||||
} else if (type == "button") {
|
} else if (type == "button") {
|
||||||
puButton* obj;
|
puButton* obj;
|
||||||
const char* legend = props->getStringValue("legend", "[none]");
|
string legend = props->getStringValue("legend", "[none]");
|
||||||
if (props->getBoolValue("one-shot", true))
|
if (props->getBoolValue("one-shot", true))
|
||||||
obj = new puOneShot(x, y, legend);
|
obj = new puOneShot(x, y, legend.c_str());
|
||||||
else
|
else
|
||||||
obj = new puButton(x, y, legend);
|
obj = new puButton(x, y, legend.c_str());
|
||||||
if (presetSize)
|
if (presetSize)
|
||||||
obj->setSize(width, height);
|
obj->setSize(width, height);
|
||||||
setupObject(obj, props);
|
setupObject(obj, props);
|
||||||
|
@ -1149,14 +1149,14 @@ void FGPUIDialog::setupObject(puObject* object, SGPropertyNode* props)
|
||||||
_conditionalObjects.push_back(cnd);
|
_conditionalObjects.push_back(cnd);
|
||||||
}
|
}
|
||||||
|
|
||||||
string type = props->getName();
|
string type = props->getNameString();
|
||||||
if (type == "input" && props->getBoolValue("live"))
|
if (type == "input" && props->getBoolValue("live"))
|
||||||
object->setDownCallback(action_callback);
|
object->setDownCallback(action_callback);
|
||||||
|
|
||||||
if (type == "text") {
|
if (type == "text") {
|
||||||
const char* format = props->getStringValue("format", 0);
|
string format = props->getStringValue("format", "");
|
||||||
if (format) {
|
if (!format.empty()) {
|
||||||
info->fmt_type = validate_format(format);
|
info->fmt_type = validate_format(format.c_str());
|
||||||
if (info->fmt_type != f_INVALID)
|
if (info->fmt_type != f_INVALID)
|
||||||
info->format = format;
|
info->format = format;
|
||||||
else
|
else
|
||||||
|
@ -1165,10 +1165,8 @@ void FGPUIDialog::setupObject(puObject* object, SGPropertyNode* props)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (props->hasValue("property")) {
|
if (props->hasValue("property")) {
|
||||||
const char* name = props->getStringValue("name");
|
string name = props->getStringValue("name", "");
|
||||||
if (name == 0)
|
string propname = props->getStringValue("property");
|
||||||
name = "";
|
|
||||||
const char* propname = props->getStringValue("property");
|
|
||||||
SGPropertyNode_ptr node = fgGetNode(propname, true);
|
SGPropertyNode_ptr node = fgGetNode(propname, true);
|
||||||
if (type == "map") {
|
if (type == "map") {
|
||||||
// mapWidget binds to a sub-tree of properties, and
|
// mapWidget binds to a sub-tree of properties, and
|
||||||
|
@ -1189,12 +1187,12 @@ void FGPUIDialog::setupObject(puObject* object, SGPropertyNode* props)
|
||||||
if (!bindings.empty()) {
|
if (!bindings.empty()) {
|
||||||
info->key = props->getIntValue("keynum", -1);
|
info->key = props->getIntValue("keynum", -1);
|
||||||
if (props->hasValue("key"))
|
if (props->hasValue("key"))
|
||||||
info->key = getKeyCode(props->getStringValue("key", ""));
|
info->key = getKeyCode(props->getStringValue("key", "").c_str());
|
||||||
|
|
||||||
|
|
||||||
for (auto bindingNode : bindings) {
|
for (auto bindingNode : bindings) {
|
||||||
const char* cmd = bindingNode->getStringValue("command");
|
string cmd = bindingNode->getStringValue("command");
|
||||||
if (!strcmp(cmd, "nasal")) {
|
if (cmd == "nasal") {
|
||||||
// we need to clone the binding node, so we can unique the
|
// we need to clone the binding node, so we can unique the
|
||||||
// Nasal module. Otherwise we always modify the global dialog
|
// Nasal module. Otherwise we always modify the global dialog
|
||||||
// definition, and cloned dialogs use the same Nasal module for
|
// definition, and cloned dialogs use the same Nasal module for
|
||||||
|
@ -1235,7 +1233,7 @@ void FGPUIDialog::setupGroup(puGroup* group, SGPropertyNode* props,
|
||||||
|
|
||||||
void FGPUIDialog::setColor(puObject* object, SGPropertyNode* props, int which)
|
void FGPUIDialog::setColor(puObject* object, SGPropertyNode* props, int which)
|
||||||
{
|
{
|
||||||
string type = props->getName();
|
string type = props->getNameString();
|
||||||
if (type.empty())
|
if (type.empty())
|
||||||
type = "dialog";
|
type = "dialog";
|
||||||
if (type == "textbox" && props->getBoolValue("editable"))
|
if (type == "textbox" && props->getBoolValue("editable"))
|
||||||
|
@ -1470,7 +1468,7 @@ void FGPUIDialog::applySize(puObject* object)
|
||||||
// Implementation of FGDialog::PropertyObject.
|
// Implementation of FGDialog::PropertyObject.
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
FGPUIDialog::PropertyObject::PropertyObject(const char* n,
|
FGPUIDialog::PropertyObject::PropertyObject(string n,
|
||||||
puObject* o, SGPropertyNode_ptr p) : name(n),
|
puObject* o, SGPropertyNode_ptr p) : name(n),
|
||||||
object(o),
|
object(o),
|
||||||
node(p)
|
node(p)
|
||||||
|
@ -1502,11 +1500,11 @@ fgValueList::~fgValueList()
|
||||||
void fgValueList::make_list()
|
void fgValueList::make_list()
|
||||||
{
|
{
|
||||||
SGPropertyNode_ptr values = _props;
|
SGPropertyNode_ptr values = _props;
|
||||||
const char* vname = "value";
|
string vname = "value";
|
||||||
|
|
||||||
if (_props->hasChild("properties")) {
|
if (_props->hasChild("properties")) {
|
||||||
// dynamic values, read from a property's children
|
// dynamic values, read from a property's children
|
||||||
const char* path = _props->getStringValue("properties");
|
string path = _props->getStringValue("properties");
|
||||||
values = fgGetNode(path, true);
|
values = fgGetNode(path, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1518,7 +1516,7 @@ void fgValueList::make_list()
|
||||||
_list = new char*[value_nodes.size() + 1];
|
_list = new char*[value_nodes.size() + 1];
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
for (i = 0; i < value_nodes.size(); i++) {
|
for (i = 0; i < value_nodes.size(); i++) {
|
||||||
_list[i] = strdup((char*)value_nodes[i]->getStringValue());
|
_list[i] = strdup((char*)value_nodes[i]->getStringValue().c_str());
|
||||||
}
|
}
|
||||||
_list[i] = 0;
|
_list[i] = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -176,7 +176,7 @@ private:
|
||||||
// closes.
|
// closes.
|
||||||
std::vector<void*> _info;
|
std::vector<void*> _info;
|
||||||
struct PropertyObject {
|
struct PropertyObject {
|
||||||
PropertyObject(const char* name,
|
PropertyObject(std::string name,
|
||||||
puObject* object,
|
puObject* object,
|
||||||
SGPropertyNode_ptr node);
|
SGPropertyNode_ptr node);
|
||||||
std::string name;
|
std::string name;
|
||||||
|
|
|
@ -195,8 +195,8 @@ FGPUIMenuBar::make_menu (SGPropertyNode * node)
|
||||||
FGLocale::utf8toLatin1(label);
|
FGLocale::utf8toLatin1(label);
|
||||||
|
|
||||||
// append the keyboard hint to the menu entry
|
// append the keyboard hint to the menu entry
|
||||||
const char* key = item_nodes[i]->getStringValue("key", 0);
|
string key = item_nodes[i]->getStringValue("key", "");
|
||||||
if (key)
|
if (!key.empty())
|
||||||
{
|
{
|
||||||
label.append(" <");
|
label.append(" <");
|
||||||
label.append(key);
|
label.append(key);
|
||||||
|
|
|
@ -77,7 +77,7 @@ bool AircraftItem::initFromFile(QDir dir, QString filePath)
|
||||||
LocalizedStrings ls;
|
LocalizedStrings ls;
|
||||||
ls.locale = "en";
|
ls.locale = "en";
|
||||||
ls.strings["name"] = QString::fromStdString(sim->getStringValue("description")).trimmed();
|
ls.strings["name"] = QString::fromStdString(sim->getStringValue("description")).trimmed();
|
||||||
authors = sim->getStringValue("author");
|
authors = QString::fromStdString(sim->getStringValue("author"));
|
||||||
|
|
||||||
if (sim->hasChild("rating")) {
|
if (sim->hasChild("rating")) {
|
||||||
SGPropertyNode_ptr ratingsNode = sim->getNode("rating");
|
SGPropertyNode_ptr ratingsNode = sim->getNode("rating");
|
||||||
|
@ -88,11 +88,11 @@ bool AircraftItem::initFromFile(QDir dir, QString filePath)
|
||||||
|
|
||||||
if (sim->hasChild("long-description")) {
|
if (sim->hasChild("long-description")) {
|
||||||
// clean up any XML whitspace in the text.
|
// clean up any XML whitspace in the text.
|
||||||
ls.strings["desc"] = QString(sim->getStringValue("long-description")).simplified();
|
ls.strings["desc"] = QString::fromStdString(sim->getStringValue("long-description")).simplified();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sim->hasChild("variant-of")) {
|
if (sim->hasChild("variant-of")) {
|
||||||
variantOf = sim->getStringValue("variant-of");
|
variantOf = QString::fromStdString(sim->getStringValue("variant-of"));
|
||||||
} else {
|
} else {
|
||||||
isPrimary = true;
|
isPrimary = true;
|
||||||
}
|
}
|
||||||
|
@ -106,16 +106,16 @@ bool AircraftItem::initFromFile(QDir dir, QString filePath)
|
||||||
int nChildren = tagsNode->nChildren();
|
int nChildren = tagsNode->nChildren();
|
||||||
for (int i = 0; i < nChildren; i++) {
|
for (int i = 0; i < nChildren; i++) {
|
||||||
const SGPropertyNode* c = tagsNode->getChild(i);
|
const SGPropertyNode* c = tagsNode->getChild(i);
|
||||||
if (strcmp(c->getName(), "tag") == 0) {
|
if (c->getNameString() == "tag") {
|
||||||
const char* tagName = c->getStringValue();
|
std::string tagName = c->getStringValue();
|
||||||
usesHeliports |= (strcmp(tagName, "helicopter") == 0);
|
usesHeliports |= (tagName == "helicopter");
|
||||||
// could also consider vtol tag?
|
// could also consider vtol tag?
|
||||||
usesSeaports |= (strcmp(tagName, "seaplane") == 0);
|
usesSeaports |= (tagName == "seaplane");
|
||||||
usesSeaports |= (strcmp(tagName, "floats") == 0);
|
usesSeaports |= (tagName == "floats");
|
||||||
needsMaintenance |= (strcmp(tagName, "needs-maintenance") == 0);
|
needsMaintenance |= (tagName == "needs-maintenance");
|
||||||
|
|
||||||
// and actually store the tags
|
// and actually store the tags
|
||||||
tags.push_back(QString::fromUtf8(tagName));
|
tags.push_back(QString::fromStdString(tagName));
|
||||||
}
|
}
|
||||||
} // of tags iteration
|
} // of tags iteration
|
||||||
} // of set-xml has tags
|
} // of set-xml has tags
|
||||||
|
@ -148,13 +148,13 @@ bool AircraftItem::initFromFile(QDir dir, QString filePath)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sim->hasChild("thumbnail")) {
|
if (sim->hasChild("thumbnail")) {
|
||||||
thumbnailPath = sim->getStringValue("thumbnail");
|
thumbnailPath = QString::fromStdString(sim->getStringValue("thumbnail"));
|
||||||
} else {
|
} else {
|
||||||
thumbnailPath = "thumbnail.jpg";
|
thumbnailPath = "thumbnail.jpg";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sim->hasChild("minimum-fg-version")) {
|
if (sim->hasChild("minimum-fg-version")) {
|
||||||
minFGVersion = sim->getStringValue("minimum-fg-version");
|
minFGVersion = QString::fromStdString(sim->getStringValue("minimum-fg-version"));
|
||||||
}
|
}
|
||||||
|
|
||||||
homepageUrl = QUrl(QString::fromStdString(sim->getStringValue("urls/home-page")));
|
homepageUrl = QUrl(QString::fromStdString(sim->getStringValue("urls/home-page")));
|
||||||
|
|
|
@ -110,7 +110,7 @@ void MPServersModel::onRefreshMPServersDone(simgear::HTTP::Request*)
|
||||||
|
|
||||||
for (int i=0; i<targetnode->nChildren(); ++i) {
|
for (int i=0; i<targetnode->nChildren(); ++i) {
|
||||||
SGPropertyNode* c = targetnode->getChild(i);
|
SGPropertyNode* c = targetnode->getChild(i);
|
||||||
if (c->getName() != std::string("server")) {
|
if (c->getNameString() != "server") {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2068,7 +2068,7 @@ MapWidget::DrawAIObject::DrawAIObject(SGPropertyNode* m, const SGGeod& g) :
|
||||||
|
|
||||||
char buffer[1024];
|
char buffer[1024];
|
||||||
::snprintf(buffer, 1024, "%s\n%dkts",
|
::snprintf(buffer, 1024, "%s\n%dkts",
|
||||||
model->getStringValue("name", "<>"),
|
model->getStringValue("name", "<>").c_str(),
|
||||||
speedKts);
|
speedKts);
|
||||||
legend = buffer;
|
legend = buffer;
|
||||||
}
|
}
|
||||||
|
|
|
@ -208,7 +208,7 @@ bool FGMouseCursor::setCursorCommand(const SGPropertyNode* arg, SGPropertyNode*)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Cursor c = cursorFromString(arg->getStringValue("cursor"));
|
Cursor c = cursorFromString(arg->getStringValue("cursor").c_str());
|
||||||
setCursor(c);
|
setCursor(c);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -400,7 +400,7 @@ QString QmlAircraftInfo::authors() const
|
||||||
QString html = "<ul>\n";
|
QString html = "<ul>\n";
|
||||||
for (auto a : structuredAuthors->getChildren("author")) {
|
for (auto a : structuredAuthors->getChildren("author")) {
|
||||||
html += "<li>";
|
html += "<li>";
|
||||||
html += a->getStringValue("name");
|
html += QString::fromStdString(a->getStringValue("name"));
|
||||||
if (a->hasChild("nick")) {
|
if (a->hasChild("nick")) {
|
||||||
html += QStringLiteral(" '") + QString::fromStdString(a->getStringValue("nick")) + QStringLiteral("'");
|
html += QStringLiteral(" '") + QString::fromStdString(a->getStringValue("nick")) + QStringLiteral("'");
|
||||||
}
|
}
|
||||||
|
|
|
@ -147,7 +147,7 @@ public:
|
||||||
|
|
||||||
auto it = std::find(_directChildren.begin(), _directChildren.end(), child);
|
auto it = std::find(_directChildren.begin(), _directChildren.end(), child);
|
||||||
if (it == _directChildren.end()) {
|
if (it == _directChildren.end()) {
|
||||||
SG_LOG(SG_GUI, SG_DEV_ALERT, "Bug in QmlPropertyModel - child not found when removing:" << parent->getPath() << " - " << child->getName());
|
SG_LOG(SG_GUI, SG_DEV_ALERT, "Bug in QmlPropertyModel - child not found when removing:" << parent->getPath() << " - " << child->getNameString());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -120,7 +120,7 @@ void mkDialog (const char *txt)
|
||||||
if (!msg->getNode(name.c_str(), false))
|
if (!msg->getNode(name.c_str(), false))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (!strcmp(txt, msg->getNode(name.c_str())->getStringValue("message"))) {
|
if (!strcmp(txt, msg->getNode(name.c_str())->getStringValue("message").c_str())) {
|
||||||
SG_LOG(SG_GENERAL, SG_WARN, "mkDialog(): duplicate of message " << txt);
|
SG_LOG(SG_GENERAL, SG_WARN, "mkDialog(): duplicate of message " << txt);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -397,11 +397,11 @@ void fgHiResDump()
|
||||||
glHint(GL_LINE_SMOOTH_HINT, GL_DONT_CARE);
|
glHint(GL_LINE_SMOOTH_HINT, GL_DONT_CARE);
|
||||||
glHint(GL_POINT_SMOOTH_HINT, GL_DONT_CARE);
|
glHint(GL_POINT_SMOOTH_HINT, GL_DONT_CARE);
|
||||||
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_DONT_CARE);
|
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_DONT_CARE);
|
||||||
if ( (!strcmp(fgGetString("/sim/rendering/fog"), "disabled")) ||
|
if ( fgGetString("/sim/rendering/fog") == "disabled" ||
|
||||||
(!fgGetBool("/sim/rendering/shading"))) {
|
(!fgGetBool("/sim/rendering/shading"))) {
|
||||||
// if fastest fog requested, or if flat shading force fastest
|
// if fastest fog requested, or if flat shading force fastest
|
||||||
glHint ( GL_FOG_HINT, GL_FASTEST );
|
glHint ( GL_FOG_HINT, GL_FASTEST );
|
||||||
} else if ( !strcmp(fgGetString("/sim/rendering/fog"), "nicest") ) {
|
} else if ( fgGetString("/sim/rendering/fog") == "nicest" ) {
|
||||||
glHint ( GL_FOG_HINT, GL_DONT_CARE );
|
glHint ( GL_FOG_HINT, GL_DONT_CARE );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,10 +24,10 @@ int LayoutWidget::stringLength(const char* s)
|
||||||
return (int)(FONT.getFloatStringWidth(s) + 0.999);
|
return (int)(FONT.getFloatStringWidth(s) + 0.999);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* LayoutWidget::type()
|
std::string LayoutWidget::type()
|
||||||
{
|
{
|
||||||
const char* t = _prop->getName();
|
string t = _prop->getNameString();
|
||||||
return (*t == 0) ? "dialog" : t;
|
return t.empty() ? "dialog" : t;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LayoutWidget::hasParent()
|
bool LayoutWidget::hasParent()
|
||||||
|
@ -47,9 +47,8 @@ int LayoutWidget::nChildren()
|
||||||
int n = 0;
|
int n = 0;
|
||||||
for(int i=0; i<_prop->nChildren(); i++) {
|
for(int i=0; i<_prop->nChildren(); i++) {
|
||||||
SGPropertyNode* p = _prop->getChild(i);
|
SGPropertyNode* p = _prop->getChild(i);
|
||||||
const char* name = p->getName();
|
string name = p->getNameString();
|
||||||
if(p->nChildren() != 0 || !strcmp(name, "hrule")
|
if (p->nChildren() != 0 || name == "hrule" || name == "vrule")
|
||||||
|| !strcmp(name, "vrule"))
|
|
||||||
n++;
|
n++;
|
||||||
}
|
}
|
||||||
return n;
|
return n;
|
||||||
|
@ -62,9 +61,8 @@ LayoutWidget LayoutWidget::getChild(int idx)
|
||||||
int n = 0;
|
int n = 0;
|
||||||
for(int i=0; i<_prop->nChildren(); i++) {
|
for(int i=0; i<_prop->nChildren(); i++) {
|
||||||
SGPropertyNode* p = _prop->getChild(i);
|
SGPropertyNode* p = _prop->getChild(i);
|
||||||
const char* name = p->getName();
|
string name = p->getNameString();
|
||||||
if(p->nChildren() != 0 || !strcmp(name, "hrule")
|
if (p->nChildren() != 0 || name == "hrule" || name == "vrule") {
|
||||||
|| !strcmp(name, "vrule")) {
|
|
||||||
if(idx == n) return LayoutWidget(p);
|
if(idx == n) return LayoutWidget(p);
|
||||||
n++;
|
n++;
|
||||||
}
|
}
|
||||||
|
@ -87,7 +85,7 @@ bool LayoutWidget::getBool(const char* f, bool dflt)
|
||||||
return _prop->getBoolValue(f, dflt);
|
return _prop->getBoolValue(f, dflt);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* LayoutWidget::getStr(const char* f)
|
std::string LayoutWidget::getStr(const char* f)
|
||||||
{
|
{
|
||||||
return _prop->getStringValue(f);
|
return _prop->getStringValue(f);
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,8 +46,8 @@ void LayoutWidget::calcPrefSize(int* w, int* h)
|
||||||
if (!getBool("enabled", true) || isType("nasal"))
|
if (!getBool("enabled", true) || isType("nasal"))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int legw = stringLength(getStr("legend"));
|
int legw = stringLength(getStr("legend").c_str());
|
||||||
int labw = stringLength(getStr("label"));
|
int labw = stringLength(getStr("label").c_str());
|
||||||
|
|
||||||
if(isType("dialog") || isType("group") || isType("frame")) {
|
if(isType("dialog") || isType("group") || isType("frame")) {
|
||||||
if(!hasField("layout")) {
|
if(!hasField("layout")) {
|
||||||
|
@ -55,10 +55,10 @@ void LayoutWidget::calcPrefSize(int* w, int* h)
|
||||||
if(hasField("width")) *w = getNum("width");
|
if(hasField("width")) *w = getNum("width");
|
||||||
if(hasField("height")) *h = getNum("height");
|
if(hasField("height")) *h = getNum("height");
|
||||||
} else {
|
} else {
|
||||||
const char* layout = getStr("layout");
|
string layout = getStr("layout");
|
||||||
if (eq(layout, "hbox" )) doHVBox(false, false, w, h);
|
if (layout == "hbox") doHVBox(false, false, w, h);
|
||||||
else if(eq(layout, "vbox" )) doHVBox(false, true, w, h);
|
else if(layout == "vbox") doHVBox(false, true, w, h);
|
||||||
else if(eq(layout, "table")) doTable(false, w, h);
|
else if(layout == "table") doTable(false, w, h);
|
||||||
}
|
}
|
||||||
} else if (isType("text")) {
|
} else if (isType("text")) {
|
||||||
*w = labw;
|
*w = labw;
|
||||||
|
@ -130,25 +130,25 @@ void LayoutWidget::layout(int x, int y, int w, int h)
|
||||||
|
|
||||||
// Correct our box for alignment. The values above correspond to
|
// Correct our box for alignment. The values above correspond to
|
||||||
// a "fill" alignment.
|
// a "fill" alignment.
|
||||||
const char* halign = (isGroup || isType("hrule")) ? "fill" : "center";
|
string halign = (isGroup || isType("hrule")) ? "fill" : "center";
|
||||||
if(hasField("halign")) halign = getStr("halign");
|
if(hasField("halign")) halign = getStr("halign");
|
||||||
if(eq(halign, "left")) {
|
if(halign == "left") {
|
||||||
w = prefw;
|
w = prefw;
|
||||||
} else if(eq(halign, "right")) {
|
} else if(halign == "right") {
|
||||||
x += w - prefw;
|
x += w - prefw;
|
||||||
w = prefw;
|
w = prefw;
|
||||||
} else if(eq(halign, "center")) {
|
} else if(halign == "center") {
|
||||||
x += (w - prefw)/2;
|
x += (w - prefw)/2;
|
||||||
w = prefw;
|
w = prefw;
|
||||||
}
|
}
|
||||||
const char* valign = (isGroup || isType("vrule")) ? "fill" : "center";
|
string valign = (isGroup || isType("vrule")) ? "fill" : "center";
|
||||||
if(hasField("valign")) valign = getStr("valign");
|
if(hasField("valign")) valign = getStr("valign");
|
||||||
if(eq(valign, "bottom")) {
|
if(valign == "bottom") {
|
||||||
h = prefh;
|
h = prefh;
|
||||||
} else if(eq(valign, "top")) {
|
} else if(valign == "top") {
|
||||||
y += h - prefh;
|
y += h - prefh;
|
||||||
h = prefh;
|
h = prefh;
|
||||||
} else if(eq(valign, "center")) {
|
} else if(valign == "center") {
|
||||||
y += (h - prefh)/2;
|
y += (h - prefh)/2;
|
||||||
h = prefh;
|
h = prefh;
|
||||||
}
|
}
|
||||||
|
@ -186,10 +186,10 @@ void LayoutWidget::layout(int x, int y, int w, int h)
|
||||||
|
|
||||||
// Finally, if we are ourselves a layout object, do the actual layout.
|
// Finally, if we are ourselves a layout object, do the actual layout.
|
||||||
if(isGroup && hasField("layout")) {
|
if(isGroup && hasField("layout")) {
|
||||||
const char* layout = getStr("layout");
|
string layout = getStr("layout");
|
||||||
if (eq(layout, "hbox" )) doHVBox(true, false);
|
if (layout == "hbox") doHVBox(true, false);
|
||||||
else if(eq(layout, "vbox" )) doHVBox(true, true);
|
else if(layout == "vbox") doHVBox(true, true);
|
||||||
else if(eq(layout, "table")) doTable(true);
|
else if(layout == "table") doTable(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ public:
|
||||||
LayoutWidget() { _prop = 0; }
|
LayoutWidget() { _prop = 0; }
|
||||||
LayoutWidget(SGPropertyNode* p) { _prop = p; }
|
LayoutWidget(SGPropertyNode* p) { _prop = p; }
|
||||||
|
|
||||||
const char* type();
|
std::string type();
|
||||||
bool hasParent();
|
bool hasParent();
|
||||||
LayoutWidget parent();
|
LayoutWidget parent();
|
||||||
int nChildren();
|
int nChildren();
|
||||||
|
@ -32,7 +32,7 @@ public:
|
||||||
bool hasField(const char* f);
|
bool hasField(const char* f);
|
||||||
int getNum(const char* f);
|
int getNum(const char* f);
|
||||||
bool getBool(const char* f, bool dflt = false);
|
bool getBool(const char* f, bool dflt = false);
|
||||||
const char* getStr(const char* f);
|
std::string getStr(const char* f);
|
||||||
void setNum(const char* f, int num);
|
void setNum(const char* f, int num);
|
||||||
|
|
||||||
void calcPrefSize(int* w, int* h);
|
void calcPrefSize(int* w, int* h);
|
||||||
|
@ -43,7 +43,7 @@ private:
|
||||||
static puFont FONT;
|
static puFont FONT;
|
||||||
|
|
||||||
static bool eq(const char* a, const char* b);
|
static bool eq(const char* a, const char* b);
|
||||||
bool isType(const char* t) { return eq(t, type()); }
|
bool isType(const char* t) { return (t == type()); }
|
||||||
|
|
||||||
int padding();
|
int padding();
|
||||||
int stringLength(const char* s); // must handle null argument
|
int stringLength(const char* s); // must handle null argument
|
||||||
|
|
|
@ -23,21 +23,21 @@ FGMenuBar::getLocalizedLabel(SGPropertyNode* node)
|
||||||
if (!node)
|
if (!node)
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
const char* name = node->getStringValue("name", 0);
|
std::string name = node->getStringValue("name", "");
|
||||||
const auto translated = globals->get_locale()->getLocalizedString(name, "menu");
|
const auto translated = globals->get_locale()->getLocalizedString(name, "menu");
|
||||||
if (!translated.empty())
|
if (!translated.empty())
|
||||||
return translated;
|
return translated;
|
||||||
|
|
||||||
// return default with fallback to name
|
// return default with fallback to name
|
||||||
const char* l = node->getStringValue("label", name);
|
std::string label = node->getStringValue("label", name.c_str());
|
||||||
|
|
||||||
// this can occur if the menu item is missing a <name>
|
// this can occur if the menu item is missing a <name>
|
||||||
if (l == nullptr) {
|
if (label.empty()) {
|
||||||
SG_LOG(SG_GUI, SG_ALERT, "FGMenuBar::getLocalizedLabel: No <name> defined for:" << node->getPath());
|
SG_LOG(SG_GUI, SG_ALERT, "FGMenuBar::getLocalizedLabel: No <name> defined for:" << node->getPath());
|
||||||
return string{"<unnamed>"};
|
return string{"<unnamed>"};
|
||||||
}
|
}
|
||||||
|
|
||||||
return string{l};
|
return label;
|
||||||
}
|
}
|
||||||
|
|
||||||
// end of menubar.cxx
|
// end of menubar.cxx
|
||||||
|
|
|
@ -71,7 +71,7 @@ NewGUI::~NewGUI ()
|
||||||
//
|
//
|
||||||
static void findAllLeafValues(SGPropertyNode* node, const std::string& leaf, std::vector<std::string>& out)
|
static void findAllLeafValues(SGPropertyNode* node, const std::string& leaf, std::vector<std::string>& out)
|
||||||
{
|
{
|
||||||
const char* name = node->getName();
|
string name = node->getNameString();
|
||||||
if (name == leaf) {
|
if (name == leaf) {
|
||||||
out.push_back(node->getStringValue());
|
out.push_back(node->getStringValue());
|
||||||
}
|
}
|
||||||
|
@ -121,7 +121,7 @@ NewGUI::init ()
|
||||||
SGPath p(globals->get_fg_root(), "gui/dialogs");
|
SGPath p(globals->get_fg_root(), "gui/dialogs");
|
||||||
readDir(p);
|
readDir(p);
|
||||||
|
|
||||||
SGPath aircraftDialogDir(string(fgGetString("/sim/aircraft-dir")), "gui/dialogs");
|
SGPath aircraftDialogDir(fgGetString("/sim/aircraft-dir"), "gui/dialogs");
|
||||||
if (aircraftDialogDir.exists()) {
|
if (aircraftDialogDir.exists()) {
|
||||||
readDir(aircraftDialogDir);
|
readDir(aircraftDialogDir);
|
||||||
}
|
}
|
||||||
|
@ -414,12 +414,11 @@ NewGUI::setMenuBarOverlapHide(bool hide)
|
||||||
void
|
void
|
||||||
NewGUI::newDialog (SGPropertyNode* props)
|
NewGUI::newDialog (SGPropertyNode* props)
|
||||||
{
|
{
|
||||||
const char* cname = props->getStringValue("name");
|
string name = props->getStringValue("name", "");
|
||||||
if(!cname) {
|
if(name.empty()) {
|
||||||
SG_LOG(SG_GENERAL, SG_ALERT, "New dialog has no <name> property");
|
SG_LOG(SG_GENERAL, SG_ALERT, "New dialog has no <name> property");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
string name = cname;
|
|
||||||
|
|
||||||
if(_active_dialogs.find(name) == _active_dialogs.end()) {
|
if(_active_dialogs.find(name) == _active_dialogs.end()) {
|
||||||
_dialog_props[name] = props;
|
_dialog_props[name] = props;
|
||||||
|
@ -566,7 +565,7 @@ NewGUI::setStyle (void)
|
||||||
|
|
||||||
for (int i = 0; i < n->nChildren(); i++) {
|
for (int i = 0; i < n->nChildren(); i++) {
|
||||||
SGPropertyNode *child = n->getChild(i);
|
SGPropertyNode *child = n->getChild(i);
|
||||||
_colors[child->getName()] = new FGColor(child);
|
_colors[child->getNameString()] = new FGColor(child);
|
||||||
}
|
}
|
||||||
|
|
||||||
FGColor *c = _colors["background"];
|
FGColor *c = _colors["background"];
|
||||||
|
|
|
@ -189,15 +189,15 @@ protected:
|
||||||
private:
|
private:
|
||||||
void createMenuBarImplementation();
|
void createMenuBarImplementation();
|
||||||
|
|
||||||
struct ltstr
|
/*struct ltstr
|
||||||
{
|
{
|
||||||
bool operator()(const char* s1, const char* s2) const {
|
bool operator()(const std::string& s1, const std::string& s2) const {
|
||||||
return strcmp(s1, s2) < 0;
|
return s1 < s2;
|
||||||
}
|
}
|
||||||
};
|
};*/
|
||||||
|
|
||||||
puFont *_font;
|
puFont *_font;
|
||||||
typedef std::map<const char*,FGColor*, ltstr> ColourDict;
|
typedef std::map<std::string, FGColor*> ColourDict;
|
||||||
ColourDict _colors;
|
ColourDict _colors;
|
||||||
typedef ColourDict::iterator _itt_t;
|
typedef ColourDict::iterator _itt_t;
|
||||||
typedef ColourDict::const_iterator _citt_t;
|
typedef ColourDict::const_iterator _citt_t;
|
||||||
|
|
|
@ -86,7 +86,7 @@ static void dumpProperties(const SGPropertyNode *node)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
int index = c->getIndex();
|
int index = c->getIndex();
|
||||||
cout << std::setw(11) << getValueTypeString(c) << " " << c->getName();
|
cout << std::setw(11) << getValueTypeString(c) << " " << c->getNameString();
|
||||||
if (index > 0)
|
if (index > 0)
|
||||||
cout << '[' << index << ']';
|
cout << '[' << index << ']';
|
||||||
cout << " = ";
|
cout << " = ";
|
||||||
|
@ -409,7 +409,7 @@ int PropertyList::nodeNameCompare(const void *p1, const void *p2)
|
||||||
const SGPropertyNode *n1 = (*(const NodeData *)p1).node;
|
const SGPropertyNode *n1 = (*(const NodeData *)p1).node;
|
||||||
const SGPropertyNode *n2 = (*(const NodeData *)p2).node;
|
const SGPropertyNode *n2 = (*(const NodeData *)p2).node;
|
||||||
|
|
||||||
int diff = strcmp(n1->getName(), n2->getName());
|
int diff = strcmp(n1->getNameString().c_str(), n2->getNameString().c_str());
|
||||||
return diff ? diff : n1->getIndex() - n2->getIndex();
|
return diff ? diff : n1->getIndex() - n2->getIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ void FGCommonInput::read_bindings (const SGPropertyNode * node, binding_list_t *
|
||||||
PropertyList bindings = node->getChildren("binding");
|
PropertyList bindings = node->getChildren("binding");
|
||||||
static string nasal = "nasal";
|
static string nasal = "nasal";
|
||||||
for (unsigned int i = 0; i < bindings.size(); i++) {
|
for (unsigned int i = 0; i < bindings.size(); i++) {
|
||||||
const char *cmd = bindings[i]->getStringValue("command");
|
std::string cmd = bindings[i]->getStringValue("command");
|
||||||
if (nasal.compare(cmd) == 0 && !module.empty())
|
if (nasal.compare(cmd) == 0 && !module.empty())
|
||||||
bindings[i]->setStringValue("module", module.c_str());
|
bindings[i]->setStringValue("module", module.c_str());
|
||||||
binding_list[modifiers].push_back(new SGBinding(bindings[i], globals->get_props()));
|
binding_list[modifiers].push_back(new SGBinding(bindings[i], globals->get_props()));
|
||||||
|
|
|
@ -820,12 +820,12 @@ void FGHIDDevice::defineReport(SGPropertyNode_ptr reportNode)
|
||||||
for (int c=0; c < nChildren; ++c) {
|
for (int c=0; c < nChildren; ++c) {
|
||||||
const auto nd = reportNode->getChild(c);
|
const auto nd = reportNode->getChild(c);
|
||||||
const int size = nd->getIntValue("size", 1); // default to a single bit
|
const int size = nd->getIntValue("size", 1); // default to a single bit
|
||||||
if (!strcmp(nd->getName(), "unused-bits")) {
|
if (nd->getNameString() == "unused-bits") {
|
||||||
bitCount += size;
|
bitCount += size;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!strcmp(nd->getName(), "type") || !strcmp(nd->getName(), "id")) {
|
if (nd->getNameString() == "type" || nd->getNameString() == "id") {
|
||||||
continue; // already handled above
|
continue; // already handled above
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -420,7 +420,7 @@ void FGMouseInput::init()
|
||||||
SGPropertyNode * mode_node = mouse_node->getChild("mode", j, true);
|
SGPropertyNode * mode_node = mouse_node->getChild("mode", j, true);
|
||||||
|
|
||||||
// Read the mouse cursor for this mode
|
// Read the mouse cursor for this mode
|
||||||
m.modes[j].cursor = FGMouseCursor::cursorFromString(mode_node->getStringValue("cursor", "inherit"));
|
m.modes[j].cursor = FGMouseCursor::cursorFromString(mode_node->getStringValue("cursor", "inherit").c_str());
|
||||||
|
|
||||||
// Read other properties for this mode
|
// Read other properties for this mode
|
||||||
m.modes[j].constrained = mode_node->getBoolValue("constrained", false);
|
m.modes[j].constrained = mode_node->getBoolValue("constrained", false);
|
||||||
|
|
|
@ -73,8 +73,8 @@ HUD::Input::Input(const SGPropertyNode *n, float factor, float offset,
|
||||||
_coeff = 1.0 - 1.0 / powf(10, fabs(n->getFloatValue("damp", 0.0)));
|
_coeff = 1.0 - 1.0 / powf(10, fabs(n->getFloatValue("damp", 0.0)));
|
||||||
SGPropertyNode *p = ((SGPropertyNode *)n)->getNode("property", false);
|
SGPropertyNode *p = ((SGPropertyNode *)n)->getNode("property", false);
|
||||||
if (p) {
|
if (p) {
|
||||||
const char *path = p->getStringValue();
|
string path = p->getStringValue();
|
||||||
if (path && path[0]) {
|
if (!path.empty()) {
|
||||||
_property = fgGetNode(path, true);
|
_property = fgGetNode(path, true);
|
||||||
_valid = true;
|
_valid = true;
|
||||||
}
|
}
|
||||||
|
@ -395,52 +395,52 @@ int HUD::load(const char *file, float x, float y, int level, const string& inden
|
||||||
|
|
||||||
for (int i = 0; i < root.nChildren(); i++) {
|
for (int i = 0; i < root.nChildren(); i++) {
|
||||||
SGPropertyNode *n = root.getChild(i);
|
SGPropertyNode *n = root.getChild(i);
|
||||||
const char *d = n->getStringValue("name", 0);
|
string d = n->getStringValue("name", "");
|
||||||
string desc;
|
string desc;
|
||||||
if (d)
|
if (!d.empty())
|
||||||
desc = string(": \"") + d + '"';
|
desc = string(": \"") + d + '"';
|
||||||
|
|
||||||
const char *name = n->getName();
|
const string name = n->getNameString();
|
||||||
if (!strcmp(name, "name")) {
|
if (name == "name") {
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
} else if (!strcmp(name, "enable3d")) {
|
} else if (name == "enable3d") {
|
||||||
// set in the tree so that valueChanged() picks it up
|
// set in the tree so that valueChanged() picks it up
|
||||||
_3DenabledN->setBoolValue(n->getBoolValue());
|
_3DenabledN->setBoolValue(n->getBoolValue());
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
} else if (!strcmp(name, "import")) {
|
} else if (name == "import") {
|
||||||
const char *fn = n->getStringValue("path", "");
|
string fn = n->getStringValue("path", "");
|
||||||
float xoffs = n->getFloatValue("x-offset", 0.0f);
|
float xoffs = n->getFloatValue("x-offset", 0.0f);
|
||||||
float yoffs = n->getFloatValue("y-offset", 0.0f);
|
float yoffs = n->getFloatValue("y-offset", 0.0f);
|
||||||
|
|
||||||
SG_LOG(SG_INPUT, TREE, indent << "|__import " << fn << desc);
|
SG_LOG(SG_INPUT, TREE, indent << "|__import " << fn << desc);
|
||||||
|
|
||||||
string ind = indent + string(i + 1 < root.nChildren() ? "| " : " ");
|
string ind = indent + string(i + 1 < root.nChildren() ? "| " : " ");
|
||||||
ret |= load(fn, x + xoffs, y + yoffs, level + 1, ind);
|
ret |= load(fn.c_str(), x + xoffs, y + yoffs, level + 1, ind);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
SG_LOG(SG_INPUT, TREE, indent << "|__" << name << desc);
|
SG_LOG(SG_INPUT, TREE, indent << "|__" << name << desc);
|
||||||
|
|
||||||
Item *item;
|
Item *item;
|
||||||
if (!strcmp(name, "label")) {
|
if (name == "label") {
|
||||||
item = static_cast<Item *>(new Label(this, n, x, y));
|
item = static_cast<Item *>(new Label(this, n, x, y));
|
||||||
} else if (!strcmp(name, "gauge")) {
|
} else if (name == "gauge") {
|
||||||
item = static_cast<Item *>(new Gauge(this, n, x, y));
|
item = static_cast<Item *>(new Gauge(this, n, x, y));
|
||||||
} else if (!strcmp(name, "tape")) {
|
} else if (name == "tape") {
|
||||||
item = static_cast<Item *>(new Tape(this, n, x, y));
|
item = static_cast<Item *>(new Tape(this, n, x, y));
|
||||||
} else if (!strcmp(name, "dial")) {
|
} else if (name == "dial") {
|
||||||
item = static_cast<Item *>(new Dial(this, n, x, y));
|
item = static_cast<Item *>(new Dial(this, n, x, y));
|
||||||
} else if (!strcmp(name, "turn-bank-indicator")) {
|
} else if (name == "turn-bank-indicator") {
|
||||||
item = static_cast<Item *>(new TurnBankIndicator(this, n, x, y));
|
item = static_cast<Item *>(new TurnBankIndicator(this, n, x, y));
|
||||||
} else if (!strcmp(name, "ladder")) {
|
} else if (name == "ladder") {
|
||||||
item = static_cast<Item *>(new Ladder(this, n, x, y));
|
item = static_cast<Item *>(new Ladder(this, n, x, y));
|
||||||
_ladders.insert(_ladders.begin(), item);
|
_ladders.insert(_ladders.begin(), item);
|
||||||
continue;
|
continue;
|
||||||
} else if (!strcmp(name, "runway")) {
|
} else if (name == "runway") {
|
||||||
item = static_cast<Item *>(new Runway(this, n, x, y));
|
item = static_cast<Item *>(new Runway(this, n, x, y));
|
||||||
} else if (!strcmp(name, "aiming-reticle")) {
|
} else if (name == "aiming-reticle") {
|
||||||
item = static_cast<Item *>(new AimingReticle(this, n, x, y));
|
item = static_cast<Item *>(new AimingReticle(this, n, x, y));
|
||||||
} else {
|
} else {
|
||||||
SG_LOG(SG_INPUT, TREE, indent << " \\...unsupported!");
|
SG_LOG(SG_INPUT, TREE, indent << " \\...unsupported!");
|
||||||
|
@ -466,7 +466,7 @@ void HUD::valueChanged(SGPropertyNode *node)
|
||||||
loadNow = true;
|
loadNow = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!strcmp(node->getName(), "current-path") && _visible) {
|
if (node->getNameString() == "current-path" && _visible) {
|
||||||
loadNow = true;
|
loadNow = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -483,7 +483,7 @@ void HUD::valueChanged(SGPropertyNode *node)
|
||||||
load(path.c_str());
|
load(path.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!strcmp(node->getName(), "current-color")) {
|
if (node->getNameString() == "current-color") {
|
||||||
currentColorChanged();
|
currentColorChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -501,7 +501,7 @@ void HUD::valueChanged(SGPropertyNode *node)
|
||||||
_a = clamp(_alpha->getFloatValue());
|
_a = clamp(_alpha->getFloatValue());
|
||||||
_cl = clamp(_alpha_clamp->getFloatValue());
|
_cl = clamp(_alpha_clamp->getFloatValue());
|
||||||
|
|
||||||
_units = strcmp(_unitsN->getStringValue(), "feet") ? METER : FEET;
|
_units = _unitsN->getStringValue() != "feet" ? METER : FEET;
|
||||||
_listener_active = false;
|
_listener_active = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,24 +51,24 @@ HUD::Item::Item(HUD *hud, const SGPropertyNode *n, float x, float y) :
|
||||||
|
|
||||||
vector<SGPropertyNode_ptr> opt = n->getChildren("option");
|
vector<SGPropertyNode_ptr> opt = n->getChildren("option");
|
||||||
for (unsigned int i = 0; i < opt.size(); i++) {
|
for (unsigned int i = 0; i < opt.size(); i++) {
|
||||||
const char *o = opt[i]->getStringValue();
|
string o = opt[i]->getStringValue();
|
||||||
if (!strcmp(o, "vertical"))
|
if (o == "vertical")
|
||||||
_options |= VERTICAL;
|
_options |= VERTICAL;
|
||||||
else if (!strcmp(o, "horizontal"))
|
else if (o == "horizontal")
|
||||||
_options |= HORIZONTAL;
|
_options |= HORIZONTAL;
|
||||||
else if (!strcmp(o, "top"))
|
else if (o == "top")
|
||||||
_options |= TOP;
|
_options |= TOP;
|
||||||
else if (!strcmp(o, "left"))
|
else if (o == "left")
|
||||||
_options |= LEFT;
|
_options |= LEFT;
|
||||||
else if (!strcmp(o, "bottom"))
|
else if (o == "bottom")
|
||||||
_options |= BOTTOM;
|
_options |= BOTTOM;
|
||||||
else if (!strcmp(o, "right"))
|
else if (o == "right")
|
||||||
_options |= RIGHT;
|
_options |= RIGHT;
|
||||||
else if (!strcmp(o, "both"))
|
else if (o == "both")
|
||||||
_options |= (LEFT|RIGHT);
|
_options |= (LEFT|RIGHT);
|
||||||
else if (!strcmp(o, "noticks"))
|
else if (o == "noticks")
|
||||||
_options |= NOTICKS;
|
_options |= NOTICKS;
|
||||||
else if (!strcmp(o, "notext"))
|
else if (o == "notext")
|
||||||
_options |= NOTEXT;
|
_options |= NOTEXT;
|
||||||
else
|
else
|
||||||
SG_LOG(SG_INPUT, SG_WARN, "HUD: unsupported option: " << o);
|
SG_LOG(SG_INPUT, SG_WARN, "HUD: unsupported option: " << o);
|
||||||
|
|
|
@ -43,29 +43,29 @@ HUD::Label::Label(HUD *hud, const SGPropertyNode *n, float x, float y) :
|
||||||
if (node)
|
if (node)
|
||||||
_blink_condition = sgReadCondition(globals->get_props(), node);
|
_blink_condition = sgReadCondition(globals->get_props(), node);
|
||||||
|
|
||||||
const char *halign = n->getStringValue("halign", "center");
|
string halign = n->getStringValue("halign", "center");
|
||||||
if (!strcmp(halign, "left"))
|
if (halign == "left")
|
||||||
_halign = LEFT;
|
_halign = LEFT;
|
||||||
else if (!strcmp(halign, "right"))
|
else if (halign == "right")
|
||||||
_halign = RIGHT;
|
_halign = RIGHT;
|
||||||
else
|
else
|
||||||
_halign = HCENTER;
|
_halign = HCENTER;
|
||||||
|
|
||||||
_halign |= VCENTER;
|
_halign |= VCENTER;
|
||||||
|
|
||||||
const char *pre = n->getStringValue("prefix", 0);
|
string pre = n->getStringValue("prefix", "");
|
||||||
const char *post = n->getStringValue("postfix", 0);
|
string post = n->getStringValue("postfix", "");
|
||||||
const char *fmt = n->getStringValue("format", 0);
|
string fmt = n->getStringValue("format", "");
|
||||||
|
|
||||||
if (pre)
|
if (!pre.empty())
|
||||||
_format = pre;
|
_format = pre;
|
||||||
|
|
||||||
if (fmt)
|
if (!fmt.empty())
|
||||||
_format += fmt;
|
_format += fmt;
|
||||||
else
|
else
|
||||||
_format += "%s";
|
_format += "%s";
|
||||||
|
|
||||||
if (post)
|
if (!post.empty())
|
||||||
_format += post;
|
_format += post;
|
||||||
|
|
||||||
_mode = check_format(_format.c_str());
|
_mode = check_format(_format.c_str());
|
||||||
|
@ -148,7 +148,7 @@ void HUD::Label::draw(void)
|
||||||
if (_mode == NONE)
|
if (_mode == NONE)
|
||||||
snprintf(buf, BUFSIZE, _format.c_str(), 0);
|
snprintf(buf, BUFSIZE, _format.c_str(), 0);
|
||||||
else if (_mode == STRING)
|
else if (_mode == STRING)
|
||||||
snprintf(buf, BUFSIZE, _format.c_str(), _input.getStringValue());
|
snprintf(buf, BUFSIZE, _format.c_str(), _input.getStringValue().c_str());
|
||||||
else if (_mode == INT)
|
else if (_mode == INT)
|
||||||
snprintf(buf, BUFSIZE, _format.c_str(), int(_input.getFloatValue()));
|
snprintf(buf, BUFSIZE, _format.c_str(), int(_input.getFloatValue()));
|
||||||
else if (_mode == LONG)
|
else if (_mode == LONG)
|
||||||
|
|
|
@ -78,8 +78,8 @@ HUD::Ladder::Ladder(HUD *hud, const SGPropertyNode *n, float x, float y) :
|
||||||
_hat(n->getBoolValue("enable-hat")),
|
_hat(n->getBoolValue("enable-hat")),
|
||||||
_clip_box(new ClipBox(n->getNode("clipping")))
|
_clip_box(new ClipBox(n->getNode("clipping")))
|
||||||
{
|
{
|
||||||
const char *t = n->getStringValue("type");
|
string t = n->getStringValue("type");
|
||||||
_type = strcmp(t, "climb-dive") ? PITCH : CLIMB_DIVE;
|
_type = t != "climb-dive" ? PITCH : CLIMB_DIVE;
|
||||||
|
|
||||||
if (!_width_units)
|
if (!_width_units)
|
||||||
_width_units = 45;
|
_width_units = 45;
|
||||||
|
@ -300,7 +300,7 @@ void HUD::Ladder::draw(void)
|
||||||
for (int i = 0; i < models->nChildren(); i++) {
|
for (int i = 0; i < models->nChildren(); i++) {
|
||||||
SGPropertyNode *chld = models->getChild(i);
|
SGPropertyNode *chld = models->getChild(i);
|
||||||
string name;
|
string name;
|
||||||
name = chld->getName();
|
name = chld->getNameString();
|
||||||
if (name == "tanker" || name == "aircraft" || name == "multiplayer") {
|
if (name == "tanker" || name == "aircraft" || name == "multiplayer") {
|
||||||
bool valid = chld->getBoolValue("valid");
|
bool valid = chld->getBoolValue("valid");
|
||||||
bool in_range = chld->getBoolValue("radar/in-range", true);
|
bool in_range = chld->getBoolValue("radar/in-range", true);
|
||||||
|
|
|
@ -73,7 +73,7 @@ public:
|
||||||
return _property->getBoolValue();
|
return _property->getBoolValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *getStringValue() const {
|
std::string getStringValue() const {
|
||||||
assert(_property);
|
assert(_property);
|
||||||
return _property->getStringValue();
|
return _property->getStringValue();
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,15 +43,14 @@ HUD::Tape::Tape(HUD *hud, const SGPropertyNode *n, float x, float y) :
|
||||||
{
|
{
|
||||||
_half_width_units = range_to_show() / 2.0;
|
_half_width_units = range_to_show() / 2.0;
|
||||||
|
|
||||||
const char *s;
|
string s = n->getStringValue("pointer-type");
|
||||||
s = n->getStringValue("pointer-type");
|
_pointer_type = s != "moving" ? FIXED : MOVING; // "fixed", "moving"
|
||||||
_pointer_type = strcmp(s, "moving") ? FIXED : MOVING; // "fixed", "moving"
|
|
||||||
|
|
||||||
s = n->getStringValue("tick-type");
|
s = n->getStringValue("tick-type");
|
||||||
_tick_type = strcmp(s, "bullet") ? LINE : CIRCLE; // "bullet", "line"
|
_tick_type = s != "bullet" ? LINE : CIRCLE; // "bullet", "line"
|
||||||
|
|
||||||
s = n->getStringValue("tick-length"); // "variable", "constant"
|
s = n->getStringValue("tick-length"); // "variable", "constant"
|
||||||
_tick_length = strcmp(s, "constant") ? VARIABLE : CONSTANT;
|
_tick_length = s != "constant" ? VARIABLE : CONSTANT;
|
||||||
|
|
||||||
_label_fmt = check_format(_format.c_str());
|
_label_fmt = check_format(_format.c_str());
|
||||||
if (_label_fmt != INT && _label_fmt != LONG
|
if (_label_fmt != INT && _label_fmt != LONG
|
||||||
|
|
|
@ -280,8 +280,8 @@ void DCLGPS::update(double dt) {
|
||||||
|
|
||||||
// Check if an alarm timer has expired
|
// Check if an alarm timer has expired
|
||||||
if(_alarmSet) {
|
if(_alarmSet) {
|
||||||
if(_alarmTime.hr() == atoi(fgGetString("/instrumentation/clock/indicated-hour"))
|
if(_alarmTime.hr() == atoi(fgGetString("/instrumentation/clock/indicated-hour").c_str())
|
||||||
&& _alarmTime.min() == atoi(fgGetString("/instrumentation/clock/indicated-min"))) {
|
&& _alarmTime.min() == atoi(fgGetString("/instrumentation/clock/indicated-min").c_str())) {
|
||||||
_messageStack.push_back("*Timer Expired");
|
_messageStack.push_back("*Timer Expired");
|
||||||
_alarmSet = false;
|
_alarmSet = false;
|
||||||
}
|
}
|
||||||
|
@ -971,8 +971,8 @@ void DCLGPS::SetPowerOnTimer() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void DCLGPS::ResetPowerOnTimer() {
|
void DCLGPS::ResetPowerOnTimer() {
|
||||||
_powerOnTime.set_hr(atoi(fgGetString("/instrumentation/clock/indicated-hour")));
|
_powerOnTime.set_hr(atoi(fgGetString("/instrumentation/clock/indicated-hour").c_str()));
|
||||||
_powerOnTime.set_min(atoi(fgGetString("/instrumentation/clock/indicated-min")));
|
_powerOnTime.set_min(atoi(fgGetString("/instrumentation/clock/indicated-min").c_str()));
|
||||||
_powerOnTimerSet = true;
|
_powerOnTimerSet = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -146,8 +146,8 @@ DME::update (double delta_time_sec)
|
||||||
char tmp[16];
|
char tmp[16];
|
||||||
|
|
||||||
// Figure out the source
|
// Figure out the source
|
||||||
const char * source = _source_node->getStringValue();
|
string source = _source_node->getStringValue();
|
||||||
if (source[0] == '\0') {
|
if (source.empty()) {
|
||||||
std::string branch;
|
std::string branch;
|
||||||
branch = "/instrumentation/" + name() + "/frequencies/selected-mhz";
|
branch = "/instrumentation/" + name() + "/frequencies/selected-mhz";
|
||||||
_source_node->setStringValue(branch.c_str());
|
_source_node->setStringValue(branch.c_str());
|
||||||
|
|
|
@ -32,7 +32,7 @@ HeadingIndicatorDG::HeadingIndicatorDG ( SGPropertyNode *node ) :
|
||||||
int i;
|
int i;
|
||||||
for ( i = 0; i < node->nChildren(); ++i ) {
|
for ( i = 0; i < node->nChildren(); ++i ) {
|
||||||
SGPropertyNode *child = node->getChild(i);
|
SGPropertyNode *child = node->getChild(i);
|
||||||
std::string cname = child->getName();
|
std::string cname = child->getNameString();
|
||||||
std::string cval = child->getStringValue();
|
std::string cval = child->getStringValue();
|
||||||
if ( cname == "name" ) {
|
if ( cname == "name" ) {
|
||||||
name = cval;
|
name = cval;
|
||||||
|
|
|
@ -31,7 +31,7 @@ HeadingIndicatorFG::HeadingIndicatorFG ( SGPropertyNode *node )
|
||||||
int i;
|
int i;
|
||||||
for ( i = 0; i < node->nChildren(); ++i ) {
|
for ( i = 0; i < node->nChildren(); ++i ) {
|
||||||
SGPropertyNode *child = node->getChild(i);
|
SGPropertyNode *child = node->getChild(i);
|
||||||
string cname = child->getName();
|
string cname = child->getNameString();
|
||||||
string cval = child->getStringValue();
|
string cval = child->getStringValue();
|
||||||
if ( cname == "name" ) {
|
if ( cname == "name" ) {
|
||||||
name = cval;
|
name = cval;
|
||||||
|
|
|
@ -111,7 +111,7 @@ bool FGInstrumentMgr::build (SGPropertyNode* config_props, const SGPath& path)
|
||||||
{
|
{
|
||||||
for ( int i = 0; i < config_props->nChildren(); ++i ) {
|
for ( int i = 0; i < config_props->nChildren(); ++i ) {
|
||||||
SGPropertyNode *node = config_props->getChild(i);
|
SGPropertyNode *node = config_props->getChild(i);
|
||||||
std::string name = node->getName();
|
std::string name = node->getNameString();
|
||||||
|
|
||||||
std::ostringstream subsystemname;
|
std::ostringstream subsystemname;
|
||||||
subsystemname << "instrument-" << i << '-'
|
subsystemname << "instrument-" << i << '-'
|
||||||
|
|
|
@ -1131,7 +1131,7 @@ MK_VIII::IOHandler::update_inputs ()
|
||||||
{
|
{
|
||||||
const char *mode;
|
const char *mode;
|
||||||
|
|
||||||
mode = mk_node(autopilot_heading_lock)->getStringValue();
|
mode = mk_node(autopilot_heading_lock)->getStringValue().c_str();
|
||||||
mk_dinput(autopilot_engaged) = mode && *mode;
|
mk_dinput(autopilot_engaged) = mode && *mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4625,7 +4625,7 @@ MK_VIII::MK_VIII (SGPropertyNode *node)
|
||||||
for (int i = 0; i < node->nChildren(); ++i)
|
for (int i = 0; i < node->nChildren(); ++i)
|
||||||
{
|
{
|
||||||
SGPropertyNode *child = node->getChild(i);
|
SGPropertyNode *child = node->getChild(i);
|
||||||
string cname = child->getName();
|
string cname = child->getNameString();
|
||||||
string cval = child->getStringValue();
|
string cval = child->getStringValue();
|
||||||
|
|
||||||
if (cname == "name")
|
if (cname == "name")
|
||||||
|
|
|
@ -291,7 +291,7 @@ TACAN::valueChanged(SGPropertyNode *prop)
|
||||||
int index = prop->getIndex();
|
int index = prop->getIndex();
|
||||||
std::string channel = _channel;
|
std::string channel = _channel;
|
||||||
|
|
||||||
if (std::string("selected-mhz") == prop->getName())
|
if (std::string("selected-mhz") == prop->getNameString())
|
||||||
{
|
{
|
||||||
FGTACANRecord *rec= globals->get_channellist()->findByFrequency(prop->getDoubleValue()*1000);
|
FGTACANRecord *rec= globals->get_channellist()->findByFrequency(prop->getDoubleValue()*1000);
|
||||||
if (rec != nullptr) {
|
if (rec != nullptr) {
|
||||||
|
|
|
@ -1184,7 +1184,7 @@ TCAS::TCAS(SGPropertyNode* pNode) :
|
||||||
for (int i = 0; i < pNode->nChildren(); ++i)
|
for (int i = 0; i < pNode->nChildren(); ++i)
|
||||||
{
|
{
|
||||||
SGPropertyNode* pChild = pNode->getChild(i);
|
SGPropertyNode* pChild = pNode->getChild(i);
|
||||||
string cname = pChild->getName();
|
string cname = pChild->getNameString();
|
||||||
string cval = pChild->getStringValue();
|
string cval = pChild->getStringValue();
|
||||||
int cintval = pChild->getIntValue();
|
int cintval = pChild->getIntValue();
|
||||||
|
|
||||||
|
|
|
@ -171,7 +171,7 @@ compare_values (SGPropertyNode * value1, SGPropertyNode * value2)
|
||||||
case simgear::props::DOUBLE:
|
case simgear::props::DOUBLE:
|
||||||
return (value1->getDoubleValue() == value2->getDoubleValue());
|
return (value1->getDoubleValue() == value2->getDoubleValue());
|
||||||
default:
|
default:
|
||||||
return !strcmp(value1->getStringValue(), value2->getStringValue());
|
return value1->getStringValue() == value2->getStringValue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -253,7 +253,7 @@ do_pause (const SGPropertyNode * arg, SGPropertyNode * root)
|
||||||
static bool
|
static bool
|
||||||
do_load (const SGPropertyNode * arg, SGPropertyNode * root)
|
do_load (const SGPropertyNode * arg, SGPropertyNode * root)
|
||||||
{
|
{
|
||||||
SGPath file(arg->getStringValue("file", "fgfs.sav"));
|
SGPath file(arg->getStringValue("file", "fgfs.sav").c_str());
|
||||||
|
|
||||||
if (file.extension() != "sav")
|
if (file.extension() != "sav")
|
||||||
file.concat(".sav");
|
file.concat(".sav");
|
||||||
|
@ -286,7 +286,7 @@ do_load (const SGPropertyNode * arg, SGPropertyNode * root)
|
||||||
static bool
|
static bool
|
||||||
do_save (const SGPropertyNode * arg, SGPropertyNode * root)
|
do_save (const SGPropertyNode * arg, SGPropertyNode * root)
|
||||||
{
|
{
|
||||||
SGPath file(arg->getStringValue("file", "fgfs.sav"));
|
SGPath file(arg->getStringValue("file", "fgfs.sav").c_str());
|
||||||
|
|
||||||
if (file.extension() != "sav")
|
if (file.extension() != "sav")
|
||||||
file.concat(".sav");
|
file.concat(".sav");
|
||||||
|
@ -543,7 +543,7 @@ do_property_adjust (const SGPropertyNode * arg, SGPropertyNode * root)
|
||||||
* arg->getDoubleValue("offset"));
|
* arg->getDoubleValue("offset"));
|
||||||
|
|
||||||
double unmodifiable, modifiable;
|
double unmodifiable, modifiable;
|
||||||
split_value(prop->getDoubleValue(), arg->getStringValue("mask", "all"),
|
split_value(prop->getDoubleValue(), arg->getStringValue("mask", "all").c_str(),
|
||||||
&unmodifiable, &modifiable);
|
&unmodifiable, &modifiable);
|
||||||
modifiable += amount;
|
modifiable += amount;
|
||||||
limit_value(&modifiable, arg);
|
limit_value(&modifiable, arg);
|
||||||
|
@ -575,7 +575,7 @@ do_property_multiply (const SGPropertyNode * arg, SGPropertyNode * root)
|
||||||
double factor = arg->getDoubleValue("factor", 1.0);
|
double factor = arg->getDoubleValue("factor", 1.0);
|
||||||
|
|
||||||
double unmodifiable, modifiable;
|
double unmodifiable, modifiable;
|
||||||
split_value(prop->getDoubleValue(), arg->getStringValue("mask", "all"),
|
split_value(prop->getDoubleValue(), arg->getStringValue("mask", "all").c_str(),
|
||||||
&unmodifiable, &modifiable);
|
&unmodifiable, &modifiable);
|
||||||
modifiable *= factor;
|
modifiable *= factor;
|
||||||
limit_value(&modifiable, arg);
|
limit_value(&modifiable, arg);
|
||||||
|
|
|
@ -365,7 +365,7 @@ private:
|
||||||
|
|
||||||
vector<SGPropertyNode_ptr> cache = _cache->getChildren("aircraft");
|
vector<SGPropertyNode_ptr> cache = _cache->getChildren("aircraft");
|
||||||
for (unsigned int i = 0; i < cache.size(); i++) {
|
for (unsigned int i = 0; i < cache.size(); i++) {
|
||||||
const char *name = cache[i]->getStringValue("file", "");
|
const std::string name = cache[i]->getStringValue("file", "");
|
||||||
if (!simgear::strutils::iequals(_searchAircraft, name)) {
|
if (!simgear::strutils::iequals(_searchAircraft, name)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -624,7 +624,7 @@ fgGetDouble (const char * name, double defaultValue)
|
||||||
return globals->get_props()->getDoubleValue(name, defaultValue);
|
return globals->get_props()->getDoubleValue(name, defaultValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *
|
std::string
|
||||||
fgGetString (const char * name, const char * defaultValue)
|
fgGetString (const char * name, const char * defaultValue)
|
||||||
{
|
{
|
||||||
return globals->get_props()->getStringValue(name, defaultValue);
|
return globals->get_props()->getStringValue(name, defaultValue);
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#define __FG_PROPS_HXX 1
|
#define __FG_PROPS_HXX 1
|
||||||
|
|
||||||
#include <iosfwd>
|
#include <iosfwd>
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
#include <simgear/structure/subsystem_mgr.hxx>
|
#include <simgear/structure/subsystem_mgr.hxx>
|
||||||
#include <simgear/props/tiedpropertylist.hxx>
|
#include <simgear/props/tiedpropertylist.hxx>
|
||||||
|
@ -424,7 +425,7 @@ inline double fgGetDouble (const std::string & name, double defaultValue = 0.0)
|
||||||
* does not exist.
|
* does not exist.
|
||||||
* @return The property's value as a string, or the default value provided.
|
* @return The property's value as a string, or the default value provided.
|
||||||
*/
|
*/
|
||||||
extern const char * fgGetString (const char * name,
|
extern std::string fgGetString (const char * name,
|
||||||
const char * defaultValue = "");
|
const char * defaultValue = "");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -441,7 +442,7 @@ extern const char * fgGetString (const char * name,
|
||||||
* does not exist.
|
* does not exist.
|
||||||
* @return The property's value as a string, or the default value provided.
|
* @return The property's value as a string, or the default value provided.
|
||||||
*/
|
*/
|
||||||
inline const char * fgGetString (const std::string & name,
|
inline std::string fgGetString (const std::string & name,
|
||||||
const std::string & defaultValue = std::string(""))
|
const std::string & defaultValue = std::string(""))
|
||||||
{
|
{
|
||||||
return fgGetString( name.c_str(), defaultValue.c_str() );
|
return fgGetString( name.c_str(), defaultValue.c_str() );
|
||||||
|
@ -856,9 +857,12 @@ public:
|
||||||
if (node->getType() != simgear::props::STRING)
|
if (node->getType() != simgear::props::STRING)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
char *s = const_cast<char *>(node->getStringValue());
|
std::string value = node->getStringValue();
|
||||||
for (; *s; s++)
|
std::string value_orig = value;
|
||||||
*s = toupper(*s);
|
std::transform(value.begin(), value.end(), value.begin(), ::toupper);
|
||||||
|
if (value != value_orig) {
|
||||||
|
node->setStringValue(value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -472,12 +472,12 @@ do_presets_commit (const SGPropertyNode * arg, SGPropertyNode * root)
|
||||||
static bool
|
static bool
|
||||||
do_press_cockpit_button (const SGPropertyNode * arg, SGPropertyNode * root)
|
do_press_cockpit_button (const SGPropertyNode * arg, SGPropertyNode * root)
|
||||||
{
|
{
|
||||||
const char *prefix = arg->getStringValue("prefix");
|
const string prefix = arg->getStringValue("prefix");
|
||||||
|
|
||||||
if (arg->getBoolValue("guarded") && fgGetDouble((string(prefix) + "-guard").c_str()) < 1)
|
if (arg->getBoolValue("guarded") && fgGetDouble((prefix + "-guard").c_str()) < 1)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
string prop = string(prefix) + "-button";
|
string prop = prefix + "-button";
|
||||||
double value;
|
double value;
|
||||||
|
|
||||||
if (arg->getBoolValue("latching"))
|
if (arg->getBoolValue("latching"))
|
||||||
|
@ -494,10 +494,10 @@ do_press_cockpit_button (const SGPropertyNode * arg, SGPropertyNode * root)
|
||||||
static bool
|
static bool
|
||||||
do_release_cockpit_button (const SGPropertyNode * arg, SGPropertyNode * root)
|
do_release_cockpit_button (const SGPropertyNode * arg, SGPropertyNode * root)
|
||||||
{
|
{
|
||||||
const char *prefix = arg->getStringValue("prefix");
|
const string prefix = arg->getStringValue("prefix");
|
||||||
|
|
||||||
if (arg->getBoolValue("guarded")) {
|
if (arg->getBoolValue("guarded")) {
|
||||||
string prop = string(prefix) + "-guard";
|
string prop = prefix + "-guard";
|
||||||
if (fgGetDouble(prop.c_str()) < 1) {
|
if (fgGetDouble(prop.c_str()) < 1) {
|
||||||
fgSetDouble(prop.c_str(), 1);
|
fgSetDouble(prop.c_str(), 1);
|
||||||
return true;
|
return true;
|
||||||
|
@ -505,7 +505,7 @@ do_release_cockpit_button (const SGPropertyNode * arg, SGPropertyNode * root)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! arg->getBoolValue("latching")) {
|
if (! arg->getBoolValue("latching")) {
|
||||||
fgSetDouble((string(prefix) + "-button").c_str(), 0);
|
fgSetDouble((prefix + "-button").c_str(), 0);
|
||||||
fgSetBool(arg->getStringValue("discrete"), false);
|
fgSetBool(arg->getStringValue("discrete"), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -84,7 +84,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// test against the aircraft-dir property
|
// test against the aircraft-dir property
|
||||||
const char* aircraftDir = fgGetString("/sim/aircraft-dir");
|
const std::string aircraftDir = fgGetString("/sim/aircraft-dir");
|
||||||
string_list aircraftDirPieces(sgPathBranchSplit(aircraftDir));
|
string_list aircraftDirPieces(sgPathBranchSplit(aircraftDir));
|
||||||
if (!aircraftDirPieces.empty() && (aircraftDirPieces.back() == pieces[1])) {
|
if (!aircraftDirPieces.empty() && (aircraftDirPieces.back() == pieces[1])) {
|
||||||
// current aircraft-dir matches resource aircraft
|
// current aircraft-dir matches resource aircraft
|
||||||
|
|
|
@ -316,8 +316,8 @@ FGLocale::loadResource(SGPropertyNode* localeNode, const char* resource)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* path_str = resourceNode->getStringValue();
|
string path_str = resourceNode->getStringValue();
|
||||||
if (!path_str)
|
if (path_str.empty())
|
||||||
{
|
{
|
||||||
SG_LOG(SG_GENERAL, SG_WARN, "No path in " << stringNode->getPath() << "/" << resource << ".");
|
SG_LOG(SG_GENERAL, SG_WARN, "No path in " << stringNode->getPath() << "/" << resource << ".");
|
||||||
return false;
|
return false;
|
||||||
|
@ -494,21 +494,21 @@ FGLocale::getLocalizedStrings(const char* id, const char* resource)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for localized font
|
// Check for localized font
|
||||||
const char*
|
std::string
|
||||||
FGLocale::getDefaultFont(const char* fallbackFont)
|
FGLocale::getDefaultFont(const char* fallbackFont)
|
||||||
{
|
{
|
||||||
assert(_inited);
|
assert(_inited);
|
||||||
const char* font = nullptr;
|
std::string font;
|
||||||
if (_currentLocale)
|
if (_currentLocale)
|
||||||
{
|
{
|
||||||
font = _currentLocale->getStringValue("font", "");
|
font = _currentLocale->getStringValue("font", "");
|
||||||
if (font[0] != 0)
|
if (!font.empty())
|
||||||
return font;
|
return font;
|
||||||
}
|
}
|
||||||
if (_defaultLocale)
|
if (_defaultLocale)
|
||||||
{
|
{
|
||||||
font = _defaultLocale->getStringValue("font", "");
|
font = _defaultLocale->getStringValue("font", "");
|
||||||
if (font[0] != 0)
|
if (!font.empty())
|
||||||
return font;
|
return font;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -96,7 +96,7 @@ public:
|
||||||
/**
|
/**
|
||||||
* Obtain default font for current locale.
|
* Obtain default font for current locale.
|
||||||
*/
|
*/
|
||||||
const char* getDefaultFont (const char* fallbackFont);
|
std::string getDefaultFont (const char* fallbackFont);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Obtain a message string, from a localized resource ID, and use it as
|
* Obtain a message string, from a localized resource ID, and use it as
|
||||||
|
|
|
@ -569,9 +569,9 @@ struct SGLogDeltasListener : SGPropertyChangeListener
|
||||||
{
|
{
|
||||||
void valueChanged(SGPropertyNode* node) override
|
void valueChanged(SGPropertyNode* node) override
|
||||||
{
|
{
|
||||||
const char* value = node->getStringValue();
|
std::string value = node->getStringValue();
|
||||||
std::cerr << __FILE__ << ":" << __LINE__ << ": sglogdeltas value=" << value << "\n";
|
std::cerr << __FILE__ << ":" << __LINE__ << ": sglogdeltas value=" << value << "\n";
|
||||||
logDeltaSet(value);
|
logDeltaSet(value.c_str());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
static SGLogDeltasListener s_sglogdeltas_listener;
|
static SGLogDeltasListener s_sglogdeltas_listener;
|
||||||
|
|
|
@ -339,17 +339,17 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int getNumMaturity(const char * str)
|
int getNumMaturity(const std::string& str)
|
||||||
{
|
{
|
||||||
// Changes should also be reflected in $FG_ROOT/options.xml
|
// Changes should also be reflected in $FG_ROOT/options.xml
|
||||||
const char* levels[] = {"alpha","beta","early-production","production"};
|
const char* levels[] = {"alpha","beta","early-production","production"};
|
||||||
|
|
||||||
if (!strcmp(str, "all")) {
|
if (str == "all") {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (size_t i=0; i<(sizeof(levels)/sizeof(levels[0]));i++)
|
for (size_t i=0; i<(sizeof(levels)/sizeof(levels[0]));i++)
|
||||||
if (strcmp(str,levels[i])==0)
|
if (str == levels[i])
|
||||||
return i;
|
return i;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -809,7 +809,7 @@ static int
|
||||||
fgOptAltitude( const char *arg )
|
fgOptAltitude( const char *arg )
|
||||||
{
|
{
|
||||||
fgSetBool("/sim/presets/onground", false);
|
fgSetBool("/sim/presets/onground", false);
|
||||||
if ( !strcmp(fgGetString("/sim/startup/units"), "feet") )
|
if ( fgGetString("/sim/startup/units") == "feet" )
|
||||||
fgSetDouble("/sim/presets/altitude-ft", atof( arg ));
|
fgSetDouble("/sim/presets/altitude-ft", atof( arg ));
|
||||||
else
|
else
|
||||||
fgSetDouble("/sim/presets/altitude-ft",
|
fgSetDouble("/sim/presets/altitude-ft",
|
||||||
|
@ -821,7 +821,7 @@ static int
|
||||||
fgOptUBody( const char *arg )
|
fgOptUBody( const char *arg )
|
||||||
{
|
{
|
||||||
fgSetString("/sim/presets/speed-set", "UVW");
|
fgSetString("/sim/presets/speed-set", "UVW");
|
||||||
if ( !strcmp(fgGetString("/sim/startup/units"), "feet") )
|
if ( fgGetString("/sim/startup/units") == "feet" )
|
||||||
fgSetDouble("/sim/presets/uBody-fps", atof( arg ));
|
fgSetDouble("/sim/presets/uBody-fps", atof( arg ));
|
||||||
else
|
else
|
||||||
fgSetDouble("/sim/presets/uBody-fps",
|
fgSetDouble("/sim/presets/uBody-fps",
|
||||||
|
@ -833,7 +833,7 @@ static int
|
||||||
fgOptVBody( const char *arg )
|
fgOptVBody( const char *arg )
|
||||||
{
|
{
|
||||||
fgSetString("/sim/presets/speed-set", "UVW");
|
fgSetString("/sim/presets/speed-set", "UVW");
|
||||||
if ( !strcmp(fgGetString("/sim/startup/units"), "feet") )
|
if ( fgGetString("/sim/startup/units") == "feet" )
|
||||||
fgSetDouble("/sim/presets/vBody-fps", atof( arg ));
|
fgSetDouble("/sim/presets/vBody-fps", atof( arg ));
|
||||||
else
|
else
|
||||||
fgSetDouble("/sim/presets/vBody-fps",
|
fgSetDouble("/sim/presets/vBody-fps",
|
||||||
|
@ -845,7 +845,7 @@ static int
|
||||||
fgOptWBody( const char *arg )
|
fgOptWBody( const char *arg )
|
||||||
{
|
{
|
||||||
fgSetString("/sim/presets/speed-set", "UVW");
|
fgSetString("/sim/presets/speed-set", "UVW");
|
||||||
if ( !strcmp(fgGetString("/sim/startup/units"), "feet") )
|
if ( fgGetString("/sim/startup/units") == "feet" )
|
||||||
fgSetDouble("/sim/presets/wBody-fps", atof(arg));
|
fgSetDouble("/sim/presets/wBody-fps", atof(arg));
|
||||||
else
|
else
|
||||||
fgSetDouble("/sim/presets/wBody-fps",
|
fgSetDouble("/sim/presets/wBody-fps",
|
||||||
|
@ -857,7 +857,7 @@ static int
|
||||||
fgOptVNorth( const char *arg )
|
fgOptVNorth( const char *arg )
|
||||||
{
|
{
|
||||||
fgSetString("/sim/presets/speed-set", "NED");
|
fgSetString("/sim/presets/speed-set", "NED");
|
||||||
if ( !strcmp(fgGetString("/sim/startup/units"), "feet") )
|
if ( fgGetString("/sim/startup/units") == "feet" )
|
||||||
fgSetDouble("/sim/presets/speed-north-fps", atof( arg ));
|
fgSetDouble("/sim/presets/speed-north-fps", atof( arg ));
|
||||||
else
|
else
|
||||||
fgSetDouble("/sim/presets/speed-north-fps",
|
fgSetDouble("/sim/presets/speed-north-fps",
|
||||||
|
@ -869,7 +869,7 @@ static int
|
||||||
fgOptVEast( const char *arg )
|
fgOptVEast( const char *arg )
|
||||||
{
|
{
|
||||||
fgSetString("/sim/presets/speed-set", "NED");
|
fgSetString("/sim/presets/speed-set", "NED");
|
||||||
if ( !strcmp(fgGetString("/sim/startup/units"), "feet") )
|
if ( fgGetString("/sim/startup/units") == "feet" )
|
||||||
fgSetDouble("/sim/presets/speed-east-fps", atof(arg));
|
fgSetDouble("/sim/presets/speed-east-fps", atof(arg));
|
||||||
else
|
else
|
||||||
fgSetDouble("/sim/presets/speed-east-fps",
|
fgSetDouble("/sim/presets/speed-east-fps",
|
||||||
|
@ -881,7 +881,7 @@ static int
|
||||||
fgOptVDown( const char *arg )
|
fgOptVDown( const char *arg )
|
||||||
{
|
{
|
||||||
fgSetString("/sim/presets/speed-set", "NED");
|
fgSetString("/sim/presets/speed-set", "NED");
|
||||||
if ( !strcmp(fgGetString("/sim/startup/units"), "feet") )
|
if ( fgGetString("/sim/startup/units") == "feet" )
|
||||||
fgSetDouble("/sim/presets/speed-down-fps", atof(arg));
|
fgSetDouble("/sim/presets/speed-down-fps", atof(arg));
|
||||||
else
|
else
|
||||||
fgSetDouble("/sim/presets/speed-down-fps",
|
fgSetDouble("/sim/presets/speed-down-fps",
|
||||||
|
@ -2416,7 +2416,7 @@ OptionResult Options::initAircraft()
|
||||||
} else {
|
} else {
|
||||||
SG_LOG(SG_INPUT, SG_INFO, "No user specified aircraft, using default" );
|
SG_LOG(SG_INPUT, SG_INFO, "No user specified aircraft, using default" );
|
||||||
// ensure aircraft-id is valid
|
// ensure aircraft-id is valid
|
||||||
fgSetString("/sim/aircraft-id", fgGetString("/sim/aircraft"));
|
fgSetString("/sim/aircraft-id", fgGetString("/sim/aircraft").c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p->showAircraft) {
|
if (p->showAircraft) {
|
||||||
|
|
|
@ -242,8 +242,8 @@ do_reinit (const SGPropertyNode * arg, SGPropertyNode * root)
|
||||||
globals->get_subsystem_mgr()->reinit();
|
globals->get_subsystem_mgr()->reinit();
|
||||||
} else {
|
} else {
|
||||||
for ( unsigned int i = 0; i < subsystems.size(); i++ ) {
|
for ( unsigned int i = 0; i < subsystems.size(); i++ ) {
|
||||||
const char * name = subsystems[i]->getStringValue();
|
std::string name = subsystems[i]->getStringValue();
|
||||||
SGSubsystem * subsystem = globals->get_subsystem(name);
|
SGSubsystem * subsystem = globals->get_subsystem(name.c_str());
|
||||||
if (subsystem == 0) {
|
if (subsystem == 0) {
|
||||||
result = false;
|
result = false;
|
||||||
SG_LOG( SG_GENERAL, SG_ALERT,
|
SG_LOG( SG_GENERAL, SG_ALERT,
|
||||||
|
@ -271,8 +271,8 @@ do_suspend (const SGPropertyNode * arg, SGPropertyNode * root)
|
||||||
|
|
||||||
vector<SGPropertyNode_ptr> subsystems = arg->getChildren("subsystem");
|
vector<SGPropertyNode_ptr> subsystems = arg->getChildren("subsystem");
|
||||||
for ( unsigned int i = 0; i < subsystems.size(); i++ ) {
|
for ( unsigned int i = 0; i < subsystems.size(); i++ ) {
|
||||||
const char * name = subsystems[i]->getStringValue();
|
std::string name = subsystems[i]->getStringValue();
|
||||||
SGSubsystem * subsystem = globals->get_subsystem(name);
|
SGSubsystem * subsystem = globals->get_subsystem(name.c_str());
|
||||||
if (subsystem == 0) {
|
if (subsystem == 0) {
|
||||||
result = false;
|
result = false;
|
||||||
SG_LOG(SG_GENERAL, SG_ALERT, "Subsystem " << name << " not found");
|
SG_LOG(SG_GENERAL, SG_ALERT, "Subsystem " << name << " not found");
|
||||||
|
@ -295,8 +295,8 @@ do_resume (const SGPropertyNode * arg, SGPropertyNode * root)
|
||||||
|
|
||||||
vector<SGPropertyNode_ptr> subsystems = arg->getChildren("subsystem");
|
vector<SGPropertyNode_ptr> subsystems = arg->getChildren("subsystem");
|
||||||
for ( unsigned int i = 0; i < subsystems.size(); i++ ) {
|
for ( unsigned int i = 0; i < subsystems.size(); i++ ) {
|
||||||
const char * name = subsystems[i]->getStringValue();
|
std::string name = subsystems[i]->getStringValue();
|
||||||
SGSubsystem * subsystem = globals->get_subsystem(name);
|
SGSubsystem * subsystem = globals->get_subsystem(name.c_str());
|
||||||
if (subsystem == 0) {
|
if (subsystem == 0) {
|
||||||
result = false;
|
result = false;
|
||||||
SG_LOG(SG_GENERAL, SG_ALERT, "Subsystem " << name << " not found");
|
SG_LOG(SG_GENERAL, SG_ALERT, "Subsystem " << name << " not found");
|
||||||
|
|
|
@ -263,8 +263,7 @@ void FGModelMgr::update(double dt)
|
||||||
if (instance->heading_deg_node != 0)
|
if (instance->heading_deg_node != 0)
|
||||||
heading = testNan(instance->heading_deg_node->getDoubleValue());
|
heading = testNan(instance->heading_deg_node->getDoubleValue());
|
||||||
} catch (const sg_range_exception&) {
|
} catch (const sg_range_exception&) {
|
||||||
const char *path = instance->node->getStringValue("path",
|
string path = instance->node->getStringValue("path", "unknown");
|
||||||
"unknown");
|
|
||||||
SG_LOG(SG_AIRCRAFT, SG_INFO, "Instance of model " << path
|
SG_LOG(SG_AIRCRAFT, SG_INFO, "Instance of model " << path
|
||||||
<< " has invalid values");
|
<< " has invalid values");
|
||||||
return;
|
return;
|
||||||
|
@ -359,7 +358,7 @@ bool FGModelMgr::Instance::checkLoaded() const
|
||||||
void
|
void
|
||||||
FGModelMgr::Listener::childAdded(SGPropertyNode * parent, SGPropertyNode * child)
|
FGModelMgr::Listener::childAdded(SGPropertyNode * parent, SGPropertyNode * child)
|
||||||
{
|
{
|
||||||
if (strcmp(parent->getName(), "model") || strcmp(child->getName(), "load"))
|
if (parent->getNameString() != "model" || child->getNameString() != "load")
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_mgr->add_model(parent);
|
_mgr->add_model(parent);
|
||||||
|
@ -368,7 +367,7 @@ FGModelMgr::Listener::childAdded(SGPropertyNode * parent, SGPropertyNode * child
|
||||||
void
|
void
|
||||||
FGModelMgr::Listener::childRemoved(SGPropertyNode * parent, SGPropertyNode * child)
|
FGModelMgr::Listener::childRemoved(SGPropertyNode * parent, SGPropertyNode * child)
|
||||||
{
|
{
|
||||||
if (strcmp(parent->getName(), "models") || strcmp(child->getName(), "model"))
|
if (parent->getNameString() != "models" || child->getNameString() != "model")
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// search instance by node and remove it from scenegraph
|
// search instance by node and remove it from scenegraph
|
||||||
|
|
|
@ -1378,7 +1378,7 @@ FGMultiplayMgr::SendMyPosition(const FGExternalMotionData& motionInfo)
|
||||||
else
|
else
|
||||||
PosMsg->pad = 0;
|
PosMsg->pad = 0;
|
||||||
|
|
||||||
strncpy(PosMsg->Model, fgGetString("/sim/model/path"), MAX_MODEL_NAME_LEN);
|
strncpy(PosMsg->Model, fgGetString("/sim/model/path").c_str(), MAX_MODEL_NAME_LEN);
|
||||||
PosMsg->Model[MAX_MODEL_NAME_LEN - 1] = '\0';
|
PosMsg->Model[MAX_MODEL_NAME_LEN - 1] = '\0';
|
||||||
if (fgGetBool("/sim/freeze/replay-state", true)&&
|
if (fgGetBool("/sim/freeze/replay-state", true)&&
|
||||||
fgGetBool("/sim/multiplay/freeze-on-replay",true))
|
fgGetBool("/sim/multiplay/freeze-on-replay",true))
|
||||||
|
@ -2163,13 +2163,13 @@ void FGMultiplayMgr::Send(double mpTime)
|
||||||
{
|
{
|
||||||
// FIXME: We assume unspecified are strings for the moment.
|
// FIXME: We assume unspecified are strings for the moment.
|
||||||
|
|
||||||
const char* cstr = it->second->getStringValue();
|
string cstr = it->second->getStringValue();
|
||||||
int len = strlen(cstr);
|
size_t len = cstr.length();
|
||||||
|
|
||||||
if (len > 0)
|
if (len > 0)
|
||||||
{
|
{
|
||||||
pData->string_value = new char[len + 1];
|
pData->string_value = new char[len + 1];
|
||||||
strcpy(pData->string_value, cstr);
|
strcpy(pData->string_value, cstr.c_str());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -2487,8 +2487,8 @@ FGMultiplayMgr::ProcessPosMsg(const FGMultiplayMgr::MsgBuf& Msg,
|
||||||
// --test-motion-mp.
|
// --test-motion-mp.
|
||||||
//
|
//
|
||||||
{
|
{
|
||||||
const char* callsign = pLogRawSpeedMultiplayer->getStringValue();
|
string callsign = pLogRawSpeedMultiplayer->getStringValue();
|
||||||
if (callsign && callsign[0] && !strcmp(callsign, MsgHdr->Callsign)) {
|
if (!callsign.empty() && callsign == string(MsgHdr->Callsign)) {
|
||||||
static SGVec3d s_pos_prev;
|
static SGVec3d s_pos_prev;
|
||||||
static double s_simtime_prev = -1;
|
static double s_simtime_prev = -1;
|
||||||
SGVec3d pos = motionInfo.position;
|
SGVec3d pos = motionInfo.position;
|
||||||
|
@ -2753,7 +2753,7 @@ FGMultiplayMgr::addMultiplayer(const std::string& callsign,
|
||||||
int config_children_n = config->nChildren();
|
int config_children_n = config->nChildren();
|
||||||
for (int i=0; i<config_children_n; ++i) {
|
for (int i=0; i<config_children_n; ++i) {
|
||||||
SGPropertyNode* node = config->getChild(i);
|
SGPropertyNode* node = config->getChild(i);
|
||||||
global_config->setDoubleValue(node->getName(), node->getDoubleValue());
|
global_config->setDoubleValue(node->getNameString(), node->getDoubleValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -385,7 +385,7 @@ WayptRef Waypt::createFromString(RouteBase* aOwner, const std::string& s, const
|
||||||
if (pos != string::npos) {
|
if (pos != string::npos) {
|
||||||
altFt = std::stof(target.substr(pos + 1));
|
altFt = std::stof(target.substr(pos + 1));
|
||||||
target = target.substr(0, pos);
|
target = target.substr(0, pos);
|
||||||
if (!strcmp(fgGetString("/sim/startup/units"), "meter")) {
|
if (fgGetString("/sim/startup/units") == "meter") {
|
||||||
altFt *= SG_METER_TO_FEET;
|
altFt *= SG_METER_TO_FEET;
|
||||||
}
|
}
|
||||||
altSetting = RESTRICT_AT;
|
altSetting = RESTRICT_AT;
|
||||||
|
@ -487,12 +487,12 @@ bool Waypt::initFromProperties(SGPropertyNode_ptr aProp)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aProp->hasChild("alt-restrict")) {
|
if (aProp->hasChild("alt-restrict")) {
|
||||||
_altRestrict = restrictionFromString(aProp->getStringValue("alt-restrict"));
|
_altRestrict = restrictionFromString(aProp->getStringValue("alt-restrict").c_str());
|
||||||
_altitudeFt = aProp->getDoubleValue("altitude-ft");
|
_altitudeFt = aProp->getDoubleValue("altitude-ft");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aProp->hasChild("speed-restrict")) {
|
if (aProp->hasChild("speed-restrict")) {
|
||||||
_speedRestrict = restrictionFromString(aProp->getStringValue("speed-restrict"));
|
_speedRestrict = restrictionFromString(aProp->getStringValue("speed-restrict").c_str());
|
||||||
_speed = aProp->getDoubleValue("speed");
|
_speed = aProp->getDoubleValue("speed");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -407,7 +407,7 @@ bool FGATCInput::do_analog_in() {
|
||||||
// read the next config entry from the property tree
|
// read the next config entry from the property tree
|
||||||
|
|
||||||
SGPropertyNode *child = analog_in_node->getChild(i);
|
SGPropertyNode *child = analog_in_node->getChild(i);
|
||||||
string cname = child->getName();
|
string cname = child->getNameString();
|
||||||
int index = child->getIndex();
|
int index = child->getIndex();
|
||||||
string name = "";
|
string name = "";
|
||||||
string type = "";
|
string type = "";
|
||||||
|
@ -680,7 +680,7 @@ bool FGATCInput::do_switches() {
|
||||||
// read the next config entry from the property tree
|
// read the next config entry from the property tree
|
||||||
|
|
||||||
SGPropertyNode *child = switches_node->getChild(i);
|
SGPropertyNode *child = switches_node->getChild(i);
|
||||||
string cname = child->getName();
|
string cname = child->getNameString();
|
||||||
string name = "";
|
string name = "";
|
||||||
string type = "";
|
string type = "";
|
||||||
vector <SGPropertyNode *> output_nodes;
|
vector <SGPropertyNode *> output_nodes;
|
||||||
|
@ -881,7 +881,7 @@ bool FGATCInput::do_radio_switches() {
|
||||||
// read the next config entry from the property tree
|
// read the next config entry from the property tree
|
||||||
|
|
||||||
SGPropertyNode *child = radio_in_node->getChild(i);
|
SGPropertyNode *child = radio_in_node->getChild(i);
|
||||||
string cname = child->getName();
|
string cname = child->getNameString();
|
||||||
|
|
||||||
if ( cname == "switch" ) {
|
if ( cname == "switch" ) {
|
||||||
string name = "";
|
string name = "";
|
||||||
|
|
|
@ -441,7 +441,7 @@ bool FGATCOutput::do_analog_out() {
|
||||||
// read the next config entry from the property tree
|
// read the next config entry from the property tree
|
||||||
|
|
||||||
SGPropertyNode *child = analog_out_node->getChild(i);
|
SGPropertyNode *child = analog_out_node->getChild(i);
|
||||||
string cname = child->getName();
|
string cname = child->getNameString();
|
||||||
int index = child->getIndex();
|
int index = child->getIndex();
|
||||||
string name = "";
|
string name = "";
|
||||||
string type = "";
|
string type = "";
|
||||||
|
@ -510,7 +510,7 @@ bool FGATCOutput::do_lamps() {
|
||||||
// read the next config entry from the property tree
|
// read the next config entry from the property tree
|
||||||
|
|
||||||
SGPropertyNode *child = lamps_out_node->getChild(i);
|
SGPropertyNode *child = lamps_out_node->getChild(i);
|
||||||
string cname = child->getName();
|
string cname = child->getNameString();
|
||||||
int index = child->getIndex();
|
int index = child->getIndex();
|
||||||
string name = "";
|
string name = "";
|
||||||
string type = "";
|
string type = "";
|
||||||
|
|
|
@ -245,7 +245,7 @@ void FGCom::postinit()
|
||||||
std::string app = "FGFS-";
|
std::string app = "FGFS-";
|
||||||
app += _version_node->getStringValue();
|
app += _version_node->getStringValue();
|
||||||
|
|
||||||
iaxc_set_callerid( _callsign_node->getStringValue(), app.c_str() );
|
iaxc_set_callerid( _callsign_node->getStringValue().c_str(), app.c_str() );
|
||||||
iaxc_set_formats (IAXC_FORMAT_SPEEX, IAXC_FORMAT_ULAW|IAXC_FORMAT_SPEEX);
|
iaxc_set_formats (IAXC_FORMAT_SPEEX, IAXC_FORMAT_ULAW|IAXC_FORMAT_SPEEX);
|
||||||
iaxc_set_speex_settings(1, 5, 0, 1, 0, 3);
|
iaxc_set_speex_settings(1, 5, 0, 1, 0, 3);
|
||||||
iaxc_set_filters(IAXC_FILTER_AGC | IAXC_FILTER_DENOISE);
|
iaxc_set_filters(IAXC_FILTER_AGC | IAXC_FILTER_DENOISE);
|
||||||
|
|
|
@ -393,7 +393,7 @@ void FGFlarm::parse_message(const std::vector<std::string>& tokens)
|
||||||
{
|
{
|
||||||
// reply with config data
|
// reply with config data
|
||||||
snprintf( nmea, 256, "$PFLAC,A,%s,%s",
|
snprintf( nmea, 256, "$PFLAC,A,%s,%s",
|
||||||
keyword.c_str(), configNode->getStringValue());
|
keyword.c_str(), configNode->getStringValue().c_str());
|
||||||
add_with_checksum(nmea, 256);
|
add_with_checksum(nmea, 256);
|
||||||
Error = false;
|
Error = false;
|
||||||
}
|
}
|
||||||
|
@ -447,7 +447,7 @@ void FGFlarm::parse_message(const std::vector<std::string>& tokens)
|
||||||
|
|
||||||
// reply
|
// reply
|
||||||
snprintf( nmea, 256, "$PFLAC,A,%s,%s",
|
snprintf( nmea, 256, "$PFLAC,A,%s,%s",
|
||||||
keyword.c_str(), configNode->getStringValue());
|
keyword.c_str(), configNode->getStringValue().c_str());
|
||||||
add_with_checksum(nmea, 256);
|
add_with_checksum(nmea, 256);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -357,8 +357,8 @@ bool FGGeneric::gen_message_binary() {
|
||||||
}
|
}
|
||||||
|
|
||||||
default: // SG_STRING
|
default: // SG_STRING
|
||||||
const char *strdata = _out_message[i].prop->getStringValue();
|
string strdata = _out_message[i].prop->getStringValue();
|
||||||
int32_t strlength = strlen(strdata);
|
size_t strlength = strdata.length();
|
||||||
|
|
||||||
if (binary_byte_order == BYTE_ORDER_NEEDS_CONVERSION) {
|
if (binary_byte_order == BYTE_ORDER_NEEDS_CONVERSION) {
|
||||||
SG_LOG( SG_IO, SG_ALERT, "Generic protocol: "
|
SG_LOG( SG_IO, SG_ALERT, "Generic protocol: "
|
||||||
|
@ -372,7 +372,7 @@ bool FGGeneric::gen_message_binary() {
|
||||||
}
|
}
|
||||||
memcpy(&buf[length], &strlength, sizeof(int32_t));
|
memcpy(&buf[length], &strlength, sizeof(int32_t));
|
||||||
length += sizeof(int32_t);
|
length += sizeof(int32_t);
|
||||||
strncpy(&buf[length], strdata, strlength);
|
strncpy(&buf[length], strdata.c_str(), strlength);
|
||||||
length += strlength;
|
length += strlength;
|
||||||
/* FIXME padding for alignment? Something like:
|
/* FIXME padding for alignment? Something like:
|
||||||
* length += (strlength % 4 > 0 ? sizeof(int32_t) - strlength % 4 : 0;
|
* length += (strlength % 4 > 0 ? sizeof(int32_t) - strlength % 4 : 0;
|
||||||
|
@ -455,7 +455,7 @@ bool FGGeneric::gen_message_ascii() {
|
||||||
|
|
||||||
default: // SG_STRING
|
default: // SG_STRING
|
||||||
snprintf(tmp, 255, format.c_str(),
|
snprintf(tmp, 255, format.c_str(),
|
||||||
_out_message[i].prop->getStringValue());
|
_out_message[i].prop->getStringValue().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
generic_sentence += tmp;
|
generic_sentence += tmp;
|
||||||
|
|
|
@ -29,7 +29,7 @@ namespace http {
|
||||||
|
|
||||||
class FlightHistoryUriHandler : public URIHandler {
|
class FlightHistoryUriHandler : public URIHandler {
|
||||||
public:
|
public:
|
||||||
FlightHistoryUriHandler( const char * uri = "/flighthistory/" ) : URIHandler( uri ) {}
|
FlightHistoryUriHandler( const std::string& uri = "/flighthistory/" ) : URIHandler( uri ) {}
|
||||||
virtual bool handleRequest( const HTTPRequest & request, HTTPResponse & response, Connection * connection );
|
virtual bool handleRequest( const HTTPRequest & request, HTTPResponse & response, Connection * connection );
|
||||||
private:
|
private:
|
||||||
};
|
};
|
||||||
|
|
|
@ -29,7 +29,7 @@ namespace http {
|
||||||
|
|
||||||
class JsonUriHandler : public URIHandler {
|
class JsonUriHandler : public URIHandler {
|
||||||
public:
|
public:
|
||||||
JsonUriHandler( const char * uri = "/json/" ) : URIHandler( uri ) {}
|
JsonUriHandler( const std::string& uri = "/json/" ) : URIHandler( uri ) {}
|
||||||
virtual bool handleRequest( const HTTPRequest & request, HTTPResponse & response, Connection * connection );
|
virtual bool handleRequest( const HTTPRequest & request, HTTPResponse & response, Connection * connection );
|
||||||
private:
|
private:
|
||||||
SGPropertyNode_ptr getRequestedNode(const HTTPRequest & request);
|
SGPropertyNode_ptr getRequestedNode(const HTTPRequest & request);
|
||||||
|
|
|
@ -28,7 +28,7 @@ namespace http {
|
||||||
|
|
||||||
class NavdbUriHandler : public URIHandler {
|
class NavdbUriHandler : public URIHandler {
|
||||||
public:
|
public:
|
||||||
NavdbUriHandler( const char * uri = "/navdb" ) : URIHandler( uri ) {}
|
NavdbUriHandler( const std::string& uri = "/navdb" ) : URIHandler( uri ) {}
|
||||||
virtual bool handleRequest( const HTTPRequest & request, HTTPResponse & response, Connection * connection );
|
virtual bool handleRequest( const HTTPRequest & request, HTTPResponse & response, Connection * connection );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ namespace http {
|
||||||
|
|
||||||
class PkgUriHandler : public URIHandler {
|
class PkgUriHandler : public URIHandler {
|
||||||
public:
|
public:
|
||||||
PkgUriHandler( const char * uri = "/pkg/" ) : URIHandler( uri ) {}
|
PkgUriHandler( const std::string& uri = "/pkg/" ) : URIHandler( uri ) {}
|
||||||
virtual bool handleRequest( const HTTPRequest & request, HTTPResponse & response, Connection * connection );
|
virtual bool handleRequest( const HTTPRequest & request, HTTPResponse & response, Connection * connection );
|
||||||
private:
|
private:
|
||||||
};
|
};
|
||||||
|
|
|
@ -74,7 +74,7 @@ private:
|
||||||
class CompareNodes {
|
class CompareNodes {
|
||||||
public:
|
public:
|
||||||
bool operator() (const SGPropertyNode *a, const SGPropertyNode *b) const {
|
bool operator() (const SGPropertyNode *a, const SGPropertyNode *b) const {
|
||||||
int r = strcmp(a->getName(), b->getName());
|
int r = strcmp(a->getNameString().c_str(), b->getNameString().c_str());
|
||||||
return r ? r < 0 : a->getIndex() < b->getIndex();
|
return r ? r < 0 : a->getIndex() < b->getIndex();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue