#include <stdio.h>
#include "aircraft.hxx"
-#include <Debug/fg_debug.h>
+#include <Debug/logstream.hxx>
#include <Include/fg_constants.h>
// This is a record containing all the info for the aircraft currently
// Initialize an Aircraft structure
void fgAircraftInit( void ) {
- fgPrintf( FG_AIRCRAFT, FG_INFO, "Initializing Aircraft structure\n" );
+ FG_LOG( FG_AIRCRAFT, FG_INFO, "Initializing Aircraft structure" );
current_aircraft.flight = &cur_flight_params;
current_aircraft.controls = &controls;
f = a->flight;
- fgPrintf( FG_FLIGHT, FG_DEBUG,
- "Pos = (%.2f,%.2f,%.2f) (Phi,Theta,Psi)=(%.2f,%.2f,%.2f)\n",
- FG_Longitude * 3600.0 * RAD_TO_DEG,
- FG_Latitude * 3600.0 * RAD_TO_DEG,
- FG_Altitude, FG_Phi, FG_Theta, FG_Psi);
-
- double elevator = controls.get_elevator();
- double aileron = controls.get_aileron();
- double rudder = controls.get_rudder();
- double throttle = controls.get_throttle( 0 );
-
- fgPrintf( FG_FLIGHT, FG_DEBUG,
- "Kts = %.0f Elev = %.2f, Aileron = %.2f, Rudder = %.2f Power = %.2f\n",
- FG_V_equiv_kts, elevator, aileron,rudder, throttle );
+ FG_LOG( FG_FLIGHT, FG_DEBUG,
+ "Pos = ("
+ << (FG_Longitude * 3600.0 * RAD_TO_DEG) << ","
+ << (FG_Latitude * 3600.0 * RAD_TO_DEG) << ","
+ << FG_Altitude
+ << ") (Phi,Theta,Psi)=("
+ << FG_Phi << "," << FG_Theta << "," << FG_Psi << ")" );
+
+ FG_LOG( FG_FLIGHT, FG_DEBUG,
+ "Kts = " << FG_V_equiv_kts
+ << " Elev = " << controls.get_elevator()
+ << " Aileron = " << controls.get_aileron()
+ << " Rudder = " << controls.get_rudder()
+ << " Power = " << controls.get_throttle( 0 ) );
}
// $Log$
+// Revision 1.4 1998/11/06 21:17:31 curt
+// Converted to new logstream debugging facility. This allows release
+// builds with no messages at all (and no performance impact) by using
+// the -DFG_NDEBUG flag.
+//
// Revision 1.3 1998/10/25 14:08:37 curt
// Turned "struct fgCONTROLS" into a class, with inlined accessor functions.
//
using namespace std;
#endif
-#include <Debug/fg_debug.h>
+#include <Debug/logstream.hxx>
// #include <Include/fg_types.h>
#include <Math/fg_geodesy.hxx>
#include <Math/mat3.h>
// find airport base material in the properties list
if ( ! material_mgr.find( APT_BASE_MATERIAL, fragment.material_ptr )) {
- fgPrintf( FG_TERRAIN, FG_ALERT,
- "Ack! unknown material name = %s in fgAptGenerat()\n",
- APT_BASE_MATERIAL );
+ FG_LOG( FG_TERRAIN, FG_ALERT,
+ "Ack! unknown material name = " << APT_BASE_MATERIAL
+ << " in fgAptGenerat()" );
}
printf(" tile center = %.2f %.2f %.2f\n",
// $Log$
+// Revision 1.9 1998/11/06 21:17:32 curt
+// Converted to new logstream debugging facility. This allows release
+// builds with no messages at all (and no performance impact) by using
+// the -DFG_NDEBUG flag.
+//
// Revision 1.8 1998/11/06 14:46:59 curt
// Changes to track Bernie's updates to fgstream.
//
#include <string>
-#include <Debug/fg_debug.h>
+#include <Debug/logstream.hxx>
#include <Main/options.hxx>
#include <Misc/fgstream.hxx>
airports.erase( airports.begin(), airports.end() );
fg_gzifstream in( path );
- if ( !in )
- fgPrintf( FG_GENERAL, FG_EXIT, "Cannot open file: %s\n",
- path.c_str());
+ if ( !in ) {
+ FG_LOG( FG_GENERAL, FG_ALERT, "Cannot open file: " << path );
+ exit(-1);
+ }
/*
// We can use the STL copy algorithm because the input
// $Log$
+// Revision 1.9 1998/11/06 21:17:34 curt
+// Converted to new logstream debugging facility. This allows release
+// builds with no messages at all (and no performance impact) by using
+// the -DFG_NDEBUG flag.
+//
// Revision 1.8 1998/11/06 14:47:01 curt
// Changes to track Bernie's updates to fgstream.
//
#include "celestialBody.hxx"
#include "star.hxx"
-#include <Debug/fg_debug.h>
+#include <Debug/logstream.hxx>
/**************************************************************************
* void CelestialBody::updatePosition(fgTIME *t, Star *ourSun)
ze = yg * sin(ecl) + zg * cos(ecl);
rightAscension = atan2(ye, xe);
declination = atan2(ze, sqrt(xe*xe + ye*ye));
- fgPrintf(FG_GENERAL, FG_INFO, "Planet found at : %f (ra), %f (dec)\n",
- rightAscension, declination);
+ FG_LOG(FG_GENERAL, FG_INFO, "Planet found at : "
+ << rightAscension << " (ra), " << declination << " (dec)" );
//calculate some variables specific to calculating the magnitude
//of the planet
#include <string.h>
#include "moon.hxx"
-#include <Debug/fg_debug.h>
+#include <Debug/logstream.hxx>
#include <Objects/texload.h>
static GLuint moon_texid;
string tpath, fg_tpath;
int width, height;
- fgPrintf( FG_GENERAL, FG_INFO, "Initializing Moon Texture\n");
+ FG_LOG( FG_GENERAL, FG_INFO, "Initializing Moon Texture");
#ifdef GL_VERSION_1_1
xglGenTextures(1, &moon_texid);
xglBindTexture(GL_TEXTURE_2D, moon_texid);
if ( (moon_texbuf = read_rgb_texture(fg_tpath.c_str(), &width, &height))
== NULL )
{
- fgPrintf( FG_GENERAL, FG_EXIT,
- "Error in loading moon texture %s\n", tpath.c_str() );
- exit(1);
+ FG_LOG( FG_GENERAL, FG_ALERT,
+ "Error in loading moon texture " << tpath );
+ exit(-1);
}
}
r += (-0.58 * cos(M - 2*D)
-0.46 * cos(2*D)
);
- fgPrintf(FG_GENERAL, FG_INFO, "Running moon update\n");
+ FG_LOG(FG_GENERAL, FG_INFO, "Running moon update");
xg = r * cos(lonecl) * cos(latecl);
yg = r * sin(lonecl) * cos(latecl);
zg = r * sin(latecl);
xglRotatef(((RAD_TO_DEG * ra)- 90.0), 0.0, 0.0, 1.0);
xglRotatef((RAD_TO_DEG * dec), 1.0, 0.0, 0.0);
- fgPrintf( FG_GENERAL, FG_INFO,
- "Ra = (%f), Dec= (%f)", (RAD_TO_DEG *ra), (RAD_TO_DEG *dec) );
+ FG_LOG( FG_GENERAL, FG_INFO,
+ "Ra = (" << (RAD_TO_DEG *ra)
+ << "), Dec= (" << (RAD_TO_DEG *dec) << ")" );
xglTranslatef(0.0, 58600.0, 0.0);
Object = gluNewQuadric();
gluQuadricTexture( Object, GL_TRUE );
#define _MOON_HXX_
#include <Aircraft/aircraft.hxx>
-#include <Debug/fg_debug.h>
#include <Include/fg_constants.h>
#include <Include/general.h>
#include <Main/views.hxx>
#include <XGL/xgl.h>
#include <Aircraft/aircraft.hxx>
-#include <Debug/fg_debug.h>
+#include <Debug/logstream.hxx>
#include <Flight/flight.hxx>
#include <Include/fg_constants.h>
#include <Main/views.hxx>
float theta;
int i;
- fgPrintf(FG_ASTRO, FG_INFO, " Generating the sky dome vertices.\n");
+ FG_LOG(FG_ASTRO, FG_INFO, " Generating the sky dome vertices.");
for ( i = 0; i < 12; i++ ) {
theta = (i * 30.0) * DEG_TO_RAD;
l = &cur_light_params;
- fgPrintf( FG_ASTRO, FG_INFO,
- " Generating the sky colors for each vertex.\n" );
+ FG_LOG( FG_ASTRO, FG_INFO,
+ " Generating the sky colors for each vertex." );
// setup for the possibility of sunset effects
sun_angle = l->sun_angle * RAD_TO_DEG;
// Initialize the sky structure and colors
void fgSkyInit( void ) {
- fgPrintf(FG_ASTRO, FG_INFO, "Initializing the sky\n");
+ FG_LOG( FG_ASTRO, FG_INFO, "Initializing the sky" );
fgSkyVerticesInit();
// $Log$
+// Revision 1.14 1998/11/06 21:17:39 curt
+// Converted to new logstream debugging facility. This allows release
+// builds with no messages at all (and no performance impact) by using
+// the -DFG_NDEBUG flag.
+//
// Revision 1.13 1998/10/20 18:28:30 curt
// Tweaked sunset/sunrise colors.
//
#include <GL/glut.h>
#include <XGL/xgl.h>
-#include <Debug/fg_debug.h>
+#include <Debug/logstream.hxx>
#include <Time/sunpos.hxx>
#include "solarsystem.hxx"
{
if (theSolarSystem)
{
- fgPrintf(FG_GENERAL, FG_EXIT, "Error: only one solarsystem allowed\n");
+ FG_LOG( FG_GENERAL, FG_ALERT, "Error: only one solarsystem allowed" );
+ exit(-1);
}
theSolarSystem = this;
ourSun = new Star(t);
#include <XGL/xgl.h>
#include <Aircraft/aircraft.hxx>
-#include <Debug/fg_debug.h>
+#include <Debug/logstream.hxx>
#include <Include/fg_constants.h>
#include <Misc/fgstream.hxx>
#include <Main/options.hxx>
// double ra_save1, decl_save1;
int i, j, starcount, count;
- fgPrintf( FG_ASTRO, FG_INFO, "Initializing stars\n");
+ FG_LOG( FG_ASTRO, FG_INFO, "Initializing stars" );
if ( FG_STAR_LEVELS < 4 ) {
- fgPrintf( FG_ASTRO, FG_EXIT, "Big whups in stars.cxx\n");
+ FG_LOG( FG_ASTRO, FG_ALERT, "Big whups in stars.cxx" );
+ exit(-1);
}
// build the full path name to the stars data base file
string path = current_options.get_fg_root() + "/Astro/stars" + ".gz";
- fgPrintf( FG_ASTRO, FG_INFO, " Loading stars from %s\n", path.c_str() );
+ FG_LOG( FG_ASTRO, FG_INFO, " Loading stars from " << path );
fg_gzifstream in( path );
- if ( ! in )
- fgPrintf( FG_ASTRO, FG_EXIT,
- "Cannot open star file: '%s'\n", path.c_str() );
+ if ( ! in ) {
+ FG_LOG( FG_ASTRO, FG_ALERT, "Cannot open star file: " << path );
+ exit(-1);
+ }
starcount = 0;
xglEndList();
- fgPrintf( FG_ASTRO, FG_INFO,
- " Loading %d stars brighter than %.2f\n",
- count, min_magnitude[i]);
+ FG_LOG( FG_ASTRO, FG_INFO,
+ " Loading " << count << " stars brighter than "
+ << min_magnitude[i] );
}
return 1; // OK, we got here because initialization worked.
// $Log$
+// Revision 1.21 1998/11/06 21:17:42 curt
+// Converted to new logstream debugging facility. This allows release
+// builds with no messages at all (and no performance impact) by using
+// the -DFG_NDEBUG flag.
+//
// Revision 1.20 1998/11/06 14:47:02 curt
// Changes to track Bernie's updates to fgstream.
//
#include <assert.h>
#include <stdlib.h>
-// #include <list>
-// #include <Include/fg_stl_config.h>
-
#include <Scenery/scenery.hxx>
-// #ifdef NEEDNAMESPACESTD
-// using namespace std;
-// #endif
-
#include "autopilot.hxx"
#include <Include/fg_constants.h>
-#include <Debug/fg_debug.h>
-
-
-// static list < double > alt_error_queue;
+#include <Debug/logstream.hxx>
// The below routines were copied right from hud.c ( I hate reinventing
{
fgAPDataPtr APData ;
- fgPrintf( FG_AUTOPILOT, FG_INFO, "Init AutoPilot Subsystem\n" );
+ FG_LOG( FG_AUTOPILOT, FG_INFO, "Init AutoPilot Subsystem" );
APData = (fgAPDataPtr)calloc(sizeof(fgAPData),1);
- if (APData == NULL) // I couldn't get the mem. Dying
- fgPrintf( FG_AUTOPILOT, FG_EXIT,"No ram for Autopilot. Dying.\n");
+ if (APData == NULL) {
+ // I couldn't get the mem. Dying
+ FG_LOG( FG_AUTOPILOT, FG_ALERT, "No ram for Autopilot. Dying.");
+ exit(-1);
+ }
APData->heading_hold = 0 ; // turn the heading hold off
APData->altitude_hold = 0 ; // turn the altitude hold off
// figure out how far off we are from desired heading
// Now it is time to deterime how far we should be rolled.
- fgPrintf( FG_AUTOPILOT, FG_DEBUG, "RelHeading: %f\n", RelHeading);
+ FG_LOG( FG_AUTOPILOT, FG_DEBUG, "RelHeading: " << RelHeading );
// Check if we are further from heading than the roll out point
// Compare Target roll to Current Roll, Generate Rel Roll
- fgPrintf( FG_COCKPIT, FG_BULK, "TargetRoll: %f\n", TargetRoll);
+ FG_LOG( FG_COCKPIT, FG_BULK, "TargetRoll: " << TargetRoll );
RelRoll = NormalizeDegrees(TargetRoll - fgAPget_roll());
APData->TargetHeading = fgAPget_heading();
}
- fgPrintf( FG_COCKPIT, FG_INFO, " fgAPSetHeading: (%d) %.2f\n",
- APData->heading_hold,
- APData->TargetHeading);
+ FG_LOG( FG_COCKPIT, FG_INFO, " fgAPSetHeading: ("
+ << APData->heading_hold << ") " << APData->TargetHeading );
}
// alt_error_queue.end() );
}
- fgPrintf( FG_COCKPIT, FG_INFO, " fgAPSetAltitude: (%d) %.2f\n",
- APData->altitude_hold,
- APData->TargetAltitude);
+ FG_LOG( FG_COCKPIT, FG_INFO, " fgAPSetAltitude: ("
+ << APData->altitude_hold << ") " << APData->TargetAltitude );
}
APData->speed_error_accum = 0.0;
}
- fgPrintf( FG_COCKPIT, FG_INFO, " fgAPSetAutoThrottle: (%d) %.2f\n",
- APData->auto_throttle,
- APData->TargetSpeed);
+ FG_LOG( FG_COCKPIT, FG_INFO, " fgAPSetAutoThrottle: ("
+ << APData->auto_throttle << ") " << APData->TargetSpeed );
}
void fgAPToggleTerrainFollow( void )
APData->alt_error_accum = 0.0;
}
- fgPrintf( FG_COCKPIT, FG_INFO, " fgAPSetTerrainFollow: (%d) %.2f\n",
- APData->terrain_follow,
- APData->TargetAGL);
+ FG_LOG( FG_COCKPIT, FG_INFO, " fgAPSetTerrainFollow: ("
+ << APData->terrain_follow << ") " << APData->TargetAGL );
}
double LinearExtrapolate( double x,double x1,double y1,double x2,double y2)
#include <string.h>
#include <Aircraft/aircraft.hxx>
-#include <Debug/fg_debug.h>
+#include <Debug/logstream.hxx>
#include <Include/fg_constants.h>
#include <Include/general.h>
#include <Main/options.hxx>
bool fgCockpitInit( fgAIRCRAFT *cur_aircraft )
{
- fgPrintf( FG_COCKPIT, FG_INFO, "Initializing cockpit subsystem\n");
+ FG_LOG( FG_COCKPIT, FG_INFO, "Initializing cockpit subsystem" );
// cockpit->code = 1; /* It will be aircraft dependent */
// cockpit->status = 0;
fgPanelInit();
}
- fgPrintf( FG_COCKPIT, FG_INFO,
- " Code %d Status %d\n",
- ac_cockpit->code(), ac_cockpit->status() );
+ FG_LOG( FG_COCKPIT, FG_INFO,
+ " Code " << ac_cockpit->code() << " Status "
+ << ac_cockpit->status() );
return true;
}
pview = ¤t_view;
- fgPrintf( FG_COCKPIT, FG_DEBUG,
- "Cockpit: code %d status %d\n",
- ac_cockpit->code(), ac_cockpit->status() );
+ FG_LOG( FG_COCKPIT, FG_DEBUG,
+ "Cockpit: code " << ac_cockpit->code() << " status "
+ << ac_cockpit->status() );
if ( current_options.get_hud_status() ) {
// This will check the global hud linked list pointer.
// $Log$
+// Revision 1.22 1998/11/06 21:17:45 curt
+// Converted to new logstream debugging facility. This allows release
+// builds with no messages at all (and no performance impact) by using
+// the -DFG_NDEBUG flag.
+//
// Revision 1.21 1998/11/02 23:04:02 curt
// HUD units now display in feet by default with meters being a command line
// option.
#endif
#include <Aircraft/aircraft.hxx>
-#include <Debug/fg_debug.h>
+#include <Debug/logstream.hxx>
#include <Include/fg_constants.h>
#include <Main/options.hxx>
#include <Math/fg_random.h>
instr_item *HIptr;
int index;
- fgPrintf( FG_COCKPIT, FG_INFO, "Initializing current aircraft HUD\n" );
+ FG_LOG( FG_COCKPIT, FG_INFO, "Initializing current aircraft HUD" );
HUD_deque.erase( HUD_deque.begin(), HUD_deque.end()); // empty the HUD deque
instr_item *HIptr;
int index;
- fgPrintf( FG_COCKPIT, FG_INFO, "Initializing current aircraft HUD\n" );
+ FG_LOG( FG_COCKPIT, FG_INFO, "Initializing current aircraft HUD" );
HUD_deque.erase( HUD_deque.begin(), HUD_deque.end());
}
// $Log$
+// Revision 1.27 1998/11/06 21:17:47 curt
+// Converted to new logstream debugging facility. This allows release
+// builds with no messages at all (and no performance impact) by using
+// the -DFG_NDEBUG flag.
+//
// Revision 1.26 1998/11/03 12:33:11 curt
// Display ft or m in mini-hud next to altitude.
//
#include <stdlib.h>
#include <string.h>
#include <Aircraft/aircraft.hxx>
-#include <Debug/fg_debug.h>
#include <Include/fg_constants.h>
#include <Math/fg_random.h>
#include <Math/mat3.h>
#include <stdlib.h>
#include <string.h>
#include <Aircraft/aircraft.hxx>
-#include <Debug/fg_debug.h>
#include <Include/fg_constants.h>
#include <Math/fg_random.h>
#include <Math/mat3.h>
#include <stdlib.h>
#include <string.h>
#include <Aircraft/aircraft.hxx>
-#include <Debug/fg_debug.h>
#include <Include/fg_constants.h>
#include <Math/fg_random.h>
#include <Math/mat3.h>
#include <stdlib.h>
#include <string.h>
#include <Aircraft/aircraft.hxx>
-#include <Debug/fg_debug.h>
#include <Include/fg_constants.h>
#include <Math/fg_random.h>
#include <Math/mat3.h>
#include <stdlib.h>
#include <string.h>
#include <Aircraft/aircraft.hxx>
-#include <Debug/fg_debug.h>
#include <Include/fg_constants.h>
#include <Math/fg_random.h>
#include <Math/mat3.h>
#include <stdlib.h>
#include <string.h>
#include <Aircraft/aircraft.hxx>
-#include <Debug/fg_debug.h>
#include <Include/fg_constants.h>
#include <Math/fg_random.h>
#include <Math/mat3.h>
#include <stdlib.h>
#include <string.h>
#include <Aircraft/aircraft.hxx>
-#include <Debug/fg_debug.h>
#include <Include/fg_constants.h>
#include <Math/fg_random.h>
#include <Math/mat3.h>
#include <stdlib.h>
#include <string.h>
#include <Aircraft/aircraft.hxx>
-#include <Debug/fg_debug.h>
#include <Include/fg_constants.h>
#include <Math/fg_random.h>
#include <Math/mat3.h>
#include <math.h>
#include <Aircraft/aircraft.hxx>
-#include <Debug/fg_debug.h>
#include <Main/options.hxx>
#include <Main/views.hxx>
// strcat(tpath, "arthor.rgb");
// if ( (imag = ImageLoad(tpath)) == NULL ){
- // fgPrintf( FG_COCKPIT, FG_EXIT,
+ // fgPrintf( FG_COCKPIT, FG_ALERT,
// "Error loading cockpit texture %s\n", tpath );
+ // exit(-1);
// }
xglPixelStorei(GL_UNPACK_ROW_LENGTH, 256);
/* $Log$
+/* Revision 1.9 1998/11/06 21:18:01 curt
+/* Converted to new logstream debugging facility. This allows release
+/* builds with no messages at all (and no performance impact) by using
+/* the -DFG_NDEBUG flag.
+/*
/* Revision 1.8 1998/10/16 23:27:37 curt
/* C++-ifying.
/*
#include "flight.hxx"
#include "LaRCsim.hxx"
-#include <Debug/fg_debug.h>
+#include <Debug/logstream.hxx>
#include <Flight/LaRCsim/ls_interface.h>
#include <Include/fg_constants.h>
#include <Math/fg_geodesy.hxx>
double save_alt = 0.0;
int result;
- fgPrintf(FG_FLIGHT,FG_INFO,"Initializing flight model\n");
+ FG_LOG( FG_FLIGHT ,FG_INFO, "Initializing flight model" );
if ( model == FG_SLEW ) {
// fgSlewInit(dt);
fgFlight_2_LaRCsim(f); /* translate FG to LaRCsim structure */
fgLaRCsimInit(dt);
- fgPrintf( FG_FLIGHT, FG_INFO, "FG pos = %.2f\n", FG_Latitude );
+ FG_LOG( FG_FLIGHT, FG_INFO, "FG pos = " << FG_Latitude );
fgLaRCsim_2_Flight(f); /* translate LaRCsim back to FG structure */
/* but lets restore our original bogus altitude when we are done */
FG_Altitude = save_alt;
}
} else {
- fgPrintf( FG_FLIGHT, FG_WARN,
- "Unimplemented flight model == %d\n", model );
+ FG_LOG( FG_FLIGHT, FG_WARN,
+ "Unimplemented flight model == " << model );
}
result = 1;
} else if ( model == FG_LARCSIM ) {
fgLaRCsimUpdate(f, multiloop);
} else {
- fgPrintf( FG_FLIGHT, FG_WARN,
- "Unimplemented flight model == %d\n", model );
+ FG_LOG( FG_FLIGHT, FG_WARN,
+ "Unimplemented flight model == " << model );
}
end_elev = FG_Altitude;
// $Log$
+// Revision 1.3 1998/11/06 21:18:03 curt
+// Converted to new logstream debugging facility. This allows release
+// builds with no messages at all (and no performance impact) by using
+// the -DFG_NDEBUG flag.
+//
// Revision 1.2 1998/10/16 23:27:40 curt
// C++-ifying.
//
#endif
#include <Aircraft/aircraft.hxx>
-#include <Debug/fg_debug.h>
+#include <Debug/logstream.hxx>
#if defined( ENABLE_LINUX_JOYSTICK )
# include <Joystick/js.hxx>
// Initialize the joystick(s)
int fgJoystickInit( void ) {
- fgPrintf( FG_INPUT, FG_INFO, "Initializing joystick\n");
+ FG_LOG( FG_INPUT, FG_INFO, "Initializing joystick" );
#if defined( ENABLE_LINUX_JOYSTICK )
js0->setDeadBand( 0, 0.1 );
js0->setDeadBand( 1, 0.1 );
- fgPrintf ( FG_INPUT, FG_INFO,
- " Joystick 0 detected with %d axes\n",
- js0->getNumAxes() );
+ FG_LOG ( FG_INPUT, FG_INFO,
+ " Joystick 0 detected with " << js0->getNumAxes()
+ << " axes" );
}
if ( js1->notWorking () ) {
js1->setDeadBand( 0, 0.1 );
js1->setDeadBand( 1, 0.1 );
- fgPrintf ( FG_INPUT, FG_INFO,
- " Joystick 1 detected with %d axes\n",
- js1->getNumAxes() );
+ FG_LOG ( FG_INPUT, FG_INFO,
+ " Joystick 1 detected with " << js1->getNumAxes()
+ << " axes" );
}
if ( js0->notWorking() && js1->notWorking() ) {
- fgPrintf ( FG_INPUT, FG_INFO, " No joysticks detected\n" );
+ FG_LOG ( FG_INPUT, FG_INFO, " No joysticks detected" );
return 0;
}
// $Log$
+// Revision 1.5 1998/11/06 21:18:04 curt
+// Converted to new logstream debugging facility. This allows release
+// builds with no messages at all (and no performance impact) by using
+// the -DFG_NDEBUG flag.
+//
// Revision 1.4 1998/10/27 02:14:32 curt
// Changes to support GLUT joystick routines as fall back.
//
#include <Astro/sky.hxx>
#include <Autopilot/autopilot.hxx>
#include <Cockpit/hud.hxx>
-#include <Debug/fg_debug.h>
+#include <Debug/logstream.hxx>
#include <GUI/gui.h>
#include <Include/fg_constants.h>
#include <Objects/material.hxx>
v = ¤t_view;
w = ¤t_weather;
- fgPrintf( FG_INPUT, FG_DEBUG, "Key hit = %d", k);
+ FG_LOG( FG_INPUT, FG_DEBUG, "Key hit = " << k );
puKeyboard(k, PU_DOWN );
if ( GLUT_ACTIVE_ALT && glutGetModifiers() ) {
- fgPrintf( FG_INPUT, FG_DEBUG, " SHIFTED\n");
+ FG_LOG( FG_INPUT, FG_DEBUG, " SHIFTED" );
switch (k) {
case 1: // Ctrl-A key
fgAPToggleAltitude();
return;
}
} else {
- fgPrintf( FG_INPUT, FG_DEBUG, "\n");
+ FG_LOG( FG_INPUT, FG_DEBUG, "" );
switch (k) {
case 50: // numeric keypad 2
controls.move_elevator(-0.05);
case 112: // p key
t->pause = !t->pause;
// printf position and attitude information
- fgPrintf( FG_INPUT, FG_INFO,
- "Lon = %.4f Lat = %.4f Altitude = %.1f\n",
- FG_Longitude * RAD_TO_DEG,
- FG_Latitude * RAD_TO_DEG,
- FG_Altitude * FEET_TO_METER);
- fgPrintf( FG_INPUT, FG_INFO,
- "Heading = %.2f Roll = %.2f Pitch = %.2f\n",
- FG_Psi * RAD_TO_DEG,
- FG_Phi * RAD_TO_DEG,
- FG_Theta * RAD_TO_DEG);
+ FG_LOG( FG_INPUT, FG_INFO,
+ "Lon = " << FG_Longitude * RAD_TO_DEG
+ << " Lat = " << FG_Latitude * RAD_TO_DEG
+ << " Altitude = " << FG_Altitude * FEET_TO_METER );
+ FG_LOG( FG_INPUT, FG_INFO,
+ "Heading = " << FG_Psi * RAD_TO_DEG
+ << " Roll = " << FG_Phi * RAD_TO_DEG
+ << " Pitch = " << FG_Theta * RAD_TO_DEG );
return;
case 116: // t key
t->warp_delta += 30;
// if( fg_DebugOutput ) {
// fclose( fg_DebugOutput );
// }
- fgPrintf( FG_INPUT, FG_EXIT,
- "Program exiting normally at user request.\n");
+ FG_LOG( FG_INPUT, FG_ALERT,
+ "Program exiting normally at user request." );
+ exit(-1);
}
}
}
v = ¤t_view;
- fgPrintf( FG_INPUT, FG_DEBUG, "Special key hit = %d", k);
+ FG_LOG( FG_INPUT, FG_DEBUG, "Special key hit = " << k );
puKeyboard(k + PU_KEY_GLUT_SPECIAL_OFFSET, PU_DOWN);
if ( GLUT_ACTIVE_SHIFT && glutGetModifiers() ) {
- fgPrintf( FG_INPUT, FG_DEBUG, " SHIFTED\n");
+ FG_LOG( FG_INPUT, FG_DEBUG, " SHIFTED" );
switch (k) {
case GLUT_KEY_END: // numeric keypad 1
v->goal_view_offset = FG_PI * 0.75;
return;
}
} else {
- fgPrintf( FG_INPUT, FG_DEBUG, "\n");
+ FG_LOG( FG_INPUT, FG_DEBUG, "" );
switch (k) {
case GLUT_KEY_F8: // F8 toggles fog ... off fastest nicest...
current_options.cycle_fog();
if ( current_options.get_fog() == fgOPTIONS::FG_FOG_DISABLED ) {
- fgPrintf( FG_INPUT, FG_INFO, "Fog disabled\n" );
+ FG_LOG( FG_INPUT, FG_INFO, "Fog disabled" );
} else if ( current_options.get_fog() ==
fgOPTIONS::FG_FOG_FASTEST )
{
- fgPrintf( FG_INPUT, FG_INFO,
- "Fog enabled, hint set to fastest\n" );
+ FG_LOG( FG_INPUT, FG_INFO,
+ "Fog enabled, hint set to fastest" );
} else if ( current_options.get_fog() ==
fgOPTIONS::FG_FOG_NICEST )
{
- fgPrintf( FG_INPUT, FG_INFO,
- "Fog enabled, hint set to nicest\n" );
+ FG_LOG( FG_INPUT, FG_INFO,
+ "Fog enabled, hint set to nicest" );
}
return;
current_options.get_textures() ?
current_options.set_textures(false) :
current_options.set_textures(true);
- fgPrintf( FG_INPUT, FG_INFO, "Toggling texture\n" );
+ FG_LOG( FG_INPUT, FG_INFO, "Toggling texture" );
} else {
- fgPrintf( FG_INPUT, FG_INFO,
- "No textures loaded, cannot toggle\n" );
+ FG_LOG( FG_INPUT, FG_INFO,
+ "No textures loaded, cannot toggle" );
}
return;
case GLUT_KEY_F10: // F10 toggles menu on and off...
- fgPrintf(FG_INPUT, FG_INFO, "Invoking call back function");
+ FG_LOG(FG_INPUT, FG_INFO, "Invoking call back function");
hideMenuButton ->
setValue ((int) !(hideMenuButton -> getValue() ) );
hideMenuButton -> invokeCallback();
// $Log$
+// Revision 1.32 1998/11/06 21:18:06 curt
+// Converted to new logstream debugging facility. This allows release
+// builds with no messages at all (and no performance impact) by using
+// the -DFG_NDEBUG flag.
+//
// Revision 1.31 1998/11/02 18:25:37 curt
// Check for __CYGWIN__ (b20) as well as __CYGWIN32__ (pre b20 compilers)
// Other misc. tweaks.
#include <Autopilot/autopilot.hxx>
#include <Cockpit/cockpit.hxx>
-#include <Debug/fg_debug.h>
+#include <Debug/logstream.hxx>
#include <GUI/gui.h>
#include <Joystick/joystick.hxx>
#include <Math/fg_geodesy.hxx>
g = &general;
t = &cur_time_params;
- fgPrintf( FG_ALL, FG_DEBUG, "Running Main Loop\n");
- fgPrintf( FG_ALL, FG_DEBUG, "======= ==== ====\n");
+ FG_LOG( FG_ALL, FG_DEBUG, "Running Main Loop");
+ FG_LOG( FG_ALL, FG_DEBUG, "======= ==== ====");
fgWeatherUpdate();
fgFlightModelSetAltitude( current_options.get_flight_model(), f,
scenery.cur_elev + alt_adjust_m );
- fgPrintf( FG_ALL, FG_BULK,
- "<*> resetting altitude to %.0f meters\n",
- FG_Altitude * FEET_TO_METER);
+ FG_LOG( FG_ALL, FG_BULK,
+ "<*> resetting altitude to "
+ << FG_Altitude * FEET_TO_METER << " meters" );
}
FG_Runway_altitude = scenery.cur_elev * METER_TO_FEET;
}
// Get elapsed time for this past frame
elapsed = fgGetTimeInterval();
- fgPrintf( FG_ALL, FG_BULK,
- "Time interval is = %d, previous remainder is = %d\n",
- elapsed, remainder);
+ FG_LOG( FG_ALL, FG_BULK,
+ "Time interval is = " << elapsed
+ << ", previous remainder is = " << remainder );
// Calculate frame rate average
if ( elapsed > 0.0 ) {
}
// Calculate model iterations needed for next frame
- fgPrintf( FG_ALL, FG_DEBUG,
- "--> Frame rate is = %.2f\n", g->frame_rate);
+ FG_LOG( FG_ALL, FG_DEBUG,
+ "--> Frame rate is = " << g->frame_rate );
elapsed += remainder;
multi_loop = (int)(((float)elapsed * 0.001) * DEFAULT_MODEL_HZ);
remainder = elapsed - ((multi_loop*1000) / DEFAULT_MODEL_HZ);
- fgPrintf( FG_ALL, FG_BULK,
- "Model iterations needed = %d, new remainder = %d\n",
- multi_loop, remainder);
+ FG_LOG( FG_ALL, FG_BULK,
+ "Model iterations needed = " << multi_loop
+ << ", new remainder = " << remainder );
/* printf("right before fm - ground = %.2f runway = %.2f alt = %.2f\n",
scenery.cur_elev,
// redraw display
fgRenderFrame();
- fgPrintf( FG_ALL, FG_DEBUG, "\n");
+ FG_LOG( FG_ALL, FG_DEBUG, "" );
}
"/Sounds/intro.mp3";
string command = "(touch " + lockfile + "; mpg123 " + mp3file +
"> /dev/null 2>&1; /bin/rm " + lockfile + ") &";
- fgPrintf( FG_GENERAL, FG_INFO,
- "Starting intro music: %s\n", mp3file.c_str() );
+ FG_LOG( FG_GENERAL, FG_INFO,
+ "Starting intro music: " << mp3file );
system ( command.c_str() );
}
#endif
// a subsystem to flight gear, its initialization call should
// located in this routine.
if( !fgInitSubsystems()) {
- fgPrintf( FG_GENERAL, FG_EXIT,
- "Subsystem initializations failed ...\n" );
+ FG_LOG( FG_GENERAL, FG_ALERT,
+ "Subsystem initializations failed ..." );
+ exit(-1);
}
idle_state++;
string lockfile = "/tmp/mpg123.running";
struct stat stat_buf;
- fgPrintf( FG_GENERAL, FG_INFO,
- "Waiting for mpg123 player to finish ...\n" );
+ FG_LOG( FG_GENERAL, FG_INFO,
+ "Waiting for mpg123 player to finish ..." );
while ( stat(lockfile.c_str(), &stat_buf) == 0 ) {
// file exist, wait ...
sleep(1);
- fgPrintf( FG_GENERAL, FG_INFO, ".");
+ FG_LOG( FG_GENERAL, FG_INFO, ".");
}
- fgPrintf( FG_GENERAL, FG_INFO, "\n");
+ FG_LOG( FG_GENERAL, FG_INFO, "");
}
#endif // WIN32
_control87(MCW_EM, MCW_EM); /* defined in float.h */
#endif
- // Initialize the debugging output system
- fgInitDebug();
+ // Initialize the [old] debugging output system
+ // fgInitDebug();
- fgPrintf(FG_GENERAL, FG_INFO, "Flight Gear: Version %s\n\n", VERSION);
+ FG_LOG( FG_GENERAL, FG_INFO, "Flight Gear: Version" << VERSION << endl );
// Attempt to locate and parse a config file
// First check fg_root
// Something must have gone horribly wrong with the command
// line parsing or maybe the user just requested help ... :-)
current_options.usage();
- fgPrintf( FG_GENERAL, FG_EXIT, "\nExiting ...\n");
+ FG_LOG( FG_GENERAL, FG_ALERT, "\nExiting ...");
+ exit(-1);
}
// Initialize the Window/Graphics environment.
if( !fgGlutInit(&argc, argv) ) {
- fgPrintf( FG_GENERAL, FG_EXIT, "GLUT initialization failed ...\n" );
+ FG_LOG( FG_GENERAL, FG_ALERT, "GLUT initialization failed ..." );
+ exit(-1);
}
// Initialize the various GLUT Event Handlers.
if( !fgGlutInitEvents() ) {
- fgPrintf( FG_GENERAL, FG_EXIT,
- "GLUT event handler initialization failed ...\n" );
+ FG_LOG( FG_GENERAL, FG_ALERT,
+ "GLUT event handler initialization failed ..." );
+ exit(-1);
}
// First do some quick general initializations
if( !fgInitGeneral()) {
- fgPrintf( FG_GENERAL, FG_EXIT,
- "General initializations failed ...\n" );
+ FG_LOG( FG_GENERAL, FG_ALERT,
+ "General initializations failed ..." );
+ exit(-1);
}
// Init the user interface (we need to do this before passing off
// $Log$
+// Revision 1.63 1998/11/06 21:18:08 curt
+// Converted to new logstream debugging facility. This allows release
+// builds with no messages at all (and no performance impact) by using
+// the -DFG_NDEBUG flag.
+//
// Revision 1.62 1998/10/27 02:14:35 curt
// Changes to support GLUT joystick routines as fall back.
//
#include <Astro/solarsystem.hxx>
#include <Autopilot/autopilot.hxx>
#include <Cockpit/cockpit.hxx>
-#include <Debug/fg_debug.h>
+// #include <Debug/fg_debug.h>
+#include <Debug/logstream.hxx>
#include <Joystick/joystick.hxx>
#include <Math/fg_geodesy.hxx>
#include <Math/fg_random.h>
fgAIRPORTS airports;
fgAIRPORT a;
- fgPrintf( FG_GENERAL, FG_INFO,
- "Attempting to set starting position from airport code %s.\n",
- id.c_str() );
+ FG_LOG( FG_GENERAL, FG_INFO,
+ "Attempting to set starting position from airport code "
+ << id );
airports.load("apt_simple");
if ( ! airports.search( id, &a ) ) {
- fgPrintf( FG_GENERAL, FG_EXIT,
- "Failed to find %s in database.\n", id.c_str() );
+ FG_LOG( FG_GENERAL, FG_ALERT,
+ "Failed to find " << id << " in database." );
+ exit(-1);
} else {
FG_Longitude = a.longitude * DEG_TO_RAD;
FG_Latitude = a.latitude * DEG_TO_RAD;
FG_Altitude = current_options.get_altitude() * METER_TO_FEET;
FG_Runway_altitude = FG_Altitude - 3.758099;
- fgPrintf( FG_GENERAL, FG_INFO,
- "Initial position is: (%.4f, %.4f, %.2f)\n",
- FG_Longitude * RAD_TO_DEG, FG_Latitude * RAD_TO_DEG,
- FG_Altitude * FEET_TO_METER);
+ FG_LOG( FG_GENERAL, FG_INFO,
+ "Initial position is: ("
+ << (FG_Longitude * RAD_TO_DEG) << ", "
+ << (FG_Latitude * RAD_TO_DEG) << ", "
+ << (FG_Altitude * FEET_TO_METER) << ")" );
return(1);
}
g = &general;
- fgPrintf( FG_GENERAL, FG_INFO, "General Initialization\n" );
- fgPrintf( FG_GENERAL, FG_INFO, "======= ==============\n" );
+ // set default log levels
+ fglog().setLogLevels( FG_ALL, FG_INFO );
+
+ FG_LOG( FG_GENERAL, FG_INFO, "General Initialization" );
+ FG_LOG( FG_GENERAL, FG_INFO, "======= ==============" );
g->glVendor = (char *)glGetString ( GL_VENDOR );
g->glRenderer = (char *)glGetString ( GL_RENDERER );
root = current_options.get_fg_root();
if ( ! root.length() ) {
// No root path set? Then bail ...
- fgPrintf( FG_GENERAL, FG_EXIT, "%s %s\n",
- "Cannot continue without environment variable FG_ROOT",
- "being defined.");
+ FG_LOG( FG_GENERAL, FG_ALERT,
+ "Cannot continue without environment variable FG_ROOT"
+ << "being defined." );
+ exit(-1);
}
- fgPrintf( FG_GENERAL, FG_INFO, "FG_ROOT = %s\n\n", root.c_str() );
+ FG_LOG( FG_GENERAL, FG_INFO, "FG_ROOT = " << root << endl );
// prime the frame rate counter pump
for ( i = 0; i < FG_FRAME_RATE_HISTORY; i++ ) {
t = &cur_time_params;
v = ¤t_view;
- fgPrintf( FG_GENERAL, FG_INFO, "Initialize Subsystems\n");
- fgPrintf( FG_GENERAL, FG_INFO, "========== ==========\n");
+ FG_LOG( FG_GENERAL, FG_INFO, "Initialize Subsystems");
+ FG_LOG( FG_GENERAL, FG_INFO, "========== ==========");
// seed the random number generater
fg_srandom();
if ( fgSceneryInit() ) {
// Scenery initialized ok.
} else {
- fgPrintf( FG_GENERAL, FG_EXIT, "Error in Scenery initialization!\n" );
+ FG_LOG( FG_GENERAL, FG_ALERT, "Error in Scenery initialization!" );
+ exit(-1);
}
if( fgTileMgrInit() ) {
// Load the local scenery data
fgTileMgrUpdate();
} else {
- fgPrintf( FG_GENERAL, FG_EXIT,
- "Error in Tile Manager initialization!\n" );
+ FG_LOG( FG_GENERAL, FG_ALERT, "Error in Tile Manager initialization!" );
+ exit(-1);
}
// calculalate a cartesian point somewhere along the line between
FG_Altitude = FG_Runway_altitude + 3.758099;
}
- fgPrintf( FG_GENERAL, FG_INFO,
- "Updated position (after elevation adj): (%.4f, %.4f, %.2f)\n",
- FG_Latitude * RAD_TO_DEG, FG_Longitude * RAD_TO_DEG,
- FG_Altitude * FEET_TO_METER);
+ FG_LOG( FG_GENERAL, FG_INFO,
+ "Updated position (after elevation adj): ("
+ << (FG_Latitude * RAD_TO_DEG) << ", "
+ << (FG_Longitude * RAD_TO_DEG) << ", "
+ << (FG_Altitude * FEET_TO_METER) << ")" );
// end of thing that I just stuck in that I should probably move
// The following section sets up the flight model EOM parameters
fgTimeUpdate(f, t);
// Initialize view parameters
+ FG_LOG( FG_GENERAL, FG_DEBUG, "Before v->init()");
v->Init();
+ FG_LOG( FG_GENERAL, FG_DEBUG, "After v->init()");
v->UpdateViewMath(f);
v->UpdateWorldToEye(f);
// Build the solar system
//fgSolarSystemInit(*t);
- fgPrintf(FG_GENERAL, FG_INFO, "Building SolarSystem\n");
+ FG_LOG(FG_GENERAL, FG_INFO, "Building SolarSystem");
SolarSystem::theSolarSystem = new SolarSystem(t);
// Initialize the Stars subsystem
if( fgStarsInit() ) {
// Stars initialized ok.
} else {
- fgPrintf( FG_GENERAL, FG_EXIT, "Error in Stars initialization!\n" );
+ FG_LOG( FG_GENERAL, FG_ALERT, "Error in Stars initialization!" );
+ exit(-1);
}
// Initialize the planetary subsystem
if( fgCockpitInit( ¤t_aircraft )) {
// Cockpit initialized ok.
} else {
- fgPrintf( FG_GENERAL, FG_EXIT, "Error in Cockpit initialization!\n" );
+ FG_LOG( FG_GENERAL, FG_ALERT, "Error in Cockpit initialization!" );
+ exit(-1);
}
// Initialize the "sky"
FG_Altitude = FG_Runway_altitude + 3.758099;
}
- fgPrintf( FG_GENERAL, FG_INFO,
- "Updated position (after elevation adj): (%.4f, %.4f, %.2f)\n",
- FG_Latitude * RAD_TO_DEG, FG_Longitude * RAD_TO_DEG,
- FG_Altitude * FEET_TO_METER);
+ FG_LOG( FG_GENERAL, FG_INFO,
+ "Updated position (after elevation adj): ("
+ << (FG_Latitude * RAD_TO_DEG) << ", "
+ << (FG_Longitude * RAD_TO_DEG) << ", "
+ << (FG_Altitude * FEET_TO_METER) << ")" );
// end of thing that I just stuck in that I should probably move
// Joystick support
if ( fgJoystickInit() ) {
// Joystick initialized ok.
} else {
- fgPrintf( FG_GENERAL, FG_ALERT, "Error in Joystick initialization!\n" );
+ FG_LOG( FG_GENERAL, FG_ALERT, "Error in Joystick initialization!" );
}
// Autopilot init added here, by Jeff Goeke-Smith
fgAPInit(¤t_aircraft);
- fgPrintf(FG_GENERAL, FG_INFO,"\n");
+ FG_LOG( FG_GENERAL, FG_INFO, endl);
return(1);
}
// $Log$
+// Revision 1.47 1998/11/06 21:18:10 curt
+// Converted to new logstream debugging facility. This allows release
+// builds with no messages at all (and no performance impact) by using
+// the -DFG_NDEBUG flag.
+//
// Revision 1.46 1998/10/27 02:14:38 curt
// Changes to support GLUT joystick routines as fall back.
//
#include <string.h>
#include <string>
-#include <Debug/fg_debug.h>
+#include <Debug/logstream.hxx>
#include <Flight/flight.hxx>
#include <Include/fg_constants.h>
#include <Misc/fgstream.hxx>
// printf("flight model = %s\n", fm);
if ( fm == "slew" ) {
- return(FG_SLEW);
+ return FG_SLEW;
} else if ( (fm == "larcsim") || (fm == "LaRCsim") ) {
- return(FG_LARCSIM);
+ return FG_LARCSIM;
} else {
- fgPrintf( FG_GENERAL, FG_EXIT, "Unknown flight model = %s\n",
- fm.c_str());
+ FG_LOG( FG_GENERAL, FG_ALERT, "Unknown flight model = " << fm );
+ exit(-1);
}
// we'll never get here, but it makes the compiler happy.
- return(-1);
+ return -1;
}
} else if ( arg == "--hud-culled" ) {
tris_or_culled = 1;
} else {
- fgPrintf( FG_GENERAL, FG_EXIT, "Unknown option '%s'\n",
- arg.c_str() );
- return(FG_OPTIONS_ERROR);
+ FG_LOG( FG_GENERAL, FG_ALERT, "Unknown option '" << arg << "'" );
+ return FG_OPTIONS_ERROR;
}
- return(FG_OPTIONS_OK);
+ return FG_OPTIONS_OK;
}
int i = 1;
int result;
- fgPrintf(FG_GENERAL, FG_INFO, "Processing command line arguments\n");
+ FG_LOG(FG_GENERAL, FG_INFO, "Processing command line arguments");
while ( i < argc ) {
- fgPrintf(FG_GENERAL, FG_DEBUG, "argv[%d] = %s\n", i, argv[i]);
+ FG_LOG( FG_GENERAL, FG_DEBUG, "argv[" << i << "] = " << argv[i] );
result = parse_option(argv[i]);
if ( (result == FG_OPTIONS_HELP) || (result == FG_OPTIONS_ERROR) ) {
if ( !in )
return(FG_OPTIONS_ERROR);
- fgPrintf( FG_GENERAL, FG_INFO, "Processing config file: %s\n",
- path.c_str() );
+ FG_LOG( FG_GENERAL, FG_INFO, "Processing config file: " << path );
in >> skipcomment;
while ( !in.eof() )
getline( in, line );
if ( parse_option( line ) == FG_OPTIONS_ERROR ) {
- fgPrintf( FG_GENERAL, FG_EXIT,
- "Config file parse error: %s '%s'\n",
- path.c_str(), line.c_str() );
+ FG_LOG( FG_GENERAL, FG_ALERT,
+ "Config file parse error: " << path << " '"
+ << line << "'" );
+ exit(-1);
}
in >> skipcomment;
}
// $Log$
+// Revision 1.29 1998/11/06 21:18:12 curt
+// Converted to new logstream debugging facility. This allows release
+// builds with no messages at all (and no performance impact) by using
+// the -DFG_NDEBUG flag.
+//
// Revision 1.28 1998/11/06 14:47:03 curt
// Changes to track Bernie's updates to fgstream.
//
#include <string.h>
-#include <Debug/fg_debug.h>
+#include <Debug/logstream.hxx>
#include <Main/options.hxx>
#include <Objects/texload.h>
string tpath, fg_tpath;
int width, height;
- fgPrintf( FG_GENERAL, FG_INFO, "Initializing splash screen\n");
+ FG_LOG( FG_GENERAL, FG_INFO, "Initializing splash screen" );
#ifdef GL_VERSION_1_1
xglGenTextures(1, &splash_texid);
xglBindTexture(GL_TEXTURE_2D, splash_texid);
if ( (splash_texbuf =
read_rgb_texture(fg_tpath.c_str(), &width, &height)) == NULL )
{
- fgPrintf( FG_GENERAL, FG_EXIT,
- "Error in loading splash screen texture %s\n",
- tpath.c_str() );
+ FG_LOG( FG_GENERAL, FG_ALERT,
+ "Error in loading splash screen texture " << tpath );
+ exit(-1);
}
}
// $Log$
+// Revision 1.7 1998/11/06 21:18:14 curt
+// Converted to new logstream debugging facility. This allows release
+// builds with no messages at all (and no performance impact) by using
+// the -DFG_NDEBUG flag.
+//
// Revision 1.6 1998/10/17 01:34:25 curt
// C++ ifying ...
//
#endif
#include <Aircraft/aircraft.hxx>
-#include <Debug/fg_debug.h>
+#include <Debug/logstream.hxx>
#include <Include/fg_constants.h>
#include <Math/mat3.h>
#include <Math/point3d.hxx>
// Initialize a view structure
void fgVIEW::Init( void ) {
- fgPrintf( FG_VIEW, FG_INFO, "Initializing View parameters\n");
+ FG_LOG( FG_VIEW, FG_INFO, "Initializing View parameters" );
view_offset = 0.0;
goal_view_offset = 0.0;
abs_view_pos = fgPolarToCart3d(p);
view_pos = abs_view_pos - scenery.center;
- fgPrintf( FG_VIEW, FG_DEBUG, "Absolute view pos = %.4f, %.4f, %.4f\n",
- abs_view_pos.x(), abs_view_pos.y(), abs_view_pos.z());
- fgPrintf( FG_VIEW, FG_DEBUG, "Relative view pos = %.4f, %.4f, %.4f\n",
- view_pos.x(), view_pos.y(), view_pos.z());
+ FG_LOG( FG_VIEW, FG_DEBUG, "Absolute view pos = "
+ << abs_view_pos.x() << ", "
+ << abs_view_pos.y() << ", "
+ << abs_view_pos.z() );
+ FG_LOG( FG_VIEW, FG_DEBUG, "Relative view pos = "
+ << view_pos.x() << ", " << view_pos.y() << ", " << view_pos.z() );
// Derive the LOCAL aircraft rotation matrix (roll, pitch, yaw)
// from FG_T_local_to_body[3][3]
// $Log$
+// Revision 1.25 1998/11/06 21:18:15 curt
+// Converted to new logstream debugging facility. This allows release
+// builds with no messages at all (and no performance impact) by using
+// the -DFG_NDEBUG flag.
+//
// Revision 1.24 1998/10/18 01:17:19 curt
// Point3D tweaks.
//
#include <string>
#include "Include/fg_stl_config.h"
-#include <Debug/fg_debug.h>
+#include <Debug/logstream.hxx>
#include <Main/options.hxx>
#include <Misc/fgstream.hxx>
#include <Main/views.hxx>
m.alpha = 0;
else
{
- fgPrintf( FG_TERRAIN, FG_INFO,
- "Bad alpha value '%s'\n", token.c_str() );
+ FG_LOG( FG_TERRAIN, FG_INFO, "Bad alpha value " << token );
}
}
else if ( token[0] == '}' )
read_rgb_texture(fg_tpath.c_str(), &width, &height))
== NULL )
{
- fgPrintf( FG_GENERAL, FG_EXIT,
- "Error in loading texture %s\n",
- tpath.c_str() );
- return;
+ FG_LOG( FG_GENERAL, FG_ALERT,
+ "Error in loading texture " << tpath );
+ exit(-1);
}
}
read_alpha_texture(fg_tpath.c_str(), &width, &height))
== NULL )
{
- fgPrintf( FG_GENERAL, FG_EXIT,
- "Error in loading texture %s\n",
- tpath.c_str() );
- return;
+ FG_LOG( FG_GENERAL, FG_ALERT,
+ "Error in loading texture " << tpath );
+ exit(-1);
}
}
// build the path name to the material db
string mpath = current_options.get_fg_root() + "/materials";
fg_gzifstream in( mpath );
- if ( ! in )
- fgPrintf( FG_GENERAL, FG_EXIT, "Cannot open file: %s\n",
- mpath.c_str() );
+ if ( ! in ) {
+ FG_LOG( FG_GENERAL, FG_ALERT, "Cannot open file: " << mpath );
+ exit(-1);
+ }
while ( ! in.eof() ) {
// printf("%s", line);
// $Log$
+// Revision 1.10 1998/11/06 21:18:17 curt
+// Converted to new logstream debugging facility. This allows release
+// builds with no messages at all (and no performance impact) by using
+// the -DFG_NDEBUG flag.
+//
// Revision 1.9 1998/11/06 14:47:05 curt
// Changes to track Bernie's updates to fgstream.
//
using namespace std;
#endif
-#include <Debug/fg_debug.h>
+#include <Debug/logstream.hxx>
#include <Include/fg_constants.h>
#include <Include/fg_zlib.h>
#include <Main/options.hxx>
in.open( path + ".obj" );
if ( ! in )
{
- fgPrintf( FG_TERRAIN, FG_ALERT,
- "Cannot open file: %s\n", path.c_str() );
+ FG_LOG( FG_TERRAIN, FG_ALERT, "Cannot open file: " << path );
return 0;
}
}
>> normals[vncount][2];
vncount++;
} else {
- fgPrintf( FG_TERRAIN, FG_EXIT,
- "Read too many vertex normals ... dying :-(\n");
+ FG_LOG( FG_TERRAIN, FG_ALERT,
+ "Read too many vertex normals ... dying :-(" );
+ exit(-1);
}
}
else if ( token[0] == 'v' )
>> t->nodes[t->ncount][2];
t->ncount++;
} else {
- fgPrintf( FG_TERRAIN, FG_EXIT,
- "Read too many nodes ... dying :-(\n");
+ FG_LOG( FG_TERRAIN, FG_ALERT,
+ "Read too many nodes ... dying :-(");
+ exit(-1);
}
}
else if ( token == "usemtl" )
// find this material in the properties list
if ( ! material_mgr.find( material, fragment.material_ptr )) {
- fgPrintf( FG_TERRAIN, FG_ALERT,
- "Ack! unknown usemtl name = %s in %s\n",
- material.c_str(), path.c_str() );
+ FG_LOG( FG_TERRAIN, FG_ALERT,
+ "Ack! unknown usemtl name = " << material
+ << " in " << path );
}
// initialize the fragment transformation matrix
last2 = n2;
}
} else {
- fgPrintf( FG_TERRAIN, FG_WARN, "Unknown token in %s = %s\n",
- path.c_str(), token.c_str() );
+ FG_LOG( FG_TERRAIN, FG_WARN, "Unknown token in "
+ << path << " = " << token );
}
// eat comments and blank lines before start of while loop so
*/
stopwatch.stop();
- fgPrintf( FG_TERRAIN, FG_INFO, "Loaded %s in %f seconds\n",
- path.c_str(), stopwatch.elapsedSeconds() );
+ FG_LOG( FG_TERRAIN, FG_INFO,
+ "Loaded " << path << " in "
+ << stopwatch.elapsedSeconds() << " seconds" );
// printf("end of tile\n");
// $Log$
+// Revision 1.10 1998/11/06 21:18:18 curt
+// Converted to new logstream debugging facility. This allows release
+// builds with no messages at all (and no performance impact) by using
+// the -DFG_NDEBUG flag.
+//
// Revision 1.9 1998/11/06 14:47:06 curt
// Changes to track Bernie's updates to fgstream.
//
#include <stdio.h>
#include <string.h>
-#include <Debug/fg_debug.h>
+#include <Debug/logstream.hxx>
#include <Main/options.hxx>
// #include "obj.hxx"
o = ¤t_options;
- fgPrintf(FG_TERRAIN, FG_INFO, "Initializing scenery subsystem\n");
+ FG_LOG( FG_TERRAIN, FG_INFO, "Initializing scenery subsystem" );
scenery.cur_elev = -9999;
// $Log$
+// Revision 1.10 1998/11/06 21:18:20 curt
+// Converted to new logstream debugging facility. This allows release
+// builds with no messages at all (and no performance impact) by using
+// the -DFG_NDEBUG flag.
+//
// Revision 1.9 1998/10/16 23:27:57 curt
// C++-ifying.
//
#include <Airports/genapt.hxx>
#include <Bucket/bucketutils.h>
-#include <Debug/fg_debug.h>
+#include <Debug/logstream.hxx>
#include <Main/options.hxx>
#include <Main/views.hxx>
#include <Objects/obj.hxx>
{
int i;
- fgPrintf(FG_TERRAIN, FG_INFO, "Initializing the tile cache.\n");
+ FG_LOG( FG_TERRAIN, FG_INFO, "Initializing the tile cache." );
for ( i = 0; i < FG_TILE_CACHE_SIZE; i++ ) {
tile_cache[i].used = 0;
if ( tile_cache[i].tile_bucket.lat == p->lat ) {
if ( tile_cache[i].tile_bucket.x == p->x ) {
if ( tile_cache[i].tile_bucket.y == p->y ) {
- fgPrintf( FG_TERRAIN, FG_DEBUG,
- "TILE EXISTS in cache ... index = %d\n", i );
+ FG_LOG( FG_TERRAIN, FG_DEBUG,
+ "TILE EXISTS in cache ... index = " << i );
return( i );
}
}
tile_cache[index].used = 0;
// Update the bucket
- fgPrintf( FG_TERRAIN, FG_DEBUG,
- "FREEING TILE = (%d %d %d %d)\n",
- tile_cache[index].tile_bucket.lon,
- tile_cache[index].tile_bucket.lat,
- tile_cache[index].tile_bucket.x,
- tile_cache[index].tile_bucket.y );
+ FG_LOG( FG_TERRAIN, FG_DEBUG,
+ "FREEING TILE = ("
+ << tile_cache[index].tile_bucket.lon << " "
+ << tile_cache[index].tile_bucket.lat << " "
+ << tile_cache[index].tile_bucket.x << " "
+ << tile_cache[index].tile_bucket.y << ")" );
// Step through the fragment list, deleting the display list, then
// the fragment, until the list is empty.
return(i);
} else {
// calculate approximate distance from view point
- fgPrintf( FG_TERRAIN, FG_DEBUG,
- "DIST Abs view pos = %.4f, %.4f, %.4f\n",
- v->abs_view_pos.x(), v->abs_view_pos.y(),
- v->abs_view_pos.z() );
- fgPrintf( FG_TERRAIN, FG_DEBUG,
- " ref point = %.4f, %.4f, %.4f\n",
- tile_cache[i].center.x(), tile_cache[i].center.y(),
- tile_cache[i].center.z());
+ FG_LOG( FG_TERRAIN, FG_DEBUG,
+ "DIST Abs view pos = "
+ << v->abs_view_pos.x() << ", "
+ << v->abs_view_pos.y() << ", "
+ << v->abs_view_pos.z() );
+ FG_LOG( FG_TERRAIN, FG_DEBUG,
+ " ref point = "
+ << tile_cache[i].center.x() << ", "
+ << tile_cache[i].center.y() << ", "
+ << tile_cache[i].center.z() );
delta.setx( fabs(tile_cache[i].center.x() - v->abs_view_pos.x() ) );
delta.sety( fabs(tile_cache[i].center.y() - v->abs_view_pos.y() ) );
}
dist = max + (med + min) / 4;
- fgPrintf( FG_TERRAIN, FG_DEBUG, " distance = %.2f\n", dist);
+ FG_LOG( FG_TERRAIN, FG_DEBUG, " distance = " << dist );
if ( dist > max_dist ) {
max_dist = dist;
// $Log$
+// Revision 1.19 1998/11/06 21:18:21 curt
+// Converted to new logstream debugging facility. This allows release
+// builds with no messages at all (and no performance impact) by using
+// the -DFG_NDEBUG flag.
+//
// Revision 1.18 1998/10/16 18:12:28 curt
// Fixed a bug in the conversion to Point3D.
//
#include <Aircraft/aircraft.hxx>
#include <Bucket/bucketutils.h>
-#include <Debug/fg_debug.h>
+#include <Debug/logstream.hxx>
#include <Include/fg_constants.h>
#include <Main/options.hxx>
#include <Main/views.hxx>
// Initialize the Tile Manager subsystem
int fgTileMgrInit( void ) {
- fgPrintf( FG_TERRAIN, FG_INFO, "Initializing Tile Manager subsystem.\n");
+ FG_LOG( FG_TERRAIN, FG_INFO, "Initializing Tile Manager subsystem." );
// load default material library
material_mgr.load_lib();
c = &global_tile_cache;
- fgPrintf( FG_TERRAIN, FG_DEBUG, "Updating for bucket %d %d %d %d\n",
- p->lon, p->lat, p->x, p->y);
+ FG_LOG( FG_TERRAIN, FG_DEBUG,
+ "Updating for bucket "
+ << p->lon << " " << p->lat << " " << p->x << " " << p->y );
// if not in cache, load tile into the next available slot
if ( (*index = c->exists(p)) < 0 ) {
c->fill_in(*index, p);
}
- fgPrintf( FG_TERRAIN, FG_DEBUG, "Selected cache index of %d\n", *index);
+ FG_LOG( FG_TERRAIN, FG_DEBUG, "Selected cache index of " << *index);
}
if ( (p1.lon == p_last.lon) && (p1.lat == p_last.lat) &&
(p1.x == p_last.x) && (p1.y == p_last.y) ) {
// same bucket as last time
- fgPrintf( FG_TERRAIN, FG_DEBUG, "Same bucket as last time\n");
+ FG_LOG( FG_TERRAIN, FG_DEBUG, "Same bucket as last time" );
} else if ( p_last.lon == -1000 ) {
// First time through, initialize the system and load all
// relavant tiles
- fgPrintf( FG_TERRAIN, FG_INFO, " First time through ... ");
- fgPrintf( FG_TERRAIN, FG_INFO, " Updating Tile list for %d,%d %d,%d\n",
- p1.lon, p1.lat, p1.x, p1.y);
- fgPrintf( FG_TERRAIN, FG_INFO, " Loading %d tiles\n",
- tile_diameter * tile_diameter);
+ FG_LOG( FG_TERRAIN, FG_INFO, " First time through ... " );
+ FG_LOG( FG_TERRAIN, FG_INFO,
+ " Updating Tile list for "
+ << p1.lon << "," << p1.lat << " " << p1.x << "," << p1.y );
+ FG_LOG( FG_TERRAIN, FG_INFO, " Loading "
+ << tile_diameter * tile_diameter
+ << " tiles" );
// wipe/initialize tile cache
c->init();
// AT ULTRA HIGH SPEEDS THIS ASSUMPTION MAY NOT BE VALID IF
// THE AIRCRAFT CAN SKIP A TILE IN A SINGLE ITERATION.
- fgPrintf( FG_TERRAIN, FG_INFO, "Updating Tile list for %d,%d %d,%d\n",
- p1.lon, p1.lat, p1.x, p1.y);
+ FG_LOG( FG_TERRAIN, FG_INFO,
+ "Updating Tile list for "
+ << p1.lon << "," << p1.lat << " " << p1.x << "," << p1.y );
if ( (p1.lon > p_last.lon) ||
( (p1.lon == p_last.lon) && (p1.x > p_last.x) ) ) {
- fgPrintf( FG_TERRAIN, FG_INFO, " Loading %d tiles\n",
- tile_diameter);
+ FG_LOG( FG_TERRAIN, FG_INFO,
+ " Loading " << tile_diameter << "tiles" );
for ( j = 0; j < tile_diameter; j++ ) {
// scrolling East
for ( i = 0; i < tile_diameter - 1; i++ ) {
}
} else if ( (p1.lon < p_last.lon) ||
( (p1.lon == p_last.lon) && (p1.x < p_last.x) ) ) {
- fgPrintf( FG_TERRAIN, FG_INFO, " Loading %d tiles\n",
- tile_diameter);
+ FG_LOG( FG_TERRAIN, FG_INFO,
+ " Loading " << tile_diameter << "tiles" );
for ( j = 0; j < tile_diameter; j++ ) {
// scrolling West
for ( i = tile_diameter - 1; i > 0; i-- ) {
if ( (p1.lat > p_last.lat) ||
( (p1.lat == p_last.lat) && (p1.y > p_last.y) ) ) {
- fgPrintf( FG_TERRAIN, FG_INFO, " Loading %d tiles\n",
- tile_diameter);
+ FG_LOG( FG_TERRAIN, FG_INFO,
+ " Loading " << tile_diameter << "tiles" );
for ( i = 0; i < tile_diameter; i++ ) {
// scrolling North
for ( j = 0; j < tile_diameter - 1; j++ ) {
}
} else if ( (p1.lat < p_last.lat) ||
( (p1.lat == p_last.lat) && (p1.y < p_last.y) ) ) {
- fgPrintf( FG_TERRAIN, FG_INFO, " Loading %d tiles\n",
- tile_diameter);
+ FG_LOG( FG_TERRAIN, FG_INFO,
+ " Loading " << tile_diameter << "tiles" );
for ( i = 0; i < tile_diameter; i++ ) {
// scrolling South
for ( j = tile_diameter - 1; j > 0; j-- ) {
earth_center = Point3D(0.0, 0.0, 0.0);
- fgPrintf( FG_TERRAIN, FG_DEBUG,
- "Pos = (%.2f, %.2f) Current bucket = %d %d %d %d Index = %ld\n",
- lon * RAD_TO_DEG, lat * RAD_TO_DEG,
- p.lon, p.lat, p.x, p.y, fgBucketGenIndex(&p) );
+ FG_LOG( FG_TERRAIN, FG_DEBUG,
+ "Pos = (" << lon * RAD_TO_DEG << ", " << lat * RAD_TO_DEG
+ << " Current bucket = "
+ << p.lon << " " << p.lat << " " << p.x << " " << p.y
+ << " Index = " << fgBucketGenIndex(&p) );
// calculate tile offset
// x = (t->offset.x = t->center.x - scenery.center.x);
mtl_ptr = frag_ptr->material_ptr;
// printf(" lookup = %s\n", mtl_ptr->texture_name);
if ( ! mtl_ptr->append_sort_list( frag_ptr ) ) {
- fgPrintf( FG_TERRAIN, FG_ALERT,
- "Overran material sorting array\n" );
+ FG_LOG( FG_TERRAIN, FG_ALERT,
+ "Overran material sorting array" );
}
// xglCallList(frag_ptr->display_list);
// $Log$
+// Revision 1.42 1998/11/06 21:18:23 curt
+// Converted to new logstream debugging facility. This allows release
+// builds with no messages at all (and no performance impact) by using
+// the -DFG_NDEBUG flag.
+//
// Revision 1.41 1998/10/18 01:17:23 curt
// Point3D tweaks.
//
#include STL_ALGORITHM
#include STL_FUNCTIONAL
-#include <Debug/fg_debug.h>
+#include <Debug/logstream.hxx>
#include "event.hxx"
fg_timestamp cur_time;
unsigned int i, size;
- fgPrintf(FG_EVENT, FG_DEBUG, "Processing events\n");
+ FG_LOG( FG_EVENT, FG_DEBUG, "Processing events" );
// get the current time
timestamp(&cur_time);
- fgPrintf( FG_EVENT, FG_DEBUG,
- " Current timestamp = %ld\n", cur_time.seconds);
+ FG_LOG( FG_EVENT, FG_DEBUG,
+ " Current timestamp = " << cur_time.seconds );
// printf("Checking if anything is ready to move to the run queue\n");
// e = *current++;
e_ptr = &event_table[i];
if ( e_ptr->status == fgEVENT::FG_EVENT_READY ) {
- fgPrintf(FG_EVENT, FG_DEBUG,
- " Item %d, current %d, next run @ %ld\n",
- i, cur_time.seconds, e_ptr->next_run.seconds);
+ FG_LOG( FG_EVENT, FG_DEBUG,
+ " Item " << i << " current " << cur_time.seconds
+ << " next run @ " << e_ptr->next_run.seconds );
if ( timediff(&cur_time, &(e_ptr->next_run)) <= 0) {
run_queue.push_back(e_ptr);
e_ptr->status = fgEVENT::FG_EVENT_QUEUED;
// $Log$
+// Revision 1.9 1998/11/06 21:18:24 curt
+// Converted to new logstream debugging facility. This allows release
+// builds with no messages at all (and no performance impact) by using
+// the -DFG_NDEBUG flag.
+//
// Revision 1.8 1998/09/15 02:09:29 curt
// Include/fg_callback.hxx
// Moved code inline to stop g++ 2.7 from complaining.
#include <Astro/sky.hxx>
#include <Astro/solarsystem.hxx>
-#include <Debug/fg_debug.h>
+#include <Debug/logstream.hxx>
#include <Flight/flight.hxx>
#include <Include/fg_constants.h>
#include <Main/options.hxx>
// Initialize the time dependent variables
void fgTimeInit(fgTIME *t) {
- fgPrintf( FG_EVENT, FG_INFO, "Initializing Time\n");
+ FG_LOG( FG_EVENT, FG_INFO, "Initializing Time" );
t->gst_diff = -9999.0;
- fgPrintf( FG_EVENT, FG_DEBUG, "time offset = %d\n",
- current_options.get_time_offset() );
+ FG_LOG( FG_EVENT, FG_DEBUG,
+ "time offset = " << current_options.get_time_offset() );
t->warp = current_options.get_time_offset();
t->warp_delta = 0;
x /= 3600.0;
gst = (1.0/SIDRATE)*hr + x;
- fgPrintf( FG_EVENT, FG_DEBUG, " gst => %.4f\n", gst);
+ FG_LOG( FG_EVENT, FG_DEBUG, " gst => " << gst );
return(gst);
}
long int start = mktime(&mt);
- fgPrintf( FG_EVENT, FG_DEBUG, "start1 = %ld\n", start);
+ FG_LOG( FG_EVENT, FG_DEBUG, "start1 = " << start );
// the ctime() call can screw up time progression on some versions
// of Linux
// fgPrintf( FG_EVENT, FG_DEBUG, "start2 = %s", ctime(&start));
- fgPrintf( FG_EVENT, FG_DEBUG, "(tm_isdst = %d)\n", mt.tm_isdst);
+ FG_LOG( FG_EVENT, FG_DEBUG, "(tm_isdst = " << mt.tm_isdst << ")" );
timezone = fix_up_timezone( timezone );
# if defined( TIMEZONE_OFFSET_WORKS )
- fgPrintf( FG_EVENT, FG_DEBUG,
- "start = %ld, timezone = %ld\n", start, timezone );
+ FG_LOG( FG_EVENT, FG_DEBUG,
+ "start = " << start << ", timezone = " << timezone );
return( start - timezone );
# else // ! defined( TIMEZONE_OFFSET_WORKS )
if ( daylight > 0 ) {
daylight = 1;
} else if ( daylight < 0 ) {
- fgPrintf( FG_EVENT, FG_WARN,
- "OOOPS, problem in fg_time.cxx, no daylight savings info.\n");
+ FG_LOG( FG_EVENT, FG_WARN,
+ "OOOPS, problem in fg_time.cxx, no daylight savings info." );
}
long int offset = -(timezone / 3600 - daylight);
- fgPrintf( FG_EVENT, FG_DEBUG,
- " Raw time zone offset = %ld\n", timezone);
- fgPrintf( FG_EVENT, FG_DEBUG,
- " Daylight Savings = %d\n", daylight);
- fgPrintf( FG_EVENT, FG_DEBUG,
- " Local hours from GMT = %ld\n", offset);
+ FG_LOG( FG_EVENT, FG_DEBUG,
+ " Raw time zone offset = " << timezone );
+ FG_LOG( FG_EVENT, FG_DEBUG,
+ " Daylight Savings = " << daylight );
+ FG_LOG( FG_EVENT, FG_DEBUG,
+ " Local hours from GMT = " << offset);
long int start_gmt = start - timezone + (daylight * 3600);
- fgPrintf( FG_EVENT, FG_DEBUG, " March 21 noon (CST) = %ld\n", start);
+ FG_LOG( FG_EVENT, FG_DEBUG, " March 21 noon (CST) = " << start );
return ( start_gmt );
# endif // ! defined( TIMEZONE_OFFSET_WORKS )
now = t->cur_time;
start_gmt = get_start_gmt(gmt->tm_year);
- fgPrintf(FG_EVENT, FG_DEBUG,
- " COURSE: GMT = %d/%d/%2d %d:%02d:%02d\n",
- gmt->tm_mon, gmt->tm_mday, gmt->tm_year,
- gmt->tm_hour, gmt->tm_min, gmt->tm_sec);
+ FG_LOG( FG_EVENT, FG_DEBUG,
+ " COURSE: GMT = %d/%d/%2d %d:%02d:%02d\n"
+ << gmt->tm_mon << "/" << gmt->tm_mday << "/" << gmt->tm_year
+ << " "
+ << gmt->tm_hour << ":" << gmt->tm_min << ":" << gmt->tm_sec );
- fgPrintf( FG_EVENT, FG_DEBUG, " March 21 noon (GMT) = %ld\n", start_gmt);
+ FG_LOG( FG_EVENT, FG_DEBUG, " March 21 noon (GMT) = " << start_gmt);
diff = (now - start_gmt) / (3600.0 * 24.0);
- fgPrintf( FG_EVENT, FG_DEBUG,
- " Time since 3/21/%2d GMT = %.2f\n", gmt->tm_year, diff);
+ FG_LOG( FG_EVENT, FG_DEBUG,
+ " Time since 3/21/" << gmt->tm_year << " GMT = " << diff );
part = fmod(diff, 1.0);
days = diff - part;
lst += 24.0;
}
- fgPrintf( FG_EVENT, FG_DEBUG,
- " days = %.1f hours = %.2f lon = %.2f lst = %.2f\n",
- days, hours, lng, lst);
+ FG_LOG( FG_EVENT, FG_DEBUG,
+ " days = " << days << " hours = " << hours << " lon = "
+ << lng << " lst = " << lst );
return(lst);
}
void fgTimeUpdate(fgFLIGHT *f, fgTIME *t) {
double gst_precise, gst_course;
- fgPrintf( FG_EVENT, FG_BULK, "Updating time\n");
+ FG_LOG( FG_EVENT, FG_BULK, "Updating time" );
// get current Unix calendar time (in seconds)
t->warp += t->warp_delta;
t->cur_time = time(NULL) + t->warp;
- fgPrintf( FG_EVENT, FG_BULK,
- " Current Unix calendar time = %ld warp = %ld delta = %ld\n",
- t->cur_time, t->warp, t->warp_delta);
+ FG_LOG( FG_EVENT, FG_BULK,
+ " Current Unix calendar time = " << t->cur_time
+ << " warp = " << t->warp << " delta = " << t->warp_delta );
if ( t->warp_delta ) {
// time is changing so force an update
// get GMT break down for current time
t->gmt = gmtime(&t->cur_time);
- fgPrintf( FG_EVENT, FG_BULK,
- " Current GMT = %d/%d/%2d %d:%02d:%02d\n",
- t->gmt->tm_mon+1, t->gmt->tm_mday, t->gmt->tm_year,
- t->gmt->tm_hour, t->gmt->tm_min, t->gmt->tm_sec);
+ FG_LOG( FG_EVENT, FG_BULK,
+ " Current GMT = " << t->gmt->tm_mon+1 << "/"
+ << t->gmt->tm_mday << "/" << t->gmt->tm_year << " "
+ << t->gmt->tm_hour << ":" << t->gmt->tm_min << ":"
+ << t->gmt->tm_sec );
// calculate modified Julian date
t->mjd = cal_mjd ((int)(t->gmt->tm_mon+1), (double)t->gmt->tm_mday,
// convert "back" to Julian date + partial day (as a fraction of one)
t->jd = t->mjd + MJD0;
- fgPrintf( FG_EVENT, FG_BULK, " Current Julian Date = %.5f\n", t->jd);
+ FG_LOG( FG_EVENT, FG_BULK, " Current Julian Date = " << t->jd );
// printf(" Current Longitude = %.3f\n", FG_Longitude * RAD_TO_DEG);
if ( t->gst_diff < -100.0 ) {
// first time through do the expensive calculation & cheap
// calculation to get the difference.
- fgPrintf( FG_EVENT, FG_INFO, " First time, doing precise gst\n");
+ FG_LOG( FG_EVENT, FG_INFO, " First time, doing precise gst" );
t->gst = gst_precise = sidereal_precise(t->mjd, 0.00);
gst_course = sidereal_course(t, 0.00);
t->gst_diff = gst_precise - gst_course;
t->gst = sidereal_course(t, 0.00) + t->gst_diff;
t->lst = sidereal_course(t, -(FG_Longitude * RAD_TO_DEG)) + t->gst_diff;
}
- fgPrintf( FG_EVENT, FG_DEBUG,
- " Current lon=0.00 Sidereal Time = %.3f\n", t->gst);
- fgPrintf( FG_EVENT, FG_DEBUG,
- " Current LOCAL Sidereal Time = %.3f (%.3f) (diff = %.3f)\n",
- t->lst, sidereal_precise(t->mjd, -(FG_Longitude * RAD_TO_DEG)),
- t->gst_diff);
+ FG_LOG( FG_EVENT, FG_DEBUG,
+ " Current lon=0.00 Sidereal Time = " << t->gst );
+ FG_LOG( FG_EVENT, FG_DEBUG,
+ " Current LOCAL Sidereal Time = " << t->lst << " ("
+ << sidereal_precise(t->mjd, -(FG_Longitude * RAD_TO_DEG))
+ << ") (diff = " << t->gst_diff << ")" );
}
// $Log$
+// Revision 1.21 1998/11/06 21:18:26 curt
+// Converted to new logstream debugging facility. This allows release
+// builds with no messages at all (and no performance impact) by using
+// the -DFG_NDEBUG flag.
+//
// Revision 1.20 1998/11/02 18:25:38 curt
// Check for __CYGWIN__ (b20) as well as __CYGWIN32__ (pre b20 compilers)
// Other misc. tweaks.
#include <string.h>
#include <Aircraft/aircraft.hxx>
-#include <Debug/fg_debug.h>
+#include <Debug/logstream.hxx>
#include <Include/fg_constants.h>
#include <Main/options.hxx>
#include <Main/views.hxx>
void fgLIGHT::Init( void ) {
string path, ambient, diffuse, sky;
- fgPrintf( FG_EVENT, FG_INFO,
- "Initializing Lighting interpolation tables.\n" );
+ FG_LOG( FG_EVENT, FG_INFO,
+ "Initializing Lighting interpolation tables." );
// build the path name to the ambient lookup table
path = current_options.get_fg_root();
t = &cur_time_params;
v = ¤t_view;
- fgPrintf( FG_EVENT, FG_INFO, "Updating light parameters.\n" );
+ FG_LOG( FG_EVENT, FG_INFO, "Updating light parameters." );
// calculate lighting parameters based on sun's relative angle to
// local up
deg = sun_angle * 180.0 / FG_PI;
- fgPrintf( FG_EVENT, FG_INFO, " Sun angle = %.2f.\n", deg );
+ FG_LOG( FG_EVENT, FG_INFO, " Sun angle = " << deg );
ambient = ambient_tbl->interpolate( deg );
diffuse = diffuse_tbl->interpolate( deg );
sky_brightness = sky_tbl->interpolate( deg );
- fgPrintf( FG_EVENT, FG_INFO,
- " ambient = %.2f diffuse = %.2f sky = %.2f\n",
- ambient, diffuse, sky_brightness );
+ FG_LOG( FG_EVENT, FG_INFO,
+ " ambient = " << ambient << " diffuse = " << diffuse
+ << " sky = " << sky_brightness );
// sky_brightness = 0.15; // used to force a dark sky (when testing)
f = current_aircraft.flight;
v = ¤t_view;
- fgPrintf( FG_EVENT, FG_DEBUG, "Updating adjusted fog parameters.\n" );
+ FG_LOG( FG_EVENT, FG_DEBUG, "Updating adjusted fog parameters." );
// set fog color (we'll try to match the sunset color in the
// direction we are looking
// $Log$
+// Revision 1.20 1998/11/06 21:18:27 curt
+// Converted to new logstream debugging facility. This allows release
+// builds with no messages at all (and no performance impact) by using
+// the -DFG_NDEBUG flag.
+//
// Revision 1.19 1998/10/20 18:41:53 curt
// Tweaked sunrise/sunset colors.
//
#include <XGL/xgl.h>
#include <math.h>
-#include <stdio.h>
#include "weather.hxx"
#include <Aircraft/aircraft.hxx>
-#include <Debug/fg_debug.h>
+#include <Debug/logstream.hxx>
#include <Math/fg_random.h>
w = ¤t_weather;
- printf("Initializing weather subsystem\n");
+ FG_LOG( FG_GENERAL, FG_INFO, "Initializing weather subsystem");
// Configure some wind
// FG_V_north_airmass = 15; // ft/s =~ 10mph
// w->fog_density = -log(0.01 / w->visibility; // for GL_FOG_EXP
w->fog_density = sqrt( -log(0.01) ) / w->visibility; // for GL_FOG_EXP2
xglFogf (GL_FOG_DENSITY, w->fog_density);
- fgPrintf( FG_INPUT, FG_DEBUG,
- "Fog density = %.4f\n", w->fog_density);
+ FG_LOG( FG_INPUT, FG_DEBUG, "Fog density = " << w->fog_density );
}
// $Log$
+// Revision 1.2 1998/11/06 21:18:29 curt
+// Converted to new logstream debugging facility. This allows release
+// builds with no messages at all (and no performance impact) by using
+// the -DFG_NDEBUG flag.
+//
// Revision 1.1 1998/10/17 01:34:36 curt
// C++ ifying ...
//