1
0
Fork 0

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.
This commit is contained in:
curt 1998-11-06 21:17:31 +00:00
parent ad3ae51348
commit c74350c4fe
38 changed files with 516 additions and 380 deletions

View file

@ -25,7 +25,7 @@
#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
@ -35,7 +35,7 @@ fgAIRCRAFT current_aircraft;
// 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;
@ -48,24 +48,29 @@ void fgAircraftOutputCurrent(fgAIRCRAFT *a) {
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);
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 << ")" );
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,
"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.
//

View file

@ -31,7 +31,7 @@
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>
@ -97,9 +97,9 @@ gen_base( const Point3D& average, const container& perimeter, fgTILE *t)
// 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",
@ -281,6 +281,11 @@ fgAptGenerate(const string& path, fgTILE *tile)
// $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.
//

View file

@ -27,7 +27,7 @@
#include <string>
#include <Debug/fg_debug.h>
#include <Debug/logstream.hxx>
#include <Main/options.hxx>
#include <Misc/fgstream.hxx>
@ -52,9 +52,10 @@ int fgAIRPORTS::load( const string& file ) {
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
@ -109,6 +110,11 @@ fgAIRPORTS::~fgAIRPORTS( void ) {
// $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.
//

View file

@ -25,7 +25,7 @@
#include "celestialBody.hxx"
#include "star.hxx"
#include <Debug/fg_debug.h>
#include <Debug/logstream.hxx>
/**************************************************************************
* void CelestialBody::updatePosition(fgTIME *t, Star *ourSun)
@ -78,8 +78,8 @@ 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

View file

@ -26,7 +26,7 @@
#include <string.h>
#include "moon.hxx"
#include <Debug/fg_debug.h>
#include <Debug/logstream.hxx>
#include <Objects/texload.h>
static GLuint moon_texid;
@ -51,7 +51,7 @@ Moon::Moon(fgTIME *t) :
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);
@ -77,9 +77,9 @@ Moon::Moon(fgTIME *t) :
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);
}
}
@ -162,7 +162,7 @@ void Moon::updatePosition(fgTIME *t, Star *ourSun)
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);
@ -213,8 +213,9 @@ void Moon::newImage(float ra, float dec)
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 );

View file

@ -26,7 +26,6 @@
#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>

View file

@ -36,7 +36,7 @@
#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>
@ -78,7 +78,7 @@ void fgSkyVerticesInit( void ) {
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;
@ -115,8 +115,8 @@ void fgSkyColorsInit( void ) {
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;
@ -243,7 +243,7 @@ void fgSkyColorsInit( void ) {
// 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();
@ -365,6 +365,11 @@ void fgSkyRender( void ) {
// $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.
//

View file

@ -33,7 +33,7 @@
#include <GL/glut.h>
#include <XGL/xgl.h>
#include <Debug/fg_debug.h>
#include <Debug/logstream.hxx>
#include <Time/sunpos.hxx>
#include "solarsystem.hxx"
@ -47,7 +47,8 @@ SolarSystem::SolarSystem(fgTIME *t)
{
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);

View file

@ -41,7 +41,7 @@
#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>
@ -70,21 +70,23 @@ int fgStarsInit( void ) {
// 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;
@ -195,9 +197,9 @@ int fgStarsInit( void ) {
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.
@ -252,6 +254,11 @@ void fgStarsRender( void ) {
// $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.
//

View file

@ -31,22 +31,12 @@
#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
@ -155,12 +145,15 @@ void fgAPInit( fgAIRCRAFT *current_aircraft )
{
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
@ -203,7 +196,7 @@ int fgAPRun( void )
// 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
@ -232,7 +225,7 @@ int fgAPRun( void )
// 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());
@ -413,9 +406,8 @@ void fgAPToggleHeading( void )
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 );
}
@ -440,9 +432,8 @@ void fgAPToggleAltitude( void )
// 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 );
}
@ -464,9 +455,8 @@ void fgAPToggleAutoThrottle ( void )
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 )
@ -488,9 +478,8 @@ 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)

View file

@ -40,7 +40,7 @@
#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>
@ -258,7 +258,7 @@ double get_climb_rate( void )
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;
@ -279,9 +279,9 @@ bool fgCockpitInit( fgAIRCRAFT *cur_aircraft )
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;
}
@ -292,9 +292,9 @@ void fgCockpitUpdate( void ) {
pview = &current_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.
@ -310,6 +310,11 @@ void fgCockpitUpdate( void ) {
// $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.

View file

@ -39,7 +39,7 @@
#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>
@ -150,7 +150,7 @@ int fgHUDInit( fgAIRCRAFT * /* current_aircraft */ )
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
@ -532,7 +532,7 @@ int fgHUDInit2( fgAIRCRAFT * /* current_aircraft */ )
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());
@ -835,6 +835,11 @@ void fgUpdateHUD( void ) {
}
// $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.
//

