From 3653508412048f49fc7c090fe518ab7d04005d83 Mon Sep 17 00:00:00 2001 From: James Turner Date: Mon, 27 Feb 2017 23:15:07 +0000 Subject: [PATCH] Build- and run-time concept of developer mode. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Make a single Cmake value to expose the build type to code, and use this to default a run-time ‘developer-mode’ property, which can be over-ridden from the command line. Use this to drive the different warning levels. Policies subject to review, especially whether nightly builds should default to developer mode or not. --- CMakeLists.txt | 9 ++++++-- src/AIModel/submodel.cxx | 10 ++++----- src/FDM/YASim/FGFDM.cpp | 36 +++++++++++++++----------------- src/Include/config_cmake.h.in | 3 +-- src/Main/bootstrap.cxx | 39 ++++++++++++++++------------------- src/Main/fg_init.cxx | 15 ++++++++++++++ src/Main/globals.cxx | 6 ++---- src/Main/main.cxx | 1 + src/Main/options.cxx | 9 ++++---- src/Systems/electrical.cxx | 34 ++++++++++++++---------------- src/Traffic/TrafficMgr.cxx | 14 +++---------- src/Viewer/splash.cxx | 15 +++++++------- 12 files changed, 95 insertions(+), 96 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 37d7b9766..a68e53b95 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,6 +25,13 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) "MinSizeRel" "RelWithDebInfo") endif() +if(NOT FG_BUILD_TYPE) + message(STATUS "Setting build type to 'Dev' as none was specified.") + set(FG_BUILD_TYPE Dev CACHE STRING "Choose the FlightGear build type" FORCE) + # Set the possible values of build type for cmake-gui + set_property(CACHE FG_BUILD_TYPE PROPERTY STRINGS "Dev" "Nightly" "Release") +endif() + if(APPLE) set(CMAKE_INSTALL_RPATH "@loader_path/../Frameworks") # when building, don't use the install RPATH already @@ -176,8 +183,6 @@ option(SYSTEM_SPEEX "Set to ON to build IAXClient with the system's speex a option(SYSTEM_GSM "Set to ON to build IAXClient with the system's GSM library" ${SYSTEM_GSM_DEFAULT}) option(SYSTEM_FLITE "Set to ON to build Flightgear with the system's Flite library" ${SYSTEM_FLITE_DEFAULT}) option(SYSTEM_HTS_ENGINE "Set to ON to build Flightgear with the system's HTS Engine library" ${SYSTEM_HTS_ENGINE_DEFAULT}) -option(FG_NIGHTLY "Set to ON to mark this as a nightly build" OFF) -option(ENABLE_DEV_WARNINGS "Set to ON to include developer-warnings" OFF) # additional utilities option(ENABLE_FGELEV "Set to ON to build the fgelev application (default)" ON) diff --git a/src/AIModel/submodel.cxx b/src/AIModel/submodel.cxx index 249fe1ade..ac9f82dc2 100644 --- a/src/AIModel/submodel.cxx +++ b/src/AIModel/submodel.cxx @@ -212,7 +212,7 @@ void FGSubmodelMgr::update(double dt) if (trigger && (*submodel_iterator)->count != 0) { //int id = (*submodel_iterator)->id; //const string& name = (*submodel_iterator)->name; - + SG_LOG(SG_AI, SG_DEBUG, "Submodels release: " << (*submodel_iterator)->id << " name " << (*submodel_iterator)->name @@ -345,7 +345,7 @@ void FGSubmodelMgr::transform(submodel *sm) if (sm->speed_node != 0) sm->speed = sm->speed_node->getDoubleValue(); - // set the Initial Conditions for the types of submodel parent + // set the Initial Conditions for the types of submodel parent if (_impact || _hit || _expiry) { _count++; @@ -576,11 +576,9 @@ void FGSubmodelMgr::setData(int id, const string& path, bool serviceable, const sm->pitch_offset = new FGXMLAutopilot::InputValue(*prop_root, b ? *b : n); if (b) old = true; -#if defined(ENABLE_DEV_WARNINGS) if (old) { - SG_LOG(SG_AI, SG_WARN, "Submodels: <*-offset> is deprecated. Use instead"); + SG_LOG(SG_AI, SG_DEV_WARN, "Submodels: <*-offset> is deprecated. Use instead"); } -#endif } // Randomness @@ -716,7 +714,7 @@ SGVec3d FGSubmodelMgr::getCartOffsetPos() const // And postrotate the orientation of the user model wrt the horizontal // local frame hlTrans *= SGQuatd::fromYawPitchRollDeg( - IC.azimuth, + IC.azimuth, IC.elevation, IC.roll); diff --git a/src/FDM/YASim/FGFDM.cpp b/src/FDM/YASim/FGFDM.cpp index 7d748f02f..88013299a 100644 --- a/src/FDM/YASim/FGFDM.cpp +++ b/src/FDM/YASim/FGFDM.cpp @@ -113,7 +113,7 @@ void FGFDM::iterate(float dt) _airplane.setFuel(i, LBS2KG * _tank_level_lbs[i]->getFloatValue()); } _airplane.calcFuelWeights(); - + setOutputProperties(dt); } @@ -231,11 +231,9 @@ void FGFDM::startElement(const char* name, const XMLAttributes &atts) if(a->hasAttribute("version")) { _airplane.setVersion( a->getValue("version") ); } -#if defined(ENABLE_DEV_WARNINGS) if( !_airplane.isVersionOrNewer( Version::YASIM_VERSION_CURRENT ) ) { - SG_LOG(SG_FLIGHT,SG_ALERT, "This aircraft does not use the latest yasim configuration version."); + SG_LOG(SG_FLIGHT, SG_DEV_ALERT, "This aircraft does not use the latest yasim configuration version."); } -#endif } else if(eq(name, "approach")) { float spd = attrf(a, "speed") * KTS2MPS; float alt = attrf(a, "alt", 0) * FT2M; @@ -322,7 +320,7 @@ void FGFDM::startElement(const char* name, const XMLAttributes &atts) j->setVMax(attrf(a, "exhaust-speed") * KTS2MPS); if(a->hasAttribute("spool-time")) j->setSpooling(attrf(a, "spool-time")); - + j->setPosition(v); _airplane.addThruster(j, mass, v); sprintf(buf, "/engines/engine[%d]", _nextEngine++); @@ -461,14 +459,14 @@ void FGFDM::startElement(const char* name, const XMLAttributes &atts) float cy = attrf(a, "cy", 1); float cz = attrf(a, "cz", 1); float idrag = attrf(a, "idrag", 1); - _airplane.addFuselage(v, b, attrf(a, "width"), taper, mid, + _airplane.addFuselage(v, b, attrf(a, "width"), taper, mid, cx, cy, cz, idrag); } else if(eq(name, "tank")) { v[0] = attrf(a, "x"); v[1] = attrf(a, "y"); v[2] = attrf(a, "z"); float density = 6.0; // gasoline, in lbs/gal - if(a->hasAttribute("jet")) density = 6.72; + if(a->hasAttribute("jet")) density = 6.72; density *= LBS2KG*CM2GALS; _airplane.addTank(v, attrf(a, "capacity") * LBS2KG, density); } else if(eq(name, "ballast")) { @@ -499,7 +497,7 @@ void FGFDM::startElement(const char* name, const XMLAttributes &atts) ((Rotor*)_currObj)->setcollective(attrf(a, "min"), attrf(a, "max")); } else if(eq(name, "cyclic")) { ((Rotor*)_currObj)->setcyclic(attrf(a, "ail"), attrf(a, "ele")); - */ + */ } else if(eq(name, "actionpt")) { v[0] = attrf(a, "x"); v[1] = attrf(a, "y"); @@ -527,11 +525,11 @@ void FGFDM::startElement(const char* name, const XMLAttributes &atts) opt |= a->hasAttribute("split") ? ControlMap::OPT_SPLIT : 0; opt |= a->hasAttribute("invert") ? ControlMap::OPT_INVERT : 0; opt |= a->hasAttribute("square") ? ControlMap::OPT_SQUARE : 0; - + ControlMap* cm = _airplane.getControlMap(); if(a->hasAttribute("src0")) { cm->addMapping(axis, control, _currObj, opt, - attrf(a, "src0"), attrf(a, "src1"), + attrf(a, "src0"), attrf(a, "src1"), attrf(a, "dst0"), attrf(a, "dst1")); } else { cm->addMapping(axis, control, _currObj, opt); @@ -557,7 +555,7 @@ void FGFDM::startElement(const char* name, const XMLAttributes &atts) int type = parseOutput(a->getValue("control")); int handle = cm->getOutputHandle(_currObj, type); float time = attrf(a, "transition-time", 0); - + cm->setTransitionTime(handle, time); } else { SG_LOG(SG_FLIGHT,SG_ALERT,"Unexpected tag '" @@ -718,7 +716,7 @@ void FGFDM::setOutputProperties(float dt) // cockpit code can scale them to the right values. float pnorm = j->getPerfNorm(); moveprop(node, "oilp-norm", pnorm, dt/3); // 3s seek time - moveprop(node, "oilt-norm", pnorm, dt/30); // 30s + moveprop(node, "oilt-norm", pnorm, dt/30); // 30s moveprop(node, "itt-norm", pnorm, dt/1); // 1s } } @@ -826,9 +824,9 @@ Rotor* FGFDM::parseRotor(XMLAttributes* a, const char* type) w->setTiltCenterZ(attrf(a,"tiltcenterz",0.0)); w->setDownwashFactor(attrf(a, "downwashfactor", 1)); if(attrb(a,"ccw")) - w->setCcw(1); + w->setCcw(1); if(attrb(a,"sharedflaphinge")) - w->setSharedFlapHinge(true); + w->setSharedFlapHinge(true); if(a->hasAttribute("name")) w->setName(a->getValue("name") ); @@ -847,7 +845,7 @@ Rotor* FGFDM::parseRotor(XMLAttributes* a, const char* type) w->setPowerAtPitch0(attrf(a, "poweratpitch-0", 300)); w->setPowerAtPitchB(attrf(a, "poweratpitch-b", 3000)); if(attrb(a,"notorque")) - w->setNotorque(1); + w->setNotorque(1); #define p(x) if (a->hasAttribute(#x)) w->setParameter((char *)#x,attrf(a,#x) ); #define p2(x,y) if (a->hasAttribute(y)) w->setParameter((char *)#x,attrf(a,y) ); @@ -895,7 +893,7 @@ void FGFDM::parsePistonEngine(XMLAttributes* a) eng->setDisplacement(attrf(a, "displacement") * CIN2CM); if(a->hasAttribute("compression")) - eng->setCompression(attrf(a, "compression")); + eng->setCompression(attrf(a, "compression")); if(a->hasAttribute("min-throttle")) eng->setMinThrottle(attrf(a, "min-throttle")); @@ -946,7 +944,7 @@ void FGFDM::parsePropeller(XMLAttributes* a) if(a->hasAttribute("displacement")) eng->setDisplacement(attrf(a, "displacement") * CIN2CM); if(a->hasAttribute("compression")) - eng->setCompression(attrf(a, "compression")); + eng->setCompression(attrf(a, "compression")); if(a->hasAttribute("turbo-mul")) { float mul = attrf(a, "turbo-mul"); float mp = attrf(a, "wastegate-mp", 1e6) * INHG2PA; @@ -1063,7 +1061,7 @@ int FGFDM::parseOutput(const char* name) if(eq(name, "TILTYAW")) return ControlMap::TILTYAW; if(eq(name, "ROTORGEARENGINEON")) return ControlMap::ROTORENGINEON; if(eq(name, "ROTORBRAKE")) return ControlMap::ROTORBRAKE; - if(eq(name, "ROTORENGINEMAXRELTORQUE")) + if(eq(name, "ROTORENGINEMAXRELTORQUE")) return ControlMap::ROTORENGINEMAXRELTORQUE; if(eq(name, "ROTORRELTARGET")) return ControlMap::ROTORRELTARGET; if(eq(name, "ROTORBALANCE")) return ControlMap::ROTORBALANCE; @@ -1145,7 +1143,7 @@ float FGFDM::attrf(XMLAttributes* atts, const char* attr, float def) { const char* val = atts->getValue(attr); if(val == 0) return def; - else return (float)atof(val); + else return (float)atof(val); } double FGFDM::attrd(XMLAttributes* atts, const char* attr) diff --git a/src/Include/config_cmake.h.in b/src/Include/config_cmake.h.in index 31f2cf2a1..d54cc51eb 100644 --- a/src/Include/config_cmake.h.in +++ b/src/Include/config_cmake.h.in @@ -1,7 +1,6 @@ #cmakedefine FG_NDEBUG -#cmakedefine FG_NIGHTLY #cmakedefine ENABLE_SIMD #cmakedefine ENABLE_SP_FDM @@ -52,4 +51,4 @@ #cmakedefine HAVE_QT -#cmakedefine ENABLE_DEV_WARNINGS +#define FG_BUILD_TYPE "@FG_BUILD_TYPE@" diff --git a/src/Main/bootstrap.cxx b/src/Main/bootstrap.cxx index 773705a95..9fa2b2646 100644 --- a/src/Main/bootstrap.cxx +++ b/src/Main/bootstrap.cxx @@ -238,7 +238,7 @@ int main ( int argc, char **argv ) char _hostname[256]; gethostname(_hostname, 256); hostname = _hostname; - + signal(SIGPIPE, SIG_IGN); # ifndef NDEBUG signal(SIGSEGV, segfault_handler); @@ -249,36 +249,36 @@ int main ( int argc, char **argv ) #if defined(HAVE_CRASHRPT) // Define CrashRpt configuration parameters - CR_INSTALL_INFO info; - memset(&info, 0, sizeof(CR_INSTALL_INFO)); - info.cb = sizeof(CR_INSTALL_INFO); + CR_INSTALL_INFO info; + memset(&info, 0, sizeof(CR_INSTALL_INFO)); + info.cb = sizeof(CR_INSTALL_INFO); info.pszAppName = "FlightGear"; info.pszAppVersion = FLIGHTGEAR_VERSION; info.pszEmailSubject = "FlightGear " FLIGHTGEAR_VERSION " crash report"; info.pszEmailTo = "fgcrash@goneabitbursar.com"; info.pszUrl = "http://fgfs.goneabitbursar.com/crashreporter/crashrpt.php"; - info.uPriorities[CR_HTTP] = 3; - info.uPriorities[CR_SMTP] = 2; + info.uPriorities[CR_HTTP] = 3; + info.uPriorities[CR_SMTP] = 2; info.uPriorities[CR_SMAPI] = 1; // Install all available exception handlers info.dwFlags |= CR_INST_ALL_POSSIBLE_HANDLERS; - - // Restart the app on crash - info.dwFlags |= CR_INST_SEND_QUEUED_REPORTS; + + // Restart the app on crash + info.dwFlags |= CR_INST_SEND_QUEUED_REPORTS; // automatically install handlers for all threads info.dwFlags |= CR_INST_AUTO_THREAD_HANDLERS; - // Define the Privacy Policy URL - info.pszPrivacyPolicyURL = "http://flightgear.org/crash-privacypolicy.html"; - + // Define the Privacy Policy URL + info.pszPrivacyPolicyURL = "http://flightgear.org/crash-privacypolicy.html"; + // Install crash reporting - int nResult = crInstall(&info); + int nResult = crInstall(&info); if(nResult!=0) { char buf[1024]; crGetLastErrorMsg(buf, 1024); - flightgear::modalMessageBox("CrashRpt setup failed", + flightgear::modalMessageBox("CrashRpt setup failed", "Failed to setup crash-reporting engine, check the installation is not damaged.", buf); } else { @@ -288,10 +288,8 @@ int main ( int argc, char **argv ) char buf[16]; ::snprintf(buf, 16, "%d", HUDSON_BUILD_NUMBER); crAddProperty("hudson-build-number", buf); - crAddProperty("git-revision", REVISION); -#if defined(FG_NIGHTLY) - crAddProperty("nightly-build", "true"); -#endif + crAddProperty("git-revision", REVISION); + crAddProperty("build-type", FG_BUILD_TYPE); } #endif @@ -325,7 +323,7 @@ int main ( int argc, char **argv ) fgviewerMain(argc, argv); else fgMainInit(argc, argv); - + } catch (const sg_throwable &t) { std::string info; if (std::strlen(t.getOrigin()) != 0) @@ -361,7 +359,7 @@ void fgExitCleanup() { fgOSCloseWindow(); } - + // on the common exit path globals is already deleted, and NULL, // so this only happens on error paths. delete globals; @@ -372,4 +370,3 @@ void fgExitCleanup() { simgear::shutdownLogging(); } - diff --git a/src/Main/fg_init.cxx b/src/Main/fg_init.cxx index 2ac66270d..9604aa572 100644 --- a/src/Main/fg_init.cxx +++ b/src/Main/fg_init.cxx @@ -474,6 +474,21 @@ int fgInitConfig ( int argc, char **argv, bool reinit ) options->init(argc, argv, dataPath); } + // establish default for developer-mode based upon compiled build types + bool developerMode = true; + if (!strcmp(FG_BUILD_TYPE, "Release")) { + developerMode = false; + } + + // allow command line to override + if (options->isOptionSet("developer")) { + string s = options->valueForOption("developer", "yes"); + developerMode = simgear::strutils::to_bool(s); + } + + fgSetBool("/sim/developer-mode", developerMode); + sglog().setDeveloperMode(developerMode); + // Read global defaults from $FG_ROOT/defaults SG_LOG(SG_GENERAL, SG_INFO, "Reading global defaults"); SGPath defaultsXML = globals->get_fg_root() / "defaults.xml"; diff --git a/src/Main/globals.cxx b/src/Main/globals.cxx index e4218d51b..b280ece9e 100644 --- a/src/Main/globals.cxx +++ b/src/Main/globals.cxx @@ -82,14 +82,12 @@ public: string_list aircraftDirPieces(sgPathBranchSplit(aircraftDir)); if (!aircraftDirPieces.empty() && (aircraftDirPieces.back() == pieces[1])) { // disable this warning for release builds -#if defined(ENABLE_DEV_WARNINGS) SGPath betterPath; for (unsigned int i=2; igetChild("fg-scenery", propIndex++, true); n->setStringValue(abspath.utf8Str()); n->setAttribute(SGPropertyNode::WRITE, false); - + // temporary fix so these values survive reset n->setAttribute(SGPropertyNode::PRESERVE, true); } diff --git a/src/Main/main.cxx b/src/Main/main.cxx index 4c7cbe1d4..b62d6e49f 100644 --- a/src/Main/main.cxx +++ b/src/Main/main.cxx @@ -455,6 +455,7 @@ int fgMainInit( int argc, char **argv ) std::string version(FLIGHTGEAR_VERSION); SG_LOG( SG_GENERAL, SG_INFO, "FlightGear: Version " << version ); + SG_LOG( SG_GENERAL, SG_INFO, "FlightGear: Build Type " << FG_BUILD_TYPE ); SG_LOG( SG_GENERAL, SG_INFO, "Built with " << SG_COMPILER_STR); SG_LOG( SG_GENERAL, SG_INFO, "Jenkins number/ID " << HUDSON_BUILD_NUMBER << ":" << HUDSON_BUILD_ID); diff --git a/src/Main/options.cxx b/src/Main/options.cxx index bcb5aae15..4d3b38ebb 100644 --- a/src/Main/options.cxx +++ b/src/Main/options.cxx @@ -243,11 +243,7 @@ void fgSetDefaults () v->setValueReadOnly("build-number", HUDSON_BUILD_NUMBER); v->setValueReadOnly("build-id", HUDSON_BUILD_ID); v->setValueReadOnly("hla-support", bool(FG_HAVE_HLA)); -#if defined(FG_NIGHTLY) - v->setValueReadOnly("nightly-build", true); -#else - v->setValueReadOnly("nightly-build", false); -#endif + v->setValueReadOnly("build-type", FG_BUILD_TYPE); char* envp = ::getenv( "http_proxy" ); if( envp != NULL ) @@ -1755,6 +1751,7 @@ struct OptionDesc { {"no-default-config", false, OPTION_IGNORE, "", false, "", 0}, {"prop", true, OPTION_FUNC | OPTION_MULTI, "", false, "", fgOptSetProperty}, {"load-tape", true, OPTION_FUNC, "", false, "", fgOptLoadTape }, + {"developer", true, OPTION_IGNORE | OPTION_BOOL, "", false, "", nullptr }, {0} }; @@ -2637,6 +2634,7 @@ void Options::showVersion() const cout << "FlightGear version: " << FLIGHTGEAR_VERSION << endl; cout << "Revision: " << REVISION << endl; cout << "Build-Id: " << HUDSON_BUILD_ID << endl; + cout << "Build-Type: " << FG_BUILD_TYPE << endl; cout << "FG_ROOT=" << globals->get_fg_root().utf8Str() << endl; cout << "FG_HOME=" << globals->get_fg_home().utf8Str() << endl; cout << "FG_SCENERY="; @@ -2673,6 +2671,7 @@ void Options::printJSONReport() const cJSON_AddStringToObject(generalNode, "name", "FlightGear"); cJSON_AddStringToObject(generalNode, "version", FLIGHTGEAR_VERSION); cJSON_AddStringToObject(generalNode, "build ID", HUDSON_BUILD_ID); + cJSON_AddStringToObject(generalNode, "build type", FG_BUILD_TYPE); cJSON *configNode = cJSON_CreateObject(); cJSON_AddItemToObject(rootNode, "config", configNode); diff --git a/src/Systems/electrical.cxx b/src/Systems/electrical.cxx index b83984dd6..288ef3296 100644 --- a/src/Systems/electrical.cxx +++ b/src/Systems/electrical.cxx @@ -85,7 +85,7 @@ FGElectricalSupplier::FGElectricalSupplier ( SGPropertyNode *node ) { } _rpm_node = fgGetNode( rpm_src.c_str(), true); -} +} float FGElectricalSupplier::apply_load( float amps, float dt ) { @@ -200,7 +200,7 @@ FGElectricalBus::FGElectricalBus ( SGPropertyNode *node ) { add_prop( prop ); } } -} +} FGElectricalOutput::FGElectricalOutput ( SGPropertyNode *node ) { @@ -222,7 +222,7 @@ FGElectricalOutput::FGElectricalOutput ( SGPropertyNode *node ) { add_prop( prop ); } } -} +} FGElectricalSwitch::FGElectricalSwitch( SGPropertyNode *node ) : @@ -248,7 +248,7 @@ FGElectricalSwitch::FGElectricalSwitch( SGPropertyNode *node ) : rating_amps = atof( cval.c_str() ); circuit_breaker = true; // cout << "initial state = " << initial_state << endl; - } + } } switch_node->setBoolValue( initial_state ); @@ -276,11 +276,11 @@ FGElectricalConnector::FGElectricalConnector ( SGPropertyNode *node, s->add_output( this ); } else { SG_LOG( SG_SYSTEMS, SG_ALERT, - "Attempt to connect to something that can't provide an output: " + "Attempt to connect to something that can't provide an output: " << child->getStringValue() ); } } else { - SG_LOG( SG_SYSTEMS, SG_ALERT, "Can't find named source: " + SG_LOG( SG_SYSTEMS, SG_ALERT, "Can't find named source: " << child->getStringValue() ); } } else if ( cname == "output" ) { @@ -297,11 +297,11 @@ FGElectricalConnector::FGElectricalConnector ( SGPropertyNode *node, s->add_output( this ); } else { SG_LOG( SG_SYSTEMS, SG_ALERT, - "Attempt to connect to something that can't provide an input: " + "Attempt to connect to something that can't provide an input: " << child->getStringValue() ); } } else { - SG_LOG( SG_SYSTEMS, SG_ALERT, "Can't find named source: " + SG_LOG( SG_SYSTEMS, SG_ALERT, "Can't find named source: " << child->getStringValue() ); } } else if ( cname == "switch" ) { @@ -310,7 +310,7 @@ FGElectricalConnector::FGElectricalConnector ( SGPropertyNode *node, add_switch( s ); } } -} +} // set all switches to the specified state @@ -375,12 +375,10 @@ void FGElectricalSystem::init () { if ( path.length() ) { SGPath config = globals->resolve_aircraft_path(path); -#if defined(ENABLE_DEV_WARNINGS) // load an obsolete xml configuration - SG_LOG( SG_SYSTEMS, SG_WARN, + SG_LOG( SG_SYSTEMS, SG_DEV_WARN, "Reading deprecated xml electrical system model from\n " << config.str() ); -#endif try { readProperties( config, config_props ); @@ -388,7 +386,7 @@ void FGElectricalSystem::init () { enabled = true; } else { throw sg_exception("Logic error in electrical system file."); - } + } } catch (const sg_exception&) { SG_LOG( SG_SYSTEMS, SG_ALERT, "Failed to load electrical system model: " @@ -454,7 +452,7 @@ void FGElectricalSystem::update (double dt) { SG_LOG(SG_SYSTEMS, SG_ALERT, "Error drawing more current than available!"); } - } + } } // for each "alternator" supplier, propagate the electrical @@ -474,7 +472,7 @@ void FGElectricalSystem::update (double dt) { SG_LOG(SG_SYSTEMS, SG_ALERT, "Error drawing more current than available!"); } - } + } } // for each "battery" supplier, propagate the electrical @@ -495,7 +493,7 @@ void FGElectricalSystem::update (double dt) { SG_LOG(SG_SYSTEMS, SG_ALERT, "Error drawing more current than available!"); } - } + } } float alt_norm @@ -575,7 +573,7 @@ bool FGElectricalSystem::build (SGPropertyNode* config_props) { new FGElectricalConnector( node, this ); connectors.push_back( c ); } else { - SG_LOG( SG_SYSTEMS, SG_ALERT, "Unknown component type specified: " + SG_LOG( SG_SYSTEMS, SG_ALERT, "Unknown component type specified: " << name ); return false; } @@ -591,7 +589,7 @@ float FGElectricalSystem::propagate( FGElectricalComponent *node, double dt, float input_volts, float input_amps, string s ) { s += " "; - + float total_load = 0.0; // determine the current to carry forward diff --git a/src/Traffic/TrafficMgr.cxx b/src/Traffic/TrafficMgr.cxx index 2099ca2ce..a38f58de8 100644 --- a/src/Traffic/TrafficMgr.cxx +++ b/src/Traffic/TrafficMgr.cxx @@ -321,9 +321,7 @@ private: if (!FGAISchedule::validModelPath(mdl)) { missingModels.insert(mdl); -#if defined(ENABLE_DEV_WARNINGS) - SG_LOG(SG_AI, SG_WARN, "TrafficMgr: Missing model path:" << mdl); -#endif + SG_LOG(SG_AI, SG_DEV_WARN, "TrafficMgr: Missing model path:" << mdl); requiredAircraft = homePort = ""; return; } @@ -586,17 +584,13 @@ void FGTrafficManager::finishInit() assert(doingInit); SG_LOG(SG_AI, SG_INFO, "finishing AI-Traffic init"); loadHeuristics(); -#if defined(ENABLE_DEV_WARNINGS) PerformanceDB* perfDB = globals->get_subsystem(); -#endif // Do sorting and scoring separately, to take advantage of the "homeport" variable BOOST_FOREACH(FGAISchedule* schedule, scheduledAircraft) { schedule->setScore(); -#if defined(ENABLE_DEV_WARNINGS) if (!perfDB->havePerformanceDataForAircraftType(schedule->getAircraft())) { - SG_LOG(SG_AI, SG_WARN, "AI-Traffic: schedule aircraft missing performance data:" << schedule->getAircraft()); + SG_LOG(SG_AI, SG_DEV_WARN, "AI-Traffic: schedule aircraft missing performance data:" << schedule->getAircraft()); } -#endif } sort(scheduledAircraft.begin(), scheduledAircraft.end(), @@ -641,10 +635,8 @@ void FGTrafficManager::loadHeuristics() break; HeuristicMapIterator itr = heurMap.find(h.registration); if (itr != heurMap.end()) { -#if defined(ENABLE_DEV_WARNINGS) - SG_LOG(SG_AI, SG_WARN,"Traffic Manager Warning: found duplicate tailnumber " << + SG_LOG(SG_AI, SG_DEV_WARN,"Traffic Manager Warning: found duplicate tailnumber " << h.registration << " for AI aircraft"); -#endif } else { heurMap[h.registration] = h; } diff --git a/src/Viewer/splash.cxx b/src/Viewer/splash.cxx index 4724e14f3..d69b803ee 100644 --- a/src/Viewer/splash.cxx +++ b/src/Viewer/splash.cxx @@ -176,13 +176,12 @@ void SplashScreen::createNodes() osgText::Text::RIGHT_BOTTOM, fgGetNode("/sim/startup/splash-progress-spinner", true)); - -#if defined(FG_NIGHTLY) - addText(geode, osg::Vec2(0.5, 0.5), 0.03, - "Unstable nightly build - some features may be under active development", - osgText::Text::CENTER_CENTER, - nullptr, -1.0, osg::Vec4(1.0, 0.0, 0.0, 1.0)); -#endif + if (!strcmp(FG_BUILD_TYPE, "Nightly")) { + addText(geode, osg::Vec2(0.5, 0.5), 0.03, + "Unstable nightly build - some features may be under active development", + osgText::Text::CENTER_CENTER, + nullptr, -1.0, osg::Vec4(1.0, 0.0, 0.0, 1.0)); + } /////////// @@ -349,7 +348,7 @@ void SplashScreen::addText(osg::Geode* geode , t->setBackdropType(osgText::Text::OUTLINE); t->setBackdropColor(osg::Vec4(0.2, 0.2, 0.2, 1)); t->setBackdropOffset(0.04); - + item.fractionalCharSize = size; item.fractionalPosition = pos; item.dynamicContent = dynamicValue;