1
0
Fork 0

Merge branch 'next' into attenuation

This commit is contained in:
adrian 2011-12-11 19:06:24 +02:00
commit 3f3755fda2
36 changed files with 170 additions and 175 deletions

View file

@ -101,7 +101,7 @@ FGAIFlightPlan::FGAIFlightPlan(const string& filename)
try { try {
readProperties(path.str(), &root); readProperties(path.str(), &root);
} catch (const sg_exception &) { } catch (const sg_exception &) {
SG_LOG(SG_GENERAL, SG_ALERT, SG_LOG(SG_AI, SG_ALERT,
"Error reading AI flight plan: " << path.str()); "Error reading AI flight plan: " << path.str());
// cout << path.str() << endl; // cout << path.str() << endl;
return; return;
@ -212,7 +212,7 @@ FGAIFlightPlan::FGAIFlightPlan(FGAIAircraft *ac,
} // of node loop } // of node loop
wpt_iterator = waypoints.begin(); wpt_iterator = waypoints.begin();
} catch (const sg_exception &e) { } 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()); e.getMessage() << " from " << e.getOrigin());
} }
} else { } else {
@ -237,7 +237,7 @@ FGAIFlightPlan::FGAIFlightPlan(FGAIAircraft *ac,
if (timeDiff >= 2000) if (timeDiff >= 2000)
leg = 5; 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(); wpt_iterator = waypoints.begin();
bool dist = 0; bool dist = 0;
isValid = create(ac, dep,arr, leg, alt, speed, lat, lon, isValid = create(ac, dep,arr, leg, alt, speed, lat, lon,

View file

@ -98,7 +98,7 @@ bool FGAIFlightPlan::create(FGAIAircraft * ac, FGAirport * dep,
break; break;
default: default:
//exit(1); //exit(1);
SG_LOG(SG_INPUT, SG_ALERT, SG_LOG(SG_AI, SG_ALERT,
"AIFlightPlan::create() attempting to create unknown leg" "AIFlightPlan::create() attempting to create unknown leg"
" this is probably an internal program error"); " this is probably an internal program error");
} }
@ -215,7 +215,7 @@ bool FGAIFlightPlan::createTakeoffTaxi(FGAIAircraft * ac, bool firstFlight,
&heading, &gateId, &heading, &gateId,
radius, fltType, radius, fltType,
acType, airline))) { 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 << acType <<
" of flight type " << fltType << " of flight type " << fltType <<
" of airline " << airline << " of airline " << airline <<

View file

@ -66,7 +66,7 @@ bool FGAIFlightPlan::createPushBack(FGAIAircraft *ac,
&heading, &gateId, &heading, &gateId,
radius, fltType, radius, fltType,
aircraftType, airline))) { 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 << aircraftType <<
" of flight type " << fltType << " of flight type " << fltType <<
" of airline " << airline << " of airline " << airline <<
@ -81,7 +81,7 @@ bool FGAIFlightPlan::createPushBack(FGAIAircraft *ac,
pushBackWaypoint(wpt); pushBackWaypoint(wpt);
} }
//cerr << "Success : GateId = " << gateId << endl; //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 << aircraftType <<
" of flight type " << fltType << " of flight type " << fltType <<
" of airline " << airline << " of airline " << airline <<
@ -118,8 +118,8 @@ bool FGAIFlightPlan::createPushBack(FGAIAircraft *ac,
pushBackRoute = parking->getPushBackRoute(); pushBackRoute = parking->getPushBackRoute();
int size = pushBackRoute->size(); int size = pushBackRoute->size();
if (size < 2) { if (size < 2) {
SG_LOG(SG_GENERAL, SG_WARN, "Push back route from gate " << gateId << " has only " << size << " nodes."); SG_LOG(SG_AI, 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, "Using " << pushBackNode);
} }
pushBackRoute->first(); pushBackRoute->first();
while (pushBackRoute->next(&node, &rte)) 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. // 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 // in cases like these we should flag the gate as being inoperative and return false
if (ts == te) { 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); parking->setAvailable(false);
return false; return false;
} }
tn = (*ts)->getEnd(); tn = (*ts)->getEnd();
lastNodeVisited = tn->getIndex(); lastNodeVisited = tn->getIndex();
if (tn == NULL) { 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); exit(1);
} }
double distance = (*ts)->getLength(); double distance = (*ts)->getLength();

View file

