string tmp = rwyno.substr(1, 1);
if (( tmp == "L" || tmp == "R" || tmp == "C" ) || (rwyno.size() == 1)) {
tmp = rwyno;
- cout << "Standardising rwy number from " << tmp;
rwyno = "0" + tmp;
- cout << " to " << rwyno << '\n';
+ SG_LOG( SG_GENERAL, SG_INFO, "Standardising rwy number from " << tmp
+ << " to " << rwyno );
}
char buf[4];
string tmp = runwayno.substr(1, 1);
if (( tmp == "L" || tmp == "R" || tmp == "C" ) || (runwayno.size() == 1)) {
tmp = runwayno;
- cout << "Standardising rwy number from " << tmp;
runwayno = "0" + tmp;
- cout << " to " << runwayno << '\n';
+ SG_LOG(SG_GENERAL, SG_INFO, "Standardising rwy number from " << tmp
+ << " to " << runwayno );
}
c4_RowRef row = vRunway->GetAt(index);
c4_FloatProp pElev ("Elevation");
int idx = vAirport->Find(pID[id.c_str()]);
- cout << "idx = " << idx << endl;
+ SG_LOG( SG_TERRAIN, SG_INFO, "idx = " << idx );
if ( idx == -1 ) {
return false;
const_iterator end = airports.end();
while ( current != end ) {
// add each airport record
- cout << "out -> " << current->id << endl;
+ SG_LOG( SG_TERRAIN, SG_BULK, "out -> " << current->id );
pID (row) = current->id.c_str();
pLon (row) = current->longitude;
pLat (row) = current->latitude;
if ( set_rst_btn == 1 && set_rst_btn == last_set_rst_btn ) {
// button depressed and was last iteration too
tmp_timer += dt;
- cout << "tmp_timer = " << tmp_timer << endl;
+ // cout << "tmp_timer = " << tmp_timer << endl;
if ( tmp_timer > 2.0 ) {
// button held depressed for 2 seconds
cout << "entering elapsed count down mode" << endl;
if ( globals->get_soundmgr()->add( sound, nav_fx_name ) ) {
// cout << "Added nav-vor-ident sound" << endl;
} else {
- cout << "Failed to add v1-vor-ident sound" << endl;
+ SG_LOG(SG_COCKPIT, SG_WARN, "Failed to add v1-vor-ident sound");
}
if ( globals->get_soundmgr()->exists( dme_fx_name ) ) {
nav_trans_ident = "";
last_nav_id = "";
if ( ! globals->get_soundmgr()->remove( nav_fx_name ) ) {
- cout << "Failed to remove nav-vor-ident sound" << endl;
+ SG_LOG(SG_COCKPIT, SG_WARN, "Failed to remove nav-vor-ident sound");
}
globals->get_soundmgr()->remove( dme_fx_name );
// cout << "not picking up vor1. :-(" << endl;
#include STL_FSTREAM
#include STL_IOSTREAM
-SG_USING_STD(cout);
-
#include "IO360.hxx"
#include "LaRCsim/ls_constants.h"
// cout << "n = " << RPM << " rpm\n";
// cout << "T_amb = " << T_amb << '\n';
// cout << "running = " << running << '\n';
- cout << "fuel = " << fgGetFloat("/consumables/fuel/tank[0]/level-gal_us") << '\n';
+// cout << "fuel = " << fgGetFloat("/consumables/fuel/tank[0]/level-gal_us") << '\n';
// cout << "Percentage_Power = " << Percentage_Power << '\n';
// cout << "current_oil_temp = " << current_oil_temp << '\n';
- cout << "EGT = " << EGT << '\n';
+// cout << "EGT = " << EGT << '\n';
}
count1++;
if(count1 == 100)
}
//if we get here something has gone badly wrong
- cout << "ERROR: error in FGNewEngine::Lookup_Combustion_Efficiency\n";
+ SG_LOG(SG_AIRCRAFT, SG_ALERT, "error in FGNewEngine::Lookup_Combustion_Efficiency");
return neta_comb_actual;
}
}
//if we get here something has gone badly wrong
- cout << "ERROR: error in FGNewEngine::Power_Mixture_Correlation\n";
+ SG_LOG(SG_AIRCRAFT, SG_ALERT, "error in FGNewEngine::Power_Mixture_Correlation");
return mixPerPow_actual;
}
SaveDialogInput->getValue(&s);
ofstream output(s);
- cout << saveFile << endl;
+ // cout << saveFile << endl;
if (output.good() && fgSaveFlight(output)) {
output.close();
mkDialog("Saved flight");
SGPropertyNode *locale = fgInitLocale(language);
if (!locale) {
- cerr << "No internationalization settings specified in preferences.xml"
- << endl;
+ SG_LOG(SG_GENERAL, SG_ALERT,
+ "No internationalization settings specified in preferences.xml" );
return false;
}
static void printMat(const sgVec4 *mat, char *name="")
{
int i;
- cout << name << endl;
+ SG_LOG(SG_GENERAL, SG_BULK, name );
for(i=0; i<4; i++) {
- cout <<" "<<mat[i][0]<<" "<<mat[i][1]<<" "<<mat[i][2]<<" "<<mat[i][3]<<endl;
+ SG_LOG(SG_GENERAL, SG_BULK, " " << mat[i][0] << " " << mat[i][1]
+ << " " << mat[i][2] << " " << mat[i][3] );
}
- cout << endl;
}
// Initialize view parameters
static void
setWindEast (double speed)
{
- cout << "Set wind-east to " << speed << endl;
+ SG_LOG(SG_GENERAL, SG_INFO,, "Set wind-east to " << speed );
current_aircraft.fdm_state->set_Velocities_Local_Airmass(getWindNorth(),
speed,
getWindDown());
void
fgInitProps ()
{
- cout << "start of fgInitProps()" << endl;
+ SG_LOG(SG_GENERAL, SG_DEBUG, "start of fgInitProps()" );
// Simulation
fgTie("/sim/logging/priority", getLoggingPriority, setLoggingPriority);
fgTie("/sim/logging/classes", getLoggingClasses, setLoggingClasses);
fgTie("/sim/temp/full-screen", getFullScreen, setFullScreen);
fgTie("/sim/temp/fdm-data-logging", getFDMDataLogging, setFDMDataLogging);
- cout << "end of fgInitProps()" << endl;
+ SG_LOG(SG_GENERAL, SG_DEBUG, "end of fgInitProps()" );
}
// update the sky dome
if ( fgGetBool("/sim/rendering/skyblend") ) {
- /* cout << "thesky->repaint() sky_color = "
+ /*
+ SG_LOG( SG_GENERAL, SG_BULK, "thesky->repaint() sky_color = "
<< cur_light_params.sky_color[0] << " "
<< cur_light_params.sky_color[1] << " "
<< cur_light_params.sky_color[2] << " "
- << cur_light_params.sky_color[3] << endl;
- cout << " fog = "
+ << cur_light_params.sky_color[3] );
+ SG_LOG( SG_GENERAL, SG_BULK, " fog = "
<< cur_light_params.fog_color[0] << " "
<< cur_light_params.fog_color[1] << " "
<< cur_light_params.fog_color[2] << " "
- << cur_light_params.fog_color[3] << endl;
- cout << " sun_angle = " << cur_light_params.sun_angle
- << " moon_angle = " << cur_light_params.moon_angle
- << endl; */
+ << cur_light_params.fog_color[3] );
+ SG_LOG( SG_GENERAL, SG_BULK,
+ " sun_angle = " << cur_light_params.sun_angle
+ << " moon_angle = " << cur_light_params.moon_angle );
+ */
thesky->repaint( cur_light_params.sky_color,
cur_light_params.adj_fog_color,
cur_light_params.sun_angle,
globals->get_ephem()->getNumStars(),
globals->get_ephem()->getStars() );
- /* cout << "thesky->reposition( view_pos = " << view_pos[0] << " "
- << view_pos[1] << " " << view_pos[2] << endl;
- cout << " zero_elev = " << zero_elev[0] << " "
+ /*
+ SG_LOG( SG_GENERAL, SG_BULK,
+ "thesky->reposition( view_pos = " << view_pos[0] << " "
+ << view_pos[1] << " " << view_pos[2] );
+ SG_LOG( SG_GENERAL, SG_BULK,
+ " zero_elev = " << zero_elev[0] << " "
<< zero_elev[1] << " " << zero_elev[2]
<< " lon = " << cur_fdm_state->get_Longitude()
- << " lat = " << cur_fdm_state->get_Latitude() << endl;
- cout << " sun_rot = " << cur_light_params.sun_rotation
- << " gst = " << SGTime::cur_time_params->getGst() << endl;
- cout << " sun ra = " << globals->get_ephem()->getSunRightAscension()
- << " sun dec = " << globals->get_ephem()->getSunDeclination()
- << " moon ra = " << globals->get_ephem()->getMoonRightAscension()
- << " moon dec = " << globals->get_ephem()->getMoonDeclination() << endl; */
+ << " lat = " << cur_fdm_state->get_Latitude() );
+ SG_LOG( SG_GENERAL, SG_BULK,
+ " sun_rot = " << cur_light_params.sun_rotation
+ << " gst = " << SGTime::cur_time_params->getGst() );
+ SG_LOG( SG_GENERAL, SG_BULK,
+ " sun ra = " << globals->get_ephem()->getSunRightAscension()
+ << " sun dec = " << globals->get_ephem()->getSunDeclination()
+ << " moon ra = " << globals->get_ephem()->getMoonRightAscension()
+ << " moon dec = " << globals->get_ephem()->getMoonDeclination() );
+ */
thesky->reposition( current__view->get_view_pos(),
current__view->get_zero_elev(),
result += seconds / 3600.0;
}
- cout << " parse_time() = " << sign * result << endl;
+ SG_LOG( SG_GENERAL, SG_INFO, " parse_time() = " << sign * result );
return(sign * result);
}
static bool
add_channel( const string& type, const string& channel_str ) {
- cout << "Channel string = " << channel_str << endl;
+ SG_LOG(SG_GENERAL, SG_INFO, "Channel string = " << channel_str );
globals->get_channel_options_list()->push_back( type + "," + channel_str );
- cout << "here" << endl;
+ // cout << "here" << endl;
return true;
}
SGPropertyNode options_root;
- cout << "" << endl;
+ cout << endl;
try {
fgLoadProps("options.xml", &options_root);
#include <arpa/inet.h>
#include <plib/netSocket.h>
#include <stdlib.h>
+
+#include <simgear/debug/logstream.hxx>
#include <Main/fg_props.hxx>
#include "multiplayrxmgr.hxx"
m_sRxAddress = fgGetString("/sim/multiplay/rxhost");
m_iRxPort = fgGetInt("/sim/multiplay/rxport");
- cout << "FGMultiplayRxMgr::init - rxaddress= " << m_sRxAddress << endl;
- cout << "FGMultiplayRxMgr::init - rxport= " << m_iRxPort << endl;
- cout << "FGMultiplayRxMgr::init - callsign= " << m_sCallsign << endl;
+ SG_LOG( SG_NETWORK, SG_INFO, "FGMultiplayRxMgr::init - rxaddress= "
+ << m_sRxAddress );
+ SG_LOG( SG_NETWORK, SG_INFO, "FGMultiplayRxMgr::init - rxport= "
+ << m_iRxPort);
+ SG_LOG( SG_NETWORK, SG_INFO, "FGMultiplayRxMgr::init - callsign= "
+ << m_sCallsign );
+
// Create and open rx socket
mDataRxSocket = new netSocket();
case CHAT_MSG_ID:
if (MsgHdr->iMsgLen == sizeof(T_MsgHdr) + sizeof(T_ChatMsg)) {
ChatMsg = (T_ChatMsg *)(sMsg + sizeof(T_MsgHdr));
- cout << "Chat [" << MsgHdr->sCallsign << "]" << " " << ChatMsg->sText << endl;
+ SG_LOG( SG_NETWORK, SG_BULK, "Chat [" << MsgHdr->sCallsign << "]" << " " << ChatMsg->sText );
} else {
- cerr << "FGMultiplayRxMgr::MP_ProcessData - Chat message received with insufficient data" << endl;
+ SG_LOG( SG_NETWORK, SG_ALERT, "FGMultiplayRxMgr::MP_ProcessData - Chat message received with insufficient data" );
}
break;
iPlayerCnt = 0;
do {
if (m_Player[iPlayerCnt] == NULL) {
- cout << "FGMultiplayRxMgr::ProcessRxData - Add new player. IP: " << sIpAddress
- << ", Call: " << sCallsign << ", model: " << sModelName << endl;
+ SG_LOG( SG_NETWORK, SG_INFO, "FGMultiplayRxMgr::ProcessRxData - Add new player. IP: " << sIpAddress << ", Call: " << sCallsign << ", model: " << sModelName );
m_Player[iPlayerCnt] = new MPPlayer;
m_Player[iPlayerCnt]->Open(string(sIpAddress), iPort, string(sCallsign), string(sModelName), false);
m_Player[iPlayerCnt]->SetPosition(PosMsg->PlayerPos);
#include <arpa/inet.h>
#include <plib/netSocket.h>
#include <stdlib.h>
+
+#include <simgear/debug/logstream.hxx>
#include <Main/fg_props.hxx>
+
#include "multiplaytxmgr.hxx"
#include "mpmessages.hxx"
#include "mpplayer.hxx"
string sTxAddress = fgGetString("/sim/multiplay/txhost");
iTxPort = fgGetInt("/sim/multiplay/txport");
- cout << "FGMultiplayTxMgr::init - txaddress= " << sTxAddress << endl;
- cout << "FGMultiplayTxMgr::init - txport= " << iTxPort << endl;
+ SG_LOG( SG_NETWORK, SG_INFO, "FGMultiplayTxMgr::init - txaddress= "
+ << sTxAddress );
+ SG_LOG( SG_NETWORK, SG_INFO, "FGMultiplayTxMgr::init - txport= "
+ << iTxPort );
if (iTxPort > 0) {
// If Tx port == zero then don't initialise
} else {
- cout << "FGMultiplayTxMgr::init - Tx Port is zero. Multiplay out disabled." << endl;
+ SG_LOG( SG_NETWORK, SG_WARN, "FGMultiplayTxMgr::init - Tx Port is zero. Multiplay out disabled." );
bSuccess = false;
}
m_bInitialised = bSuccess;
} else {
- cerr << "FGMultiplayTxMgr::init - Attempt to init object that is already opened" << endl;
+ SG_LOG( SG_NETWORK, SG_ALERT, "FGMultiplayTxMgr::init - Attempt to init object that is already opened" );
bSuccess = false;
}
return;
}
- cout << "[ 20%] allocating memory \r";
+ SG_LOG(SG_MATH, SG_DEBUG, "[ 20%] allocating memory");
point = new double*[numPoints];
tmppoint = new double*[numPoints+3];
f[i] = _f[i];
}
- cout << "[ 30%] creating delaunay diagram \r";
+ SG_LOG(SG_MATH, SG_DEBUG, "[ 30%] creating delaunay diagram");
Delaunay2D();
}
nts = 1; // number of triangles
i4 = 1;
- cout << "[ 40%] create triangulation \r";
+ SG_LOG(SG_MATH, SG_DEBUG, "[ 40%] create triangulation");
// compute triangulation
for (i0 = 0; i0 < numPoints; i0++)
}
// count the number of triangles
- cout << "[ 50%] count the number of triangles \r";
+ SG_LOG(SG_MATH, SG_DEBUG, "[ 50%] count the number of triangles");
numTriangles = 0;
i0 = -1;
}
// create the triangles
- cout << "[ 60%] create the triangles \r";
+ SG_LOG(SG_MATH, SG_DEBUG "[ 60%] create the triangles");
triangle = new Triangle[numTriangles];
}
// build edge table
- cout << "[ 70%] build the edge table \r";
+ SG_LOG(SG_MATH, SG_DEBUG, "[ 70%] build the edge table");
numEdges = 0;
edge = new Edge[3*numTriangles];
for (i = 0; i < numTriangles; i++)
{
if ( (i%500) == 0)
- cout << "[ 7" << 10*i/numTriangles << "%] build the edge table \r";
+ SG_LOG(SG_MATH, SG_BULK, "[ 7" << 10*i/numTriangles << "%] build the edge table");
Triangle& t = triangle[i];
}
// establish links between adjacent triangles
- cout << "[ 80%] establishing links between adjacent triangles \r";
+ SG_LOG(SG_MATH, SG_DEBUG, "[ 80%] establishing links between adjacent triangles");
for (i = 0; i < numEdges; i++)
{
delete[] ccr[0];
delete[] ccr;
- cout << "[ 90%] finsishes delauney triangulation \r";
+ SG_LOG(SG_MATH, SG_DEBUG, "[ 90%] finsishes delauney triangulation");
return result;
}
// For complete spherical coverage, include the two antipodal points
// (0,0,1,f(0,0,1)) and (0,0,-1,f(0,0,-1)) in the data set.
- cout << "Initialising spherical interpolator.\n";
- cout << "[ 0%] Allocating memory \r";
+ SG_LOG(SG_MATH, SG_DEBUG, "Initialising spherical interpolator.");
+ SG_LOG(SG_MATH, SG_DEBUG, "[ 0%] Allocating memory");
theta = new double[3*n];
phi = new double[3*n];
}
// use periodicity to get wrap-around in the Delaunay triangulation
- cout << "[ 10%] copying vertices for wrap-around\r";
+ SG_LOG(SG_MATH, SG_DEBUG, "[ 10%] copying vertices for wrap-aroundr");
int j, k;
for (i = 0, j = n, k = 2*n; i < n; i++, j++, k++)
{
pInterp = new mgcLinInterp2D(3*n,theta,phi,func);
- cout << "[100%] Finished initialising spherical interpolator. \n";
+ SG_LOG(SG_MATH, SG_DEBUG, "[100%] Finished initialising spherical interpolator.");
}
SphereInterpolate::SphereInterpolate (int n, const sgVec2* p, const unsigned int* f)
// Assumes (x[i],y[i],z[i]) is unit length for all 0 <= i < n.
// For complete spherical coverage, include the two antipodal points
// (0,0,1,f(0,0,1)) and (0,0,-1,f(0,0,-1)) in the data set.
- cout << "Initialising spherical interpolator.\n";
- cout << "[ 0%] Allocating memory \r";
+ SG_LOG(SG_MATH, SG_DEBUG, "Initialising spherical interpolator.");
+ SG_LOG(SG_MATH, SG_DEBUG, "[ 0%] Allocating memory");
theta = new double[3*n];
phi = new double[3*n];
func = new unsigned int[3*n];
// convert data to spherical coordinates
- cout << "[ 10%] copying vertices for wrap-around \r";
+ SG_LOG(SG_MATH, SG_DEBUG, "[ 10%] copying vertices for wrap-around");
int i, j, k;
for (i = 0, j = n, k = 2*n; i < n; i++, j++, k++)
pInterp = new mgcLinInterp2D(3*n,theta,phi,func);
- cout << "[100%] Finished initialising spherical interpolator. \n";
+ SG_LOG(SG_MATH, SG_DEBUG, "[100%] Finished initialising spherical interpolator.");
}
//---------------------------------------------------------------------------
SphereInterpolate::~SphereInterpolate ()