]> git.mxchange.org Git - flightgear.git/blobdiff - src/Cockpit/panel_io.cxx
Use !strcmp for all property string-value comparisons.
[flightgear.git] / src / Cockpit / panel_io.cxx
index 763d40ac32b6dae143ab97e5d89f9dadd86f0e35..b81717430377f78988ba13e832d70cb0bbbd1cb3 100644 (file)
@@ -295,8 +295,8 @@ readTransformation (const SGPropertyNode * node, float w_scale, float h_scale)
     type = "rotation";
   }
 
-  if (propName != (string)"") {
-    target = fgGetNode(propName, true);
+  if (!propName.empty()) {
+    target = fgGetNode(propName.c_str(), true);
   }
 
   t->node = target;
@@ -313,7 +313,7 @@ readTransformation (const SGPropertyNode * node, float w_scale, float h_scale)
     t->table = new SGInterpTable();
     for(int i = 0; i < trans_table->nChildren(); i++) {
       const SGPropertyNode * node = trans_table->getChild(i);
-      if (node->getName() == "entry") {
+      if (string(node->getName()) == "entry") {
        double ind = node->getDoubleValue("ind", 0.0);
        double dep = node->getDoubleValue("dep", 0.0);
        SG_LOG( SG_COCKPIT, SG_INFO, "Adding interpolation entry "
@@ -413,7 +413,7 @@ readTextChunk (const SGPropertyNode * node)
   else if (type == "number-value") {
     string propName = node->getStringValue("property");
     float scale = node->getFloatValue("scale", 1.0);
-    SGPropertyNode * target = fgGetNode(propName, true);
+    SGPropertyNode * target = fgGetNode(propName.c_str(), true);
     chunk = new FGTextLayer::Chunk(FGTextLayer::DOUBLE_VALUE, target,
                                   format, scale);
   }
@@ -485,7 +485,7 @@ readLayer (const SGPropertyNode * node, float w_scale, float h_scale)
     for (int i = 0; i < node->nChildren(); i++) {
       const SGPropertyNode * child = node->getChild(i);
       cerr << "Trying child " << child->getName() << endl;
-      if (child->getName() == "layer") {
+      if (string(child->getName()) == "layer") {
        cerr << "succeeded!" << endl;
        ((FGGroupLayer *)layer)->addLayer(readLayer(child, w_scale, h_scale));
       }
@@ -516,7 +516,7 @@ 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 (node->getName() == "chunk") {
+       if (string(node->getName()) == "chunk") {
          FGTextLayer::Chunk * chunk = readTextChunk(node);
          if (chunk != 0)
            tlayer->addChunk(chunk);
@@ -576,7 +576,7 @@ 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 (node->getName() == "transformation") {
+      if (string(node->getName()) == "transformation") {
        FGPanelTransformation * t = readTransformation(node, w_scale, h_scale);
        if (t != 0)
          layer->addTransformation(t);
@@ -645,7 +645,7 @@ readInstrument (const SGPropertyNode * node)
     int nActions = action_group->nChildren();
     for (int i = 0; i < nActions; i++) {
       const SGPropertyNode * node = action_group->getChild(i);
-      if (node->getName() == "action") {
+      if (string(node->getName()) == "action") {
        FGPanelAction * action = readAction(node, w_scale, h_scale);
        if (action != 0)
          instrument->addAction(action);
@@ -664,7 +664,7 @@ readInstrument (const SGPropertyNode * node)
     int nLayers = layer_group->nChildren();
     for (int i = 0; i < nLayers; i++) {
       const SGPropertyNode * node = layer_group->getChild(i);
-      if (node->getName() == "layer") {
+      if (string(node->getName()) == "layer") {
        FGInstrumentLayer * layer = readLayer(node, w_scale, h_scale);
        if (layer != 0)
          instrument->addLayer(layer);
@@ -708,7 +708,7 @@ readPanel (const SGPropertyNode * root)
 
   // conditional removed by jim wilson to allow panel xml code 
   // with y-offset defined to work...
-  // if (!fgHasNode("/sim/panel/y-offset"))
+  if (!fgHasNode("/sim/panel/y-offset"))
     fgSetInt("/sim/panel/y-offset", root->getIntValue("y-offset", 0));
 
   //
@@ -724,7 +724,7 @@ readPanel (const SGPropertyNode * root)
   // Get multibackground if any...
   //
   string mbgTexture = root->getStringValue("multibackground[0]");
-  if (mbgTexture != (string)"") {
+  if (!mbgTexture.empty()) {
     panel->setMultiBackground(FGTextureManager::createTexture(mbgTexture.c_str()), 0);
     SG_LOG( SG_COCKPIT, SG_INFO, "Set background texture to " << mbgTexture );
 
@@ -783,7 +783,7 @@ readPanel (const SGPropertyNode * root)
     int nInstruments = instrument_group->nChildren();
     for (int i = 0; i < nInstruments; i++) {
       const SGPropertyNode * node = instrument_group->getChild(i);
-      if (node->getName() == "instrument") {
+      if (string(node->getName()) == "instrument") {
        FGPanelInstrument * instrument = readInstrument(node);
        if (instrument != 0)
          panel->addInstrument(instrument);