@ -103,11 +103,11 @@ FGAIManager::postinit() {
continue; continue;
if (scenarios.find(name) != scenarios.end()) { 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; continue;
} }
SG_LOG(SG_GENERAL, SG_ALERT, "loading scenario '" << name << '\''); SG_LOG(SG_AI, SG_ALERT, "loading scenario '" << name << '\'');
processScenario(name); processScenario(name);
scenarios[name] = true; scenarios[name] = true;
} }
@ -376,7 +376,7 @@ FGAIManager::loadScenarioFile(const std::string& filename)
readProperties(path.str(), root); readProperties(path.str(), root);
return root; return root;
} catch (const sg_exception &t) { } 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()); << path.str() << "': " << t.getFormattedMessage());
return 0; 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 if (fabs(tgt_alt - alt) > tgt_ht[type] || type == FGAIBase::otBallistic
|| type == FGAIBase::otStorm || type == FGAIBase::otThermal ) { || 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) // << fabs(tgt_alt - alt)
// << " " // << " "
// << type // << 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); 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() // << ai_list.size()
// << " type " << type // << " type " << type
// << " ID " << id // << " ID " << id
@ -464,7 +464,7 @@ FGAIManager::calcCollision(double alt, double lat, double lon, double fuse_range
tgt_length[type] += fuse_range; tgt_length[type] += fuse_range;
if (range < tgt_length[type]){ if (range < tgt_length[type]){
SG_LOG(SG_GENERAL, SG_DEBUG, "AIManager: HIT! " SG_LOG(SG_AI, SG_DEBUG, "AIManager: HIT! "
<< " type " << type << " type " << type
<< " ID " << id << " ID " << id
<< " range " << range << " range " << range

View file

@ -54,7 +54,7 @@ public:
ai_list_type ai_list; ai_list_type ai_list;
inline const ai_list_type& get_ai_list() const { 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; return ai_list;
} }

View file

@ -62,7 +62,7 @@ void PerformanceDB::load(SGPath filename) {
try { try {
readProperties(filename.str(), &root); readProperties(filename.str(), &root);
} catch (const sg_exception &) { } catch (const sg_exception &) {
SG_LOG(SG_GENERAL, SG_ALERT, SG_LOG(SG_AI, SG_ALERT,
"Error reading AI aircraft performance database: " << filename.str()); "Error reading AI aircraft performance database: " << filename.str());
return; return;
} }

View file

@ -136,19 +136,19 @@ void FGSubmodelMgr::update(double dt)
if ( parent_subID == 0 || id == -1) // this entry in the list has no associated submodel if ( parent_subID == 0 || id == -1) // this entry in the list has no associated submodel
continue; // or is invalid so we can continue 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 <<" parent_subID " << parent_subID);
_hit = (*sm_list_itr)->_getCollisionData(); _hit = (*sm_list_itr)->_getCollisionData();
_impact = (*sm_list_itr)->_getImpactData(); _impact = (*sm_list_itr)->_getImpactData();
_expiry = (*sm_list_itr)->_getExpiryData(); _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 // << " Impact " << _impact << " hit! " << _hit
// << " exipiry :-( " << _expiry ); // << " exipiry :-( " << _expiry );
if (_impact || _hit || _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 ); //<< " exipiry :-( " << _expiry );
submodel_iterator = submodels.begin(); submodel_iterator = submodels.begin();
@ -191,7 +191,7 @@ void FGSubmodelMgr::update(double dt)
while (submodel_iterator != submodels.end()) { while (submodel_iterator != submodels.end()) {
i++; i++;
/*SG_LOG(SG_GENERAL, SG_DEBUG, /*SG_LOG(SG_AI, SG_DEBUG,
"Submodels: " << (*submodel_iterator)->id "Submodels: " << (*submodel_iterator)->id
<< " name " << (*submodel_iterator)->name << " name " << (*submodel_iterator)->name
);*/ );*/
@ -210,7 +210,7 @@ void FGSubmodelMgr::update(double dt)
//int id = (*submodel_iterator)->id; //int id = (*submodel_iterator)->id;
string name = (*submodel_iterator)->name; string name = (*submodel_iterator)->name;
SG_LOG(SG_GENERAL, SG_DEBUG, SG_LOG(SG_AI, SG_DEBUG,
"Submodels release: " << (*submodel_iterator)->id "Submodels release: " << (*submodel_iterator)->id
<< " name " << (*submodel_iterator)->name << " name " << (*submodel_iterator)->name
<< " count " << (*submodel_iterator)->count << " count " << (*submodel_iterator)->count
@ -477,12 +477,12 @@ void FGSubmodelMgr::updatelat(double lat)
void FGSubmodelMgr::loadAI() 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()); FGAIManager::ai_list_type sm_list(aiManager()->get_ai_list());
if (sm_list.empty()) { 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; return;
} }
@ -516,11 +516,11 @@ void FGSubmodelMgr::setData(int id, string& path, bool serviceable)
SGPath config = globals->resolve_aircraft_path(path); SGPath config = globals->resolve_aircraft_path(path);
try { try {
SG_LOG(SG_GENERAL, SG_DEBUG, SG_LOG(SG_AI, SG_DEBUG,
"Submodels: Trying to read AI submodels file: " << config.str()); "Submodels: Trying to read AI submodels file: " << config.str());
readProperties(config.str(), &root); readProperties(config.str(), &root);
} catch (const sg_exception &) { } 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()); "Submodels: Unable to read AI submodels file: " << config.str());
return; return;
} }
@ -620,12 +620,12 @@ void FGSubmodelMgr::setSubData(int id, string& path, bool serviceable)
SGPath config = globals->resolve_aircraft_path(path); SGPath config = globals->resolve_aircraft_path(path);
try { try {
SG_LOG(SG_GENERAL, SG_DEBUG, SG_LOG(SG_AI, SG_DEBUG,
"Submodels: Trying to read AI submodels file: " << config.str()); "Submodels: Trying to read AI submodels file: " << config.str());
readProperties(config.str(), &root); readProperties(config.str(), &root);
} catch (const sg_exception &) { } 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()); "Submodels: Unable to read AI submodels file: " << config.str());
return; return;
} }
@ -722,7 +722,7 @@ void FGSubmodelMgr::setSubData(int id, string& path, bool serviceable)
void FGSubmodelMgr::loadSubmodels() 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; _found_sub = false;
@ -733,7 +733,7 @@ void FGSubmodelMgr::loadSubmodels()
if (!submodel.empty()) { if (!submodel.empty()) {
//int id = (*submodel_iterator)->id; //int id = (*submodel_iterator)->id;
bool serviceable = true; bool serviceable = true;
SG_LOG(SG_GENERAL, SG_DEBUG, "found path sub sub " SG_LOG(SG_AI, SG_DEBUG, "found path sub sub "
<< submodel << submodel
<< " index " << index << " index " << index
<< " name " << (*submodel_iterator)->name); << " name " << (*submodel_iterator)->name);
@ -766,7 +766,7 @@ void FGSubmodelMgr::loadSubmodels()
// int id = (*submodel_iterator)->id; // int id = (*submodel_iterator)->id;
// subcount++; // subcount++;
// SG_LOG(SG_GENERAL, SG_ALERT,"after pushback " // SG_LOG(SG_AI, SG_ALERT,"after pushback "
// << " parent id " << id // << " parent id " << id
// << " name " << (*submodel_iterator)->name // << " name " << (*submodel_iterator)->name
// << " sub id " << (*submodel_iterator)->sub_id // << " sub id " << (*submodel_iterator)->sub_id
@ -898,7 +898,7 @@ void FGSubmodelMgr::setParentNode(int id) {
//cout << name << " IC.speed " << IC.speed << endl; //cout << name << " IC.speed " << IC.speed << endl;
} else { } else {
SG_LOG(SG_GENERAL, SG_ALERT, "AISubmodel: parent node not found "); SG_LOG(SG_AI, SG_ALERT, "AISubmodel: parent node not found ");
} }
} }

