diff --git a/src/AIModel/AIFlightPlan.cxx b/src/AIModel/AIFlightPlan.cxx index 0f99e7a9e..09d1eb746 100644 --- a/src/AIModel/AIFlightPlan.cxx +++ b/src/AIModel/AIFlightPlan.cxx @@ -101,7 +101,7 @@ FGAIFlightPlan::FGAIFlightPlan(const string& filename) try { readProperties(path.str(), &root); } catch (const sg_exception &) { - SG_LOG(SG_GENERAL, SG_ALERT, + SG_LOG(SG_AI, SG_ALERT, "Error reading AI flight plan: " << path.str()); // cout << path.str() << endl; return; @@ -212,7 +212,7 @@ FGAIFlightPlan::FGAIFlightPlan(FGAIAircraft *ac, } // of node loop wpt_iterator = waypoints.begin(); } catch (const sg_exception &e) { - SG_LOG(SG_GENERAL, SG_WARN, "Error reading AI flight plan: " << + SG_LOG(SG_AI, SG_WARN, "Error reading AI flight plan: " << e.getMessage() << " from " << e.getOrigin()); } } else { @@ -237,7 +237,7 @@ FGAIFlightPlan::FGAIFlightPlan(FGAIAircraft *ac, if (timeDiff >= 2000) leg = 5; */ - SG_LOG(SG_GENERAL, SG_INFO, "Route from " << dep->getId() << " to " << arr->getId() << ". Set leg to : " << leg << " " << ac->getTrafficRef()->getCallSign()); + SG_LOG(SG_AI, SG_INFO, "Route from " << dep->getId() << " to " << arr->getId() << ". Set leg to : " << leg << " " << ac->getTrafficRef()->getCallSign()); wpt_iterator = waypoints.begin(); bool dist = 0; isValid = create(ac, dep,arr, leg, alt, speed, lat, lon, diff --git a/src/AIModel/AIFlightPlanCreate.cxx b/src/AIModel/AIFlightPlanCreate.cxx index 8375c854e..b603173de 100644 --- a/src/AIModel/AIFlightPlanCreate.cxx +++ b/src/AIModel/AIFlightPlanCreate.cxx @@ -98,7 +98,7 @@ bool FGAIFlightPlan::create(FGAIAircraft * ac, FGAirport * dep, break; default: //exit(1); - SG_LOG(SG_INPUT, SG_ALERT, + SG_LOG(SG_AI, SG_ALERT, "AIFlightPlan::create() attempting to create unknown leg" " this is probably an internal program error"); } @@ -215,7 +215,7 @@ bool FGAIFlightPlan::createTakeoffTaxi(FGAIAircraft * ac, bool firstFlight, &heading, &gateId, radius, fltType, acType, airline))) { - SG_LOG(SG_INPUT, SG_WARN, "Could not find parking for a " << + SG_LOG(SG_AI, SG_WARN, "Could not find parking for a " << acType << " of flight type " << fltType << " of airline " << airline << diff --git a/src/AIModel/AIFlightPlanCreatePushBack.cxx b/src/AIModel/AIFlightPlanCreatePushBack.cxx index d5c79356e..b65333dd7 100644 --- a/src/AIModel/AIFlightPlanCreatePushBack.cxx +++ b/src/AIModel/AIFlightPlanCreatePushBack.cxx @@ -66,7 +66,7 @@ bool FGAIFlightPlan::createPushBack(FGAIAircraft *ac, &heading, &gateId, radius, fltType, aircraftType, airline))) { - SG_LOG(SG_INPUT, SG_WARN, "Warning: Could not find parking for a " << + SG_LOG(SG_AI, SG_WARN, "Warning: Could not find parking for a " << aircraftType << " of flight type " << fltType << " of airline " << airline << @@ -81,7 +81,7 @@ bool FGAIFlightPlan::createPushBack(FGAIAircraft *ac, pushBackWaypoint(wpt); } //cerr << "Success : GateId = " << gateId << endl; - SG_LOG(SG_INPUT, SG_WARN, "Warning: Succesfully found a parking for a " << + SG_LOG(SG_AI, SG_WARN, "Warning: Succesfully found a parking for a " << aircraftType << " of flight type " << fltType << " of airline " << airline << @@ -118,8 +118,8 @@ bool FGAIFlightPlan::createPushBack(FGAIAircraft *ac, pushBackRoute = parking->getPushBackRoute(); int size = pushBackRoute->size(); if (size < 2) { - SG_LOG(SG_GENERAL, SG_WARN, "Push back route from gate " << gateId << " has only " << size << " nodes."); - SG_LOG(SG_GENERAL, SG_WARN, "Using " << pushBackNode); + SG_LOG(SG_AI, SG_WARN, "Push back route from gate " << gateId << " has only " << size << " nodes."); + SG_LOG(SG_AI, SG_WARN, "Using " << pushBackNode); } pushBackRoute->first(); while (pushBackRoute->next(&node, &rte)) @@ -151,14 +151,14 @@ bool FGAIFlightPlan::createPushBack(FGAIAircraft *ac, // if the starting node equals the ending node, then there aren't any routes for this parking. // in cases like these we should flag the gate as being inoperative and return false if (ts == te) { - SG_LOG(SG_GENERAL, SG_ALERT, "Gate " << gateId << "doesn't seem to have routes associated with it."); + SG_LOG(SG_AI, SG_ALERT, "Gate " << gateId << "doesn't seem to have routes associated with it."); parking->setAvailable(false); return false; } tn = (*ts)->getEnd(); lastNodeVisited = tn->getIndex(); if (tn == NULL) { - SG_LOG(SG_GENERAL, SG_ALERT, "No valid taxinode found"); + SG_LOG(SG_AI, SG_ALERT, "No valid taxinode found"); exit(1); } double distance = (*ts)->getLength(); diff --git a/src/AIModel/AIManager.cxx b/src/AIModel/AIManager.cxx index 731983f25..d2232fc84 100644 --- a/src/AIModel/AIManager.cxx +++ b/src/AIModel/AIManager.cxx @@ -103,11 +103,11 @@ FGAIManager::postinit() { continue; if (scenarios.find(name) != scenarios.end()) { - SG_LOG(SG_GENERAL, SG_DEBUG, "won't load scenario '" << name << "' twice"); + SG_LOG(SG_AI, SG_DEBUG, "won't load scenario '" << name << "' twice"); continue; } - SG_LOG(SG_GENERAL, SG_ALERT, "loading scenario '" << name << '\''); + SG_LOG(SG_AI, SG_ALERT, "loading scenario '" << name << '\''); processScenario(name); scenarios[name] = true; } @@ -376,7 +376,7 @@ FGAIManager::loadScenarioFile(const std::string& filename) readProperties(path.str(), root); return root; } catch (const sg_exception &t) { - SG_LOG(SG_GENERAL, SG_ALERT, "Failed to load scenario '" + SG_LOG(SG_AI, SG_ALERT, "Failed to load scenario '" << path.str() << "': " << t.getFormattedMessage()); return 0; } @@ -437,7 +437,7 @@ FGAIManager::calcCollision(double alt, double lat, double lon, double fuse_range if (fabs(tgt_alt - alt) > tgt_ht[type] || type == FGAIBase::otBallistic || type == FGAIBase::otStorm || type == FGAIBase::otThermal ) { - //SG_LOG(SG_GENERAL, SG_DEBUG, "AIManager: skipping " + //SG_LOG(SG_AI, SG_DEBUG, "AIManager: skipping " // << fabs(tgt_alt - alt) // << " " // << type @@ -452,7 +452,7 @@ FGAIManager::calcCollision(double alt, double lat, double lon, double fuse_range double range = calcRange(lat, lon, tgt_lat, tgt_lon); - //SG_LOG(SG_GENERAL, SG_DEBUG, "AIManager: AI list size " + //SG_LOG(SG_AI, SG_DEBUG, "AIManager: AI list size " // << ai_list.size() // << " type " << type // << " ID " << id @@ -464,7 +464,7 @@ FGAIManager::calcCollision(double alt, double lat, double lon, double fuse_range tgt_length[type] += fuse_range; if (range < tgt_length[type]){ - SG_LOG(SG_GENERAL, SG_DEBUG, "AIManager: HIT! " + SG_LOG(SG_AI, SG_DEBUG, "AIManager: HIT! " << " type " << type << " ID " << id << " range " << range diff --git a/src/AIModel/AIManager.hxx b/src/AIModel/AIManager.hxx index 5c951912e..fad76a63d 100644 --- a/src/AIModel/AIManager.hxx +++ b/src/AIModel/AIManager.hxx @@ -54,7 +54,7 @@ public: ai_list_type ai_list; inline const ai_list_type& get_ai_list() const { - SG_LOG(SG_GENERAL, SG_DEBUG, "AI Manager: AI model return list size " << ai_list.size()); + SG_LOG(SG_AI, SG_DEBUG, "AI Manager: AI model return list size " << ai_list.size()); return ai_list; } diff --git a/src/AIModel/performancedb.cxx b/src/AIModel/performancedb.cxx index f7c286a9a..842cb9bf8 100644 --- a/src/AIModel/performancedb.cxx +++ b/src/AIModel/performancedb.cxx @@ -62,7 +62,7 @@ void PerformanceDB::load(SGPath filename) { try { readProperties(filename.str(), &root); } catch (const sg_exception &) { - SG_LOG(SG_GENERAL, SG_ALERT, + SG_LOG(SG_AI, SG_ALERT, "Error reading AI aircraft performance database: " << filename.str()); return; } diff --git a/src/AIModel/submodel.cxx b/src/AIModel/submodel.cxx index 83bb681b0..e4746bfc8 100644 --- a/src/AIModel/submodel.cxx +++ b/src/AIModel/submodel.cxx @@ -136,19 +136,19 @@ void FGSubmodelMgr::update(double dt) if ( parent_subID == 0 || id == -1) // this entry in the list has no associated submodel continue; // or is invalid so we can continue - //SG_LOG(SG_GENERAL, SG_DEBUG, "Submodel: Impact " << _impact << " hit! " + //SG_LOG(SG_AI, SG_DEBUG, "Submodel: Impact " << _impact << " hit! " // << _hit <<" parent_subID " << parent_subID); _hit = (*sm_list_itr)->_getCollisionData(); _impact = (*sm_list_itr)->_getImpactData(); _expiry = (*sm_list_itr)->_getExpiryData(); - //SG_LOG(SG_GENERAL, SG_ALERT, "Submodel: " << (*sm_list_itr)->_getName() + //SG_LOG(SG_AI, SG_ALERT, "Submodel: " << (*sm_list_itr)->_getName() // << " Impact " << _impact << " hit! " << _hit // << " exipiry :-( " << _expiry ); if (_impact || _hit || _expiry) { - // SG_LOG(SG_GENERAL, SG_ALERT, "Submodel: Impact " << _impact << " hit! " << _hit + // SG_LOG(SG_AI, SG_ALERT, "Submodel: Impact " << _impact << " hit! " << _hit //<< " exipiry :-( " << _expiry ); submodel_iterator = submodels.begin(); @@ -191,7 +191,7 @@ void FGSubmodelMgr::update(double dt) while (submodel_iterator != submodels.end()) { i++; - /*SG_LOG(SG_GENERAL, SG_DEBUG, + /*SG_LOG(SG_AI, SG_DEBUG, "Submodels: " << (*submodel_iterator)->id << " name " << (*submodel_iterator)->name );*/ @@ -210,7 +210,7 @@ void FGSubmodelMgr::update(double dt) //int id = (*submodel_iterator)->id; string name = (*submodel_iterator)->name; - SG_LOG(SG_GENERAL, SG_DEBUG, + SG_LOG(SG_AI, SG_DEBUG, "Submodels release: " << (*submodel_iterator)->id << " name " << (*submodel_iterator)->name << " count " << (*submodel_iterator)->count @@ -477,12 +477,12 @@ void FGSubmodelMgr::updatelat(double lat) void FGSubmodelMgr::loadAI() { - SG_LOG(SG_GENERAL, SG_DEBUG, "Submodels: Loading AI submodels "); + SG_LOG(SG_AI, SG_DEBUG, "Submodels: Loading AI submodels "); FGAIManager::ai_list_type sm_list(aiManager()->get_ai_list()); if (sm_list.empty()) { - SG_LOG(SG_GENERAL, SG_ALERT, "Submodels: Unable to read AI submodel list"); + SG_LOG(SG_AI, SG_ALERT, "Submodels: Unable to read AI submodel list"); return; } @@ -516,11 +516,11 @@ void FGSubmodelMgr::setData(int id, string& path, bool serviceable) SGPath config = globals->resolve_aircraft_path(path); try { - SG_LOG(SG_GENERAL, SG_DEBUG, + SG_LOG(SG_AI, SG_DEBUG, "Submodels: Trying to read AI submodels file: " << config.str()); readProperties(config.str(), &root); } catch (const sg_exception &) { - SG_LOG(SG_GENERAL, SG_ALERT, + SG_LOG(SG_AI, SG_ALERT, "Submodels: Unable to read AI submodels file: " << config.str()); return; } @@ -620,12 +620,12 @@ void FGSubmodelMgr::setSubData(int id, string& path, bool serviceable) SGPath config = globals->resolve_aircraft_path(path); try { - SG_LOG(SG_GENERAL, SG_DEBUG, + SG_LOG(SG_AI, SG_DEBUG, "Submodels: Trying to read AI submodels file: " << config.str()); readProperties(config.str(), &root); } catch (const sg_exception &) { - SG_LOG(SG_GENERAL, SG_ALERT, + SG_LOG(SG_AI, SG_ALERT, "Submodels: Unable to read AI submodels file: " << config.str()); return; } @@ -722,7 +722,7 @@ void FGSubmodelMgr::setSubData(int id, string& path, bool serviceable) void FGSubmodelMgr::loadSubmodels() { - SG_LOG(SG_GENERAL, SG_DEBUG, "Submodels: Loading sub submodels"); + SG_LOG(SG_AI, SG_DEBUG, "Submodels: Loading sub submodels"); _found_sub = false; @@ -733,7 +733,7 @@ void FGSubmodelMgr::loadSubmodels() if (!submodel.empty()) { //int id = (*submodel_iterator)->id; bool serviceable = true; - SG_LOG(SG_GENERAL, SG_DEBUG, "found path sub sub " + SG_LOG(SG_AI, SG_DEBUG, "found path sub sub " << submodel << " index " << index << " name " << (*submodel_iterator)->name); @@ -766,7 +766,7 @@ void FGSubmodelMgr::loadSubmodels() // int id = (*submodel_iterator)->id; // subcount++; - // SG_LOG(SG_GENERAL, SG_ALERT,"after pushback " + // SG_LOG(SG_AI, SG_ALERT,"after pushback " // << " parent id " << id // << " name " << (*submodel_iterator)->name // << " sub id " << (*submodel_iterator)->sub_id @@ -898,7 +898,7 @@ void FGSubmodelMgr::setParentNode(int id) { //cout << name << " IC.speed " << IC.speed << endl; } else { - SG_LOG(SG_GENERAL, SG_ALERT, "AISubmodel: parent node not found "); + SG_LOG(SG_AI, SG_ALERT, "AISubmodel: parent node not found "); } } diff --git a/src/ATC/atc_mgr.cxx b/src/ATC/atc_mgr.cxx index 0fbec1313..ea81f390f 100644 --- a/src/ATC/atc_mgr.cxx +++ b/src/ATC/atc_mgr.cxx @@ -107,7 +107,7 @@ void FGATCManager::init() { fp = new FGAIFlightPlan; while (park_index >= 0 && dcs->getParkingName(park_index) != parking) park_index--; if (park_index < 0) { - SG_LOG( SG_GENERAL, SG_ALERT, + SG_LOG( SG_ATC, SG_ALERT, "Failed to find parking position " << parking << " at airport " << airport << " at " << SG_ORIGIN); } diff --git a/src/ATC/trafficcontrol.cxx b/src/ATC/trafficcontrol.cxx index e42def60d..ee0f06a7f 100644 --- a/src/ATC/trafficcontrol.cxx +++ b/src/ATC/trafficcontrol.cxx @@ -186,7 +186,7 @@ void FGTrafficRecord::setPositionAndIntentions(int pos, if (intentions.size()) { intVecIterator i = intentions.begin(); if ((*i) != pos) { - SG_LOG(SG_GENERAL, SG_ALERT, + SG_LOG(SG_ATC, SG_ALERT, "Error in FGTrafficRecord::setPositionAndIntentions at " << SG_ORIGIN); cerr << "Pos : " << pos << " Curr " << *(intentions.begin()) << endl; for (intVecIterator i = intentions.begin(); @@ -894,7 +894,7 @@ void FGTowerController::updateAircraftInformation(int id, double lat, double lon } // // update position of the current aircraft if (i == activeTraffic.end() || (activeTraffic.size() == 0)) { - SG_LOG(SG_GENERAL, SG_ALERT, + SG_LOG(SG_ATC, SG_ALERT, "AI error: updating aircraft without traffic record at " << SG_ORIGIN); } else { i->setPositionAndHeading(lat, lon, heading, speed, alt); @@ -989,12 +989,12 @@ void FGTowerController::signOff(int id) rwy->setCleared(0); rwy->updateDepartureCue(); } else { - SG_LOG(SG_GENERAL, SG_ALERT, + SG_LOG(SG_ATC, SG_ALERT, "AI error: Attempting to erase non-existing runway clearance record in FGTowerController::signoff at " << SG_ORIGIN); } } if (i == activeTraffic.end() || (activeTraffic.size() == 0)) { - SG_LOG(SG_GENERAL, SG_ALERT, + SG_LOG(SG_ATC, SG_ALERT, "AI error: Aircraft without traffic record is signing off from tower at " << SG_ORIGIN); } else { i->getAircraft()->resetTakeOffStatus(); @@ -1024,7 +1024,7 @@ bool FGTowerController::hasInstruction(int id) } } if (i == activeTraffic.end() || (activeTraffic.size() == 0)) { - SG_LOG(SG_GENERAL, SG_ALERT, + SG_LOG(SG_ATC, SG_ALERT, "AI error: checking ATC instruction for aircraft without traffic record at " << SG_ORIGIN); } else { return i->hasInstruction(); @@ -1048,7 +1048,7 @@ FGATCInstruction FGTowerController::getInstruction(int id) } } if (i == activeTraffic.end() || (activeTraffic.size() == 0)) { - SG_LOG(SG_GENERAL, SG_ALERT, + SG_LOG(SG_ATC, SG_ALERT, "AI error: requesting ATC instruction for aircraft without traffic record at " << SG_ORIGIN); } else { return i->getInstruction(); @@ -1143,7 +1143,7 @@ bool FGStartupController::hasInstruction(int id) } } if (i == activeTraffic.end() || (activeTraffic.size() == 0)) { - SG_LOG(SG_GENERAL, SG_ALERT, + SG_LOG(SG_ATC, SG_ALERT, "AI error: checking ATC instruction for aircraft without traffic record at " << SG_ORIGIN); } else { return i->hasInstruction(); @@ -1167,7 +1167,7 @@ FGATCInstruction FGStartupController::getInstruction(int id) } } if (i == activeTraffic.end() || (activeTraffic.size() == 0)) { - SG_LOG(SG_GENERAL, SG_ALERT, + SG_LOG(SG_ATC, SG_ALERT, "AI error: requesting ATC instruction for aircraft without traffic record at " << SG_ORIGIN); } else { return i->getInstruction(); @@ -1190,7 +1190,7 @@ void FGStartupController::signOff(int id) } } if (i == activeTraffic.end() || (activeTraffic.size() == 0)) { - SG_LOG(SG_GENERAL, SG_ALERT, + SG_LOG(SG_ATC, SG_ALERT, "AI error: Aircraft without traffic record is signing off from tower at " << SG_ORIGIN); } else { //cerr << i->getAircraft()->getCallSign() << " signing off from startupcontroller" << endl; @@ -1251,7 +1251,7 @@ void FGStartupController::updateAircraftInformation(int id, double lat, double l // // update position of the current aircraft if (i == activeTraffic.end() || (activeTraffic.size() == 0)) { - SG_LOG(SG_GENERAL, SG_ALERT, + SG_LOG(SG_ATC, SG_ALERT, "AI error: updating aircraft without traffic record at " << SG_ORIGIN); } else { i->setPositionAndHeading(lat, lon, heading, speed, alt); @@ -1594,7 +1594,7 @@ void FGApproachController::updateAircraftInformation(int id, double lat, double } // // update position of the current aircraft if (i == activeTraffic.end() || (activeTraffic.size() == 0)) { - SG_LOG(SG_GENERAL, SG_ALERT, + SG_LOG(SG_ATC, SG_ALERT, "AI error: updating aircraft without traffic record at " << SG_ORIGIN); } else { i->setPositionAndHeading(lat, lon, heading, speed, alt); @@ -1642,7 +1642,7 @@ void FGApproachController::signOff(int id) } } if (i == activeTraffic.end() || (activeTraffic.size() == 0)) { - SG_LOG(SG_GENERAL, SG_ALERT, + SG_LOG(SG_ATC, SG_ALERT, "AI error: Aircraft without traffic record is signing off from approach at " << SG_ORIGIN); } else { i = activeTraffic.erase(i); @@ -1671,7 +1671,7 @@ bool FGApproachController::hasInstruction(int id) } } if (i == activeTraffic.end() || (activeTraffic.size() == 0)) { - SG_LOG(SG_GENERAL, SG_ALERT, + SG_LOG(SG_ATC, SG_ALERT, "AI error: checking ATC instruction for aircraft without traffic record at " << SG_ORIGIN); } else { return i->hasInstruction(); @@ -1695,7 +1695,7 @@ FGATCInstruction FGApproachController::getInstruction(int id) } } if (i == activeTraffic.end() || (activeTraffic.size() == 0)) { - SG_LOG(SG_GENERAL, SG_ALERT, + SG_LOG(SG_ATC, SG_ALERT, "AI error: requesting ATC instruction for aircraft without traffic record at " << SG_ORIGIN); } else { return i->getInstruction(); diff --git a/src/ATCDCL/ATC.cxx b/src/ATCDCL/ATC.cxx index 4701a67ee..776ec3441 100644 --- a/src/ATCDCL/ATC.cxx +++ b/src/ATCDCL/ATC.cxx @@ -226,7 +226,7 @@ void FGATC::Render(string& msg, const float volume, _sgr->add(simple, refname); _sgr->play(refname, repeating); } catch ( sg_io_exception &e ) { - SG_LOG(SG_GENERAL, SG_ALERT, e.getFormattedMessage()); + SG_LOG(SG_ATC, SG_ALERT, e.getFormattedMessage()); } } } @@ -300,7 +300,7 @@ std::istream& operator >> ( std::istream& fin, ATCData& a ) a.type = INVALID; return fin >> skipeol; default: - SG_LOG(SG_GENERAL, SG_ALERT, "Warning - unknown type \'" << tp << "\' found whilst reading ATC frequency data!\n"); + SG_LOG(SG_ATC, SG_ALERT, "Warning - unknown type \'" << tp << "\' found whilst reading ATC frequency data!\n"); a.type = INVALID; return fin >> skipeol; } diff --git a/src/ATCDCL/ATCmgr.cxx b/src/ATCDCL/ATCmgr.cxx index 69a0b1179..334523fd4 100644 --- a/src/ATCDCL/ATCmgr.cxx +++ b/src/ATCDCL/ATCmgr.cxx @@ -155,7 +155,7 @@ void FGATCMgr::ZapOtherService(const string ncunit, const string svc_name){ //cout << "Eradicating service: '" << svc->first << "'" << endl; svc->second->SetNoDisplay(); svc->second->Update(0); // one last update - SG_LOG(SG_GENERAL, SG_INFO, "would have erased ATC service:" << svc->second->get_name()<< "/" + SG_LOG(SG_ATC, SG_INFO, "would have erased ATC service:" << svc->second->get_name()<< "/" << svc->second->get_ident()); // delete svc->second; atc_list->erase(svc); diff --git a/src/Cockpit/panel.cxx b/src/Cockpit/panel.cxx index 6cdce3d70..3ac15621e 100644 --- a/src/Cockpit/panel.cxx +++ b/src/Cockpit/panel.cxx @@ -1176,7 +1176,7 @@ FGTextLayer::setFontName(const string &name) FGFontCache *fc = globals->get_fontcache(); fntFont* font = fc->getTexFont(_font_name.c_str()); if (!font) { - SG_LOG(SG_GENERAL, SG_WARN, "unable to find font:" << name); + SG_LOG(SG_COCKPIT, SG_WARN, "unable to find font:" << name); } } diff --git a/src/FDM/YASim/Rotor.cpp b/src/FDM/YASim/Rotor.cpp index 8c756c75b..1231cf6b8 100644 --- a/src/FDM/YASim/Rotor.cpp +++ b/src/FDM/YASim/Rotor.cpp @@ -1307,7 +1307,7 @@ void Rotor::compile() &(torque[1]),&(lift[1])); //pitch b rps[0]->calculateAlpha(v_wind,rho_null,0,0,0, &(torque[3]),&(lift[3])); //pitch 0 - SG_LOG(SG_GENERAL, SG_INFO, + SG_LOG(SG_FLIGHT, SG_INFO, "Rotor: coefficients for airfoil:" << endl << setprecision(6) << " drag0: " << _dragcoef0*_number_of_parts/_number_of_blades/_c2 << " drag1: " << _dragcoef1*_number_of_parts/_number_of_blades/_c2 diff --git a/src/FDM/YASim/YASim.cxx b/src/FDM/YASim/YASim.cxx index d20ade274..24d62735d 100644 --- a/src/FDM/YASim/YASim.cxx +++ b/src/FDM/YASim/YASim.cxx @@ -142,7 +142,7 @@ void YASim::init() try { readXML(f.str(), *_fdm); } catch (const sg_exception &e) { - SG_LOG(SG_GENERAL, SG_ALERT, + SG_LOG(SG_FLIGHT, SG_ALERT, "Error reading YASim FDM: '" << f.str() << "'" << std::endl << e.getFormattedMessage()); throw e; diff --git a/src/Input/fgjs.cxx b/src/Input/fgjs.cxx index f1930b0e3..9a873ed51 100644 --- a/src/Input/fgjs.cxx +++ b/src/Input/fgjs.cxx @@ -234,12 +234,12 @@ static string fgScanForOption( const string& option, int argc, char **argv ) { free_hostname = true; } - SG_LOG(SG_GENERAL, SG_INFO, "Scanning command line for: " << option ); + SG_LOG(SG_INPUT, SG_INFO, "Scanning command line for: " << option ); int len = option.length(); while ( i < argc ) { - SG_LOG( SG_GENERAL, SG_DEBUG, "argv[" << i << "] = " << argv[i] ); + SG_LOG( SG_INPUT, SG_DEBUG, "argv[" << i << "] = " << argv[i] ); string arg = argv[i]; if ( arg.find( option ) == 0 ) { @@ -260,7 +260,7 @@ static string fgScanForOption( const string& option, const string& path ) { return ""; } - SG_LOG( SG_GENERAL, SG_INFO, "Scanning " << path << " for: " << option ); + SG_LOG( SG_INPUT, SG_INFO, "Scanning " << path << " for: " << option ); int len = option.length(); diff --git a/src/Instrumentation/HUD/HUD.cxx b/src/Instrumentation/HUD/HUD.cxx index 8cbb2e513..762b206fc 100644 --- a/src/Instrumentation/HUD/HUD.cxx +++ b/src/Instrumentation/HUD/HUD.cxx @@ -53,8 +53,8 @@ static float clamp(float f) HUD::HUD() : - _path(fgGetNode("/sim/hud/path[1]", "Huds/default.xml")), - _current(fgGetNode("/sim/hud/current-color", true)), + _currentPath(fgGetNode("/sim/hud/current-path", true)), + _currentColor(fgGetNode("/sim/hud/current-color", true)), _visibility(fgGetNode("/sim/hud/visibility[1]", true)), _3DenabledN(fgGetNode("/sim/hud/enable3d[1]", true)), _antialiasing(fgGetNode("/sim/hud/color/antialiased", true)), @@ -85,43 +85,16 @@ HUD::HUD() : { SG_LOG(SG_COCKPIT, SG_INFO, "Initializing HUD Instrument"); - _path->addChangeListener(this); - _visibility->addChangeListener(this); - _3DenabledN->addChangeListener(this); - _antialiasing->addChangeListener(this); - _transparency->addChangeListener(this); - _red->addChangeListener(this); - _green->addChangeListener(this); - _blue->addChangeListener(this); - _alpha->addChangeListener(this); - _alpha_clamp->addChangeListener(this); - _brightness->addChangeListener(this); - _current->addChangeListener(this); - _scr_widthN->addChangeListener(this); - _scr_heightN->addChangeListener(this); - _unitsN->addChangeListener(this, true); + SGPropertyNode* hud = fgGetNode("/sim/hud"); + hud->addChangeListener(this); } HUD::~HUD() { - _path->removeChangeListener(this); - _visibility->removeChangeListener(this); - _3DenabledN->removeChangeListener(this); - _antialiasing->removeChangeListener(this); - _transparency->removeChangeListener(this); - _red->removeChangeListener(this); - _green->removeChangeListener(this); - _blue->removeChangeListener(this); - _alpha->removeChangeListener(this); - _alpha_clamp->removeChangeListener(this); - _brightness->removeChangeListener(this); - _current->removeChangeListener(this); - _scr_widthN->removeChangeListener(this); - _scr_heightN->removeChangeListener(this); - _unitsN->removeChangeListener(this); - delete _font_renderer; - + SGPropertyNode* hud = fgGetNode("/sim/hud"); + hud->removeChangeListener(this); + deinit(); } @@ -144,8 +117,7 @@ void HUD::init() _text_list.setFont(_font_renderer); currentColorChanged(); - - _path->fireValueChanged(); + _currentPath->fireValueChanged(); } void HUD::deinit() @@ -167,7 +139,7 @@ void HUD::deinit() void HUD::reinit() { deinit(); - _path->fireValueChanged(); + _currentPath->fireValueChanged(); } void HUD::update(double dt) @@ -455,9 +427,18 @@ void HUD::valueChanged(SGPropertyNode *node) if (_listener_active) return; _listener_active = true; - if (!strcmp(node->getName(), "path")) - load(fgGetString("/sim/hud/path[1]", "Huds/default.xml")); - + if (!strcmp(node->getName(), "current-path")) { + int pathIndex = _currentPath->getIntValue(); + SGPropertyNode* pathNode = fgGetNode("/sim/hud/path", pathIndex); + std::string path("Huds/default.xml"); + if (pathNode && pathNode->hasValue()) { + path = pathNode->getStringValue(); + SG_LOG(SG_INSTR, SG_INFO, "will load Hud from " << path); + } + + load(path.c_str()); + } + if (!strcmp(node->getName(), "current-color")) { currentColorChanged(); } @@ -483,7 +464,7 @@ void HUD::valueChanged(SGPropertyNode *node) void HUD::currentColorChanged() { SGPropertyNode *n = fgGetNode("/sim/hud/palette", true); - int index = _current->getIntValue(); + int index = _currentColor->getIntValue(); if (index < 0) { index = 0; } diff --git a/src/Instrumentation/HUD/HUD.hxx b/src/Instrumentation/HUD/HUD.hxx index f492b6103..f10c580f8 100644 --- a/src/Instrumentation/HUD/HUD.hxx +++ b/src/Instrumentation/HUD/HUD.hxx @@ -218,8 +218,8 @@ private: deque _items; deque _ladders; - SGPropertyNode_ptr _path; - SGPropertyNode_ptr _current; + SGPropertyNode_ptr _currentPath; + SGPropertyNode_ptr _currentColor; SGPropertyNode_ptr _visibility; SGPropertyNode_ptr _3DenabledN; SGPropertyNode_ptr _antialiasing; diff --git a/src/Instrumentation/adf.cxx b/src/Instrumentation/adf.cxx index 386f93dcb..bfde62385 100644 --- a/src/Instrumentation/adf.cxx +++ b/src/Instrumentation/adf.cxx @@ -200,7 +200,7 @@ ADF::update (double delta_time_sec) if ( sound != NULL ) sound->set_volume( volume ); else - SG_LOG( SG_GENERAL, SG_ALERT, "Can't find adf-ident sound" ); + SG_LOG( SG_INSTR, SG_ALERT, "Can't find adf-ident sound" ); } time_t cur_time = globals->get_time_params()->get_cur_time(); diff --git a/src/Instrumentation/dclgps.cxx b/src/Instrumentation/dclgps.cxx index ec78643aa..f193c5624 100644 --- a/src/Instrumentation/dclgps.cxx +++ b/src/Instrumentation/dclgps.cxx @@ -808,7 +808,7 @@ void DCLGPS::LoadApproachData() { w.lat = rwy->begin().getLatitudeRad(); w.lon = rwy->begin().getLongitudeRad(); } catch(const sg_exception&) { - SG_LOG(SG_GENERAL, SG_WARN, "Unable to find runway " << w.id.substr(2, 2) << " at airport " << iap->_aptIdent); + SG_LOG(SG_INSTR, SG_WARN, "Unable to find runway " << w.id.substr(2, 2) << " at airport " << iap->_aptIdent); //cout << "Unable to find runway " << w.id.substr(2, 2) << " at airport " << iap->_aptIdent << " ( w.id = " << w.id << ", rwystr = " << rwystr << " )\n"; wp_error = true; } diff --git a/src/Instrumentation/mrg.cxx b/src/Instrumentation/mrg.cxx index 8146cd1f9..247ffe5fe 100644 --- a/src/Instrumentation/mrg.cxx +++ b/src/Instrumentation/mrg.cxx @@ -202,7 +202,7 @@ MasterReferenceGyro::update (double dt) } else { _g_error += (max_g_error /(erect_time * 0.33)) * dt * 2; - //SG_LOG(SG_GENERAL, SG_ALERT,_num << + //SG_LOG(SG_INSTR, SG_ALERT,_num << // " g input " << _g_in_node->getDoubleValue() * gravity // <<" _erect_time " << _erect_time // << " yaw " << yaw_rate @@ -230,7 +230,7 @@ MasterReferenceGyro::update (double dt) if ( diff < -180.0 ) { diff += 360.0; } if ( diff > 180.0 ) { diff -= 360.0; } _error_out_node->setDoubleValue( diff ); - //SG_LOG(SG_GENERAL, SG_ALERT, + //SG_LOG(SG_INSTR, SG_ALERT, //"autopilot input " << bnode->getDoubleValue() //<< " output " << _error_out_node->getDoubleValue()<<); } diff --git a/src/Instrumentation/od_gauge.cxx b/src/Instrumentation/od_gauge.cxx index 707030ef6..349d7fdbf 100644 --- a/src/Instrumentation/od_gauge.cxx +++ b/src/Instrumentation/od_gauge.cxx @@ -97,10 +97,10 @@ void FGODGauge::allocRT () { // rt->Reset("rgba ctt"); // if( rt->Initialize(256, 256, true) ) { -// SG_LOG(SG_ALL, SG_INFO, "FGODGauge:Initialize sucessfull"); +// SG_LOG(SG_INSTR, SG_INFO, "FGODGauge:Initialize sucessfull"); // if (rt->BeginCapture()) // { -// SG_LOG(SG_ALL, SG_INFO, "FGODGauge:BeginCapture sucessfull, RTT available"); +// SG_LOG(SG_INSTR, SG_INFO, "FGODGauge:BeginCapture sucessfull, RTT available"); // rtAvailable = true; // glViewport(0, 0, textureWH, textureWH); // glMatrixMode(GL_PROJECTION); @@ -124,9 +124,9 @@ void FGODGauge::allocRT () { // glBlendFunc( GL_ONE, GL_ONE_MINUS_SRC_ALPHA ); // rt->EndCapture(); // } else -// SG_LOG(SG_ALL, SG_WARN, "FGODGauge:BeginCapture failed, RTT not available, using backbuffer"); +// SG_LOG(SG_INSTR, SG_WARN, "FGODGauge:BeginCapture failed, RTT not available, using backbuffer"); // } else -// SG_LOG(SG_ALL, SG_WARN, "FGODGauge:Initialize failed, RTT not available, using backbuffer"); +// SG_LOG(SG_INSTR, SG_WARN, "FGODGauge:Initialize failed, RTT not available, using backbuffer"); } FGODGauge::~FGODGauge() { diff --git a/src/Instrumentation/rnav_waypt_controller.cxx b/src/Instrumentation/rnav_waypt_controller.cxx index e728b88d2..e0f30e92a 100644 --- a/src/Instrumentation/rnav_waypt_controller.cxx +++ b/src/Instrumentation/rnav_waypt_controller.cxx @@ -86,12 +86,12 @@ bool geocRadialIntersection(const SGGeoc& a, double r1, const SGGeoc& b, double double ang2 = SGMiscd::normalizeAngle2(crs21-crs23); if ((sin(ang1) == 0.0) && (sin(ang2) == 0.0)) { - SG_LOG(SG_GENERAL, SG_WARN, "geocRadialIntersection: infinity of intersections"); + SG_LOG(SG_INSTR, SG_WARN, "geocRadialIntersection: infinity of intersections"); return false; } if ((sin(ang1)*sin(ang2))<0.0) { - SG_LOG(SG_GENERAL, SG_WARN, "geocRadialIntersection: intersection ambiguous"); + SG_LOG(SG_INSTR, SG_WARN, "geocRadialIntersection: intersection ambiguous"); return false; } @@ -320,21 +320,21 @@ public: case RESTRICT_AT: { double d = curAlt - _waypt->altitudeFt(); if (fabs(d) < 50.0) { - SG_LOG(SG_GENERAL, SG_INFO, "ConstHdgToAltCtl, reached target altitude " << _waypt->altitudeFt()); + SG_LOG(SG_INSTR, SG_INFO, "ConstHdgToAltCtl, reached target altitude " << _waypt->altitudeFt()); setDone(); } } break; case RESTRICT_ABOVE: if (curAlt >= _waypt->altitudeFt()) { - SG_LOG(SG_GENERAL, SG_INFO, "ConstHdgToAltCtl, above target altitude " << _waypt->altitudeFt()); + SG_LOG(SG_INSTR, SG_INFO, "ConstHdgToAltCtl, above target altitude " << _waypt->altitudeFt()); setDone(); } break; case RESTRICT_BELOW: if (curAlt <= _waypt->altitudeFt()) { - SG_LOG(SG_GENERAL, SG_INFO, "ConstHdgToAltCtl, below target altitude " << _waypt->altitudeFt()); + SG_LOG(SG_INSTR, SG_INFO, "ConstHdgToAltCtl, below target altitude " << _waypt->altitudeFt()); setDone(); } break; @@ -395,7 +395,7 @@ public: double r = SGGeodesy::courseDeg(_waypt->position(), _rnav->position()); SG_LOG(SG_AUTOPILOT, SG_INFO, "current radial=" << r); if (fabs(r - _trueRadial) < 0.5) { - SG_LOG(SG_GENERAL, SG_INFO, "InterceptCtl, intercepted radial " << _trueRadial); + SG_LOG(SG_INSTR, SG_INFO, "InterceptCtl, intercepted radial " << _trueRadial); setDone(); } } @@ -440,7 +440,7 @@ public: _distanceNm = SGGeodesy::distanceNm(_rnav->position(), _dme->position()); double d = fabs(_distanceNm - _dme->dmeDistanceNm()); if (d < 0.1) { - SG_LOG(SG_GENERAL, SG_INFO, "DMEInterceptCtl, intercepted DME " << _dme->dmeDistanceNm()); + SG_LOG(SG_INSTR, SG_INFO, "DMEInterceptCtl, intercepted DME " << _dme->dmeDistanceNm()); setDone(); } } diff --git a/src/Instrumentation/wxradar.cxx b/src/Instrumentation/wxradar.cxx index d167f78d5..885754ea2 100644 --- a/src/Instrumentation/wxradar.cxx +++ b/src/Instrumentation/wxradar.cxx @@ -356,7 +356,7 @@ wxRadarBg::update (double delta_time_sec) _radar_centre_node->setBoolValue(false); } - //SG_LOG(SG_GENERAL, SG_DEBUG, "Radar: displacement " + //SG_LOG(SG_INSTR, SG_DEBUG, "Radar: displacement " // << _x_offset <<", "<<_y_offset // << " user_speed_east_fps * SG_FPS_TO_KT " // << user_speed_east_fps * SG_FPS_TO_KT @@ -538,7 +538,7 @@ wxRadarBg::update_weather() * wxRotate(angle) * _centerTrans); addQuad(_vertices, _texCoords, m, texBase); - //SG_LOG(SG_GENERAL, SG_DEBUG, "Radar: drawing clouds" + //SG_LOG(SG_INSTR, SG_DEBUG, "Radar: drawing clouds" // << " ID=" << cloudId // << " x=" << x // << " y="<< y @@ -917,7 +917,7 @@ wxRadarBg::update_tacan() * wxRotate(angle) * _centerTrans); addQuad(_vertices, _texCoords, m, texBase); - //SG_LOG(SG_GENERAL, SG_DEBUG, "Radar: drawing TACAN" + //SG_LOG(SG_INSTR, SG_DEBUG, "Radar: drawing TACAN" // << " dist=" << radius // << " view_heading=" << _view_heading * SG_RADIANS_TO_DEGREES // << " bearing=" << angle * SG_RADIANS_TO_DEGREES @@ -940,7 +940,7 @@ wxRadarBg::update_heading_marker() m *= _centerTrans; addQuad(_vertices, _texCoords, m, texBase); - //SG_LOG(SG_GENERAL, SG_DEBUG, "Radar: drawing heading marker" + //SG_LOG(SG_INSTR, SG_DEBUG, "Radar: drawing heading marker" // << " x,y " << x <<","<< y // << " dist" << dist // << " view_heading" << _view_heading * SG_RADIANS_TO_DEGREES @@ -989,7 +989,7 @@ wxRadarBg::withinRadarHorizon(double user_alt, double alt, double range_nm) alt = 0; // to allow some vertical extent of target double radarhorizon = 1.23 * (sqrt(alt) + sqrt(user_alt)); -// SG_LOG(SG_GENERAL, SG_ALERT, "Radar: radar horizon " << radarhorizon); +// SG_LOG(SG_INSTR, SG_ALERT, "Radar: radar horizon " << radarhorizon); return radarhorizon >= range_nm; } @@ -1017,7 +1017,7 @@ wxRadarBg::inRadarRange(double sigma, double range_nm) constant = 35; double maxrange = constant * pow(sigma, 0.25); - //SG_LOG(SG_GENERAL, SG_DEBUG, "Radar: max range " << maxrange); + //SG_LOG(SG_INSTR, SG_DEBUG, "Radar: max range " << maxrange); return maxrange >= range_nm; } diff --git a/src/Main/fg_props.cxx b/src/Main/fg_props.cxx index 103fafecd..c12026434 100644 --- a/src/Main/fg_props.cxx +++ b/src/Main/fg_props.cxx @@ -127,7 +127,7 @@ addLoggingClass (const string &name) /** * Set the logging classes. */ -static void +void setLoggingClasses (const char * c) { string classes = c; @@ -147,12 +147,16 @@ setLoggingClasses (const char * c) string rest = classes; string name = ""; - int sep = rest.find('|'); - while (sep > 0) { + string::size_type sep = rest.find('|'); + if (sep == string::npos) + sep = rest.find(','); + while (sep != string::npos) { name = rest.substr(0, sep); rest = rest.substr(sep+1); addLoggingClass(name); sep = rest.find('|'); + if (sep == string::npos) + sep = rest.find(','); } addLoggingClass(rest); SG_LOG(SG_GENERAL, SG_INFO, "Set logging classes to " @@ -188,7 +192,7 @@ getLoggingPriority () /** * Set the logging priority. */ -static void +void setLoggingPriority (const char * p) { if (p == 0) diff --git a/src/Main/fg_props.hxx b/src/Main/fg_props.hxx index d4d7ef1c8..756ac763b 100644 --- a/src/Main/fg_props.hxx +++ b/src/Main/fg_props.hxx @@ -70,6 +70,8 @@ extern bool fgLoadFlight (std::istream &input); extern bool fgLoadProps (const char * path, SGPropertyNode * props, bool in_fg_root = true, int default_mode = 0); +void setLoggingClasses (const char * c); +void setLoggingPriority (const char * p); //////////////////////////////////////////////////////////////////////// diff --git a/src/Main/options.cxx b/src/Main/options.cxx index 00624af53..d71766671 100644 --- a/src/Main/options.cxx +++ b/src/Main/options.cxx @@ -900,29 +900,20 @@ fgOptTraceRead( const char *arg ) static int fgOptLogLevel( const char *arg ) { - fgSetString("/sim/logging/classes", "all"); fgSetString("/sim/logging/priority", arg); - - string priority = arg; - logbuf::set_log_classes(SG_ALL); - if (priority == "bulk") { - logbuf::set_log_priority(SG_BULK); - } else if (priority == "debug") { - logbuf::set_log_priority(SG_DEBUG); - } else if (priority == "info") { - logbuf::set_log_priority(SG_INFO); - } else if (priority == "warn") { - logbuf::set_log_priority(SG_WARN); - } else if (priority == "alert") { - logbuf::set_log_priority(SG_ALERT); - } else { - SG_LOG(SG_GENERAL, SG_WARN, "Unknown logging priority " << priority); - } - SG_LOG(SG_GENERAL, SG_DEBUG, "Logging priority is " << priority); + setLoggingPriority(arg); return FG_OPTIONS_OK; } +static int +fgOptLogClasses( const char *arg ) +{ + fgSetString("/sim/logging/classes", arg); + setLoggingClasses (arg); + + return FG_OPTIONS_OK; +} static int fgOptTraceWrite( const char *arg ) @@ -1466,7 +1457,7 @@ struct OptionDesc { {"hud-tris", false, OPTION_STRING, "/sim/hud/frame-stat-type", false, "tris", 0 }, {"hud-culled", false, OPTION_STRING, "/sim/hud/frame-stat-type", false, "culled", 0 }, {"atcsim", true, OPTION_CHANNEL, "", false, "dummy", 0 }, - {"atlas", true, OPTION_CHANNEL, "", false, "", 0 }, + {"atlas", true, OPTION_CHANNEL | OPTION_MULTI, "", false, "", 0 }, {"httpd", true, OPTION_CHANNEL, "", false, "", 0 }, #ifdef FG_JPEG_SERVER {"jpg-httpd", true, OPTION_CHANNEL, "", false, "", 0 }, @@ -1499,6 +1490,7 @@ struct OptionDesc { {"trace-read", true, OPTION_FUNC | OPTION_MULTI, "", false, "", fgOptTraceRead }, {"trace-write", true, OPTION_FUNC | OPTION_MULTI, "", false, "", fgOptTraceWrite }, {"log-level", true, OPTION_FUNC, "", false, "", fgOptLogLevel }, + {"log-class", true, OPTION_FUNC, "", false, "", fgOptLogClasses }, {"view-offset", true, OPTION_FUNC | OPTION_MULTI, "", false, "", fgOptViewOffset }, {"visibility", true, OPTION_FUNC, "", false, "", fgOptVisibilityMeters }, {"visibility-miles", true, OPTION_FUNC, "", false, "", fgOptVisibilityMiles }, diff --git a/src/Model/acmodel.cxx b/src/Model/acmodel.cxx index 3b0658b0a..f17459e8a 100644 --- a/src/Model/acmodel.cxx +++ b/src/Model/acmodel.cxx @@ -67,9 +67,9 @@ FGAircraftModel::init () osg::Node *model = fgLoad3DModelPanel( path, globals->get_props()); _aircraft->init( model ); } catch (const sg_exception &ex) { - SG_LOG(SG_GENERAL, SG_ALERT, "Failed to load aircraft from " << path << ':'); - SG_LOG(SG_GENERAL, SG_ALERT, " " << ex.getFormattedMessage()); - SG_LOG(SG_GENERAL, SG_ALERT, "(Falling back to glider.ac.)"); + SG_LOG(SG_AIRCRAFT, SG_ALERT, "Failed to load aircraft from " << path << ':'); + SG_LOG(SG_AIRCRAFT, SG_ALERT, " " << ex.getFormattedMessage()); + SG_LOG(SG_AIRCRAFT, SG_ALERT, "(Falling back to glider.ac.)"); osg::Node *model = fgLoad3DModelPanel( "Models/Geometry/glider.ac", globals->get_props()); _aircraft->init( model ); diff --git a/src/Model/modelmgr.cxx b/src/Model/modelmgr.cxx index 139cf2d4f..142d7af40 100644 --- a/src/Model/modelmgr.cxx +++ b/src/Model/modelmgr.cxx @@ -68,7 +68,7 @@ FGModelMgr::init () void FGModelMgr::add_model (SGPropertyNode * node) { - SG_LOG(SG_GENERAL, SG_INFO, + SG_LOG(SG_AIRCRAFT, SG_INFO, "Adding model " << node->getStringValue("name", "[unnamed]")); const char *path = node->getStringValue("path", "Models/Geometry/glider.ac"); @@ -77,7 +77,7 @@ FGModelMgr::add_model (SGPropertyNode * node) try { object = SGModelLib::loadDeferredModel(path, globals->get_props()); } catch (const sg_throwable& t) { - SG_LOG(SG_GENERAL, SG_ALERT, "Error loading " << path << ":\n " + SG_LOG(SG_AIRCRAFT, SG_ALERT, "Error loading " << path << ":\n " << t.getFormattedMessage() << t.getOrigin()); return; } @@ -181,7 +181,7 @@ struct UpdateFunctor : public std::unary_function } catch (const sg_range_exception&) { const char *path = instance->node->getStringValue("path", "unknown"); - SG_LOG(SG_GENERAL, SG_INFO, "Instance of model " << path + SG_LOG(SG_AIRCRAFT, SG_INFO, "Instance of model " << path << " has invalid values"); return; } diff --git a/src/Network/ATC-Main.cxx b/src/Network/ATC-Main.cxx index 546f03ebe..b3cefd228 100644 --- a/src/Network/ATC-Main.cxx +++ b/src/Network/ATC-Main.cxx @@ -98,7 +98,7 @@ void FGATCMain::init_config() { SGPath atcsim_config( envp ); atcsim_config.append( ".fgfs-atc610x.xml" ); try { - SG_LOG(SG_GENERAL, SG_ALERT, + SG_LOG(SG_NETWORK, SG_ALERT, "Warning: loading deprecated config file: " << atcsim_config.str() ); readProperties( atcsim_config.str(), globals->get_props() ); @@ -224,7 +224,7 @@ bool FGATCMain::process() { FGNasalSys *n = (FGNasalSys*)globals->get_subsystem("nasal"); bool result = n->parseAndRun( "atcsim.update()" ); if ( !result ) { - SG_LOG( SG_GENERAL, SG_ALERT, "Nasal: atcsim.update() failed!" ); + SG_LOG( SG_NETWORK, SG_ALERT, "Nasal: atcsim.update() failed!" ); } // process the ATC outputs diff --git a/src/Network/generic.cxx b/src/Network/generic.cxx index eb0bd63ba..8a3aa440f 100644 --- a/src/Network/generic.cxx +++ b/src/Network/generic.cxx @@ -55,7 +55,7 @@ FGGeneric::FGGeneric(vector tokens) : exitOnError(false) } if (configToken >= tokens.size()) { - SG_LOG(SG_GENERAL, SG_ALERT, + SG_LOG(SG_NETWORK, SG_ALERT, "Not enough tokens passed for generic protocol"); return; } @@ -65,7 +65,7 @@ FGGeneric::FGGeneric(vector tokens) : exitOnError(false) direction = tokens[2]; if (direction != "in" && direction != "out" && direction != "bi") { - SG_LOG(SG_GENERAL, SG_ALERT, "Unsuported protocol direction: " + SG_LOG(SG_NETWORK, SG_ALERT, "Unsuported protocol direction: " << direction); } @@ -543,14 +543,14 @@ FGGeneric::reinit() path.append("Protocol"); path.append(file_name.c_str()); - SG_LOG(SG_GENERAL, SG_INFO, "Reading communication protocol from " + SG_LOG(SG_NETWORK, SG_INFO, "Reading communication protocol from " << path.str()); SGPropertyNode root; try { readProperties(path.str(), &root); } catch (const sg_exception & ex) { - SG_LOG(SG_GENERAL, SG_ALERT, + SG_LOG(SG_NETWORK, SG_ALERT, "Unable to load the protocol configuration file: " << ex.getFormattedMessage() ); return; } diff --git a/src/Network/httpd.cxx b/src/Network/httpd.cxx index 31d4b9337..f301f552d 100644 --- a/src/Network/httpd.cxx +++ b/src/Network/httpd.cxx @@ -147,7 +147,7 @@ void HttpdChannel::foundTerminator (void) { if ( !globals->get_commands() ->execute(urlDecode(b).c_str(), &args) ) { - SG_LOG( SG_GENERAL, SG_ALERT, + SG_LOG( SG_NETWORK, SG_ALERT, "Command " << urlDecode(b) << " failed."); } diff --git a/src/Network/net_gui.hxx b/src/Network/net_gui.hxx index 1025d6acc..d33391823 100644 --- a/src/Network/net_gui.hxx +++ b/src/Network/net_gui.hxx @@ -20,7 +20,7 @@ // and 8 bytes for double. -const uint32_t FG_NET_GUI_VERSION = 7; +const uint32_t FG_NET_GUI_VERSION = 8; // Define a structure containing the top level flight dynamics model @@ -36,23 +36,33 @@ public: FG_MAX_TANKS = 4 }; - uint32_t version; // increment when data values change +// Note: align fields properly and manually to avoid incompatibilities +// between 32bit and 64bit CPUs. Make sure that each field is already +// placed on an offset which is a multiple of the size of its data +// type, i.e. uint32/float need to have on offset of 4, doubles need +// an offset of 8. This guarantees that compilers will _not_ add +// CPU-specific padding bytes. Whenever in doubt about padding rules, +// check "data structure alignment" in Wikipedia/Google :). - // Positions - double longitude; // geodetic (radians) - double latitude; // geodetic (radians) - float altitude; // above sea level (meters) - float agl; // above ground level (meters) - float phi; // roll (radians) - float theta; // pitch (radians) - float psi; // yaw or true heading (radians) + uint32_t version; // increment when data values change + uint32_t padding1; // 4 padding bytes, so the next (64bit) var is aligned to 8 + + // Positions (note: offset for these doubles is already aligned to 8 - to avoid architecture specific alignments) + double longitude; // geodetic (radians) + double latitude; // geodetic (radians) + + float altitude; // above sea level (meters) + float agl; // above ground level (meters) + float phi; // roll (radians) + float theta; // pitch (radians) + float psi; // yaw or true heading (radians) // Velocities float vcas; - float climb_rate; // feet per second + float climb_rate; // feet per second // Consumables - uint32_t num_tanks; // Max number of fuel tanks + uint32_t num_tanks; // Max number of fuel tanks float fuel_quantity[FG_MAX_TANKS]; // Environment diff --git a/src/Network/props.cxx b/src/Network/props.cxx index ac1b6ee97..7240d5cb2 100644 --- a/src/Network/props.cxx +++ b/src/Network/props.cxx @@ -292,7 +292,7 @@ PropsChannel::foundTerminator() if ( !globals->get_commands() ->execute( "reinit", &args) ) { - SG_LOG( SG_GENERAL, SG_ALERT, + SG_LOG( SG_NETWORK, SG_ALERT, "Command " << tokens[1] << " failed."); if ( mode == PROMPT ) { tmp += "*failed*"; @@ -357,7 +357,7 @@ PropsChannel::foundTerminator() if ( !globals->get_commands() ->execute(tokens[1].c_str(), &args) ) { - SG_LOG( SG_GENERAL, SG_ALERT, + SG_LOG( SG_NETWORK, SG_ALERT, "Command " << tokens[1] << " failed."); if ( mode == PROMPT ) { tmp += "*failed*"; diff --git a/src/Scripting/NasalSys.cxx b/src/Scripting/NasalSys.cxx index 0134dcb26..777d1eede 100644 --- a/src/Scripting/NasalSys.cxx +++ b/src/Scripting/NasalSys.cxx @@ -215,7 +215,7 @@ static naRef f_getprop(naContext c, naRef me, int argc, naRef* args) { double dv = p->getDoubleValue(); if (osg::isNaN(dv)) { - SG_LOG(SG_GENERAL, SG_ALERT, "Nasal getprop: property " << p->getPath() << " is NaN"); + SG_LOG(SG_NASAL, SG_ALERT, "Nasal getprop: property " << p->getPath() << " is NaN"); return naNil(); } @@ -294,7 +294,7 @@ static naRef f_print(naContext c, naRef me, int argc, naRef* args) if(naIsNil(s)) continue; buf += naStr_data(s); } - SG_LOG(SG_GENERAL, SG_ALERT, buf); + SG_LOG(SG_NASAL, SG_ALERT, buf); return naNum(buf.length()); } diff --git a/src/Scripting/nasal-props.cxx b/src/Scripting/nasal-props.cxx index 15a3016f3..0233b69dd 100644 --- a/src/Scripting/nasal-props.cxx +++ b/src/Scripting/nasal-props.cxx @@ -174,7 +174,7 @@ static naRef f_getValue(naContext c, naRef me, int argc, naRef* args) { double dv = (*node)->getDoubleValue(); if (osg::isNaN(dv)) { - SG_LOG(SG_GENERAL, SG_ALERT, "Nasal getValue: property " << (*node)->getPath() << " is NaN"); + SG_LOG(SG_NASAL, SG_ALERT, "Nasal getValue: property " << (*node)->getPath() << " is NaN"); return naNil(); } diff --git a/src/Sound/fg_fx.cxx b/src/Sound/fg_fx.cxx index 390609567..94b7f6b98 100644 --- a/src/Sound/fg_fx.cxx +++ b/src/Sound/fg_fx.cxx @@ -94,6 +94,12 @@ FGFX::init() } SGPath path = globals->resolve_aircraft_path(path_str); + if (path.isNull()) + { + SG_LOG(SG_SOUND, SG_ALERT, + "File not found: '" << path_str); + return; + } SG_LOG(SG_SOUND, SG_INFO, "Reading sound " << node->getName() << " from " << path.str());