Unused vars, loss of precision, bool type conversions.
else if (attname == "lon")
lon = atts.getValue(i);
else if (attname == "isOnRunway")
- onRunway = (bool) std::atoi(atts.getValue(i));
+ onRunway = std::atoi(atts.getValue(i)) != 0;
else if (attname == "holdPointType") {
string attval = atts.getValue(i);
if (attval=="none") {
else if (attname == "end")
end = std::atoi(atts.getValue(i));
else if (attname == "isPushBackRoute")
- isPushBackRoute = (bool) std::atoi(atts.getValue(i));
+ isPushBackRoute = std::atoi(atts.getValue(i)) != 0;
}
_dynamics->getGroundNetwork()->addSegment(new FGTaxiSegment(begin, end, isPushBackRoute));
bool isDirty() const
{
- return _status & DIRTY;
+ return (_status & DIRTY)!=0;
}
bool isComplete() const
_localBvhTree->accept(wireIntersector);
_wire = wireIntersector.getWire();
- return _wire;
+ return (_wire != NULL);
}
class FGGroundCache::WireFinder : public BVHVisitor {
inline float red() const { return clamp(_red); }
inline float green() const { return clamp(_green); }
inline float blue() const { return clamp(_blue); }
- inline float alpha() const { return _alpha < 0.0 ? 1.0 : clamp(_alpha); }
+ inline float alpha() const { return _alpha < 0.0 ? 1.0f : clamp(_alpha); }
protected:
float _red, _green, _blue, _alpha;
private:
- float clamp(float f) const { return f < 0.0 ? 0.0 : f > 1.0 ? 1.0 : f; }
+ float clamp(float f) const { return f < 0.0 ? 0.0f : f > 1.0 ? 1.0f : f; }
};
-#endif
\ No newline at end of file
+#endif
try {
readProperties(it->second.str(), result);
result->setStringValue("source", it->second.c_str());
- } catch (sg_exception& e) {
+ } catch (sg_exception&) {
SG_LOG(SG_INPUT, SG_WARN, "parse failure reading:" << it->second);
return NULL;
}
SGPropertyNode_ptr n(new SGPropertyNode);
try {
readProperties(path.str(), n);
- } catch (sg_exception& e) {
+ } catch (sg_exception&) {
SG_LOG(SG_INPUT, SG_WARN, "parse failure reading:" << path);
return;
}
try {
execSelect(stmt);
- } catch (sg_exception& e) {
+ } catch (sg_exception&) {
sqlite3_finalize(stmt);
throw; // re-throw
}
reset(loadAirportStmt);
sqlite3_bind_int64(loadAirportStmt, 1, rowId);
execSelect1(loadAirportStmt);
- bool hasMetar = sqlite3_column_int(loadAirportStmt, 0);
+ bool hasMetar = (sqlite3_column_int(loadAirportStmt, 0) > 0);
return new FGAirport(rowId, id, pos, name, hasMetar, ty);
}
}
FGRunwayRef r(const_cast<FGRunway*>(aWay));
- return (_runways.count(r));
+ return (_runways.count(r) > 0);
}
RunwayVec ArrivalDeparture::runways() const
// or
node->setDoubleValue( "spoilers", net->spoilers ); //JWW
// cout << "NET->Spoilers: " << net->spoilers << endl;
- fgSetBool( "/systems/electrical/outputs/flaps", net->flaps_power );
- node->setBoolValue( "flaps-serviceable", net->flap_motor_ok );
+ fgSetBool( "/systems/electrical/outputs/flaps", net->flaps_power > 0 );
+ node->setBoolValue( "flaps-serviceable", net->flap_motor_ok > 0 );
for ( i = 0; i < FGNetCtrls::FG_MAX_ENGINES; ++i ) {
// Controls
node->getChild( "magnetos" )->setDoubleValue( net->magnetos[i] );
node->getChild( "starter" )->setDoubleValue( net->starter_power[i] );
node->getChild( "feed_tank" )->setIntValue( net->feed_tank_to[i] );
- node->getChild( "reverser" )->setBoolValue( net->reverse[i] );
+ node->getChild( "reverser" )->setBoolValue( net->reverse[i] > 0 );
// Faults
SGPropertyNode *faults = node->getNode( "faults", true );
- faults->setBoolValue( "serviceable", net->engine_ok[i] );
+ faults->setBoolValue( "serviceable", net->engine_ok[i] > 0 );
faults->setBoolValue( "left-magneto-serviceable",
- net->mag_left_ok[i] );
+ net->mag_left_ok[i] > 0 );
faults->setBoolValue( "right-magneto-serviceable",
- net->mag_right_ok[i]);
+ net->mag_right_ok[i] > 0);
faults->setBoolValue( "spark-plugs-serviceable",
- net->spark_plugs_ok[i] );
+ net->spark_plugs_ok[i] > 0);
faults->setIntValue( "oil-pressure-status", net->oil_press_status[i] );
- faults->setBoolValue( "fuel-pump-serviceable", net->fuel_pump_ok[i] );
+ faults->setBoolValue( "fuel-pump-serviceable", net->fuel_pump_ok[i] > 0);
}
fgSetBool( "/systems/electrical/outputs/fuel-pump",
- net->fuel_pump_power[0] );
+ net->fuel_pump_power[0] > 0);
for ( i = 0; i < FGNetCtrls::FG_MAX_TANKS; ++i ) {
node = fgGetNode( "/controls/fuel/tank", i );
node->getChild( "fuel_selector" )
- ->setBoolValue( net->fuel_selector[i] );
+ ->setBoolValue( net->fuel_selector[i] > 0 );
// node->getChild( "to_tank" )->xfer_tank( i, net->xfer_to[i] );
}
node = fgGetNode( "/controls/gear" );
}
node = fgGetNode( "/controls/gear", true );
- node->setBoolValue( "gear-down", net->gear_handle );
+ node->setBoolValue( "gear-down", net->gear_handle > 0 );
// node->setDoubleValue( "brake-parking", net->brake_parking );
// node->setDoubleValue( net->brake_left );
// node->setDoubleValue( net->brake_right );
node = fgGetNode( "/controls/switches", true );
- node->setBoolValue( "master-bat", net->master_bat );
- node->setBoolValue( "master-alt", net->master_alt );
- node->setBoolValue( "master-avionics", net->master_avionics );
+ node->setBoolValue( "master-bat", net->master_bat > 0 );
+ node->setBoolValue( "master-alt", net->master_alt > 0);
+ node->setBoolValue( "master-avionics", net->master_avionics > 0);
node = fgGetNode( "/environment", true );
node->setDoubleValue( "wind-speed-kt", net->wind_speed_kt );
if ( honor_freezes ) {
node = fgGetNode( "/sim/freeze", true );
- node->setBoolValue( "master", net->freeze & 0x01 );
- node->setBoolValue( "position", net->freeze & 0x02 );
- node->setBoolValue( "fuel", net->freeze & 0x04 );
+ node->setBoolValue( "master", (net->freeze & 0x01) > 0 );
+ node->setBoolValue( "position", (net->freeze & 0x02) > 0 );
+ node->setBoolValue( "fuel", (net->freeze & 0x04) > 0 );
}
}
// Approach
fgSetDouble( "/instrumentation/nav[0]/frequencies/selected-mhz",
net->tuned_freq );
- fgSetBool( "/instrumentation/nav[0]/in-range", net->in_range );
+ fgSetBool( "/instrumentation/nav[0]/in-range", net->in_range > 0);
fgSetDouble( "/instrumentation/dme/indicated-distance-nm", net->dist_nm );
fgSetDouble( "/instrumentation/nav[0]/heading-needle-deflection",
net->course_deviation_deg );
SGPropertyNode *n = globals->get_props()->getNode( param[1].c_str() );
if (n)
n->removeChangeListener( this );
- } catch (sg_exception &e) {
+ } catch (sg_exception&) {
error("Error:Listener could not be removed");
}
}
return false;
}
- return naEqual(naVec_get(parents, 0), geoCoordClass);
+ return naEqual(naVec_get(parents, 0), geoCoordClass) != 0;
}
bool geodFromHash(naRef ref, SGGeod& result)
naRef child = naVec_get(argv, 0);
if(!naIsString(child)) return naNil();
naRef idx = naNumValue(naVec_get(argv, 1));
- bool create = naTrue(naVec_get(argv, 2));
+ bool create = naTrue(naVec_get(argv, 2)) != 0;
SGPropertyNode* n;
try {
if(naIsNil(idx) || !naIsNum(idx)) {
bool append = true;
if( !naIsNil(ref_append) )
- append = naTrue(ref_append);
+ append = naTrue(ref_append) != 0;
n = (*node)->addChild(naStr_data(child), min_index, append);
}
{
NODEARG();
naRef path = naVec_get(argv, 0);
- bool create = naTrue(naVec_get(argv, 1));
+ bool create = naTrue(naVec_get(argv, 1)) != 0;
if(!naIsString(path)) return naNil();
SGPropertyNode* n;
try {