View file

@ -107,7 +107,7 @@ void FGATCManager::init() {
fp = new FGAIFlightPlan; fp = new FGAIFlightPlan;
while (park_index >= 0 && dcs->getParkingName(park_index) != parking) park_index--; while (park_index >= 0 && dcs->getParkingName(park_index) != parking) park_index--;
if (park_index < 0) { if (park_index < 0) {
SG_LOG( SG_GENERAL, SG_ALERT, SG_LOG( SG_ATC, SG_ALERT,
"Failed to find parking position " << parking << "Failed to find parking position " << parking <<
" at airport " << airport << " at " << SG_ORIGIN); " at airport " << airport << " at " << SG_ORIGIN);
} }

View file

@ -186,7 +186,7 @@ void FGTrafficRecord::setPositionAndIntentions(int pos,
if (intentions.size()) { if (intentions.size()) {
intVecIterator i = intentions.begin(); intVecIterator i = intentions.begin();
if ((*i) != pos) { if ((*i) != pos) {
SG_LOG(SG_GENERAL, SG_ALERT, SG_LOG(SG_ATC, SG_ALERT,
"Error in FGTrafficRecord::setPositionAndIntentions at " << SG_ORIGIN); "Error in FGTrafficRecord::setPositionAndIntentions at " << SG_ORIGIN);
cerr << "Pos : " << pos << " Curr " << *(intentions.begin()) << endl; cerr << "Pos : " << pos << " Curr " << *(intentions.begin()) << endl;
for (intVecIterator i = intentions.begin(); for (intVecIterator i = intentions.begin();
@ -894,7 +894,7 @@ void FGTowerController::updateAircraftInformation(int id, double lat, double lon
} }
// // update position of the current aircraft // // update position of the current aircraft
if (i == activeTraffic.end() || (activeTraffic.size() == 0)) { 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); "AI error: updating aircraft without traffic record at " << SG_ORIGIN);
} else { } else {
i->setPositionAndHeading(lat, lon, heading, speed, alt); i->setPositionAndHeading(lat, lon, heading, speed, alt);
@ -989,12 +989,12 @@ void FGTowerController::signOff(int id)
rwy->setCleared(0); rwy->setCleared(0);
rwy->updateDepartureCue(); rwy->updateDepartureCue();
} else { } 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); "AI error: Attempting to erase non-existing runway clearance record in FGTowerController::signoff at " << SG_ORIGIN);
} }
} }
if (i == activeTraffic.end() || (activeTraffic.size() == 0)) { 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); "AI error: Aircraft without traffic record is signing off from tower at " << SG_ORIGIN);
} else { } else {
i->getAircraft()->resetTakeOffStatus(); i->getAircraft()->resetTakeOffStatus();
@ -1024,7 +1024,7 @@ bool FGTowerController::hasInstruction(int id)
} }
} }
if (i == activeTraffic.end() || (activeTraffic.size() == 0)) { 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); "AI error: checking ATC instruction for aircraft without traffic record at " << SG_ORIGIN);
} else { } else {
return i->hasInstruction(); return i->hasInstruction();
@ -1048,7 +1048,7 @@ FGATCInstruction FGTowerController::getInstruction(int id)
} }
} }
if (i == activeTraffic.end() || (activeTraffic.size() == 0)) { 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); "AI error: requesting ATC instruction for aircraft without traffic record at " << SG_ORIGIN);
} else { } else {
return i->getInstruction(); return i->getInstruction();
@ -1143,7 +1143,7 @@ bool FGStartupController::hasInstruction(int id)
} }
} }
if (i == activeTraffic.end() || (activeTraffic.size() == 0)) { 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); "AI error: checking ATC instruction for aircraft without traffic record at " << SG_ORIGIN);
} else { } else {
return i->hasInstruction(); return i->hasInstruction();
@ -1167,7 +1167,7 @@ FGATCInstruction FGStartupController::getInstruction(int id)
} }
} }
if (i == activeTraffic.end() || (activeTraffic.size() == 0)) { 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); "AI error: requesting ATC instruction for aircraft without traffic record at " << SG_ORIGIN);
} else { } else {
return i->getInstruction(); return i->getInstruction();
@ -1190,7 +1190,7 @@ void FGStartupController::signOff(int id)
} }
} }
if (i == activeTraffic.end() || (activeTraffic.size() == 0)) { 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); "AI error: Aircraft without traffic record is signing off from tower at " << SG_ORIGIN);
} else { } else {
//cerr << i->getAircraft()->getCallSign() << " signing off from startupcontroller" << endl; //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 // // update position of the current aircraft
if (i == activeTraffic.end() || (activeTraffic.size() == 0)) { 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); "AI error: updating aircraft without traffic record at " << SG_ORIGIN);
} else { } else {
i->setPositionAndHeading(lat, lon, heading, speed, alt); 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 // // update position of the current aircraft
if (i == activeTraffic.end() || (activeTraffic.size() == 0)) { 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); "AI error: updating aircraft without traffic record at " << SG_ORIGIN);
} else { } else {
i->setPositionAndHeading(lat, lon, heading, speed, alt); i->setPositionAndHeading(lat, lon, heading, speed, alt);
@ -1642,7 +1642,7 @@ void FGApproachController::signOff(int id)
} }
} }
if (i == activeTraffic.end() || (activeTraffic.size() == 0)) { 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); "AI error: Aircraft without traffic record is signing off from approach at " << SG_ORIGIN);
} else { } else {
i = activeTraffic.erase(i); i = activeTraffic.erase(i);
@ -1671,7 +1671,7 @@ bool FGApproachController::hasInstruction(int id)
} }
} }
if (i == activeTraffic.end() || (activeTraffic.size() == 0)) { 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); "AI error: checking ATC instruction for aircraft without traffic record at " << SG_ORIGIN);
} else { } else {
return i->hasInstruction(); return i->hasInstruction();
@ -1695,7 +1695,7 @@ FGATCInstruction FGApproachController::getInstruction(int id)
} }
} }
if (i == activeTraffic.end() || (activeTraffic.size() == 0)) { 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); "AI error: requesting ATC instruction for aircraft without traffic record at " << SG_ORIGIN);
} else { } else {
return i->getInstruction(); return i->getInstruction();

View file

@ -226,7 +226,7 @@ void FGATC::Render(string& msg, const float volume,
_sgr->add(simple, refname); _sgr->add(simple, refname);
_sgr->play(refname, repeating); _sgr->play(refname, repeating);
} catch ( sg_io_exception &e ) { } 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; a.type = INVALID;
return fin >> skipeol; return fin >> skipeol;
default: 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; a.type = INVALID;
return fin >> skipeol; return fin >> skipeol;
} }