View file

@ -8,7 +8,6 @@
#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>

View file

@ -8,7 +8,6 @@
#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>

View file

@ -8,7 +8,6 @@
#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>

View file

@ -11,7 +11,6 @@
#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>

View file

@ -8,7 +8,6 @@
#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>

View file

@ -8,7 +8,6 @@
#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>

View file

@ -8,7 +8,6 @@
#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>

View file

@ -8,7 +8,6 @@
#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>

View file

@ -42,7 +42,6 @@
#include <math.h>
#include <Aircraft/aircraft.hxx>
#include <Debug/fg_debug.h>
#include <Main/options.hxx>
#include <Main/views.hxx>
@ -404,8 +403,9 @@ CreatePointer(&pointer[i]);
// 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);
@ -726,6 +726,11 @@ pointer->vertices[19] = pointer->vertices[3];
/* $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.
/*

View file

@ -27,7 +27,7 @@
#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>
@ -41,7 +41,7 @@ int fgFlightModelInit(int model, fgFLIGHT *f, double dt) {
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);
@ -54,7 +54,7 @@ int fgFlightModelInit(int model, fgFLIGHT *f, double 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 */
@ -62,8 +62,8 @@ int fgFlightModelInit(int model, fgFLIGHT *f, double dt) {
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;
@ -86,8 +86,8 @@ int fgFlightModelUpdate(int model, fgFLIGHT *f, int multiloop) {
} 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;
@ -121,6 +121,11 @@ void fgFlightModelSetAltitude(int model, fgFLIGHT *f, double alt_meters) {
// $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.
//

View file

@ -31,7 +31,7 @@
#endif
#include <Aircraft/aircraft.hxx>
#include <Debug/fg_debug.h>
#include <Debug/logstream.hxx>
#if defined( ENABLE_LINUX_JOYSTICK )
# include <Joystick/js.hxx>
@ -112,7 +112,7 @@ void joystick(unsigned int buttonMask, int js_x, int js_y, int js_z)
// 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 )
@ -129,9 +129,9 @@ int fgJoystickInit( void ) {
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 () ) {
@ -144,13 +144,13 @@ int fgJoystickInit( void ) {
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;
}
@ -191,6 +191,11 @@ int fgJoystickRead( void ) {
// $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.
//

View file

@ -40,7 +40,7 @@
#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>
@ -81,11 +81,11 @@ void GLUTkey(unsigned char k, int x, int y) {
v = &current_view;
w = &current_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();
@ -173,7 +173,7 @@ void GLUTkey(unsigned char k, int x, int y) {
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);
@ -230,16 +230,14 @@ void GLUTkey(unsigned char k, int x, int y) {
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;
@ -263,8 +261,9 @@ void GLUTkey(unsigned char k, int x, int y) {
// 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);
}
}
}
@ -276,11 +275,11 @@ void GLUTspecialkey(int k, int x, int y) {
v = &current_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;
@ -308,23 +307,23 @@ void GLUTspecialkey(int k, int x, int y) {
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;
@ -333,14 +332,14 @@ void GLUTspecialkey(int k, int x, int y) {
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();
@ -387,6 +386,11 @@ void GLUTspecialkey(int k, int x, int y) {
// $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.

View file

@ -62,7 +62,7 @@
#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>
@ -468,8 +468,8 @@ static void fgMainLoop( void ) {
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();
@ -492,9 +492,9 @@ static void fgMainLoop( void ) {
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;
}
@ -518,9 +518,9 @@ static void fgMainLoop( void ) {
// 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 ) {
@ -538,15 +538,15 @@ static void fgMainLoop( void ) {
}
// 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,
@ -587,7 +587,7 @@ static void fgMainLoop( void ) {
// redraw display
fgRenderFrame();
fgPrintf( FG_ALL, FG_DEBUG, "\n");
FG_LOG( FG_ALL, FG_DEBUG, "" );
}
@ -621,8 +621,8 @@ static void fgIdleFunction ( void ) {
"/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
@ -645,8 +645,9 @@ static void fgIdleFunction ( void ) {
// 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++;
@ -674,14 +675,14 @@ static void fgIdleFunction ( void ) {
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
@ -833,10 +834,10 @@ int main( int argc, char **argv ) {
_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
@ -859,24 +860,28 @@ int main( int argc, char **argv ) {
// 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
@ -892,6 +897,11 @@ int main( int argc, char **argv ) {
// $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.
//

View file

@ -49,7 +49,8 @@
#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>
@ -85,14 +86,15 @@ int fgInitPosition( void ) {
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;
@ -108,10 +110,11 @@ int fgInitPosition( void ) {
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);
}
@ -125,8 +128,11 @@ int fgInitGeneral( void ) {
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 );
@ -135,11 +141,12 @@ int fgInitGeneral( void ) {
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++ ) {
@ -166,8 +173,8 @@ int fgInitSubsystems( void )
t = &cur_time_params;
v = &current_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();
@ -184,15 +191,16 @@ int fgInitSubsystems( void )
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
@ -212,10 +220,11 @@ int fgInitSubsystems( void )
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
@ -264,20 +273,23 @@ int fgInitSubsystems( void )
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
@ -319,7 +331,8 @@ int fgInitSubsystems( void )
if( fgCockpitInit( &current_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"
@ -339,29 +352,35 @@ int fgInitSubsystems( void )
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(&current_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.
//

View file

@ -33,7 +33,7 @@
#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>
@ -312,16 +312,16 @@ fgOPTIONS::parse_flight_model( const string& fm ) {
// 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;
}
@ -437,12 +437,11 @@ int fgOPTIONS::parse_option( const string& arg ) {
} 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;
}
@ -451,10 +450,10 @@ int fgOPTIONS::parse_command_line( int argc, char **argv ) {
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) ) {
@ -474,8 +473,7 @@ int fgOPTIONS::parse_config_file( const string& path ) {
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() )
@ -484,9 +482,10 @@ int fgOPTIONS::parse_config_file( const string& path ) {
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;
}
@ -573,6 +572,11 @@ fgOPTIONS::~fgOPTIONS( void ) {
// $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.
//

View file

@ -36,7 +36,7 @@
#include <string.h>
#include <Debug/fg_debug.h>
#include <Debug/logstream.hxx>
#include <Main/options.hxx>
#include <Objects/texload.h>
@ -52,7 +52,7 @@ void fgSplashInit ( void ) {
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);
@ -79,9 +79,9 @@ void fgSplashInit ( void ) {
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);
}
}
@ -148,6 +148,11 @@ void fgSplashUpdate ( double progress ) {
// $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 ...
//

View file

@ -28,7 +28,7 @@
#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>
@ -52,7 +52,7 @@ fgVIEW::fgVIEW( void ) {
// 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;
@ -287,10 +287,12 @@ void fgVIEW::UpdateViewMath( fgFLIGHT *f ) {
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]
@ -584,6 +586,11 @@ fgVIEW::~fgVIEW( void ) {
// $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.
//

View file

@ -37,7 +37,7 @@
#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>
@ -117,8 +117,7 @@ operator >> ( istream& in, fgMATERIAL& m )
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] == '}' )
@ -177,10 +176,9 @@ fgMATERIAL::load_texture()
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);
}
}
@ -202,10 +200,9 @@ fgMATERIAL::load_texture()
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);
}
}
@ -278,9 +275,10 @@ fgMATERIAL_MGR::load_lib ( void )
// 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);
@ -357,6 +355,11 @@ fgMATERIAL_MGR::render_fragments()
// $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.
//

View file

@ -48,7 +48,7 @@ extern "C" void *memset(void *, int, size_t);
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>
@ -148,8 +148,7 @@ int fgObjLoad( const string& path, fgTILE *t) {
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;
}
}
@ -198,8 +197,9 @@ int fgObjLoad( const string& path, fgTILE *t) {
>> 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' )
@ -211,8 +211,9 @@ int fgObjLoad( const string& path, fgTILE *t) {
>> 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" )
@ -254,9 +255,9 @@ int fgObjLoad( const string& path, fgTILE *t) {
// 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
@ -505,8 +506,8 @@ int fgObjLoad( const string& path, fgTILE *t) {
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
@ -543,8 +544,9 @@ int fgObjLoad( const string& path, fgTILE *t) {
*/
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");
@ -553,6 +555,11 @@ int fgObjLoad( const string& path, fgTILE *t) {
// $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.
//

View file

@ -36,7 +36,7 @@
#include <stdio.h>
#include <string.h>
#include <Debug/fg_debug.h>
#include <Debug/logstream.hxx>
#include <Main/options.hxx>
// #include "obj.hxx"
@ -61,7 +61,7 @@ int fgSceneryInit( void ) {
o = &current_options;
fgPrintf(FG_TERRAIN, FG_INFO, "Initializing scenery subsystem\n");
FG_LOG( FG_TERRAIN, FG_INFO, "Initializing scenery subsystem" );
scenery.cur_elev = -9999;
@ -82,6 +82,11 @@ void fgSceneryRender( void ) {
// $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.
//

View file

@ -35,7 +35,7 @@
#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>
@ -59,7 +59,7 @@ fgTILECACHE::init( void )
{
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;
@ -78,8 +78,8 @@ fgTILECACHE::exists( fgBUCKET *p )
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 );
}
}
@ -139,12 +139,12 @@ fgTILECACHE::entry_free( int index )
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.
@ -188,14 +188,16 @@ fgTILECACHE::next_avail( void )
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() ) );
@ -210,7 +212,7 @@ fgTILECACHE::next_avail( void )
}
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;
@ -234,6 +236,11 @@ fgTILECACHE::~fgTILECACHE( void ) {
// $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.
//

View file

@ -36,7 +36,7 @@
#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>
@ -78,7 +78,7 @@ int tiles[FG_LOCAL_X_Y];
// 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();
@ -93,8 +93,9 @@ void fgTileMgrLoadTile( fgBUCKET *p, int *index) {
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 ) {
@ -102,7 +103,7 @@ void fgTileMgrLoadTile( fgBUCKET *p, int *index) {
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);
}
@ -128,16 +129,18 @@ int fgTileMgrUpdate( void ) {
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();
@ -157,13 +160,14 @@ int fgTileMgrUpdate( void ) {
// 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++ ) {
@ -177,8 +181,8 @@ int fgTileMgrUpdate( void ) {
}
} 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-- ) {
@ -193,8 +197,8 @@ int fgTileMgrUpdate( void ) {
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++ ) {
@ -208,8 +212,8 @@ int fgTileMgrUpdate( void ) {
}
} 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-- ) {
@ -436,10 +440,11 @@ double fgTileMgrCurElev( double lon, double lat, const Point3D& abs_view_pos ) {
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);
@ -594,8 +599,8 @@ void fgTileMgrRender( void ) {
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);
@ -633,6 +638,11 @@ void fgTileMgrRender( void ) {
// $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.
//

View file

@ -43,7 +43,7 @@
#include STL_ALGORITHM
#include STL_FUNCTIONAL
#include <Debug/fg_debug.h>
#include <Debug/logstream.hxx>
#include "event.hxx"
@ -214,13 +214,13 @@ void fgEVENT_MGR::Process( void ) {
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");
@ -231,9 +231,9 @@ void fgEVENT_MGR::Process( void ) {
// 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;
@ -258,6 +258,11 @@ fgEVENT_MGR::~fgEVENT_MGR( void ) {
// $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.

View file

@ -53,7 +53,7 @@
#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>
@ -83,12 +83,12 @@ static void local_update_sky_and_lighting_params( void ) {
// 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;
@ -214,7 +214,7 @@ double utc_gst (double mjd) {
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);
}
@ -303,17 +303,17 @@ time_t get_start_gmt(int year) {
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 )
@ -321,22 +321,22 @@ time_t get_start_gmt(int year) {
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 )
@ -354,17 +354,18 @@ double sidereal_course(fgTIME *t, double lng) {
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;
@ -376,9 +377,9 @@ double sidereal_course(fgTIME *t, double lng) {
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);
}
@ -388,14 +389,14 @@ double sidereal_course(fgTIME *t, double lng) {
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
@ -404,10 +405,11 @@ void fgTimeUpdate(fgFLIGHT *f, fgTIME *t) {
// 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,
@ -419,7 +421,7 @@ void fgTimeUpdate(fgFLIGHT *f, fgTIME *t) {
// 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);
@ -427,7 +429,7 @@ void fgTimeUpdate(fgFLIGHT *f, fgTIME *t) {
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;
@ -438,16 +440,21 @@ void fgTimeUpdate(fgFLIGHT *f, fgTIME *t) {
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.

View file

@ -36,7 +36,7 @@
#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>
@ -62,8 +62,8 @@ fgLIGHT::fgLIGHT( void ) {
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();
@ -99,21 +99,21 @@ void fgLIGHT::Update( void ) {
t = &cur_time_params;
v = &current_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)
@ -152,7 +152,7 @@ void fgLIGHT::UpdateAdjFog( void ) {
f = current_aircraft.flight;
v = &current_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
@ -212,6 +212,11 @@ fgLIGHT::~fgLIGHT( void ) {
// $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.
//

View file

@ -34,12 +34,11 @@
#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>
@ -53,7 +52,7 @@ void fgWeatherInit( void ) {
w = &current_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
@ -101,12 +100,16 @@ void fgWeatherSetVisibility( float visibility ) {
// 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 ...
//