From: curt Date: Wed, 20 Mar 2002 15:57:31 +0000 (+0000) Subject: Various Irix cleanups. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=99fa3a6e7949693f1ab21b1a6f0f796801b08d97;p=flightgear.git Various Irix cleanups. Float/Double clean ups for fg_sound.cxx --- diff --git a/src/Cockpit/panel_io.cxx b/src/Cockpit/panel_io.cxx index f3b76d8e3..d7707d687 100644 --- a/src/Cockpit/panel_io.cxx +++ b/src/Cockpit/panel_io.cxx @@ -295,7 +295,7 @@ readTransformation (const SGPropertyNode * node, float w_scale, float h_scale) type = "rotation"; } - if (propName != "") { + if (propName != (string)"") { target = fgGetNode(propName.c_str(), true); } diff --git a/src/Main/main.cxx b/src/Main/main.cxx index a9bd8003e..4892ac57a 100644 --- a/src/Main/main.cxx +++ b/src/Main/main.cxx @@ -552,7 +552,7 @@ void fgRenderFrame( void ) { } glEnable( GL_DEPTH_TEST ); - if ( fgGetString("/sim/rendering/fog") != (string)"disabled" ) { + if ( fgGetString("/sim/rendering/fog") != "disabled" ) { glEnable( GL_FOG ); glFogi( GL_FOG_MODE, GL_EXP2 ); glFogfv( GL_FOG_COLOR, l->adj_fog_color ); diff --git a/src/Objects/matlib.cxx b/src/Objects/matlib.cxx index 11be5cf57..d725bf9b7 100644 --- a/src/Objects/matlib.cxx +++ b/src/Objects/matlib.cxx @@ -53,6 +53,7 @@ #include "matlib.hxx" +SG_USING_NAMESPACE(std); SG_USING_STD(string); @@ -89,7 +90,7 @@ bool FGMaterialLib::load( const string& mpath ) { for (unsigned int j = 0; j < names.size(); j++) { string name = names[j]->getStringValue(); m->ref(); - std::cerr << "Material " << name << endl; + // cerr << "Material " << name << endl; matlib[name] = m; SG_LOG( SG_TERRAIN, SG_INFO, " Loading material " << names[j]->getStringValue()); diff --git a/src/Sound/fg_sound.cxx b/src/Sound/fg_sound.cxx index 626a2ce2b..f61becd6b 100644 --- a/src/Sound/fg_sound.cxx +++ b/src/Sound/fg_sound.cxx @@ -86,18 +86,17 @@ FGSound::init() _property = fgGetNode(_node->getStringValue("property"), true); // - // seet sound global properties + // set global sound properties // _name = _node->getStringValue("name"); - if ((_factor = _node->getFloatValue("factor")) == 0.0) + if ((_factor = _node->getDoubleValue("factor")) == 0.0) _factor = 1.0; - if ((_offset = _node->getFloatValue("offset")) == 0.0) + if ((_offset = _node->getDoubleValue("offset")) == 0.0) _offset = 0.0; - SG_LOG(SG_GENERAL, SG_INFO, - "Loading sound information for: " << _name ); + SG_LOG(SG_GENERAL, SG_INFO, "Loading sound information for: " << _name ); string mode_str = _node->getStringValue("mode"); if (mode_str == "looped") { @@ -127,9 +126,9 @@ FGSound::init() // // set position properties // - _pos.dist = _node->getFloatValue("dist"); - _pos.hor = _node->getFloatValue("pos_hor"); - _pos.vert = _node->getFloatValue("pos_vert"); + _pos.dist = _node->getDoubleValue("dist"); + _pos.hor = _node->getDoubleValue("pos_hor"); + _pos.vert = _node->getDoubleValue("pos_vert"); #endif // @@ -145,7 +144,7 @@ FGSound::init() == 0) volume.prop = fgGetNode("/null", true); - if ((volume.factor = kids[i]->getFloatValue("factor")) == 0.0) + if ((volume.factor = kids[i]->getDoubleValue("factor")) == 0.0) volume.factor = 1.0; else if (volume.factor < 0.0) { @@ -164,16 +163,16 @@ FGSound::init() if (!volume.fn) SG_LOG( SG_GENERAL, SG_INFO, "Unknown volume type, default to 'lin'"); - if ((volume.offset = kids[i]->getFloatValue("offset")) == 0.0) + if ((volume.offset = kids[i]->getDoubleValue("offset")) == 0.0) volume.offset = 0.0; - if ((volume.min = kids[i]->getFloatValue("min")) < 0.0) { + if ((volume.min = kids[i]->getDoubleValue("min")) < 0.0) { SG_LOG( SG_GENERAL, SG_WARN, "Volume minimum value below 0. Forced to 0."); volume.min = 0.0; } - if ((volume.max = kids[i]->getFloatValue("max")) <= volume.min) { + if ((volume.max = kids[i]->getDoubleValue("max")) < volume.min) { SG_LOG( SG_GENERAL, SG_ALERT, "Volume maximum value below minimum value. Forced above minimum."); volume.max = volume.min + 5.0; @@ -197,12 +196,12 @@ FGSound::init() == 0) pitch.prop = fgGetNode("/null", true); - if ((pitch.factor = kids[i]->getFloatValue("factor")) == 0.0) + if ((pitch.factor = kids[i]->getDoubleValue("factor")) == 0.0) pitch.factor = 1.0; pitch.fn = NULL; for (int j=0; __fg_snd_fn[j].fn; j++) - if(__fg_snd_fn[j].name == kids[i]->getStringValue("type")) { + if (__fg_snd_fn[j].name == kids[i]->getStringValue("type")) { pitch.fn = __fg_snd_fn[j].fn; break; } @@ -210,16 +209,16 @@ FGSound::init() if (!pitch.fn) SG_LOG( SG_GENERAL, SG_INFO, "Unknown pitch type, default to 'lin'"); - if ((pitch.offset = kids[i]->getFloatValue("offset")) == 0.0) + if ((pitch.offset = kids[i]->getDoubleValue("offset")) == 0.0) pitch.offset = 1.0; - if ((pitch.min = kids[i]->getFloatValue("min")) < 0.0) { + if ((pitch.min = kids[i]->getDoubleValue("min")) < 0.0) { SG_LOG( SG_GENERAL, SG_WARN, "Pitch minimum value below 0. Forced to 0."); pitch.min = 0.0; } - if ((pitch.max = kids[i]->getFloatValue("max")) <= pitch.min) { + if ((pitch.max = kids[i]->getDoubleValue("max")) < pitch.min) { SG_LOG( SG_GENERAL, SG_ALERT, "Pitch maximum value below minimum value. Forced above minimum."); pitch.max = pitch.min + 5.0; @@ -264,7 +263,10 @@ FGSound::update (int dt) if ((_type == FGSound::LEVEL) || (_type == FGSound::INVERTED)) { - bool check = (int)(_offset + _property->getFloatValue() * _factor); + // + // use an integer to get false when: -1 < check < 1 + // + bool check = (int)(_offset + _property->getDoubleValue() * _factor); if (_type == FGSound::INVERTED) check = !check; @@ -289,7 +291,7 @@ FGSound::update (int dt) } else { // FLIPFLOP, RAISE, FALL - bool check = (int)(_offset + _property->getFloatValue() * _factor); + bool check = (int)(_offset + _property->getDoubleValue() * _factor); if (check == _active) return;