View file

@ -155,7 +155,7 @@ void FGATCMgr::ZapOtherService(const string ncunit, const string svc_name){
//cout << "Eradicating service: '" << svc->first << "'" << endl; //cout << "Eradicating service: '" << svc->first << "'" << endl;
svc->second->SetNoDisplay(); svc->second->SetNoDisplay();
svc->second->Update(0); // one last update 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()); << svc->second->get_ident());
// delete svc->second; // delete svc->second;
atc_list->erase(svc); atc_list->erase(svc);

View file

@ -1176,7 +1176,7 @@ FGTextLayer::setFontName(const string &name)
FGFontCache *fc = globals->get_fontcache(); FGFontCache *fc = globals->get_fontcache();
fntFont* font = fc->getTexFont(_font_name.c_str()); fntFont* font = fc->getTexFont(_font_name.c_str());
if (!font) { if (!font) {
SG_LOG(SG_GENERAL, SG_WARN, "unable to find font:" << name); SG_LOG(SG_COCKPIT, SG_WARN, "unable to find font:" << name);
} }
} }

View file

@ -1307,7 +1307,7 @@ void Rotor::compile()
&(torque[1]),&(lift[1])); //pitch b &(torque[1]),&(lift[1])); //pitch b
rps[0]->calculateAlpha(v_wind,rho_null,0,0,0, rps[0]->calculateAlpha(v_wind,rho_null,0,0,0,
&(torque[3]),&(lift[3])); //pitch 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) "Rotor: coefficients for airfoil:" << endl << setprecision(6)
<< " drag0: " << _dragcoef0*_number_of_parts/_number_of_blades/_c2 << " drag0: " << _dragcoef0*_number_of_parts/_number_of_blades/_c2
<< " drag1: " << _dragcoef1*_number_of_parts/_number_of_blades/_c2 << " drag1: " << _dragcoef1*_number_of_parts/_number_of_blades/_c2

View file

@ -142,7 +142,7 @@ void YASim::init()
try { try {
readXML(f.str(), *_fdm); readXML(f.str(), *_fdm);
} catch (const sg_exception &e) { } 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 "Error reading YASim FDM: '" << f.str() << "'" << std::endl
<< e.getFormattedMessage()); << e.getFormattedMessage());
throw e; throw e;

View file

@ -234,12 +234,12 @@ static string fgScanForOption( const string& option, int argc, char **argv ) {
free_hostname = true; 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(); int len = option.length();
while ( i < argc ) { 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]; string arg = argv[i];
if ( arg.find( option ) == 0 ) { if ( arg.find( option ) == 0 ) {
@ -260,7 +260,7 @@ static string fgScanForOption( const string& option, const string& path ) {
return ""; 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(); int len = option.length();

View file

@ -53,8 +53,8 @@ static float clamp(float f)
HUD::HUD() : HUD::HUD() :
_path(fgGetNode("/sim/hud/path[1]", "Huds/default.xml")), _currentPath(fgGetNode("/sim/hud/current-path", true)),
_current(fgGetNode("/sim/hud/current-color", true)), _currentColor(fgGetNode("/sim/hud/current-color", true)),
_visibility(fgGetNode("/sim/hud/visibility[1]", true)), _visibility(fgGetNode("/sim/hud/visibility[1]", true)),
_3DenabledN(fgGetNode("/sim/hud/enable3d[1]", true)), _3DenabledN(fgGetNode("/sim/hud/enable3d[1]", true)),
_antialiasing(fgGetNode("/sim/hud/color/antialiased", true)), _antialiasing(fgGetNode("/sim/hud/color/antialiased", true)),
@ -85,42 +85,15 @@ HUD::HUD() :
{ {
SG_LOG(SG_COCKPIT, SG_INFO, "Initializing HUD Instrument"); SG_LOG(SG_COCKPIT, SG_INFO, "Initializing HUD Instrument");
_path->addChangeListener(this); SGPropertyNode* hud = fgGetNode("/sim/hud");
_visibility->addChangeListener(this); hud->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);
} }
HUD::~HUD() HUD::~HUD()
{ {
_path->removeChangeListener(this); SGPropertyNode* hud = fgGetNode("/sim/hud");
_visibility->removeChangeListener(this); hud->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;
deinit(); deinit();
} }
@ -144,8 +117,7 @@ void HUD::init()
_text_list.setFont(_font_renderer); _text_list.setFont(_font_renderer);
currentColorChanged(); currentColorChanged();
_currentPath->fireValueChanged();
_path->fireValueChanged();
} }
void HUD::deinit() void HUD::deinit()
@ -167,7 +139,7 @@ void HUD::deinit()
void HUD::reinit() void HUD::reinit()
{ {
deinit(); deinit();
_path->fireValueChanged(); _currentPath->fireValueChanged();
} }
void HUD::update(double dt) void HUD::update(double dt)
@ -455,8 +427,17 @@ void HUD::valueChanged(SGPropertyNode *node)
if (_listener_active) if (_listener_active)
return; return;
_listener_active = true; _listener_active = true;
if (!strcmp(node->getName(), "path")) if (!strcmp(node->getName(), "current-path")) {
load(fgGetString("/sim/hud/path[1]", "Huds/default.xml")); 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")) { if (!strcmp(node->getName(), "current-color")) {
currentColorChanged(); currentColorChanged();
@ -483,7 +464,7 @@ void HUD::valueChanged(SGPropertyNode *node)
void HUD::currentColorChanged() void HUD::currentColorChanged()
{ {
SGPropertyNode *n = fgGetNode("/sim/hud/palette", true); SGPropertyNode *n = fgGetNode("/sim/hud/palette", true);
int index = _current->getIntValue(); int index = _currentColor->getIntValue();
if (index < 0) { if (index < 0) {
index = 0; index = 0;
} }

View file

@ -218,8 +218,8 @@ private:
deque<Item *> _items; deque<Item *> _items;
deque<Item *> _ladders; deque<Item *> _ladders;
SGPropertyNode_ptr _path; SGPropertyNode_ptr _currentPath;
SGPropertyNode_ptr _current; SGPropertyNode_ptr _currentColor;
SGPropertyNode_ptr _visibility; SGPropertyNode_ptr _visibility;
SGPropertyNode_ptr _3DenabledN; SGPropertyNode_ptr _3DenabledN;
SGPropertyNode_ptr _antialiasing; SGPropertyNode_ptr _antialiasing;

View file

@ -200,7 +200,7 @@ ADF::update (double delta_time_sec)
if ( sound != NULL ) if ( sound != NULL )
sound->set_volume( volume ); sound->set_volume( volume );
else 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(); time_t cur_time = globals->get_time_params()->get_cur_time();

View file

@ -808,7 +808,7 @@ void DCLGPS::LoadApproachData() {
w.lat = rwy->begin().getLatitudeRad(); w.lat = rwy->begin().getLatitudeRad();
w.lon = rwy->begin().getLongitudeRad(); w.lon = rwy->begin().getLongitudeRad();
} catch(const sg_exception&) { } 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"; //cout << "Unable to find runway " << w.id.substr(2, 2) << " at airport " << iap->_aptIdent << " ( w.id = " << w.id << ", rwystr = " << rwystr << " )\n";
wp_error = true; wp_error = true;
} }

View file

@ -202,7 +202,7 @@ MasterReferenceGyro::update (double dt)
} else { } else {
_g_error += (max_g_error /(erect_time * 0.33)) * dt * 2; _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 // " g input " << _g_in_node->getDoubleValue() * gravity
// <<" _erect_time " << _erect_time // <<" _erect_time " << _erect_time
// << " yaw " << yaw_rate // << " 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; }
if ( diff > 180.0 ) { diff -= 360.0; } if ( diff > 180.0 ) { diff -= 360.0; }
_error_out_node->setDoubleValue( diff ); _error_out_node->setDoubleValue( diff );
//SG_LOG(SG_GENERAL, SG_ALERT, //SG_LOG(SG_INSTR, SG_ALERT,
//"autopilot input " << bnode->getDoubleValue() //"autopilot input " << bnode->getDoubleValue()
//<< " output " << _error_out_node->getDoubleValue()<<); //<< " output " << _error_out_node->getDoubleValue()<<);
} }

View file

