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;
|
||||
|
||||
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));
|
||||
|
||||
|
|
|
@ -173,7 +173,7 @@ void FGAICarrier::update(double dt) {
|
|||
|
||||
//automatic turn into wind with a target wind of 25 kts otd
|
||||
//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());
|
||||
}
|
||||
else if (!_MPControl && _AIControl){
|
||||
|
|
|
@ -455,8 +455,8 @@ void FGAIMultiplayer::update(double dt)
|
|||
//
|
||||
bool motion_logging = false;
|
||||
{
|
||||
const char* callsign = mLogRawSpeedMultiplayer->getStringValue();
|
||||
if (callsign && callsign[0] && this->_callsign == callsign)
|
||||
string callsign = mLogRawSpeedMultiplayer->getStringValue();
|
||||
if (!callsign.empty() && this->_callsign == callsign)
|
||||
{
|
||||
motion_logging = true;
|
||||
}
|
||||
|
|
|
@ -118,10 +118,10 @@ void PerformanceDB::load(const SGPath& filename)
|
|||
SGPropertyNode * node = root.getNode("performancedb");
|
||||
for (int i = 0; i < node->nChildren(); i++) {
|
||||
SGPropertyNode * db_node = node->getChild(i);
|
||||
if (!strcmp(db_node->getName(), "aircraft")) {
|
||||
if (db_node->getNameString() == "aircraft") {
|
||||
PerformanceData* data = NULL;
|
||||
if (db_node->hasChild("base")) {
|
||||
const string& baseName = db_node->getStringValue("base");
|
||||
std::string baseName = db_node->getStringValue("base");
|
||||
PerformanceData* baseData = _db[baseName];
|
||||
if (!baseData) {
|
||||
SG_LOG(SG_AI, SG_ALERT,
|
||||
|
@ -136,21 +136,21 @@ void PerformanceDB::load(const SGPath& filename)
|
|||
}
|
||||
|
||||
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);
|
||||
} else if (!strcmp(db_node->getName(), "alias")) {
|
||||
const string& alias(db_node->getStringValue("alias"));
|
||||
} else if (db_node->getNameString() == "alias") {
|
||||
std::string alias = db_node->getStringValue("alias");
|
||||
if (alias.empty()) {
|
||||
SG_LOG(SG_AI, SG_ALERT, "performance DB alias entry with no <alias> definition");
|
||||
continue;
|
||||
}
|
||||
|
||||
for (auto matchNode : db_node->getChildren("match")) {
|
||||
const string& match(matchNode->getStringValue());
|
||||
std::string match = matchNode->getStringValue();
|
||||
_aliases.push_back(StringPair(match, alias));
|
||||
}
|
||||
} 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
|
||||
}
|
||||
|
|
|
@ -625,8 +625,8 @@ void FGSubmodelMgr::setData(int id, const string& path, bool serviceable, const
|
|||
if (sm->contents_node != 0)
|
||||
sm->contents = sm->contents_node->getDoubleValue();
|
||||
|
||||
const char *trigger_path = entry_node->getStringValue("trigger", 0);
|
||||
if (trigger_path) {
|
||||
string trigger_path = entry_node->getStringValue("trigger", "");
|
||||
if (!trigger_path.empty()) {
|
||||
sm->trigger_node = fgGetNode(trigger_path, true);
|
||||
sm->trigger_node->setBoolValue(sm->trigger_node->getBoolValue());
|
||||
}
|
||||
|
|
|
@ -225,9 +225,9 @@ string ATISEncoder::processTokens( SGPropertyNode_ptr node )
|
|||
|
||||
string ATISEncoder::processToken( SGPropertyNode_ptr token )
|
||||
{
|
||||
HandlerMap::iterator it = handlerMap.find( token->getName());
|
||||
HandlerMap::iterator it = handlerMap.find( token->getNameString());
|
||||
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;
|
||||
}
|
||||
handler_t h = it->second;
|
||||
|
|
|
@ -104,7 +104,7 @@ ATISInformationProvider::CloudEntries MetarPropertiesATISInformationProvider::ge
|
|||
using simgear::PropertyList;
|
||||
PropertyList layers = _metar->getNode("clouds", true )->getChildren("layer");
|
||||
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 );
|
||||
if( elevation > 0 ) {
|
||||
reply[elevation] = coverage;
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
|
||||
using std::string;
|
||||
|
||||
static SGPropertyNode *getNamedNode(SGPropertyNode *prop, const char *name)
|
||||
static SGPropertyNode *getNamedNode(SGPropertyNode *prop, const std::string& name)
|
||||
{
|
||||
SGPropertyNode* p;
|
||||
|
||||
|
@ -52,7 +52,7 @@ static SGPropertyNode *getNamedNode(SGPropertyNode *prop, const char *name)
|
|||
if ((p = getNamedNode(prop->getChild(i), name)))
|
||||
return p;
|
||||
|
||||
if (!strcmp(prop->getStringValue("name"), name))
|
||||
if (prop->getStringValue("name") == name)
|
||||
return prop;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -137,18 +137,18 @@ static bool ReadFGReplayData2(
|
|||
ret->raw_data.resize(0);
|
||||
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);
|
||||
uint32_t length;
|
||||
readRaw(in, length);
|
||||
SG_LOG(SG_SYSTEMS, SG_DEBUG, "length=" << length);
|
||||
if (!in) break;
|
||||
if (load_signals && !strcmp(data_type, "signals"))
|
||||
if (load_signals && data_type == "signals")
|
||||
{
|
||||
ret->raw_data.resize(length);
|
||||
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. */
|
||||
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);
|
||||
}
|
||||
|
@ -439,14 +439,14 @@ static void writeFrame2(FGReplayData* r, std::ostream& out, SGPropertyNode_ptr c
|
|||
{
|
||||
for (auto data: config->getChildren("data"))
|
||||
{
|
||||
const char* data_type = data->getStringValue();
|
||||
if (!strcmp(data_type, "signals"))
|
||||
std::string data_type = data->getStringValue();
|
||||
if (data_type == "signals")
|
||||
{
|
||||
uint32_t signals_size = r->raw_data.size();
|
||||
writeRaw(out, signals_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;
|
||||
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);
|
||||
}
|
||||
}
|
||||
else if (!strcmp(data_type, "extra-properties"))
|
||||
else if (data_type == "extra-properties")
|
||||
{
|
||||
uint32_t length = r->extra_properties.size();
|
||||
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;
|
||||
for (auto data: config->getChildren("data"))
|
||||
{
|
||||
const char* data_type = data->getStringValue();
|
||||
if (!strcmp(data_type, "signals"))
|
||||
std::string data_type = data->getStringValue();
|
||||
if (data_type == "signals")
|
||||
{
|
||||
has_signals = true;
|
||||
}
|
||||
else if (!strcmp(data_type, "multiplayer"))
|
||||
else if (data_type == "multiplayer")
|
||||
{
|
||||
if (!r->multiplayer_messages.empty())
|
||||
{
|
||||
has_multiplayer = true;
|
||||
}
|
||||
}
|
||||
else if (!strcmp(data_type, "extra-properties"))
|
||||
else if (data_type == "extra-properties")
|
||||
{
|
||||
if (!r->extra_properties.empty())
|
||||
{
|
||||
|
|
|
@ -83,7 +83,7 @@ static void s_RecordPropertyDiffs(
|
|||
{
|
||||
assert(a);
|
||||
assert(b);
|
||||
assert(!strcmp(a->getName(), b->getName()));
|
||||
assert(a->getNameString() == b->getNameString());
|
||||
assert(a->getPath() == b->getPath());
|
||||
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.
|
||||
const char* a_value = a->getStringValue();
|
||||
const char* b_value = b->getStringValue();
|
||||
if (strcmp(a_value, b_value)) {
|
||||
const std::string a_value = a->getStringValue();
|
||||
const std::string b_value = b->getStringValue();
|
||||
if (a_value != b_value) {
|
||||
// Values are different so write out node <a> and update b.
|
||||
SG_LOG(SG_SYSTEMS, SG_DEBUG, "recording property change:"
|
||||
<< a->getPath()
|
||||
|
@ -114,7 +114,7 @@ static void s_RecordPropertyDiffs(
|
|||
int bn = b->nChildren();
|
||||
for (int i=0; i<bn; ++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) {
|
||||
// Child node is in b but not in a; we write out special
|
||||
// information about the deleted node and remove from b.
|
||||
|
@ -129,7 +129,7 @@ static void s_RecordPropertyDiffs(
|
|||
int an = a->nChildren();
|
||||
for (int i=0; i<an; ++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.
|
||||
s_RecordPropertyDiffs(out, ac, bc, path_exclude_prefixes);
|
||||
}
|
||||
|
@ -282,7 +282,7 @@ FGFlightRecorder::reinit(SGPropertyNode_ptr ConfigNode)
|
|||
else
|
||||
{
|
||||
// set name of active flight recorder type
|
||||
const char* pRecorderName =
|
||||
const std::string pRecorderName =
|
||||
m_ConfigNode->getStringValue("name",
|
||||
"aircraft-specific flight recorder");
|
||||
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
|
||||
SG_LOG(SG_SYSTEMS, SG_INFO, "FlightRecorder: No custom configuration. Loading generic default recorder.");
|
||||
|
||||
const char* Path = m_RecorderNode->getStringValue("default-config",NULL);
|
||||
if (!Path)
|
||||
const std::string Path = m_RecorderNode->getStringValue("default-config", "");
|
||||
if (Path.empty())
|
||||
{
|
||||
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);
|
||||
if (SignalNode.valid()&&
|
||||
(0==strcmp(pSignalType, SignalNode->getStringValue("type","float"))))
|
||||
(std::string(pSignalType) == SignalNode->getStringValue("type", "float")))
|
||||
{
|
||||
string PropertyPath = SignalNode->getStringValue("property", "");
|
||||
if (!PropertyPath.empty())
|
||||
{
|
||||
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.
|
||||
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);
|
||||
}
|
||||
|
||||
if (0==strcmp(pInterpolation,"discrete"))
|
||||
if (pInterpolation == "discrete")
|
||||
Capture.Interpolation = discrete;
|
||||
else
|
||||
if ((0==strcmp(pInterpolation,"angular"))||
|
||||
(0==strcmp(pInterpolation,"angular-rad")))
|
||||
if ((pInterpolation == "angular")||
|
||||
(pInterpolation == "angular-rad"))
|
||||
Capture.Interpolation = angular_rad;
|
||||
else
|
||||
if (0==strcmp(pInterpolation,"angular-deg"))
|
||||
if (pInterpolation == "angular-deg")
|
||||
Capture.Interpolation = angular_deg;
|
||||
else
|
||||
if (0==strcmp(pInterpolation,"linear"))
|
||||
if (pInterpolation == "linear")
|
||||
Capture.Interpolation = linear;
|
||||
else
|
||||
{
|
||||
|
|
|
@ -198,8 +198,8 @@ static void popupTip(const char* message, int delay)
|
|||
|
||||
SGPath makeSavePath(FGTapeType type, SGPath* path_timeless)
|
||||
{
|
||||
const char* tape_directory = fgGetString("/sim/replay/tape-directory", "");
|
||||
const char* aircraftType = fgGetString("/sim/aircraft", "unknown");
|
||||
std::string tape_directory = fgGetString("/sim/replay/tape-directory", "");
|
||||
std::string aircraftType = fgGetString("/sim/aircraft", "unknown");
|
||||
if (path_timeless) *path_timeless = "";
|
||||
SGPath path = SGPath(tape_directory);
|
||||
path.append(aircraftType);
|
||||
|
@ -296,10 +296,10 @@ static void loadMessages(FGReplayInternal& self)
|
|||
|
||||
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 char* msgSpeaker = (*it)->getStringValue("speaker", "pilot");
|
||||
if (msgText[0] != 0 && msgTime >= 0)
|
||||
std::string msgSpeaker = (*it)->getStringValue("speaker", "pilot");
|
||||
if (!msgText.empty() && msgTime >= 0)
|
||||
{
|
||||
FGReplayMessages data;
|
||||
data.sim_time = msgTime;
|
||||
|
@ -605,7 +605,7 @@ static bool saveRawReplayData(
|
|||
for (auto data: meta->getNode("meta")->getChildren("data"))
|
||||
{
|
||||
SG_LOG(SG_SYSTEMS, SG_DEBUG, "data->getStringValue()=" << data->getStringValue());
|
||||
if (!strcmp(data->getStringValue(), "multiplayer"))
|
||||
if (data->getStringValue() == "multiplayer")
|
||||
{
|
||||
uint32_t length = 0;
|
||||
for (auto message: frame->multiplayer_messages)
|
||||
|
@ -1622,19 +1622,20 @@ static void indexContinuousRecording(FGReplayInternal& self, const void* data, s
|
|||
}
|
||||
if (length)
|
||||
{
|
||||
stats[data->getStringValue()].num_frames += 1;
|
||||
stats[data->getStringValue()].bytes += length;
|
||||
if (!strcmp(data->getStringValue(), "signals"))
|
||||
std::string data_type = data->getStringValue();
|
||||
stats[data_type].num_frames += 1;
|
||||
stats[data_type].bytes += length;
|
||||
if (data_type == "signals")
|
||||
{
|
||||
frameinfo.has_signals = true;
|
||||
}
|
||||
else if (!strcmp(data->getStringValue(), "multiplayer"))
|
||||
else if (data_type == "multiplayer")
|
||||
{
|
||||
frameinfo.has_multiplayer = true;
|
||||
++self.m_continuous->m_num_frames_multiplayer;
|
||||
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;
|
||||
++self.m_continuous->m_num_frames_extra_properties;
|
||||
|
@ -2012,7 +2013,7 @@ FGReplayInternal::loadTape(
|
|||
bool multiplayer = false;
|
||||
for (auto data: meta_meta.getChildren("data"))
|
||||
{
|
||||
if (!strcmp(data->getStringValue(), "multiplayer"))
|
||||
if (data->getStringValue() == "multiplayer")
|
||||
{
|
||||
multiplayer = true;
|
||||
}
|
||||
|
|
|
@ -167,7 +167,7 @@ Autopilot::Autopilot( SGPropertyNode_ptr rootNode, SGPropertyNode_ptr configNode
|
|||
for( int i = 0; i < count; ++i )
|
||||
{
|
||||
SGPropertyNode_ptr node = configNode->getChild(i);
|
||||
string childName = node->getName();
|
||||
string childName = node->getNameString();
|
||||
if( childName == "property"
|
||||
|| childName == "property-root" )
|
||||
continue;
|
||||
|
|
|
@ -187,7 +187,7 @@ void FGXMLAutopilotGroupImplementation::initFrom( SGPropertyNode_ptr rootNode,
|
|||
|
||||
void FGXMLAutopilotGroup::addAutopilotFromFile( const std::string& name,
|
||||
SGPropertyNode_ptr apNode,
|
||||
const char* path )
|
||||
const std::string& path )
|
||||
{
|
||||
SGPath config = globals->resolve_maybe_aircraft_path(path);
|
||||
if( config.isNull() )
|
||||
|
|
|
@ -36,7 +36,7 @@ public:
|
|||
|
||||
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 removeAutopilot( const std::string & name ) = 0;
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ bool Component::configure( SGPropertyNode& prop_root,
|
|||
for( int i = 0; i < cfg.nChildren(); ++i )
|
||||
{
|
||||
SGPropertyNode_ptr child = cfg.getChild(i);
|
||||
std::string cname(child->getName());
|
||||
std::string cname(child->getNameString());
|
||||
|
||||
if( !configure(*child, cname, prop_root)
|
||||
&& 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 )
|
||||
{
|
||||
SGPropertyNode_ptr child = cfg.getChild(i);
|
||||
std::string cname(child->getName());
|
||||
std::string cname(child->getNameString());
|
||||
bool ok = false;
|
||||
if (!ok) ok = _implementation->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 )
|
||||
{
|
||||
SGPropertyNode_ptr child = cfg.getChild(i);
|
||||
string cname(child->getName());
|
||||
string cname(child->getNameString());
|
||||
|
||||
if( configure(*child, cname, prop_root) )
|
||||
continue;
|
||||
|
|
|
@ -154,13 +154,13 @@ void InputValue::parse( SGPropertyNode& prop_root,
|
|||
if( !valueNode )
|
||||
{
|
||||
// no <value>, <prop> or <expression> element, use text node
|
||||
const char * textnode = cfg.getStringValue();
|
||||
std::string textnode = cfg.getStringValue();
|
||||
char * endp = NULL;
|
||||
// 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
|
||||
// a property name
|
||||
_value = strtod( textnode, &endp );
|
||||
if( endp == textnode )
|
||||
_value = strtod( textnode.c_str(), &endp );
|
||||
if( endp == textnode.c_str() )
|
||||
_property = prop_root.getNode(textnode, true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -131,7 +131,7 @@ static string formatPropertyValue(SGPropertyNode* nd, const string& format)
|
|||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -466,8 +466,8 @@ NavDisplay::NavDisplay(SGPropertyNode *node) :
|
|||
continue;
|
||||
}
|
||||
|
||||
const char* id = symbol->getStringValue("id");
|
||||
if (id && strlen(id)) {
|
||||
string id = symbol->getStringValue("id", "");
|
||||
if (!id.empty()) {
|
||||
definitionDict[id] = def;
|
||||
}
|
||||
|
||||
|
@ -481,8 +481,8 @@ NavDisplay::NavDisplay(SGPropertyNode *node) :
|
|||
continue;
|
||||
}
|
||||
|
||||
const char* id = rule->getStringValue("symbol");
|
||||
if (id && strlen(id) && (definitionDict.find(id) != definitionDict.end())) {
|
||||
string id = rule->getStringValue("symbol", "");
|
||||
if (!id.empty() && (definitionDict.find(id) != definitionDict.end())) {
|
||||
r->setDefinition(definitionDict[id]);
|
||||
} else {
|
||||
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)
|
||||
{
|
||||
// assume all multiplayer items are aircraft for the moment. Not ideal.
|
||||
if (!strcmp(model->getName(), "multiplayer")) {
|
||||
if (model->getNameString() == "multiplayer") {
|
||||
return "ai-aircraft";
|
||||
}
|
||||
|
||||
return string("ai-") + model->getName();
|
||||
return string("ai-") + model->getNameString();
|
||||
}
|
||||
|
||||
void NavDisplay::processAI()
|
||||
|
@ -1464,7 +1464,7 @@ void NavDisplay::processCustomSymbols()
|
|||
string_set ss;
|
||||
computeCustomSymbolStates(symNode, ss);
|
||||
SymbolRuleVector rules;
|
||||
findRules(symNode->getName(), ss, rules);
|
||||
findRules(symNode->getNameString(), ss, rules);
|
||||
if (rules.empty()) {
|
||||
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 ) {
|
||||
SGPropertyNode *node = config_props->getChild(i);
|
||||
std::string name = node->getName();
|
||||
std::string name = node->getNameString();
|
||||
|
||||
std::ostringstream subsystemname;
|
||||
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);
|
||||
}
|
||||
|
||||
void GroundRadar::createTexture(const char* texture_name)
|
||||
void GroundRadar::createTexture(const std::string& texture_name)
|
||||
{
|
||||
setSize(TextureHalfSize + TextureHalfSize);
|
||||
allocRT();
|
||||
|
|
|
@ -52,7 +52,7 @@ public:
|
|||
virtual void update (double dt);
|
||||
|
||||
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);
|
||||
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());
|
||||
return _buf;
|
||||
case TEXT_VALUE:
|
||||
sprintf(_buf, _fmt.c_str(), _node->getStringValue());
|
||||
sprintf(_buf, _fmt.c_str(), _node->getStringValue().c_str());
|
||||
break;
|
||||
case DOUBLE_VALUE:
|
||||
double d = _offs + _node->getFloatValue() * _mult;
|
||||
|
|
|
@ -115,7 +115,7 @@ readTexture (const SGPropertyNode * node)
|
|||
node->getFloatValue("y1"),
|
||||
node->getFloatValue("x2", 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;
|
||||
}
|
||||
|
||||
|
@ -255,7 +255,7 @@ readTransformation (const SGPropertyNode * node, float w_scale, float h_scale)
|
|||
{
|
||||
FGPanelTransformation * t = new FGPanelTransformation;
|
||||
|
||||
string name = node->getName();
|
||||
string name = node->getNameString();
|
||||
string type = node->getStringValue("type");
|
||||
string propName = node->getStringValue("property", "");
|
||||
SGPropertyNode * target = 0;
|
||||
|
@ -454,7 +454,7 @@ readLayer (const SGPropertyNode * node, float w_scale, float h_scale)
|
|||
layer = new FGGroupLayer();
|
||||
for (int i = 0; i < node->nChildren(); 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));
|
||||
}
|
||||
}
|
||||
|
@ -483,12 +483,12 @@ readLayer (const SGPropertyNode * node, float w_scale, float h_scale)
|
|||
int nChunks = chunk_group->nChildren();
|
||||
for (int i = 0; i < nChunks; i++) {
|
||||
const SGPropertyNode * node = chunk_group->getChild(i);
|
||||
if (!strcmp(node->getName(), "chunk")) {
|
||||
if (node->getNameString() == "chunk") {
|
||||
FGTextLayer::Chunk * chunk = readTextChunk(node);
|
||||
if (chunk != 0)
|
||||
tlayer->addChunk(chunk);
|
||||
} else {
|
||||
SG_LOG( SG_COCKPIT, SG_INFO, "Skipping " << node->getName()
|
||||
SG_LOG( SG_COCKPIT, SG_INFO, "Skipping " << node->getNameString()
|
||||
<< " in chunks" );
|
||||
}
|
||||
}
|
||||
|
@ -501,7 +501,7 @@ readLayer (const SGPropertyNode * node, float w_scale, float h_scale)
|
|||
layer = new FGSwitchLayer();
|
||||
for (int i = 0; i < node->nChildren(); 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));
|
||||
}
|
||||
}
|
||||
|
@ -542,12 +542,12 @@ readLayer (const SGPropertyNode * node, float w_scale, float h_scale)
|
|||
int nTransformations = trans_group->nChildren();
|
||||
for (int i = 0; i < nTransformations; 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);
|
||||
if (t != 0)
|
||||
layer->addTransformation(t);
|
||||
} else {
|
||||
SG_LOG( SG_COCKPIT, SG_INFO, "Skipping " << node->getName()
|
||||
SG_LOG( SG_COCKPIT, SG_INFO, "Skipping " << node->getNameString()
|
||||
<< " in transformations" );
|
||||
}
|
||||
}
|
||||
|
@ -611,12 +611,12 @@ readInstrument (const SGPropertyNode * node, const SGPath& path)
|
|||
int nActions = action_group->nChildren();
|
||||
for (int i = 0; i < nActions; 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);
|
||||
if (action != 0)
|
||||
instrument->addAction(action);
|
||||
} else {
|
||||
SG_LOG( SG_COCKPIT, SG_INFO, "Skipping " << node->getName()
|
||||
SG_LOG( SG_COCKPIT, SG_INFO, "Skipping " << node->getNameString()
|
||||
<< " in actions" );
|
||||
}
|
||||
}
|
||||
|
@ -630,12 +630,12 @@ readInstrument (const SGPropertyNode * node, const SGPath& path)
|
|||
int nLayers = layer_group->nChildren();
|
||||
for (int i = 0; i < nLayers; 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);
|
||||
if (layer != 0)
|
||||
instrument->addLayer(layer);
|
||||
} else {
|
||||
SG_LOG( SG_COCKPIT, SG_INFO, "Skipping " << node->getName()
|
||||
SG_LOG( SG_COCKPIT, SG_INFO, "Skipping " << node->getNameString()
|
||||
<< " in layers" );
|
||||
}
|
||||
}
|
||||
|
@ -741,11 +741,11 @@ readPanel (const SGPropertyNode * root, const SGPath& path)
|
|||
int nInstruments = instrument_group->nChildren();
|
||||
for (int i = 0; i < nInstruments; i++) {
|
||||
const SGPropertyNode * node = instrument_group->getChild(i);
|
||||
if (!strcmp(node->getName(), "instrument")) {
|
||||
if (node->getNameString() == "instrument") {
|
||||
FGPanelInstrument * instrument = readInstrument(node, path);
|
||||
if (instrument != 0)
|
||||
panel->addInstrument(instrument);
|
||||
} else if (!strcmp(node->getName(), "special-instrument")) {
|
||||
} else if (node->getNameString() == "special-instrument") {
|
||||
//cout << "Special instrument found in instruments section!\n";
|
||||
const string name = node->getStringValue("name");
|
||||
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" );
|
||||
}
|
||||
} else {
|
||||
SG_LOG( SG_COCKPIT, SG_WARN, "Skipping " << node->getName()
|
||||
SG_LOG( SG_COCKPIT, SG_WARN, "Skipping " << node->getNameString()
|
||||
<< " in instruments section" );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -96,7 +96,7 @@ wxRadarBg::wxRadarBg(SGPropertyNode *node) :
|
|||
branch = "/instrumentation/" + _name;
|
||||
_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);
|
||||
|
||||
_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->setLineSpacing(_font_spacing);
|
||||
|
||||
const char *identity = ac->getStringValue("transponder-id");
|
||||
if (!identity[0])
|
||||
string identity = ac->getStringValue("transponder-id", "");
|
||||
if (identity.empty())
|
||||
identity = ac->getStringValue("callsign");
|
||||
|
||||
stringstream text;
|
||||
|
@ -730,7 +730,7 @@ wxRadarBg::update_aircraft()
|
|||
continue;
|
||||
|
||||
double echo_radius, sigma;
|
||||
const string name = model->getName();
|
||||
const string name = model->getNameString();
|
||||
|
||||
//cout << "name "<<name << endl;
|
||||
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++) {
|
||||
SGPropertyNode *abox = box_def->getChild(i);
|
||||
if( strcmp(abox->getName(), "box") == 0) {
|
||||
if( abox->getNameString() == "box" ) {
|
||||
|
||||
string type = abox->getStringValue("type", "cu-small");
|
||||
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++) {
|
||||
SGPropertyNode *acloud = layer_def->getChild(i);
|
||||
if( strcmp(acloud->getName(), "cloud") == 0) {
|
||||
if( acloud->getNameString() == "cloud" ) {
|
||||
string cloud_name = acloud->getStringValue("name");
|
||||
tCloudVariety[CloudVarietyCount].name = cloud_name;
|
||||
double count = acloud->getDoubleValue("count", 1.0);
|
||||
|
|
|
@ -519,7 +519,7 @@ void FGExternalPipe::update_property( double dt ) {
|
|||
// Send requested property values to fdm
|
||||
for ( unsigned int i = 0; i < nodes.size(); i++ ) {
|
||||
sprintf( cmd, "set %s %s", property_names[i].c_str(),
|
||||
nodes[i]->getStringValue() );
|
||||
nodes[i]->getStringValue().c_str() );
|
||||
// cout << " sending " << cmd << endl;
|
||||
result = write_property( pd1, cmd );
|
||||
}
|
||||
|
|
|
@ -922,7 +922,7 @@ void FGFDMExec::BuildPropertyCatalog(struct PropertyCatalogStructure* pcs)
|
|||
|
||||
for (int i=0; i<pcs->node->nChildren(); i++) {
|
||||
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();
|
||||
if (node_idx != 0) {
|
||||
pcsNew->base_string = CreateIndexedPropertyName(pcsNew->base_string, node_idx);
|
||||
|
|
|
@ -112,14 +112,14 @@ bool FGPropertyNode::HasNode (const string &path)
|
|||
|
||||
string FGPropertyNode::GetName( void ) const
|
||||
{
|
||||
return string( getName() );
|
||||
return getNameString();
|
||||
}
|
||||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
string FGPropertyNode::GetPrintableName( void ) const
|
||||
{
|
||||
string temp_string(getName());
|
||||
string temp_string(getNameString());
|
||||
size_t initial_location=0;
|
||||
size_t found_location;
|
||||
|
||||
|
|
|
@ -130,7 +130,7 @@ void FGDeadBand::Debug(int from)
|
|||
cout << " GAIN: " << gain << endl;
|
||||
|
||||
for (auto node: OutputNodes)
|
||||
cout << " OUTPUT: " << node->getName() << endl;
|
||||
cout << " OUTPUT: " << node->getNameString() << endl;
|
||||
}
|
||||
}
|
||||
if (debug_lvl & 2 ) { // Instantiation/Destruction notification
|
||||
|
|
|
@ -121,7 +121,7 @@ void FGFCSFunction::Debug(int from)
|
|||
if (!InputNodes.empty())
|
||||
cout << " INPUT: " << InputNodes[0]->GetName() << endl;
|
||||
for (auto node: OutputNodes)
|
||||
cout << " OUTPUT: " << node->getName() << endl;
|
||||
cout << " OUTPUT: " << node->getNameString() << endl;
|
||||
}
|
||||
}
|
||||
if (debug_lvl & 2 ) { // Instantiation/Destruction notification
|
||||
|
|
|
@ -224,7 +224,7 @@ void FGFilter::Debug(int from)
|
|||
}
|
||||
|
||||
for (auto node: OutputNodes)
|
||||
cout << " OUTPUT: " << node->getName() << endl;
|
||||
cout << " OUTPUT: " << node->getNameString() << endl;
|
||||
}
|
||||
}
|
||||
if (debug_lvl & 2 ) { // Instantiation/Destruction notification
|
||||
|
|
|
@ -198,7 +198,7 @@ void FGGain::Debug(int from)
|
|||
cout << " GAIN: " << Gain->GetName() << endl;
|
||||
|
||||
for (auto node: OutputNodes)
|
||||
cout << " OUTPUT: " << node->getName() << endl;
|
||||
cout << " OUTPUT: " << node->getNameString() << endl;
|
||||
|
||||
if (Type == "AEROSURFACE_SCALE") {
|
||||
cout << " In/Out Mapping:" << endl;
|
||||
|
|
|
@ -190,7 +190,7 @@ void FGKinemat::Debug(int from)
|
|||
cout << " " << Detents[i] << " " << TransitionTimes[i] << endl;
|
||||
}
|
||||
for (auto node: OutputNodes)
|
||||
cout << " OUTPUT: " << node->getName() << endl;
|
||||
cout << " OUTPUT: " << node->getNameString() << endl;
|
||||
if (!DoScale) cout << " NOSCALE" << endl;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -237,7 +237,7 @@ void FGPID::Debug(int from)
|
|||
cout << " INPUT: " << InputNodes[0]->GetNameWithSign() << endl;
|
||||
|
||||
for (auto node: OutputNodes)
|
||||
cout << " OUTPUT: " << node->getName() << endl;
|
||||
cout << " OUTPUT: " << node->getNameString() << endl;
|
||||
}
|
||||
}
|
||||
if (debug_lvl & 2 ) { // Instantiation/Destruction notification
|
||||
|
|
|
@ -334,7 +334,7 @@ void FGSensor::Debug(int from)
|
|||
}
|
||||
}
|
||||
for (auto node: OutputNodes)
|
||||
cout << " OUTPUT: " << node->getName() << endl;
|
||||
cout << " OUTPUT: " << node->getNameString() << endl;
|
||||
}
|
||||
}
|
||||
if (debug_lvl & 2 ) { // Instantiation/Destruction notification
|
||||
|
|
|
@ -204,7 +204,7 @@ void FGSwitch::Debug(int from)
|
|||
++i;
|
||||
}
|
||||
for (auto node: OutputNodes)
|
||||
cout << " OUTPUT: " << node->getName() << endl;
|
||||
cout << " OUTPUT: " << node->getNameString() << endl;
|
||||
}
|
||||
}
|
||||
if (debug_lvl & 2 ) { // Instantiation/Destruction notification
|
||||
|
|
|
@ -57,10 +57,10 @@ FGLaRCsim::FGLaRCsim( double dt ) {
|
|||
aero = fgGetNode("/sim/aero", 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
|
||||
if ( !strcmp(aero->getStringValue(), "c172") ) {
|
||||
if ( aero->getStringValue() == "c172" ) {
|
||||
copy_to_LaRCsim(); // initialize all of LaRCsim's vars
|
||||
|
||||
//this should go away someday -- formerly done in fg_init.cxx
|
||||
|
@ -71,7 +71,7 @@ FGLaRCsim::FGLaRCsim( double dt ) {
|
|||
I_xz = 0.000000E+00;
|
||||
}
|
||||
|
||||
if ( !strcmp(aero->getStringValue(), "basic") ) {
|
||||
if ( aero->getStringValue() == "basic" ) {
|
||||
copy_to_LaRCsim(); // initialize all of LaRCsim's vars
|
||||
|
||||
//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);
|
||||
|
||||
// if flying c172-larcsim, do the following
|
||||
if ( !strcmp(aero->getStringValue(), "c172") ) {
|
||||
if ( aero->getStringValue() == "c172" ) {
|
||||
// set control inputs
|
||||
// cout << "V_calibrated_kts = " << V_calibrated_kts << '\n';
|
||||
eng.set_IAS( V_calibrated_kts );
|
||||
|
@ -190,7 +190,7 @@ void FGLaRCsim::update( double dt ) {
|
|||
}
|
||||
// done with c172-larcsim if-block
|
||||
|
||||
if ( !strcmp(aero->getStringValue(), "basic") ) {
|
||||
if ( aero->getStringValue() == "basic" ) {
|
||||
// set control inputs
|
||||
// cout << "V_calibrated_kts = " << V_calibrated_kts << '\n';
|
||||
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).
|
||||
// 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;
|
||||
// } else {
|
||||
// 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
|
||||
#ifdef ENABLE_UIUC_MODEL
|
||||
if ( !strcmp(aero->getStringValue(), "uiuc")) {
|
||||
if ( aero->getStringValue() == "uiuc" ) {
|
||||
|
||||
// surface positions and other general properties
|
||||
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
|
||||
fgSetDouble("/engines/engine/cranking", 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
|
||||
}
|
||||
else if ( !strcmp(uiuc_type->getStringValue(), "uiuc-jet")) {
|
||||
else if ( uiuc_type->getStringValue() == "uiuc-jet" ) {
|
||||
// uiuc jet aircraft, e.g. a4d
|
||||
// used for setting the sound
|
||||
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
|
||||
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
|
||||
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
|
||||
fgSetDouble("/engines/engine/cranking", 0);
|
||||
}
|
||||
else if ( !strcmp(uiuc_type->getStringValue(), "uiuc-ornithopter")) {
|
||||
else if ( uiuc_type->getStringValue() == "uiuc-ornithopter" ) {
|
||||
// flapping wings
|
||||
fgSetDouble("/canopy/position-norm", 0);
|
||||
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;
|
||||
|
||||
#ifdef ENABLE_UIUC_MODEL
|
||||
if (!strcmp(aero->getStringValue(), "uiuc") && aircraft_) {
|
||||
if (aero->getStringValue() == "uiuc" && aircraft_) {
|
||||
if (pilot_elev_no) {
|
||||
globals->get_controls()->set_elevator(Long_control);
|
||||
globals->get_controls()->set_elevator_trim(Long_trim);
|
||||
|
|
|
@ -281,15 +281,14 @@ void Hitch::findBestAIObject(bool doit,bool running_as_autoconnect)
|
|||
_towEndIsConnectedToProperty=false;
|
||||
SGPropertyNode * ainode = fgGetNode("/ai/models",false);
|
||||
if(!ainode) return;
|
||||
char myCallsign[256]="***********";
|
||||
std::string myCallsign = "***********";
|
||||
if (running_as_autoconnect)
|
||||
{
|
||||
//get own callsign
|
||||
SGPropertyNode *cs=fgGetNode("/sim/multiplay/callsign",false);
|
||||
if (cs)
|
||||
{
|
||||
strncpy(myCallsign,cs->getStringValue(),256);
|
||||
myCallsign[255]=0;
|
||||
myCallsign = cs->getStringValue();
|
||||
}
|
||||
//reset tow length for search radius. Lentgh will be later copied from master
|
||||
_towLength=_winchInitialTowLength;
|
||||
|
@ -299,8 +298,8 @@ void Hitch::findBestAIObject(bool doit,bool running_as_autoconnect)
|
|||
for (int i=0;i<ainode->nChildren();i++)
|
||||
{
|
||||
SGPropertyNode * n=ainode->getChild(i);
|
||||
_nodeIsMultiplayer = strncmp("multiplayer",n->getName(),11)==0;
|
||||
_nodeIsAiAircraft = strncmp("aircraft",n->getName(),8)==0;
|
||||
_nodeIsMultiplayer = strncmp("multiplayer", n->getNameString().c_str(), 11) == 0;
|
||||
_nodeIsAiAircraft = strncmp("aircraft", n->getNameString().c_str(), 8) == 0;
|
||||
if (!(_nodeIsMultiplayer || _nodeIsAiAircraft))
|
||||
continue;
|
||||
if (running_as_autoconnect)
|
||||
|
@ -308,7 +307,7 @@ void Hitch::findBestAIObject(bool doit,bool running_as_autoconnect)
|
|||
if (!_nodeIsMultiplayer)
|
||||
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;
|
||||
}
|
||||
double pos[3];
|
||||
|
@ -565,7 +564,7 @@ void Hitch::integrate (float dt)
|
|||
{
|
||||
std::stringstream message;
|
||||
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());
|
||||
_open=true;
|
||||
return;
|
||||
|
@ -576,7 +575,7 @@ void Hitch::integrate (float dt)
|
|||
if (_node->getBoolValue("broken",false)&&_open)
|
||||
message<<"Oh no, the tow is broken";
|
||||
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());
|
||||
_oldOpen=_open;
|
||||
}
|
||||
|
@ -599,23 +598,21 @@ void Hitch::integrate (float dt)
|
|||
if (_node)
|
||||
{
|
||||
//_towEndNode=fgGetNode(_node->getStringValue("tow/node"), false);
|
||||
char towNode[256];
|
||||
strncpy(towNode,_node->getStringValue("tow/node"),256);
|
||||
towNode[255]=0;
|
||||
std::string towNode = _node->getStringValue("tow/node");
|
||||
_towEndNode=fgGetNode("ai/models")->getNode(towNode, false);
|
||||
//AI and multiplayer objects seem to change node?
|
||||
//Check if we have the right one by callsign
|
||||
if (_nodeIsMultiplayer || _nodeIsAiAircraft)
|
||||
{
|
||||
char MPcallsign[256]="";
|
||||
const char *MPc;
|
||||
MPc=_node->getStringValue("tow/connected-to-ai-or-mp-callsign");
|
||||
if (MPc)
|
||||
std::string MPcallsign = "";
|
||||
std::string MPc =_node->getStringValue("tow/connected-to-ai-or-mp-callsign");
|
||||
if (!MPc.empty())
|
||||
{
|
||||
strncpy(MPcallsign,MPc,256);
|
||||
MPcallsign[255]=0;
|
||||
MPcallsign = MPc;
|
||||
}
|
||||
if (((_towEndNode)&&(strncmp(_towEndNode->getStringValue("callsign"),MPcallsign,255)!=0))||!_towEndNode)
|
||||
if ((_towEndNode
|
||||
&& _towEndNode->getStringValue("callsign") != MPcallsign)
|
||||
|| !_towEndNode)
|
||||
{
|
||||
_timeToNextReConnectTry-=dt;
|
||||
if((_timeToNextReConnectTry<0)||(_timeToNextReConnectTry>10))
|
||||
|
@ -627,8 +624,11 @@ void Hitch::integrate (float dt)
|
|||
for (int i=0;i<ainode->nChildren();i++)
|
||||
{
|
||||
SGPropertyNode * n=ainode->getChild(i);
|
||||
if(_nodeIsMultiplayer?strncmp("multiplayer",n->getName(),11)==0:strncmp("aircraft",n->getName(),8))
|
||||
if (strcmp(n->getStringValue("callsign"),MPcallsign)==0)//found
|
||||
if (_nodeIsMultiplayer
|
||||
? strncmp("multiplayer", n->getNameString().c_str(), 11) == 0
|
||||
: strncmp("aircraft", n->getNameString().c_str(), 8)
|
||||
) {
|
||||
if (n->getStringValue("callsign") == MPcallsign)//found
|
||||
{
|
||||
_towEndNode=n;
|
||||
//_node->setStringValue("tow/node",n->getPath());
|
||||
|
@ -639,6 +639,7 @@ void Hitch::integrate (float dt)
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(_towEndNode)
|
||||
{
|
||||
_winchPos[0]=_towEndNode->getDoubleValue("position/global-x",_winchPos[0]);
|
||||
|
|
|
@ -81,14 +81,14 @@ CanvasWidget::CanvasWidget( int x, int y,
|
|||
SGPropertyNode *load = nasal->getNode("load");
|
||||
if( load )
|
||||
{
|
||||
const char *s = load->getStringValue();
|
||||
const std::string s = load->getStringValue();
|
||||
// avoid crash FLIGHTGEAR-5FQ
|
||||
if (!s) {
|
||||
if (s.empty()) {
|
||||
SG_LOG(SG_GUI, SG_ALERT, "Empty 'load' script for Canvas widget:" << cprops->getStringValue("name"));
|
||||
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();
|
||||
for (int i = 0; i < nChildren; i++) {
|
||||
SGPropertyNode_ptr scenario = scenarios->getChild(i);
|
||||
if (strcmp(scenario->getName(), "scenario") != 0) {
|
||||
if (scenario->getNameString() != "scenario") {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -164,7 +164,7 @@ FGFontCache::get(SGPropertyNode *node)
|
|||
if (!node)
|
||||
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 slant = node->getFloatValue("slant", 0.0);
|
||||
|
||||
|
|
|
@ -254,7 +254,7 @@ void GUIInfo::apply_format(SGPropertyNode* n)
|
|||
else if (fmt_type == f_DOUBLE)
|
||||
snprintf(buf, FORMAT_BUFSIZE, format.c_str(), n->getDoubleValue());
|
||||
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';
|
||||
text = buf;
|
||||
|
@ -686,8 +686,8 @@ FGPUIDialog::FGPUIDialog(SGPropertyNode* props) : FGDialog(props),
|
|||
_nasal_close = nasal->getNode("close");
|
||||
SGPropertyNode* open = nasal->getNode("open");
|
||||
if (open) {
|
||||
const char* s = open->getStringValue();
|
||||
nas->createModule(_module.c_str(), _module.c_str(), s, strlen(s), props);
|
||||
string s = open->getStringValue();
|
||||
nas->createModule(_module.c_str(), _module.c_str(), s.c_str(), s.length(), props);
|
||||
}
|
||||
}
|
||||
display(props);
|
||||
|
@ -703,8 +703,8 @@ FGPUIDialog::~FGPUIDialog()
|
|||
auto nas = globals->get_subsystem<FGNasalSys>();
|
||||
if (nas) {
|
||||
if (_nasal_close) {
|
||||
const char* s = _nasal_close->getStringValue();
|
||||
nas->createModule(_module.c_str(), _module.c_str(), s, strlen(s), _props);
|
||||
string s = _nasal_close->getStringValue();
|
||||
nas->createModule(_module.c_str(), _module.c_str(), s.c_str(), s.length(), _props);
|
||||
}
|
||||
nas->deleteModule(_module.c_str());
|
||||
}
|
||||
|
@ -890,7 +890,7 @@ FGPUIDialog::makeObject(SGPropertyNode* props, int parentWidth, int parentHeight
|
|||
int height = props->getIntValue("height", parentHeight);
|
||||
int x = props->getIntValue("x", (parentWidth - width) / 2);
|
||||
int y = props->getIntValue("y", (parentHeight - height) / 2);
|
||||
string type = props->getName();
|
||||
string type = props->getNameString();
|
||||
|
||||
if (type.empty())
|
||||
type = "dialog";
|
||||
|
@ -989,11 +989,11 @@ FGPUIDialog::makeObject(SGPropertyNode* props, int parentWidth, int parentHeight
|
|||
|
||||
} else if (type == "button") {
|
||||
puButton* obj;
|
||||
const char* legend = props->getStringValue("legend", "[none]");
|
||||
string legend = props->getStringValue("legend", "[none]");
|
||||
if (props->getBoolValue("one-shot", true))
|
||||
obj = new puOneShot(x, y, legend);
|
||||
obj = new puOneShot(x, y, legend.c_str());
|
||||
else
|
||||
obj = new puButton(x, y, legend);
|
||||
obj = new puButton(x, y, legend.c_str());
|
||||
if (presetSize)
|
||||
obj->setSize(width, height);
|
||||
setupObject(obj, props);
|
||||
|
@ -1149,14 +1149,14 @@ void FGPUIDialog::setupObject(puObject* object, SGPropertyNode* props)
|
|||
_conditionalObjects.push_back(cnd);
|
||||
}
|
||||
|
||||
string type = props->getName();
|
||||
string type = props->getNameString();
|
||||
if (type == "input" && props->getBoolValue("live"))
|
||||
object->setDownCallback(action_callback);
|
||||
|
||||
if (type == "text") {
|
||||
const char* format = props->getStringValue("format", 0);
|
||||
if (format) {
|
||||
info->fmt_type = validate_format(format);
|
||||
string format = props->getStringValue("format", "");
|
||||
if (!format.empty()) {
|
||||
info->fmt_type = validate_format(format.c_str());
|
||||
if (info->fmt_type != f_INVALID)
|
||||
info->format = format;
|
||||
else
|
||||
|
@ -1165,10 +1165,8 @@ void FGPUIDialog::setupObject(puObject* object, SGPropertyNode* props)
|
|||
}
|
||||
|
||||
if (props->hasValue("property")) {
|
||||
const char* name = props->getStringValue("name");
|
||||
if (name == 0)
|
||||
name = "";
|
||||
const char* propname = props->getStringValue("property");
|
||||
string name = props->getStringValue("name", "");
|
||||
string propname = props->getStringValue("property");
|
||||
SGPropertyNode_ptr node = fgGetNode(propname, true);
|
||||
if (type == "map") {
|
||||
// mapWidget binds to a sub-tree of properties, and
|
||||
|
@ -1189,12 +1187,12 @@ void FGPUIDialog::setupObject(puObject* object, SGPropertyNode* props)
|
|||
if (!bindings.empty()) {
|
||||
info->key = props->getIntValue("keynum", -1);
|
||||
if (props->hasValue("key"))
|
||||
info->key = getKeyCode(props->getStringValue("key", ""));
|
||||
info->key = getKeyCode(props->getStringValue("key", "").c_str());
|
||||
|
||||
|
||||
for (auto bindingNode : bindings) {
|
||||
const char* cmd = bindingNode->getStringValue("command");
|
||||
if (!strcmp(cmd, "nasal")) {
|
||||
string cmd = bindingNode->getStringValue("command");
|
||||
if (cmd == "nasal") {
|
||||
// we need to clone the binding node, so we can unique the
|
||||
// Nasal module. Otherwise we always modify the global dialog
|
||||
// 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)
|
||||
{
|
||||
string type = props->getName();
|
||||
string type = props->getNameString();
|
||||
if (type.empty())
|
||||
type = "dialog";
|
||||
if (type == "textbox" && props->getBoolValue("editable"))
|
||||
|
@ -1470,7 +1468,7 @@ void FGPUIDialog::applySize(puObject* object)
|
|||
// Implementation of FGDialog::PropertyObject.
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
FGPUIDialog::PropertyObject::PropertyObject(const char* n,
|
||||
FGPUIDialog::PropertyObject::PropertyObject(string n,
|
||||
puObject* o, SGPropertyNode_ptr p) : name(n),
|
||||
object(o),
|
||||
node(p)
|
||||
|
@ -1502,11 +1500,11 @@ fgValueList::~fgValueList()
|
|||
void fgValueList::make_list()
|
||||
{
|
||||
SGPropertyNode_ptr values = _props;
|
||||
const char* vname = "value";
|
||||
string vname = "value";
|
||||
|
||||
if (_props->hasChild("properties")) {
|
||||
// dynamic values, read from a property's children
|
||||
const char* path = _props->getStringValue("properties");
|
||||
string path = _props->getStringValue("properties");
|
||||
values = fgGetNode(path, true);
|
||||
}
|
||||
|
||||
|
@ -1518,7 +1516,7 @@ void fgValueList::make_list()
|
|||
_list = new char*[value_nodes.size() + 1];
|
||||
unsigned int 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;
|
||||
}
|
||||
|
|
|
@ -176,7 +176,7 @@ private:
|
|||
// closes.
|
||||
std::vector<void*> _info;
|
||||
struct PropertyObject {
|
||||
PropertyObject(const char* name,
|
||||
PropertyObject(std::string name,
|
||||
puObject* object,
|
||||
SGPropertyNode_ptr node);
|
||||
std::string name;
|
||||
|
|
|
@ -195,8 +195,8 @@ FGPUIMenuBar::make_menu (SGPropertyNode * node)
|
|||
FGLocale::utf8toLatin1(label);
|
||||
|
||||
// append the keyboard hint to the menu entry
|
||||
const char* key = item_nodes[i]->getStringValue("key", 0);
|
||||
if (key)
|
||||
string key = item_nodes[i]->getStringValue("key", "");
|
||||
if (!key.empty())
|
||||
{
|
||||
label.append(" <");
|
||||
label.append(key);
|
||||
|
|
|
@ -77,7 +77,7 @@ bool AircraftItem::initFromFile(QDir dir, QString filePath)
|
|||
LocalizedStrings ls;
|
||||
ls.locale = "en";
|
||||
ls.strings["name"] = QString::fromStdString(sim->getStringValue("description")).trimmed();
|
||||
authors = sim->getStringValue("author");
|
||||
authors = QString::fromStdString(sim->getStringValue("author"));
|
||||
|
||||
if (sim->hasChild("rating")) {
|
||||
SGPropertyNode_ptr ratingsNode = sim->getNode("rating");
|
||||
|
@ -88,11 +88,11 @@ bool AircraftItem::initFromFile(QDir dir, QString filePath)
|
|||
|
||||
if (sim->hasChild("long-description")) {
|
||||
// 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")) {
|
||||
variantOf = sim->getStringValue("variant-of");
|
||||
variantOf = QString::fromStdString(sim->getStringValue("variant-of"));
|
||||
} else {
|
||||
isPrimary = true;
|
||||
}
|
||||
|
@ -106,16 +106,16 @@ bool AircraftItem::initFromFile(QDir dir, QString filePath)
|
|||
int nChildren = tagsNode->nChildren();
|
||||
for (int i = 0; i < nChildren; i++) {
|
||||
const SGPropertyNode* c = tagsNode->getChild(i);
|
||||
if (strcmp(c->getName(), "tag") == 0) {
|
||||
const char* tagName = c->getStringValue();
|
||||
usesHeliports |= (strcmp(tagName, "helicopter") == 0);
|
||||
if (c->getNameString() == "tag") {
|
||||
std::string tagName = c->getStringValue();
|
||||
usesHeliports |= (tagName == "helicopter");
|
||||
// could also consider vtol tag?
|
||||
usesSeaports |= (strcmp(tagName, "seaplane") == 0);
|
||||
usesSeaports |= (strcmp(tagName, "floats") == 0);
|
||||
needsMaintenance |= (strcmp(tagName, "needs-maintenance") == 0);
|
||||
usesSeaports |= (tagName == "seaplane");
|
||||
usesSeaports |= (tagName == "floats");
|
||||
needsMaintenance |= (tagName == "needs-maintenance");
|
||||
|
||||
// and actually store the tags
|
||||
tags.push_back(QString::fromUtf8(tagName));
|
||||
tags.push_back(QString::fromStdString(tagName));
|
||||
}
|
||||
} // of tags iteration
|
||||
} // of set-xml has tags
|
||||
|
@ -148,13 +148,13 @@ bool AircraftItem::initFromFile(QDir dir, QString filePath)
|
|||
}
|
||||
|
||||
if (sim->hasChild("thumbnail")) {
|
||||
thumbnailPath = sim->getStringValue("thumbnail");
|
||||
thumbnailPath = QString::fromStdString(sim->getStringValue("thumbnail"));
|
||||
} else {
|
||||
thumbnailPath = "thumbnail.jpg";
|
||||
}
|
||||
|
||||
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")));
|
||||
|
|
|
@ -110,7 +110,7 @@ void MPServersModel::onRefreshMPServersDone(simgear::HTTP::Request*)
|
|||
|
||||
for (int i=0; i<targetnode->nChildren(); ++i) {
|
||||
SGPropertyNode* c = targetnode->getChild(i);
|
||||
if (c->getName() != std::string("server")) {
|
||||
if (c->getNameString() != "server") {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -2068,7 +2068,7 @@ MapWidget::DrawAIObject::DrawAIObject(SGPropertyNode* m, const SGGeod& g) :
|
|||
|
||||
char buffer[1024];
|
||||
::snprintf(buffer, 1024, "%s\n%dkts",
|
||||
model->getStringValue("name", "<>"),
|
||||
model->getStringValue("name", "<>").c_str(),
|
||||
speedKts);
|
||||
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);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -400,7 +400,7 @@ QString QmlAircraftInfo::authors() const
|
|||
QString html = "<ul>\n";
|
||||
for (auto a : structuredAuthors->getChildren("author")) {
|
||||
html += "<li>";
|
||||
html += a->getStringValue("name");
|
||||
html += QString::fromStdString(a->getStringValue("name"));
|
||||
if (a->hasChild("nick")) {
|
||||
html += QStringLiteral(" '") + QString::fromStdString(a->getStringValue("nick")) + QStringLiteral("'");
|
||||
}
|
||||
|
|
|
@ -147,7 +147,7 @@ public:
|
|||
|
||||
auto it = std::find(_directChildren.begin(), _directChildren.end(), child);
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -120,7 +120,7 @@ void mkDialog (const char *txt)
|
|||
if (!msg->getNode(name.c_str(), false))
|
||||
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);
|
||||
return;
|
||||
}
|
||||
|
@ -397,11 +397,11 @@ void fgHiResDump()
|
|||
glHint(GL_LINE_SMOOTH_HINT, GL_DONT_CARE);
|
||||
glHint(GL_POINT_SMOOTH_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"))) {
|
||||
// if fastest fog requested, or if flat shading force 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 );
|
||||
}
|
||||
|
||||
|
|
|
@ -24,10 +24,10 @@ int LayoutWidget::stringLength(const char* s)
|
|||
return (int)(FONT.getFloatStringWidth(s) + 0.999);
|
||||
}
|
||||
|
||||
const char* LayoutWidget::type()
|
||||
std::string LayoutWidget::type()
|
||||
{
|
||||
const char* t = _prop->getName();
|
||||
return (*t == 0) ? "dialog" : t;
|
||||
string t = _prop->getNameString();
|
||||
return t.empty() ? "dialog" : t;
|
||||
}
|
||||
|
||||
bool LayoutWidget::hasParent()
|
||||
|
@ -47,9 +47,8 @@ int LayoutWidget::nChildren()
|
|||
int n = 0;
|
||||
for(int i=0; i<_prop->nChildren(); i++) {
|
||||
SGPropertyNode* p = _prop->getChild(i);
|
||||
const char* name = p->getName();
|
||||
if(p->nChildren() != 0 || !strcmp(name, "hrule")
|
||||
|| !strcmp(name, "vrule"))
|
||||
string name = p->getNameString();
|
||||
if (p->nChildren() != 0 || name == "hrule" || name == "vrule")
|
||||
n++;
|
||||
}
|
||||
return n;
|
||||
|
@ -62,9 +61,8 @@ LayoutWidget LayoutWidget::getChild(int idx)
|
|||
int n = 0;
|
||||
for(int i=0; i<_prop->nChildren(); i++) {
|
||||
SGPropertyNode* p = _prop->getChild(i);
|
||||
const char* name = p->getName();
|
||||
if(p->nChildren() != 0 || !strcmp(name, "hrule")
|
||||
|| !strcmp(name, "vrule")) {
|
||||
string name = p->getNameString();
|
||||
if (p->nChildren() != 0 || name == "hrule" || name == "vrule") {
|
||||
if(idx == n) return LayoutWidget(p);
|
||||
n++;
|
||||
}
|
||||
|
@ -87,7 +85,7 @@ bool LayoutWidget::getBool(const char* f, bool dflt)
|
|||
return _prop->getBoolValue(f, dflt);
|
||||
}
|
||||
|
||||
const char* LayoutWidget::getStr(const char* f)
|
||||
std::string LayoutWidget::getStr(const char* f)
|
||||
{
|
||||
return _prop->getStringValue(f);
|
||||
}
|
||||
|
|
|
@ -46,8 +46,8 @@ void LayoutWidget::calcPrefSize(int* w, int* h)
|
|||
if (!getBool("enabled", true) || isType("nasal"))
|
||||
return;
|
||||
|
||||
int legw = stringLength(getStr("legend"));
|
||||
int labw = stringLength(getStr("label"));
|
||||
int legw = stringLength(getStr("legend").c_str());
|
||||
int labw = stringLength(getStr("label").c_str());
|
||||
|
||||
if(isType("dialog") || isType("group") || isType("frame")) {
|
||||
if(!hasField("layout")) {
|
||||
|
@ -55,10 +55,10 @@ void LayoutWidget::calcPrefSize(int* w, int* h)
|
|||
if(hasField("width")) *w = getNum("width");
|
||||
if(hasField("height")) *h = getNum("height");
|
||||
} else {
|
||||
const char* layout = getStr("layout");
|
||||
if (eq(layout, "hbox" )) doHVBox(false, false, w, h);
|
||||
else if(eq(layout, "vbox" )) doHVBox(false, true, w, h);
|
||||
else if(eq(layout, "table")) doTable(false, w, h);
|
||||
string layout = getStr("layout");
|
||||
if (layout == "hbox") doHVBox(false, false, w, h);
|
||||
else if(layout == "vbox") doHVBox(false, true, w, h);
|
||||
else if(layout == "table") doTable(false, w, h);
|
||||
}
|
||||
} else if (isType("text")) {
|
||||
*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
|
||||
// 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(eq(halign, "left")) {
|
||||
if(halign == "left") {
|
||||
w = prefw;
|
||||
} else if(eq(halign, "right")) {
|
||||
} else if(halign == "right") {
|
||||
x += w - prefw;
|
||||
w = prefw;
|
||||
} else if(eq(halign, "center")) {
|
||||
} else if(halign == "center") {
|
||||
x += (w - prefw)/2;
|
||||
w = prefw;
|
||||
}
|
||||
const char* valign = (isGroup || isType("vrule")) ? "fill" : "center";
|
||||
string valign = (isGroup || isType("vrule")) ? "fill" : "center";
|
||||
if(hasField("valign")) valign = getStr("valign");
|
||||
if(eq(valign, "bottom")) {
|
||||
if(valign == "bottom") {
|
||||
h = prefh;
|
||||
} else if(eq(valign, "top")) {
|
||||
} else if(valign == "top") {
|
||||
y += h - prefh;
|
||||
h = prefh;
|
||||
} else if(eq(valign, "center")) {
|
||||
} else if(valign == "center") {
|
||||
y += (h - prefh)/2;
|
||||
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.
|
||||
if(isGroup && hasField("layout")) {
|
||||
const char* layout = getStr("layout");
|
||||
if (eq(layout, "hbox" )) doHVBox(true, false);
|
||||
else if(eq(layout, "vbox" )) doHVBox(true, true);
|
||||
else if(eq(layout, "table")) doTable(true);
|
||||
string layout = getStr("layout");
|
||||
if (layout == "hbox") doHVBox(true, false);
|
||||
else if(layout == "vbox") doHVBox(true, true);
|
||||
else if(layout == "table") doTable(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ public:
|
|||
LayoutWidget() { _prop = 0; }
|
||||
LayoutWidget(SGPropertyNode* p) { _prop = p; }
|
||||
|
||||
const char* type();
|
||||
std::string type();
|
||||
bool hasParent();
|
||||
LayoutWidget parent();
|
||||
int nChildren();
|
||||
|
@ -32,7 +32,7 @@ public:
|
|||
bool hasField(const char* f);
|
||||
int getNum(const char* f);
|
||||
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 calcPrefSize(int* w, int* h);
|
||||
|
@ -43,7 +43,7 @@ private:
|
|||
static puFont FONT;
|
||||
|
||||
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 stringLength(const char* s); // must handle null argument
|
||||
|
|
|
@ -23,21 +23,21 @@ FGMenuBar::getLocalizedLabel(SGPropertyNode* node)
|
|||
if (!node)
|
||||
return {};
|
||||
|
||||
const char* name = node->getStringValue("name", 0);
|
||||
std::string name = node->getStringValue("name", "");
|
||||
const auto translated = globals->get_locale()->getLocalizedString(name, "menu");
|
||||
if (!translated.empty())
|
||||
return translated;
|
||||
|
||||
// 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>
|
||||
if (l == nullptr) {
|
||||
if (label.empty()) {
|
||||
SG_LOG(SG_GUI, SG_ALERT, "FGMenuBar::getLocalizedLabel: No <name> defined for:" << node->getPath());
|
||||
return string{"<unnamed>"};
|
||||
}
|
||||
|
||||
return string{l};
|
||||
return label;
|
||||
}
|
||||
|
||||
// end of menubar.cxx
|
||||
|
|
|
@ -71,7 +71,7 @@ NewGUI::~NewGUI ()
|
|||
//
|
||||
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) {
|
||||
out.push_back(node->getStringValue());
|
||||
}
|
||||
|
@ -121,7 +121,7 @@ NewGUI::init ()
|
|||
SGPath p(globals->get_fg_root(), "gui/dialogs");
|
||||
readDir(p);
|
||||
|
||||
SGPath aircraftDialogDir(string(fgGetString("/sim/aircraft-dir")), "gui/dialogs");
|
||||
SGPath aircraftDialogDir(fgGetString("/sim/aircraft-dir"), "gui/dialogs");
|
||||
if (aircraftDialogDir.exists()) {
|
||||
readDir(aircraftDialogDir);
|
||||
}
|
||||
|
@ -414,12 +414,11 @@ NewGUI::setMenuBarOverlapHide(bool hide)
|
|||
void
|
||||
NewGUI::newDialog (SGPropertyNode* props)
|
||||
{
|
||||
const char* cname = props->getStringValue("name");
|
||||
if(!cname) {
|
||||
string name = props->getStringValue("name", "");
|
||||
if(name.empty()) {
|
||||
SG_LOG(SG_GENERAL, SG_ALERT, "New dialog has no <name> property");
|
||||
return;
|
||||
}
|
||||
string name = cname;
|
||||
|
||||
if(_active_dialogs.find(name) == _active_dialogs.end()) {
|
||||
_dialog_props[name] = props;
|
||||
|
@ -566,7 +565,7 @@ NewGUI::setStyle (void)
|
|||
|
||||
for (int i = 0; i < n->nChildren(); i++) {
|
||||
SGPropertyNode *child = n->getChild(i);
|
||||
_colors[child->getName()] = new FGColor(child);
|
||||
_colors[child->getNameString()] = new FGColor(child);
|
||||
}
|
||||
|
||||
FGColor *c = _colors["background"];
|
||||
|
|
|
@ -189,15 +189,15 @@ protected:
|
|||
private:
|
||||
void createMenuBarImplementation();
|
||||
|
||||
struct ltstr
|
||||
/*struct ltstr
|
||||
{
|
||||
bool operator()(const char* s1, const char* s2) const {
|
||||
return strcmp(s1, s2) < 0;
|
||||
bool operator()(const std::string& s1, const std::string& s2) const {
|
||||
return s1 < s2;
|
||||
}
|
||||
};
|
||||
};*/
|
||||
|
||||
puFont *_font;
|
||||
typedef std::map<const char*,FGColor*, ltstr> ColourDict;
|
||||
typedef std::map<std::string, FGColor*> ColourDict;
|
||||
ColourDict _colors;
|
||||
typedef ColourDict::iterator _itt_t;
|
||||
typedef ColourDict::const_iterator _citt_t;
|
||||
|
|
|
@ -86,7 +86,7 @@ static void dumpProperties(const SGPropertyNode *node)
|
|||
continue;
|
||||
|
||||
int index = c->getIndex();
|
||||
cout << std::setw(11) << getValueTypeString(c) << " " << c->getName();
|
||||
cout << std::setw(11) << getValueTypeString(c) << " " << c->getNameString();
|
||||
if (index > 0)
|
||||
cout << '[' << index << ']';
|
||||
cout << " = ";
|
||||
|
@ -409,7 +409,7 @@ int PropertyList::nodeNameCompare(const void *p1, const void *p2)
|
|||
const SGPropertyNode *n1 = (*(const NodeData *)p1).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();
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ void FGCommonInput::read_bindings (const SGPropertyNode * node, binding_list_t *
|
|||
PropertyList bindings = node->getChildren("binding");
|
||||
static string nasal = "nasal";
|
||||
for (unsigned int i = 0; i < bindings.size(); i++) {
|
||||
const char *cmd = bindings[i]->getStringValue("command");
|
||||
std::string cmd = bindings[i]->getStringValue("command");
|
||||
if (nasal.compare(cmd) == 0 && !module.empty())
|
||||
bindings[i]->setStringValue("module", module.c_str());
|
||||
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) {
|
||||
const auto nd = reportNode->getChild(c);
|
||||
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;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!strcmp(nd->getName(), "type") || !strcmp(nd->getName(), "id")) {
|
||||
if (nd->getNameString() == "type" || nd->getNameString() == "id") {
|
||||
continue; // already handled above
|
||||
}
|
||||
|
||||
|
|
|
@ -420,7 +420,7 @@ void FGMouseInput::init()
|
|||
SGPropertyNode * mode_node = mouse_node->getChild("mode", j, true);
|
||||
|
||||
// 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
|
||||
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)));
|
||||
SGPropertyNode *p = ((SGPropertyNode *)n)->getNode("property", false);
|
||||
if (p) {
|
||||
const char *path = p->getStringValue();
|
||||
if (path && path[0]) {
|
||||
string path = p->getStringValue();
|
||||
if (!path.empty()) {
|
||||
_property = fgGetNode(path, 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++) {
|
||||
SGPropertyNode *n = root.getChild(i);
|
||||
const char *d = n->getStringValue("name", 0);
|
||||
string d = n->getStringValue("name", "");
|
||||
string desc;
|
||||
if (d)
|
||||
if (!d.empty())
|
||||
desc = string(": \"") + d + '"';
|
||||
|
||||
const char *name = n->getName();
|
||||
if (!strcmp(name, "name")) {
|
||||
const string name = n->getNameString();
|
||||
if (name == "name") {
|
||||
continue;
|
||||
|
||||
} else if (!strcmp(name, "enable3d")) {
|
||||
} else if (name == "enable3d") {
|
||||
// set in the tree so that valueChanged() picks it up
|
||||
_3DenabledN->setBoolValue(n->getBoolValue());
|
||||
continue;
|
||||
|
||||
} else if (!strcmp(name, "import")) {
|
||||
const char *fn = n->getStringValue("path", "");
|
||||
} else if (name == "import") {
|
||||
string fn = n->getStringValue("path", "");
|
||||
float xoffs = n->getFloatValue("x-offset", 0.0f);
|
||||
float yoffs = n->getFloatValue("y-offset", 0.0f);
|
||||
|
||||
SG_LOG(SG_INPUT, TREE, indent << "|__import " << fn << desc);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
SG_LOG(SG_INPUT, TREE, indent << "|__" << name << desc);
|
||||
|
||||
Item *item;
|
||||
if (!strcmp(name, "label")) {
|
||||
if (name == "label") {
|
||||
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));
|
||||
} else if (!strcmp(name, "tape")) {
|
||||
} else if (name == "tape") {
|
||||
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));
|
||||
} else if (!strcmp(name, "turn-bank-indicator")) {
|
||||
} else if (name == "turn-bank-indicator") {
|
||||
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));
|
||||
_ladders.insert(_ladders.begin(), item);
|
||||
continue;
|
||||
} else if (!strcmp(name, "runway")) {
|
||||
} else if (name == "runway") {
|
||||
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));
|
||||
} else {
|
||||
SG_LOG(SG_INPUT, TREE, indent << " \\...unsupported!");
|
||||
|
@ -466,7 +466,7 @@ void HUD::valueChanged(SGPropertyNode *node)
|
|||
loadNow = true;
|
||||
}
|
||||
|
||||
if (!strcmp(node->getName(), "current-path") && _visible) {
|
||||
if (node->getNameString() == "current-path" && _visible) {
|
||||
loadNow = true;
|
||||
}
|
||||
|
||||
|
@ -483,7 +483,7 @@ void HUD::valueChanged(SGPropertyNode *node)
|
|||
load(path.c_str());
|
||||
}
|
||||
|
||||
if (!strcmp(node->getName(), "current-color")) {
|
||||
if (node->getNameString() == "current-color") {
|
||||
currentColorChanged();
|
||||
}
|
||||
|
||||
|
@ -501,7 +501,7 @@ void HUD::valueChanged(SGPropertyNode *node)
|
|||
_a = clamp(_alpha->getFloatValue());
|
||||
_cl = clamp(_alpha_clamp->getFloatValue());
|
||||
|
||||
_units = strcmp(_unitsN->getStringValue(), "feet") ? METER : FEET;
|
||||
_units = _unitsN->getStringValue() != "feet" ? METER : FEET;
|
||||
_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");
|
||||
for (unsigned int i = 0; i < opt.size(); i++) {
|
||||
const char *o = opt[i]->getStringValue();
|
||||
if (!strcmp(o, "vertical"))
|
||||
string o = opt[i]->getStringValue();
|
||||
if (o == "vertical")
|
||||
_options |= VERTICAL;
|
||||
else if (!strcmp(o, "horizontal"))
|
||||
else if (o == "horizontal")
|
||||
_options |= HORIZONTAL;
|
||||
else if (!strcmp(o, "top"))
|
||||
else if (o == "top")
|
||||
_options |= TOP;
|
||||
else if (!strcmp(o, "left"))
|
||||
else if (o == "left")
|
||||
_options |= LEFT;
|
||||
else if (!strcmp(o, "bottom"))
|
||||
else if (o == "bottom")
|
||||
_options |= BOTTOM;
|
||||
else if (!strcmp(o, "right"))
|
||||
else if (o == "right")
|
||||
_options |= RIGHT;
|
||||
else if (!strcmp(o, "both"))
|
||||
else if (o == "both")
|
||||
_options |= (LEFT|RIGHT);
|
||||
else if (!strcmp(o, "noticks"))
|
||||
else if (o == "noticks")
|
||||
_options |= NOTICKS;
|
||||
else if (!strcmp(o, "notext"))
|
||||
else if (o == "notext")
|
||||
_options |= NOTEXT;
|
||||
else
|
||||
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)
|
||||
_blink_condition = sgReadCondition(globals->get_props(), node);
|
||||
|
||||
const char *halign = n->getStringValue("halign", "center");
|
||||
if (!strcmp(halign, "left"))
|
||||
string halign = n->getStringValue("halign", "center");
|
||||
if (halign == "left")
|
||||
_halign = LEFT;
|
||||
else if (!strcmp(halign, "right"))
|
||||
else if (halign == "right")
|
||||
_halign = RIGHT;
|
||||
else
|
||||
_halign = HCENTER;
|
||||
|
||||
_halign |= VCENTER;
|
||||
|
||||
const char *pre = n->getStringValue("prefix", 0);
|
||||
const char *post = n->getStringValue("postfix", 0);
|
||||
const char *fmt = n->getStringValue("format", 0);
|
||||
string pre = n->getStringValue("prefix", "");
|
||||
string post = n->getStringValue("postfix", "");
|
||||
string fmt = n->getStringValue("format", "");
|
||||
|
||||
if (pre)
|
||||
if (!pre.empty())
|
||||
_format = pre;
|
||||
|
||||
if (fmt)
|
||||
if (!fmt.empty())
|
||||
_format += fmt;
|
||||
else
|
||||
_format += "%s";
|
||||
|
||||
if (post)
|
||||
if (!post.empty())
|
||||
_format += post;
|
||||
|
||||
_mode = check_format(_format.c_str());
|
||||
|
@ -148,7 +148,7 @@ void HUD::Label::draw(void)
|
|||
if (_mode == NONE)
|
||||
snprintf(buf, BUFSIZE, _format.c_str(), 0);
|
||||
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)
|
||||
snprintf(buf, BUFSIZE, _format.c_str(), int(_input.getFloatValue()));
|
||||
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")),
|
||||
_clip_box(new ClipBox(n->getNode("clipping")))
|
||||
{
|
||||
const char *t = n->getStringValue("type");
|
||||
_type = strcmp(t, "climb-dive") ? PITCH : CLIMB_DIVE;
|
||||
string t = n->getStringValue("type");
|
||||
_type = t != "climb-dive" ? PITCH : CLIMB_DIVE;
|
||||
|
||||
if (!_width_units)
|
||||
_width_units = 45;
|
||||
|
@ -300,7 +300,7 @@ void HUD::Ladder::draw(void)
|
|||
for (int i = 0; i < models->nChildren(); i++) {
|
||||
SGPropertyNode *chld = models->getChild(i);
|
||||
string name;
|
||||
name = chld->getName();
|
||||
name = chld->getNameString();
|
||||
if (name == "tanker" || name == "aircraft" || name == "multiplayer") {
|
||||
bool valid = chld->getBoolValue("valid");
|
||||
bool in_range = chld->getBoolValue("radar/in-range", true);
|
||||
|
|
|
@ -73,7 +73,7 @@ public:
|
|||
return _property->getBoolValue();
|
||||
}
|
||||
|
||||
const char *getStringValue() const {
|
||||
std::string getStringValue() const {
|
||||
assert(_property);
|
||||
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;
|
||||
|
||||
const char *s;
|
||||
s = n->getStringValue("pointer-type");
|
||||
_pointer_type = strcmp(s, "moving") ? FIXED : MOVING; // "fixed", "moving"
|
||||
string s = n->getStringValue("pointer-type");
|
||||
_pointer_type = s != "moving" ? FIXED : MOVING; // "fixed", "moving"
|
||||
|
||||
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"
|
||||
_tick_length = strcmp(s, "constant") ? VARIABLE : CONSTANT;
|
||||
_tick_length = s != "constant" ? VARIABLE : CONSTANT;
|
||||
|
||||
_label_fmt = check_format(_format.c_str());
|
||||
if (_label_fmt != INT && _label_fmt != LONG
|
||||
|
|
|
@ -280,8 +280,8 @@ void DCLGPS::update(double dt) {
|
|||
|
||||
// Check if an alarm timer has expired
|
||||
if(_alarmSet) {
|
||||
if(_alarmTime.hr() == atoi(fgGetString("/instrumentation/clock/indicated-hour"))
|
||||
&& _alarmTime.min() == atoi(fgGetString("/instrumentation/clock/indicated-min"))) {
|
||||
if(_alarmTime.hr() == atoi(fgGetString("/instrumentation/clock/indicated-hour").c_str())
|
||||
&& _alarmTime.min() == atoi(fgGetString("/instrumentation/clock/indicated-min").c_str())) {
|
||||
_messageStack.push_back("*Timer Expired");
|
||||
_alarmSet = false;
|
||||
}
|
||||
|
@ -971,8 +971,8 @@ void DCLGPS::SetPowerOnTimer() {
|
|||
}
|
||||
|
||||
void DCLGPS::ResetPowerOnTimer() {
|
||||
_powerOnTime.set_hr(atoi(fgGetString("/instrumentation/clock/indicated-hour")));
|
||||
_powerOnTime.set_min(atoi(fgGetString("/instrumentation/clock/indicated-min")));
|
||||
_powerOnTime.set_hr(atoi(fgGetString("/instrumentation/clock/indicated-hour").c_str()));
|
||||
_powerOnTime.set_min(atoi(fgGetString("/instrumentation/clock/indicated-min").c_str()));
|
||||
_powerOnTimerSet = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -146,8 +146,8 @@ DME::update (double delta_time_sec)
|
|||
char tmp[16];
|
||||
|
||||
// Figure out the source
|
||||
const char * source = _source_node->getStringValue();
|
||||
if (source[0] == '\0') {
|
||||
string source = _source_node->getStringValue();
|
||||
if (source.empty()) {
|
||||
std::string branch;
|
||||
branch = "/instrumentation/" + name() + "/frequencies/selected-mhz";
|
||||
_source_node->setStringValue(branch.c_str());
|
||||
|
|
|
@ -32,7 +32,7 @@ HeadingIndicatorDG::HeadingIndicatorDG ( SGPropertyNode *node ) :
|
|||
int i;
|
||||
for ( i = 0; i < node->nChildren(); ++i ) {
|
||||
SGPropertyNode *child = node->getChild(i);
|
||||
std::string cname = child->getName();
|
||||
std::string cname = child->getNameString();
|
||||
std::string cval = child->getStringValue();
|
||||
if ( cname == "name" ) {
|
||||
name = cval;
|
||||
|
|
|
@ -31,7 +31,7 @@ HeadingIndicatorFG::HeadingIndicatorFG ( SGPropertyNode *node )
|
|||
int i;
|
||||
for ( i = 0; i < node->nChildren(); ++i ) {
|
||||
SGPropertyNode *child = node->getChild(i);
|
||||
string cname = child->getName();
|
||||
string cname = child->getNameString();
|
||||
string cval = child->getStringValue();
|
||||
if ( cname == "name" ) {
|
||||
name = cval;
|
||||
|
|
|
@ -111,7 +111,7 @@ bool FGInstrumentMgr::build (SGPropertyNode* config_props, const SGPath& path)
|
|||
{
|
||||
for ( int i = 0; i < config_props->nChildren(); ++i ) {
|
||||
SGPropertyNode *node = config_props->getChild(i);
|
||||
std::string name = node->getName();
|
||||
std::string name = node->getNameString();
|
||||
|
||||
std::ostringstream subsystemname;
|
||||
subsystemname << "instrument-" << i << '-'
|
||||
|
|
|
@ -1131,7 +1131,7 @@ MK_VIII::IOHandler::update_inputs ()
|
|||
{
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -4625,7 +4625,7 @@ MK_VIII::MK_VIII (SGPropertyNode *node)
|
|||
for (int i = 0; i < node->nChildren(); ++i)
|
||||
{
|
||||
SGPropertyNode *child = node->getChild(i);
|
||||
string cname = child->getName();
|
||||
string cname = child->getNameString();
|
||||
string cval = child->getStringValue();
|
||||
|
||||
if (cname == "name")
|
||||
|
|
|
@ -291,7 +291,7 @@ TACAN::valueChanged(SGPropertyNode *prop)
|
|||
int index = prop->getIndex();
|
||||
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);
|
||||
if (rec != nullptr) {
|
||||
|
|
|
@ -1184,7 +1184,7 @@ TCAS::TCAS(SGPropertyNode* pNode) :
|
|||
for (int i = 0; i < pNode->nChildren(); ++i)
|
||||
{
|
||||
SGPropertyNode* pChild = pNode->getChild(i);
|
||||
string cname = pChild->getName();
|
||||
string cname = pChild->getNameString();
|
||||
string cval = pChild->getStringValue();
|
||||
int cintval = pChild->getIntValue();
|
||||
|
||||
|
|
|
@ -171,7 +171,7 @@ compare_values (SGPropertyNode * value1, SGPropertyNode * value2)
|
|||
case simgear::props::DOUBLE:
|
||||
return (value1->getDoubleValue() == value2->getDoubleValue());
|
||||
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
|
||||
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")
|
||||
file.concat(".sav");
|
||||
|
@ -286,7 +286,7 @@ do_load (const SGPropertyNode * arg, SGPropertyNode * root)
|
|||
static bool
|
||||
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")
|
||||
file.concat(".sav");
|
||||
|
@ -543,7 +543,7 @@ do_property_adjust (const SGPropertyNode * arg, SGPropertyNode * root)
|
|||
* arg->getDoubleValue("offset"));
|
||||
|
||||
double unmodifiable, modifiable;
|
||||
split_value(prop->getDoubleValue(), arg->getStringValue("mask", "all"),
|
||||
split_value(prop->getDoubleValue(), arg->getStringValue("mask", "all").c_str(),
|
||||
&unmodifiable, &modifiable);
|
||||
modifiable += amount;
|
||||
limit_value(&modifiable, arg);
|
||||
|
@ -575,7 +575,7 @@ do_property_multiply (const SGPropertyNode * arg, SGPropertyNode * root)
|
|||
double factor = arg->getDoubleValue("factor", 1.0);
|
||||
|
||||
double unmodifiable, modifiable;
|
||||
split_value(prop->getDoubleValue(), arg->getStringValue("mask", "all"),
|
||||
split_value(prop->getDoubleValue(), arg->getStringValue("mask", "all").c_str(),
|
||||
&unmodifiable, &modifiable);
|
||||
modifiable *= factor;
|
||||
limit_value(&modifiable, arg);
|
||||
|
|
|
@ -365,7 +365,7 @@ private:
|
|||
|
||||
vector<SGPropertyNode_ptr> cache = _cache->getChildren("aircraft");
|
||||
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)) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -624,7 +624,7 @@ fgGetDouble (const char * name, double defaultValue)
|
|||
return globals->get_props()->getDoubleValue(name, defaultValue);
|
||||
}
|
||||
|
||||
const char *
|
||||
std::string
|
||||
fgGetString (const char * name, const char * defaultValue)
|
||||
{
|
||||
return globals->get_props()->getStringValue(name, defaultValue);
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#define __FG_PROPS_HXX 1
|
||||
|
||||
#include <iosfwd>
|
||||
#include <algorithm>
|
||||
|
||||
#include <simgear/structure/subsystem_mgr.hxx>
|
||||
#include <simgear/props/tiedpropertylist.hxx>
|
||||
|
@ -424,7 +425,7 @@ inline double fgGetDouble (const std::string & name, double defaultValue = 0.0)
|
|||
* does not exist.
|
||||
* @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 = "");
|
||||
|
||||
/**
|
||||
|
@ -441,7 +442,7 @@ extern const char * fgGetString (const char * name,
|
|||
* does not exist.
|
||||
* @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(""))
|
||||
{
|
||||
return fgGetString( name.c_str(), defaultValue.c_str() );
|
||||
|
@ -856,9 +857,12 @@ public:
|
|||
if (node->getType() != simgear::props::STRING)
|
||||
return;
|
||||
|
||||
char *s = const_cast<char *>(node->getStringValue());
|
||||
for (; *s; s++)
|
||||
*s = toupper(*s);
|
||||
std::string value = node->getStringValue();
|
||||
std::string value_orig = value;
|
||||
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
|
||||
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;
|
||||
|
||||
string prop = string(prefix) + "-button";
|
||||
string prop = prefix + "-button";
|
||||
double value;
|
||||
|
||||
if (arg->getBoolValue("latching"))
|
||||
|
@ -494,10 +494,10 @@ do_press_cockpit_button (const SGPropertyNode * arg, SGPropertyNode * root)
|
|||
static bool
|
||||
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")) {
|
||||
string prop = string(prefix) + "-guard";
|
||||
string prop = prefix + "-guard";
|
||||
if (fgGetDouble(prop.c_str()) < 1) {
|
||||
fgSetDouble(prop.c_str(), 1);
|
||||
return true;
|
||||
|
@ -505,7 +505,7 @@ do_release_cockpit_button (const SGPropertyNode * arg, SGPropertyNode * root)
|
|||
}
|
||||
|
||||
if (! arg->getBoolValue("latching")) {
|
||||
fgSetDouble((string(prefix) + "-button").c_str(), 0);
|
||||
fgSetDouble((prefix + "-button").c_str(), 0);
|
||||
fgSetBool(arg->getStringValue("discrete"), false);
|
||||
}
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ public:
|
|||
}
|
||||
|
||||
// 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));
|
||||
if (!aircraftDirPieces.empty() && (aircraftDirPieces.back() == pieces[1])) {
|
||||
// current aircraft-dir matches resource aircraft
|
||||
|
|
|
@ -316,8 +316,8 @@ FGLocale::loadResource(SGPropertyNode* localeNode, const char* resource)
|
|||
return true;
|
||||
}
|
||||
|
||||
const char* path_str = resourceNode->getStringValue();
|
||||
if (!path_str)
|
||||
string path_str = resourceNode->getStringValue();
|
||||
if (path_str.empty())
|
||||
{
|
||||
SG_LOG(SG_GENERAL, SG_WARN, "No path in " << stringNode->getPath() << "/" << resource << ".");
|
||||
return false;
|
||||
|
@ -494,21 +494,21 @@ FGLocale::getLocalizedStrings(const char* id, const char* resource)
|
|||
}
|
||||
|
||||
// Check for localized font
|
||||
const char*
|
||||
std::string
|
||||
FGLocale::getDefaultFont(const char* fallbackFont)
|
||||
{
|
||||
assert(_inited);
|
||||
const char* font = nullptr;
|
||||
std::string font;
|
||||
if (_currentLocale)
|
||||
{
|
||||
font = _currentLocale->getStringValue("font", "");
|
||||
if (font[0] != 0)
|
||||
if (!font.empty())
|
||||
return font;
|
||||
}
|
||||
if (_defaultLocale)
|
||||
{
|
||||
font = _defaultLocale->getStringValue("font", "");
|
||||
if (font[0] != 0)
|
||||
if (!font.empty())
|
||||
return font;
|
||||
}
|
||||
|
||||
|
|
|
@ -96,7 +96,7 @@ public:
|
|||
/**
|
||||
* 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
|
||||
|
|
|
@ -569,9 +569,9 @@ struct SGLogDeltasListener : SGPropertyChangeListener
|
|||
{
|
||||
void valueChanged(SGPropertyNode* node) override
|
||||
{
|
||||
const char* value = node->getStringValue();
|
||||
std::string value = node->getStringValue();
|
||||
std::cerr << __FILE__ << ":" << __LINE__ << ": sglogdeltas value=" << value << "\n";
|
||||
logDeltaSet(value);
|
||||
logDeltaSet(value.c_str());
|
||||
}
|
||||
};
|
||||
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
|
||||
const char* levels[] = {"alpha","beta","early-production","production"};
|
||||
|
||||
if (!strcmp(str, "all")) {
|
||||
if (str == "all") {
|
||||
return 0;
|
||||
}
|
||||
|
||||
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 0;
|
||||
|
@ -809,7 +809,7 @@ static int
|
|||
fgOptAltitude( const char *arg )
|
||||
{
|
||||
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 ));
|
||||
else
|
||||
fgSetDouble("/sim/presets/altitude-ft",
|
||||
|
@ -821,7 +821,7 @@ static int
|
|||
fgOptUBody( const char *arg )
|
||||
{
|
||||
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 ));
|
||||
else
|
||||
fgSetDouble("/sim/presets/uBody-fps",
|
||||
|
@ -833,7 +833,7 @@ static int
|
|||
fgOptVBody( const char *arg )
|
||||
{
|
||||
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 ));
|
||||
else
|
||||
fgSetDouble("/sim/presets/vBody-fps",
|
||||
|
@ -845,7 +845,7 @@ static int
|
|||
fgOptWBody( const char *arg )
|
||||
{
|
||||
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));
|
||||
else
|
||||
fgSetDouble("/sim/presets/wBody-fps",
|
||||
|
@ -857,7 +857,7 @@ static int
|
|||
fgOptVNorth( const char *arg )
|
||||
{
|
||||
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 ));
|
||||
else
|
||||
fgSetDouble("/sim/presets/speed-north-fps",
|
||||
|
@ -869,7 +869,7 @@ static int
|
|||
fgOptVEast( const char *arg )
|
||||
{
|
||||
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));
|
||||
else
|
||||
fgSetDouble("/sim/presets/speed-east-fps",
|
||||
|
@ -881,7 +881,7 @@ static int
|
|||
fgOptVDown( const char *arg )
|
||||
{
|
||||
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));
|
||||
else
|
||||
fgSetDouble("/sim/presets/speed-down-fps",
|
||||
|
@ -2416,7 +2416,7 @@ OptionResult Options::initAircraft()
|
|||
} else {
|
||||
SG_LOG(SG_INPUT, SG_INFO, "No user specified aircraft, using default" );
|
||||
// ensure aircraft-id is valid
|
||||
fgSetString("/sim/aircraft-id", fgGetString("/sim/aircraft"));
|
||||
fgSetString("/sim/aircraft-id", fgGetString("/sim/aircraft").c_str());
|
||||
}
|
||||
|
||||
if (p->showAircraft) {
|
||||
|
|
|
@ -242,8 +242,8 @@ do_reinit (const SGPropertyNode * arg, SGPropertyNode * root)
|
|||
globals->get_subsystem_mgr()->reinit();
|
||||
} else {
|
||||
for ( unsigned int i = 0; i < subsystems.size(); i++ ) {
|
||||
const char * name = subsystems[i]->getStringValue();
|
||||
SGSubsystem * subsystem = globals->get_subsystem(name);
|
||||
std::string name = subsystems[i]->getStringValue();
|
||||
SGSubsystem * subsystem = globals->get_subsystem(name.c_str());
|
||||
if (subsystem == 0) {
|
||||
result = false;
|
||||
SG_LOG( SG_GENERAL, SG_ALERT,
|
||||
|
@ -271,8 +271,8 @@ do_suspend (const SGPropertyNode * arg, SGPropertyNode * root)
|
|||
|
||||
vector<SGPropertyNode_ptr> subsystems = arg->getChildren("subsystem");
|
||||
for ( unsigned int i = 0; i < subsystems.size(); i++ ) {
|
||||
const char * name = subsystems[i]->getStringValue();
|
||||
SGSubsystem * subsystem = globals->get_subsystem(name);
|
||||
std::string name = subsystems[i]->getStringValue();
|
||||
SGSubsystem * subsystem = globals->get_subsystem(name.c_str());
|
||||
if (subsystem == 0) {
|
||||
result = false;
|
||||
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");
|
||||
for ( unsigned int i = 0; i < subsystems.size(); i++ ) {
|
||||
const char * name = subsystems[i]->getStringValue();
|
||||
SGSubsystem * subsystem = globals->get_subsystem(name);
|
||||
std::string name = subsystems[i]->getStringValue();
|
||||
SGSubsystem * subsystem = globals->get_subsystem(name.c_str());
|
||||
if (subsystem == 0) {
|
||||
result = false;
|
||||
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)
|
||||
heading = testNan(instance->heading_deg_node->getDoubleValue());
|
||||
} catch (const sg_range_exception&) {
|
||||
const char *path = instance->node->getStringValue("path",
|
||||
"unknown");
|
||||
string path = instance->node->getStringValue("path", "unknown");
|
||||
SG_LOG(SG_AIRCRAFT, SG_INFO, "Instance of model " << path
|
||||
<< " has invalid values");
|
||||
return;
|
||||
|
@ -359,7 +358,7 @@ bool FGModelMgr::Instance::checkLoaded() const
|
|||
void
|
||||
FGModelMgr::Listener::childAdded(SGPropertyNode * parent, SGPropertyNode * child)
|
||||
{
|
||||
if (strcmp(parent->getName(), "model") || strcmp(child->getName(), "load"))
|
||||
if (parent->getNameString() != "model" || child->getNameString() != "load")
|
||||
return;
|
||||
|
||||
_mgr->add_model(parent);
|
||||
|
@ -368,7 +367,7 @@ FGModelMgr::Listener::childAdded(SGPropertyNode * parent, SGPropertyNode * child
|
|||
void
|
||||
FGModelMgr::Listener::childRemoved(SGPropertyNode * parent, SGPropertyNode * child)
|
||||
{
|
||||
if (strcmp(parent->getName(), "models") || strcmp(child->getName(), "model"))
|
||||
if (parent->getNameString() != "models" || child->getNameString() != "model")
|
||||
return;
|
||||
|
||||
// search instance by node and remove it from scenegraph
|
||||
|
|
|
@ -1378,7 +1378,7 @@ FGMultiplayMgr::SendMyPosition(const FGExternalMotionData& motionInfo)
|
|||
else
|
||||
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';
|
||||
if (fgGetBool("/sim/freeze/replay-state", 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.
|
||||
|
||||
const char* cstr = it->second->getStringValue();
|
||||
int len = strlen(cstr);
|
||||
string cstr = it->second->getStringValue();
|
||||
size_t len = cstr.length();
|
||||
|
||||
if (len > 0)
|
||||
{
|
||||
pData->string_value = new char[len + 1];
|
||||
strcpy(pData->string_value, cstr);
|
||||
strcpy(pData->string_value, cstr.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2487,8 +2487,8 @@ FGMultiplayMgr::ProcessPosMsg(const FGMultiplayMgr::MsgBuf& Msg,
|
|||
// --test-motion-mp.
|
||||
//
|
||||
{
|
||||
const char* callsign = pLogRawSpeedMultiplayer->getStringValue();
|
||||
if (callsign && callsign[0] && !strcmp(callsign, MsgHdr->Callsign)) {
|
||||
string callsign = pLogRawSpeedMultiplayer->getStringValue();
|
||||
if (!callsign.empty() && callsign == string(MsgHdr->Callsign)) {
|
||||
static SGVec3d s_pos_prev;
|
||||
static double s_simtime_prev = -1;
|
||||
SGVec3d pos = motionInfo.position;
|
||||
|
@ -2753,7 +2753,7 @@ FGMultiplayMgr::addMultiplayer(const std::string& callsign,
|
|||
int config_children_n = config->nChildren();
|
||||
for (int i=0; i<config_children_n; ++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) {
|
||||
altFt = std::stof(target.substr(pos + 1));
|
||||
target = target.substr(0, pos);
|
||||
if (!strcmp(fgGetString("/sim/startup/units"), "meter")) {
|
||||
if (fgGetString("/sim/startup/units") == "meter") {
|
||||
altFt *= SG_METER_TO_FEET;
|
||||
}
|
||||
altSetting = RESTRICT_AT;
|
||||
|
@ -487,12 +487,12 @@ bool Waypt::initFromProperties(SGPropertyNode_ptr aProp)
|
|||
}
|
||||
|
||||
if (aProp->hasChild("alt-restrict")) {
|
||||
_altRestrict = restrictionFromString(aProp->getStringValue("alt-restrict"));
|
||||
_altRestrict = restrictionFromString(aProp->getStringValue("alt-restrict").c_str());
|
||||
_altitudeFt = aProp->getDoubleValue("altitude-ft");
|
||||
}
|
||||
|
||||
if (aProp->hasChild("speed-restrict")) {
|
||||
_speedRestrict = restrictionFromString(aProp->getStringValue("speed-restrict"));
|
||||
_speedRestrict = restrictionFromString(aProp->getStringValue("speed-restrict").c_str());
|
||||
_speed = aProp->getDoubleValue("speed");
|
||||
}
|
||||
|
||||
|
|
|
@ -407,7 +407,7 @@ bool FGATCInput::do_analog_in() {
|
|||
// read the next config entry from the property tree
|
||||
|
||||
SGPropertyNode *child = analog_in_node->getChild(i);
|
||||
string cname = child->getName();
|
||||
string cname = child->getNameString();
|
||||
int index = child->getIndex();
|
||||
string name = "";
|
||||
string type = "";
|
||||
|
@ -680,7 +680,7 @@ bool FGATCInput::do_switches() {
|
|||
// read the next config entry from the property tree
|
||||
|
||||
SGPropertyNode *child = switches_node->getChild(i);
|
||||
string cname = child->getName();
|
||||
string cname = child->getNameString();
|
||||
string name = "";
|
||||
string type = "";
|
||||
vector <SGPropertyNode *> output_nodes;
|
||||
|
@ -881,7 +881,7 @@ bool FGATCInput::do_radio_switches() {
|
|||
// read the next config entry from the property tree
|
||||
|
||||
SGPropertyNode *child = radio_in_node->getChild(i);
|
||||
string cname = child->getName();
|
||||
string cname = child->getNameString();
|
||||
|
||||
if ( cname == "switch" ) {
|
||||
string name = "";
|
||||
|
|
|
@ -441,7 +441,7 @@ bool FGATCOutput::do_analog_out() {
|
|||
// read the next config entry from the property tree
|
||||
|
||||
SGPropertyNode *child = analog_out_node->getChild(i);
|
||||
string cname = child->getName();
|
||||
string cname = child->getNameString();
|
||||
int index = child->getIndex();
|
||||
string name = "";
|
||||
string type = "";
|
||||
|
@ -510,7 +510,7 @@ bool FGATCOutput::do_lamps() {
|
|||
// read the next config entry from the property tree
|
||||
|
||||
SGPropertyNode *child = lamps_out_node->getChild(i);
|
||||
string cname = child->getName();
|
||||
string cname = child->getNameString();
|
||||
int index = child->getIndex();
|
||||
string name = "";
|
||||
string type = "";
|
||||
|
|
|
@ -245,7 +245,7 @@ void FGCom::postinit()
|
|||
std::string app = "FGFS-";
|
||||
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_speex_settings(1, 5, 0, 1, 0, 3);
|
||||
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
|
||||
snprintf( nmea, 256, "$PFLAC,A,%s,%s",
|
||||
keyword.c_str(), configNode->getStringValue());
|
||||
keyword.c_str(), configNode->getStringValue().c_str());
|
||||
add_with_checksum(nmea, 256);
|
||||
Error = false;
|
||||
}
|
||||
|
@ -447,7 +447,7 @@ void FGFlarm::parse_message(const std::vector<std::string>& tokens)
|
|||
|
||||
// reply
|
||||
snprintf( nmea, 256, "$PFLAC,A,%s,%s",
|
||||
keyword.c_str(), configNode->getStringValue());
|
||||
keyword.c_str(), configNode->getStringValue().c_str());
|
||||
add_with_checksum(nmea, 256);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -357,8 +357,8 @@ bool FGGeneric::gen_message_binary() {
|
|||
}
|
||||
|
||||
default: // SG_STRING
|
||||
const char *strdata = _out_message[i].prop->getStringValue();
|
||||
int32_t strlength = strlen(strdata);
|
||||
string strdata = _out_message[i].prop->getStringValue();
|
||||
size_t strlength = strdata.length();
|
||||
|
||||
if (binary_byte_order == BYTE_ORDER_NEEDS_CONVERSION) {
|
||||
SG_LOG( SG_IO, SG_ALERT, "Generic protocol: "
|
||||
|
@ -372,7 +372,7 @@ bool FGGeneric::gen_message_binary() {
|
|||
}
|
||||
memcpy(&buf[length], &strlength, sizeof(int32_t));
|
||||
length += sizeof(int32_t);
|
||||
strncpy(&buf[length], strdata, strlength);
|
||||
strncpy(&buf[length], strdata.c_str(), strlength);
|
||||
length += strlength;
|
||||
/* FIXME padding for alignment? Something like:
|
||||
* length += (strlength % 4 > 0 ? sizeof(int32_t) - strlength % 4 : 0;
|
||||
|
@ -455,7 +455,7 @@ bool FGGeneric::gen_message_ascii() {
|
|||
|
||||
default: // SG_STRING
|
||||
snprintf(tmp, 255, format.c_str(),
|
||||
_out_message[i].prop->getStringValue());
|
||||
_out_message[i].prop->getStringValue().c_str());
|
||||
}
|
||||
|
||||
generic_sentence += tmp;
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace http {
|
|||
|
||||
class FlightHistoryUriHandler : public URIHandler {
|
||||
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 );
|
||||
private:
|
||||
};
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace http {
|
|||
|
||||
class JsonUriHandler : public URIHandler {
|
||||
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 );
|
||||
private:
|
||||
SGPropertyNode_ptr getRequestedNode(const HTTPRequest & request);
|
||||
|
|
|
@ -28,7 +28,7 @@ namespace http {
|
|||
|
||||
class NavdbUriHandler : public URIHandler {
|
||||
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 );
|
||||
};
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace http {
|
|||
|
||||
class PkgUriHandler : public URIHandler {
|
||||
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 );
|
||||
private:
|
||||
};
|
||||
|
|
|
@ -74,7 +74,7 @@ private:
|
|||
class CompareNodes {
|
||||
public:
|
||||
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();
|
||||
}
|
||||
};
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue