return;
if (_ht_agl_ft <= 0) {
- SG_LOG(SG_GENERAL, SG_DEBUG, "AIBallistic: terrain impact material" << _mat_name);
+ SG_LOG(SG_AI, SG_DEBUG, "AIBallistic: terrain impact material" << _mat_name);
report_impact(_elevation_m);
_impact_reported = true;
void FGAIBallistic::handle_expiry() {
- //SG_LOG(SG_GENERAL, SG_DEBUG, "AIBallistic: handle_expiry " << pos.getElevationM());
+ //SG_LOG(SG_AI, SG_DEBUG, "AIBallistic: handle_expiry " << pos.getElevationM());
report_impact(pos.getElevationM());
_expiry_reported = true;
else
n->setStringValue("type", "terrain");
- SG_LOG(SG_GENERAL, SG_DEBUG, "AIBallistic: object impact " << _name
+ SG_LOG(SG_AI, SG_DEBUG, "AIBallistic: object impact " << _name
<< " lon " <<_impact_lon << " lat " <<_impact_lat << " sec " << _life_timer);
n->setDoubleValue("longitude-deg", _impact_lon);
_initialized = true;
} else if (!model_path.empty()) {
- SG_LOG(SG_INPUT, SG_WARN, "AIBase: Could not load model " << model_path);
+ SG_LOG(SG_AI, SG_WARN, "AIBase: Could not load model " << model_path);
// not properly installed...
_installed = false;
}
if( _path != ""){
props->setStringValue("submodels/path", _path.c_str());
- SG_LOG(SG_INPUT, SG_DEBUG, "AIBase: submodels/path " << _path);
+ SG_LOG(SG_AI, SG_DEBUG, "AIBase: submodels/path " << _path);
}
if( _parent!= ""){
fgSetString("/ai/models/model-added", props->getPath().c_str());
} else if (!model_path.empty()) {
- SG_LOG(SG_INPUT, SG_WARN, "AIBase: Could not load model " << model_path);
+ SG_LOG(SG_AI, SG_WARN, "AIBase: Could not load model " << model_path);
}
setDie(false);
bool FGAIBase::setParentNode() {
if (_parent == ""){
- SG_LOG(SG_GENERAL, SG_ALERT, "AIBase: " << _name
+ SG_LOG(SG_AI, SG_ALERT, "AIBase: " << _name
<< " parent not set ");
return false;
}
const string name = _selected_ac->getStringValue("name");
return true;
} else {
- SG_LOG(SG_GENERAL, SG_ALERT, "AIBase: " << _name
+ SG_LOG(SG_AI, SG_ALERT, "AIBase: " << _name
<< " parent not found: dying ");
setDie(true);
return false;
FGAIShip::update(dt);
//automatic turn into wind with a target wind of 25 kts otd
- //SG_LOG(SG_GENERAL, SG_ALERT, "AICarrier: MPControl " << MPControl << " AIControl " << AIControl);
+ //SG_LOG(SG_AI, SG_ALERT, "AICarrier: MPControl " << MPControl << " AIControl " << AIControl);
if (!MPControl && AIControl){
if(turn_to_launch_hdg){
bool FGAICarrier::OutsideBox() { //returns true if the carrier is outside operating box
if ( max_lat == 0 && min_lat == 0 && max_long == 0 && min_long == 0) {
- SG_LOG(SG_GENERAL, SG_DEBUG, "AICarrier: No Operating Box defined" );
+ SG_LOG(SG_AI, SG_DEBUG, "AICarrier: No Operating Box defined" );
return false;
}
return true;
}
- SG_LOG(SG_GENERAL, SG_DEBUG, "AICarrier: Inside Operating Box" );
+ SG_LOG(SG_AI, SG_DEBUG, "AICarrier: Inside Operating Box" );
return false;
} // end OutsideBox
// these are the AI rules for the manoeuvring of escorts
if (_MPControl && _tgtrange > 4 * _stn_limit){
- SG_LOG(SG_GENERAL, SG_ALERT, "AIEscort: " << _name
+ SG_LOG(SG_AI, SG_ALERT, "AIEscort: " << _name
<< " re-aligning to MP pos");
pos = _tgtpos;
speed = 0;
}
void FGAIGroundVehicle::update(double dt) {
- // SG_LOG(SG_GENERAL, SG_ALERT, "updating GroundVehicle: " << _name );
+ // SG_LOG(SG_AI, SG_ALERT, "updating GroundVehicle: " << _name );
FGAIShip::update(dt);
RunGroundVehicle(dt);
string parent_next_name =_selected_ac->getStringValue("waypoint/name-next");
while(fp->getNextWaypoint() != 0 && fp->getNextWaypoint()->getName() != "END" && count < 5){
- SG_LOG(SG_GENERAL, SG_DEBUG, "AIGroundVeh1cle: " << _name
+ SG_LOG(SG_AI, SG_DEBUG, "AIGroundVeh1cle: " << _name
<<" advancing waypoint to: " << parent_next_name);
if (fp->getNextWaypoint()->getName() == parent_next_name){
- SG_LOG(SG_GENERAL, SG_DEBUG, "AIGroundVeh1cle: " << _name
+ SG_LOG(SG_AI, SG_DEBUG, "AIGroundVeh1cle: " << _name
<< " not setting waypoint already at: " << fp->getNextWaypoint()->getName());
return;
}
next = fp->getNextWaypoint();
if (fp->getNextWaypoint()->getName() == parent_next_name){
- SG_LOG(SG_GENERAL, SG_DEBUG, "AIGroundVeh1cle: " << _name
+ SG_LOG(SG_AI, SG_DEBUG, "AIGroundVeh1cle: " << _name
<< " waypoint set to: " << fp->getNextWaypoint()->getName());
return;
}
while(fp->getPreviousWaypoint() != 0 && fp->getPreviousWaypoint()->getName() != "END"
&& count > -10){
- SG_LOG(SG_GENERAL, SG_DEBUG, "AIGroundVeh1cle: " << _name
+ SG_LOG(SG_AI, SG_DEBUG, "AIGroundVeh1cle: " << _name
<< " retreating waypoint to: " << parent_next_name
<< " at: " << fp->getNextWaypoint()->getName());
if (fp->getNextWaypoint()->getName() == parent_next_name){
- SG_LOG(SG_GENERAL, SG_DEBUG, "AIGroundVeh1cle: " << _name
+ SG_LOG(SG_AI, SG_DEBUG, "AIGroundVeh1cle: " << _name
<< " not setting waypoint already at:" << fp->getNextWaypoint()->getName() );
return;
}
next = fp->getNextWaypoint();
if (fp->getNextWaypoint()->getName() == parent_next_name){
- SG_LOG(SG_GENERAL, SG_DEBUG, "AIGroundVeh1cle: " << _name
+ SG_LOG(SG_AI, SG_DEBUG, "AIGroundVeh1cle: " << _name
<< " waypoint set to: " << fp->getNextWaypoint()->getName());
return;
}
//bool parent_restart = _selected_ac->getBoolValue("controls/restart");
if (parent_next_name == "END" && fp->getNextWaypoint()->getName() != "END" ){
- SG_LOG(SG_GENERAL, SG_DEBUG, "AIGroundVeh1cle: " << _name
+ SG_LOG(SG_AI, SG_DEBUG, "AIGroundVeh1cle: " << _name
<< " setting END: getting new waypoints ");
AdvanceFP();
setWPNames();
if(_restart) _missed_count = 200;
/*} else if (parent_next_name == "WAIT" && fp->getNextWaypoint()->name != "WAIT" ){*/
} else if (parent_waiting && !_waiting){
- SG_LOG(SG_GENERAL, SG_DEBUG, "AIGroundVeh1cle: " << _name
+ SG_LOG(SG_AI, SG_DEBUG, "AIGroundVeh1cle: " << _name
<< " setting WAIT/WAITUNTIL: getting new waypoints ");
AdvanceFP();
setWPNames();
_waiting = true;
} else if (parent_next_name != "WAIT" && fp->getNextWaypoint()->getName() == "WAIT"){
- SG_LOG(SG_GENERAL, SG_DEBUG, "AIGroundVeh1cle: " << _name
+ SG_LOG(SG_AI, SG_DEBUG, "AIGroundVeh1cle: " << _name
<< " wait done: getting new waypoints ");
_waiting = false;
_wait_count = 0;
setWPNames();
} else if (_range_ft > (_x_offset +_parent_x_offset)* 4
){
- SG_LOG(SG_GENERAL, SG_ALERT, "AIGroundVeh1cle: " << _name
+ SG_LOG(SG_AI, SG_ALERT, "AIGroundVeh1cle: " << _name
<< " rescue: reforming train " << _range_ft
);
if ((!mAllowExtrapolation && offset + lag < mTimeOffset)
|| (offset - 10 > mTimeOffset)) {
mTimeOffset = offset;
- SG_LOG(SG_GENERAL, SG_DEBUG, "Resetting time offset adjust system to "
+ SG_LOG(SG_AI, SG_DEBUG, "Resetting time offset adjust system to "
"avoid extrapolation: time offset = " << mTimeOffset);
} else {
// the error of the offset, respectively the negative error to avoid
systemIncrement = err;
mTimeOffset += systemIncrement;
- SG_LOG(SG_GENERAL, SG_DEBUG, "Offset adjust system: time offset = "
+ SG_LOG(SG_AI, SG_DEBUG, "Offset adjust system: time offset = "
<< mTimeOffset << ", expected longitudinal position error due to "
" current adjustment of the offset: "
<< fabs(norm(it->second.linearVel)*systemIncrement));
// Find the first packet before the target time
MotionInfo::iterator nextIt = mMotionInfo.upper_bound(tInterp);
if (nextIt == mMotionInfo.begin()) {
- SG_LOG(SG_GENERAL, SG_DEBUG, "Taking oldest packet!");
+ SG_LOG(SG_AI, SG_DEBUG, "Taking oldest packet!");
// We have no packet before the target time, just use the first one
MotionInfo::iterator firstIt = mMotionInfo.begin();
ecPos = firstIt->second.position;
}
else
{
- SG_LOG(SG_GENERAL, SG_DEBUG, "Unable to find property: " << (*firstPropIt)->id << "\n");
+ SG_LOG(SG_AI, SG_DEBUG, "Unable to find property: " << (*firstPropIt)->id << "\n");
}
++firstPropIt;
}
double intervalLen = intervalEnd - intervalStart;
double tau = (tInterp - intervalStart)/intervalLen;
- SG_LOG(SG_GENERAL, SG_DEBUG, "Multiplayer vehicle interpolation: ["
+ SG_LOG(SG_AI, SG_DEBUG, "Multiplayer vehicle interpolation: ["
<< intervalStart << ", " << intervalEnd << "], intervalLen = "
<< intervalLen << ", interpolation parameter = " << tau);
}
else
{
- SG_LOG(SG_GENERAL, SG_DEBUG, "Unable to find property: " << (*prevPropIt)->id << "\n");
+ SG_LOG(SG_AI, SG_DEBUG, "Unable to find property: " << (*prevPropIt)->id << "\n");
}
++prevPropIt;
double t = tInterp - motionInfo.time;
t = SGMisc<double>::min(t, 5);
- SG_LOG(SG_GENERAL, SG_DEBUG, "Multiplayer vehicle extrapolation: "
+ SG_LOG(SG_AI, SG_DEBUG, "Multiplayer vehicle extrapolation: "
"extrapolation time = " << t);
// Do a few explicit euler steps with the constant acceleration's
}
else
{
- SG_LOG(SG_GENERAL, SG_DEBUG, "Unable to find property: " << (*firstPropIt)->id << "\n");
+ SG_LOG(SG_AI, SG_DEBUG, "Unable to find property: " << (*firstPropIt)->id << "\n");
}
++firstPropIt;
roll = rDeg;
pitch = pDeg;
- SG_LOG(SG_GENERAL, SG_DEBUG, "Multiplayer position and orientation: "
+ SG_LOG(SG_AI, SG_DEBUG, "Multiplayer position and orientation: "
<< ecPos << ", " << hlOr);
//###########################//
setSMPath(scFileNode->getStringValue("submodel-path", ""));
if (!flightplan.empty()) {
- SG_LOG(SG_GENERAL, SG_ALERT, "getting flightplan: " << _name );
+ SG_LOG(SG_AI, SG_ALERT, "getting flightplan: " << _name );
FGAIFlightPlan* fp = new FGAIFlightPlan(flightplan);
setFlightPlan(fp);
}
void FGAIShip::update(double dt) {
- //SG_LOG(SG_GENERAL, SG_ALERT, "updating Ship: " << _name <<hdg<<pitch<<roll);
+ //SG_LOG(SG_AI, SG_ALERT, "updating Ship: " << _name <<hdg<<pitch<<roll);
// For computation of rotation speeds we just use finite differences here.
// That is perfectly valid since this thing is not driven by accelerations
// but by just apply discrete changes at its velocity variables.
setCurrName(curr->getName());
else{
setCurrName("");
- SG_LOG(SG_GENERAL, SG_ALERT, "AIShip: current wp name error" );
+ SG_LOG(SG_AI, SG_ALERT, "AIShip: current wp name error" );
}
if (next != 0)
else
setNextName("");
- SG_LOG(SG_GENERAL, SG_DEBUG, "AIShip: prev wp name " << prev->getName());
- SG_LOG(SG_GENERAL, SG_DEBUG, "AIShip: current wp name " << curr->getName());
- SG_LOG(SG_GENERAL, SG_DEBUG, "AIShip: next wp name " << next->getName());
+ SG_LOG(SG_AI, SG_DEBUG, "AIShip: prev wp name " << prev->getName());
+ SG_LOG(SG_AI, SG_DEBUG, "AIShip: current wp name " << curr->getName());
+ SG_LOG(SG_AI, SG_DEBUG, "AIShip: next wp name " << next->getName());
}
geo_inverse_wgs_84(lat, lon, lat2, lon2, &course, &recip, &distance);
if (tgt_speed >= 0) {
return course;
- SG_LOG(SG_GENERAL, SG_DEBUG, "AIShip: course " << course);
+ SG_LOG(SG_AI, SG_DEBUG, "AIShip: course " << course);
} else {
return recip;
- SG_LOG(SG_GENERAL, SG_DEBUG, "AIShip: recip " << recip);
+ SG_LOG(SG_AI, SG_DEBUG, "AIShip: recip " << recip);
}
}
if (_next_name == "TUNNEL"){
_tunnel = !_tunnel;
- SG_LOG(SG_GENERAL, SG_DEBUG, "AIShip: " << _name << " " << sp_turn_radius_nm );
+ SG_LOG(SG_AI, SG_DEBUG, "AIShip: " << _name << " " << sp_turn_radius_nm );
fp->IncrementWaypoint(false);
next = fp->getNextWaypoint();
}else if(_next_name == "END" || fp->getNextWaypoint() == 0) {
if (_repeat) {
- SG_LOG(SG_GENERAL, SG_INFO, "AIShip: "<< _name << " Flightplan repeating ");
+ SG_LOG(SG_AI, SG_INFO, "AIShip: "<< _name << " Flightplan repeating ");
fp->restart();
prev = curr;
curr = fp->getCurrentWaypoint();
_lead_angle = 0;
AccelTo(prev->getSpeed());
} else if (_restart){
- SG_LOG(SG_GENERAL, SG_INFO, "AIShip: " << _name << " Flightplan restarting ");
+ SG_LOG(SG_AI, SG_INFO, "AIShip: " << _name << " Flightplan restarting ");
_missed_count = 0;
initFlightPlan();
} else {
- SG_LOG(SG_GENERAL, SG_ALERT, "AIShip: " << _name << " Flightplan dying ");
+ SG_LOG(SG_AI, SG_ALERT, "AIShip: " << _name << " Flightplan dying ");
setDie(true);
_dt_count = 0;
return;
} else if (_next_name == "WAIT") {
if (_wait_count < next->getTime_sec()) {
- SG_LOG(SG_GENERAL, SG_DEBUG, "AIShip: " << _name << " waiting ");
+ SG_LOG(SG_AI, SG_DEBUG, "AIShip: " << _name << " waiting ");
setSpeed(0);
_waiting = true;
_wait_count += _dt_count;
_lead_angle = 0;
return;
} else {
- SG_LOG(SG_GENERAL, SG_DEBUG, "AIShip: " << _name
+ SG_LOG(SG_AI, SG_DEBUG, "AIShip: " << _name
<< " wait done: getting new waypoints ");
_waiting = false;
_wait_count = 0;
_until_time = next->getTime();
setUntilTime(next->getTime());
if (until_time_sec > time_sec) {
- SG_LOG(SG_GENERAL, SG_INFO, "AIShip: " << _name << " "
+ SG_LOG(SG_AI, SG_INFO, "AIShip: " << _name << " "
<< curr->getName() << " waiting until: "
<< _until_time << " " << until_time_sec << " now " << time_sec );
setSpeed(0);
_waiting = true;
return;
} else {
- SG_LOG(SG_GENERAL, SG_INFO, "AIShip: "
+ SG_LOG(SG_AI, SG_INFO, "AIShip: "
<< _name << " wait until done: getting new waypoints ");
setUntilTime("");
fp->IncrementWaypoint(false);
} else {
//now reorganise the waypoints, so that next becomes current and so on
- SG_LOG(SG_GENERAL, SG_DEBUG, "AIShip: " << _name << " getting new waypoints ");
+ SG_LOG(SG_AI, SG_DEBUG, "AIShip: " << _name << " getting new waypoints ");
fp->IncrementWaypoint(false);
prev = fp->getPreviousWaypoint(); //first waypoint
curr = fp->getCurrentWaypoint(); //second waypoint
if (finite(_course))
TurnTo(_course);
else
- SG_LOG(SG_GENERAL, SG_ALERT, "AIShip: Bearing or Range is not a finite number");
+ SG_LOG(SG_AI, SG_ALERT, "AIShip: Bearing or Range is not a finite number");
_dt_count = 0;
} // end Processing FlightPlan
bool FGAIShip::initFlightPlan() {
- SG_LOG(SG_GENERAL, SG_ALERT, "AIShip: " << _name << " initializing waypoints ");
+ SG_LOG(SG_AI, SG_ALERT, "AIShip: " << _name << " initializing waypoints ");
bool init = false;
_start_sec = 0;
next = fp->getNextWaypoint(); //third waypoint (might not exist!)
while (curr->getName() == "WAIT" || curr->getName() == "WAITUNTIL") { // don't wait when initialising
- SG_LOG(SG_GENERAL, SG_DEBUG, "AIShip: " << _name << " re-initializing waypoints ");
+ SG_LOG(SG_AI, SG_DEBUG, "AIShip: " << _name << " re-initializing waypoints ");
fp->IncrementWaypoint(false);
curr = fp->getCurrentWaypoint();
next = fp->getNextWaypoint();
_missed_count = 0;
_new_waypoint = true;
- SG_LOG(SG_GENERAL, SG_ALERT, "AIShip: " << _name << " done initialising waypoints " << _tunnel);
+ SG_LOG(SG_AI, SG_ALERT, "AIShip: " << _name << " done initialising waypoints " << _tunnel);
if (prev)
init = true;
_formate_to_ac = true;
_join = false;
- SG_LOG(SG_GENERAL, SG_ALERT, _name << " joined " << " RANGE " << distance
+ SG_LOG(SG_AI, SG_ALERT, _name << " joined " << " RANGE " << distance
<< " SPEED " << speed );
return;
rxPort = txPort;
}
if (rxPort <= 0) {
- SG_LOG(SG_NETWORK, SG_ALERT,
+ SG_LOG(SG_NETWORK, SG_INFO,
"FGMultiplayMgr - No receiver port. Multiplayer mode disabled.");
return;
}
mSocket.reset(new simgear::Socket());
if (!mSocket->open(false)) {
SG_LOG( SG_NETWORK, SG_WARN,
- "FGMultiplayMgr - Failed to create data socket." );
+ "FGMultiplayMgr - Failed to create data socket. Multiplayer mode disabled." );
return;
}
mSocket->setBlocking(false);
fgSetBool("/sim/multiplay/online", true);
mInitialised = true;
+
+ SG_LOG(SG_NETWORK, SG_ALERT, "Multiplayer mode active!");
} // FGMultiplayMgr::init()
//////////////////////////////////////////////////////////////////////