@ -97,10 +97,10 @@ void FGODGauge::allocRT () {
// rt->Reset("rgba ctt"); // rt->Reset("rgba ctt");
// if( rt->Initialize(256, 256, true) ) { // 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()) // 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; // rtAvailable = true;
// glViewport(0, 0, textureWH, textureWH); // glViewport(0, 0, textureWH, textureWH);
// glMatrixMode(GL_PROJECTION); // glMatrixMode(GL_PROJECTION);
@ -124,9 +124,9 @@ void FGODGauge::allocRT () {
// glBlendFunc( GL_ONE, GL_ONE_MINUS_SRC_ALPHA ); // glBlendFunc( GL_ONE, GL_ONE_MINUS_SRC_ALPHA );
// rt->EndCapture(); // rt->EndCapture();
// } else // } 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 // } 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() { FGODGauge::~FGODGauge() {

View file

@ -86,12 +86,12 @@ bool geocRadialIntersection(const SGGeoc& a, double r1, const SGGeoc& b, double
double ang2 = SGMiscd::normalizeAngle2(crs21-crs23); double ang2 = SGMiscd::normalizeAngle2(crs21-crs23);
if ((sin(ang1) == 0.0) && (sin(ang2) == 0.0)) { 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; return false;
} }
if ((sin(ang1)*sin(ang2))<0.0) { 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; return false;
} }
@ -320,21 +320,21 @@ public:
case RESTRICT_AT: { case RESTRICT_AT: {
double d = curAlt - _waypt->altitudeFt(); double d = curAlt - _waypt->altitudeFt();
if (fabs(d) < 50.0) { 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(); setDone();
} }
} break; } break;
case RESTRICT_ABOVE: case RESTRICT_ABOVE:
if (curAlt >= _waypt->altitudeFt()) { 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(); setDone();
} }
break; break;
case RESTRICT_BELOW: case RESTRICT_BELOW:
if (curAlt <= _waypt->altitudeFt()) { 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(); setDone();
} }
break; break;
@ -395,7 +395,7 @@ public:
double r = SGGeodesy::courseDeg(_waypt->position(), _rnav->position()); double r = SGGeodesy::courseDeg(_waypt->position(), _rnav->position());
SG_LOG(SG_AUTOPILOT, SG_INFO, "current radial=" << r); SG_LOG(SG_AUTOPILOT, SG_INFO, "current radial=" << r);
if (fabs(r - _trueRadial) < 0.5) { 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(); setDone();
} }
} }
@ -440,7 +440,7 @@ public:
_distanceNm = SGGeodesy::distanceNm(_rnav->position(), _dme->position()); _distanceNm = SGGeodesy::distanceNm(_rnav->position(), _dme->position());
double d = fabs(_distanceNm - _dme->dmeDistanceNm()); double d = fabs(_distanceNm - _dme->dmeDistanceNm());
if (d < 0.1) { 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(); setDone();
} }
} }

View file

@ -356,7 +356,7 @@ wxRadarBg::update (double delta_time_sec)
_radar_centre_node->setBoolValue(false); _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 // << _x_offset <<", "<<_y_offset
// << " user_speed_east_fps * SG_FPS_TO_KT " // << " user_speed_east_fps * SG_FPS_TO_KT "
// << 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); * wxRotate(angle) * _centerTrans);
addQuad(_vertices, _texCoords, m, texBase); 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 // << " ID=" << cloudId
// << " x=" << x // << " x=" << x
// << " y="<< y // << " y="<< y
@ -917,7 +917,7 @@ wxRadarBg::update_tacan()
* wxRotate(angle) * _centerTrans); * wxRotate(angle) * _centerTrans);
addQuad(_vertices, _texCoords, m, texBase); 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 // << " dist=" << radius
// << " view_heading=" << _view_heading * SG_RADIANS_TO_DEGREES // << " view_heading=" << _view_heading * SG_RADIANS_TO_DEGREES
// << " bearing=" << angle * SG_RADIANS_TO_DEGREES // << " bearing=" << angle * SG_RADIANS_TO_DEGREES
@ -940,7 +940,7 @@ wxRadarBg::update_heading_marker()
m *= _centerTrans; m *= _centerTrans;
addQuad(_vertices, _texCoords, m, texBase); 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 // << " x,y " << x <<","<< y
// << " dist" << dist // << " dist" << dist
// << " view_heading" << _view_heading * SG_RADIANS_TO_DEGREES // << " 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 alt = 0; // to allow some vertical extent of target
double radarhorizon = 1.23 * (sqrt(alt) + sqrt(user_alt)); 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; return radarhorizon >= range_nm;
} }
@ -1017,7 +1017,7 @@ wxRadarBg::inRadarRange(double sigma, double range_nm)
constant = 35; constant = 35;
double maxrange = constant * pow(sigma, 0.25); 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; return maxrange >= range_nm;
} }

View file

@ -127,7 +127,7 @@ addLoggingClass (const string &name)
/** /**
* Set the logging classes. * Set the logging classes.
*/ */
static void void
setLoggingClasses (const char * c) setLoggingClasses (const char * c)
{ {
string classes = c; string classes = c;
@ -147,12 +147,16 @@ setLoggingClasses (const char * c)
string rest = classes; string rest = classes;
string name = ""; string name = "";
int sep = rest.find('|'); string::size_type sep = rest.find('|');
while (sep > 0) { if (sep == string::npos)
sep = rest.find(',');
while (sep != string::npos) {
name = rest.substr(0, sep); name = rest.substr(0, sep);
rest = rest.substr(sep+1); rest = rest.substr(sep+1);
addLoggingClass(name); addLoggingClass(name);
sep = rest.find('|'); sep = rest.find('|');
if (sep == string::npos)
sep = rest.find(',');
} }
addLoggingClass(rest); addLoggingClass(rest);
SG_LOG(SG_GENERAL, SG_INFO, "Set logging classes to " SG_LOG(SG_GENERAL, SG_INFO, "Set logging classes to "
@ -188,7 +192,7 @@ getLoggingPriority ()
/** /**
* Set the logging priority. * Set the logging priority.
*/ */
static void void
setLoggingPriority (const char * p) setLoggingPriority (const char * p)
{ {
if (p == 0) if (p == 0)

View file

@ -70,6 +70,8 @@ extern bool fgLoadFlight (std::istream &input);
extern bool fgLoadProps (const char * path, SGPropertyNode * props, extern bool fgLoadProps (const char * path, SGPropertyNode * props,
bool in_fg_root = true, int default_mode = 0); bool in_fg_root = true, int default_mode = 0);
void setLoggingClasses (const char * c);
void setLoggingPriority (const char * p);
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////

View file

@ -900,29 +900,20 @@ fgOptTraceRead( const char *arg )
static int static int
fgOptLogLevel( const char *arg ) fgOptLogLevel( const char *arg )
{ {
fgSetString("/sim/logging/classes", "all");
fgSetString("/sim/logging/priority", arg); fgSetString("/sim/logging/priority", arg);
setLoggingPriority(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);
return FG_OPTIONS_OK; return FG_OPTIONS_OK;
} }
static int
fgOptLogClasses( const char *arg )
{
fgSetString("/sim/logging/classes", arg);
setLoggingClasses (arg);
return FG_OPTIONS_OK;
}
static int static int
fgOptTraceWrite( const char *arg ) fgOptTraceWrite( const char *arg )
@ -1466,7 +1457,7 @@ struct OptionDesc {
{"hud-tris", false, OPTION_STRING, "/sim/hud/frame-stat-type", false, "tris", 0 }, {"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 }, {"hud-culled", false, OPTION_STRING, "/sim/hud/frame-stat-type", false, "culled", 0 },
{"atcsim", true, OPTION_CHANNEL, "", false, "dummy", 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 }, {"httpd", true, OPTION_CHANNEL, "", false, "", 0 },
#ifdef FG_JPEG_SERVER #ifdef FG_JPEG_SERVER
{"jpg-httpd", true, OPTION_CHANNEL, "", false, "", 0 }, {"jpg-httpd", true, OPTION_CHANNEL, "", false, "", 0 },
@ -1499,6 +1490,7 @@ struct OptionDesc {
{"trace-read", true, OPTION_FUNC | OPTION_MULTI, "", false, "", fgOptTraceRead }, {"trace-read", true, OPTION_FUNC | OPTION_MULTI, "", false, "", fgOptTraceRead },
{"trace-write", true, OPTION_FUNC | OPTION_MULTI, "", false, "", fgOptTraceWrite }, {"trace-write", true, OPTION_FUNC | OPTION_MULTI, "", false, "", fgOptTraceWrite },
{"log-level", true, OPTION_FUNC, "", false, "", fgOptLogLevel }, {"log-level", true, OPTION_FUNC, "", false, "", fgOptLogLevel },
{"log-class", true, OPTION_FUNC, "", false, "", fgOptLogClasses },
{"view-offset", true, OPTION_FUNC | OPTION_MULTI, "", false, "", fgOptViewOffset }, {"view-offset", true, OPTION_FUNC | OPTION_MULTI, "", false, "", fgOptViewOffset },
{"visibility", true, OPTION_FUNC, "", false, "", fgOptVisibilityMeters }, {"visibility", true, OPTION_FUNC, "", false, "", fgOptVisibilityMeters },
{"visibility-miles", true, OPTION_FUNC, "", false, "", fgOptVisibilityMiles }, {"visibility-miles", true, OPTION_FUNC, "", false, "", fgOptVisibilityMiles },

View file

@ -67,9 +67,9 @@ FGAircraftModel::init ()
osg::Node *model = fgLoad3DModelPanel( path, globals->get_props()); osg::Node *model = fgLoad3DModelPanel( path, globals->get_props());
_aircraft->init( model ); _aircraft->init( model );
} catch (const sg_exception &ex) { } catch (const sg_exception &ex) {
SG_LOG(SG_GENERAL, SG_ALERT, "Failed to load aircraft from " << path << ':'); SG_LOG(SG_AIRCRAFT, SG_ALERT, "Failed to load aircraft from " << path << ':');
SG_LOG(SG_GENERAL, SG_ALERT, " " << ex.getFormattedMessage()); SG_LOG(SG_AIRCRAFT, SG_ALERT, " " << ex.getFormattedMessage());
SG_LOG(SG_GENERAL, SG_ALERT, "(Falling back to glider.ac.)"); SG_LOG(SG_AIRCRAFT, SG_ALERT, "(Falling back to glider.ac.)");
osg::Node *model = fgLoad3DModelPanel( "Models/Geometry/glider.ac", osg::Node *model = fgLoad3DModelPanel( "Models/Geometry/glider.ac",
globals->get_props()); globals->get_props());
_aircraft->init( model ); _aircraft->init( model );

View file

@ -68,7 +68,7 @@ FGModelMgr::init ()
void void
FGModelMgr::add_model (SGPropertyNode * node) FGModelMgr::add_model (SGPropertyNode * node)
{ {
SG_LOG(SG_GENERAL, SG_INFO, SG_LOG(SG_AIRCRAFT, SG_INFO,
"Adding model " << node->getStringValue("name", "[unnamed]")); "Adding model " << node->getStringValue("name", "[unnamed]"));
const char *path = node->getStringValue("path", "Models/Geometry/glider.ac"); const char *path = node->getStringValue("path", "Models/Geometry/glider.ac");
@ -77,7 +77,7 @@ FGModelMgr::add_model (SGPropertyNode * node)
try { try {
object = SGModelLib::loadDeferredModel(path, globals->get_props()); object = SGModelLib::loadDeferredModel(path, globals->get_props());
} catch (const sg_throwable& t) { } 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()); << t.getFormattedMessage() << t.getOrigin());
return; return;
} }
@ -181,7 +181,7 @@ struct UpdateFunctor : public std::unary_function<FGModelMgr::Instance*, void>
} catch (const sg_range_exception&) { } catch (const sg_range_exception&) {
const char *path = instance->node->getStringValue("path", const char *path = instance->node->getStringValue("path",
"unknown"); "unknown");
SG_LOG(SG_GENERAL, SG_INFO, "Instance of model " << path SG_LOG(SG_AIRCRAFT, SG_INFO, "Instance of model " << path
<< " has invalid values"); << " has invalid values");
return; return;
} }

View file

@ -98,7 +98,7 @@ void FGATCMain::init_config() {
SGPath atcsim_config( envp ); SGPath atcsim_config( envp );
atcsim_config.append( ".fgfs-atc610x.xml" ); atcsim_config.append( ".fgfs-atc610x.xml" );
try { try {
SG_LOG(SG_GENERAL, SG_ALERT, SG_LOG(SG_NETWORK, SG_ALERT,
"Warning: loading deprecated config file: " << "Warning: loading deprecated config file: " <<
atcsim_config.str() ); atcsim_config.str() );
readProperties( atcsim_config.str(), globals->get_props() ); readProperties( atcsim_config.str(), globals->get_props() );
@ -224,7 +224,7 @@ bool FGATCMain::process() {
FGNasalSys *n = (FGNasalSys*)globals->get_subsystem("nasal"); FGNasalSys *n = (FGNasalSys*)globals->get_subsystem("nasal");
bool result = n->parseAndRun( "atcsim.update()" ); bool result = n->parseAndRun( "atcsim.update()" );
if ( !result ) { 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 // process the ATC outputs

View file

@ -55,7 +55,7 @@ FGGeneric::FGGeneric(vector<string> tokens) : exitOnError(false)
} }
if (configToken >= tokens.size()) { if (configToken >= tokens.size()) {
SG_LOG(SG_GENERAL, SG_ALERT, SG_LOG(SG_NETWORK, SG_ALERT,
"Not enough tokens passed for generic protocol"); "Not enough tokens passed for generic protocol");
return; return;
} }
@ -65,7 +65,7 @@ FGGeneric::FGGeneric(vector<string> tokens) : exitOnError(false)
direction = tokens[2]; direction = tokens[2];
if (direction != "in" && direction != "out" && direction != "bi") { 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); << direction);
} }
@ -543,14 +543,14 @@ FGGeneric::reinit()
path.append("Protocol"); path.append("Protocol");
path.append(file_name.c_str()); 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()); << path.str());
SGPropertyNode root; SGPropertyNode root;
try { try {
readProperties(path.str(), &root); readProperties(path.str(), &root);
} catch (const sg_exception & ex) { } 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() ); "Unable to load the protocol configuration file: " << ex.getFormattedMessage() );
return; return;
} }

View file

@ -147,7 +147,7 @@ void HttpdChannel::foundTerminator (void) {
if ( !globals->get_commands() if ( !globals->get_commands()
->execute(urlDecode(b).c_str(), &args) ) ->execute(urlDecode(b).c_str(), &args) )
{ {
SG_LOG( SG_GENERAL, SG_ALERT, SG_LOG( SG_NETWORK, SG_ALERT,
"Command " << urlDecode(b) "Command " << urlDecode(b)
<< " failed."); << " failed.");
} }

View file

@ -20,7 +20,7 @@
// and 8 bytes for double. // 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 // Define a structure containing the top level flight dynamics model
@ -36,11 +36,21 @@ public:
FG_MAX_TANKS = 4 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 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 longitude; // geodetic (radians)
double latitude; // geodetic (radians) double latitude; // geodetic (radians)
float altitude; // above sea level (meters) float altitude; // above sea level (meters)
float agl; // above ground level (meters) float agl; // above ground level (meters)
float phi; // roll (radians) float phi; // roll (radians)

View file

@ -292,7 +292,7 @@ PropsChannel::foundTerminator()
if ( !globals->get_commands() if ( !globals->get_commands()
->execute( "reinit", &args) ) ->execute( "reinit", &args) )
{ {
SG_LOG( SG_GENERAL, SG_ALERT, SG_LOG( SG_NETWORK, SG_ALERT,
"Command " << tokens[1] << " failed."); "Command " << tokens[1] << " failed.");
if ( mode == PROMPT ) { if ( mode == PROMPT ) {
tmp += "*failed*"; tmp += "*failed*";
@ -357,7 +357,7 @@ PropsChannel::foundTerminator()
if ( !globals->get_commands() if ( !globals->get_commands()
->execute(tokens[1].c_str(), &args) ) ->execute(tokens[1].c_str(), &args) )
{ {
SG_LOG( SG_GENERAL, SG_ALERT, SG_LOG( SG_NETWORK, SG_ALERT,
"Command " << tokens[1] << " failed."); "Command " << tokens[1] << " failed.");
if ( mode == PROMPT ) { if ( mode == PROMPT ) {
tmp += "*failed*"; tmp += "*failed*";

View file

@ -215,7 +215,7 @@ static naRef f_getprop(naContext c, naRef me, int argc, naRef* args)
{ {
double dv = p->getDoubleValue(); double dv = p->getDoubleValue();
if (osg::isNaN(dv)) { 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(); return naNil();
} }
@ -294,7 +294,7 @@ static naRef f_print(naContext c, naRef me, int argc, naRef* args)
if(naIsNil(s)) continue; if(naIsNil(s)) continue;
buf += naStr_data(s); buf += naStr_data(s);
} }
SG_LOG(SG_GENERAL, SG_ALERT, buf); SG_LOG(SG_NASAL, SG_ALERT, buf);
return naNum(buf.length()); return naNum(buf.length());
} }

View file

@ -174,7 +174,7 @@ static naRef f_getValue(naContext c, naRef me, int argc, naRef* args)
{ {
double dv = (*node)->getDoubleValue(); double dv = (*node)->getDoubleValue();
if (osg::isNaN(dv)) { 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(); return naNil();
} }

View file

@ -94,6 +94,12 @@ FGFX::init()
} }
SGPath path = globals->resolve_aircraft_path(path_str); 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() SG_LOG(SG_SOUND, SG_INFO, "Reading sound " << node->getName()
<< " from " << path.str()); << " from " << path.str());