# include <windows.h>
#endif
-#include <math.h>
-#include <stdio.h>
-#include <string.h>
+#include "Include/compiler.h"
+#ifdef FG_HAVE_STD_INCLUDES
+# include <cmath>
+# include <cstdio>
+# include <cstring>
+# include <ctime>
+#else
+# include <math.h>
+# include <stdio.h>
+# include <string.h>
+# include <time.h>
+#endif
+
#include <string>
-#include <time.h>
#include <GL/glut.h>
#include <XGL/xgl.h>
-#include <Aircraft/aircraft.h>
-#include <Debug/fg_debug.h>
+#include <Aircraft/aircraft.hxx>
+#include <Debug/logstream.hxx>
#include <Include/fg_constants.h>
-#include <Include/fg_types.h>
#include <Misc/fgstream.hxx>
#include <Main/options.hxx>
#include <Main/views.hxx>
#include <Misc/stopwatch.hxx>
#include <Time/fg_time.hxx>
+#include "Misc/stopwatch.hxx"
#include "stars.hxx"
+FG_USING_STD(getline);
#define EpochStart (631065600)
#define DaysSinceEpoch(secs) (((secs)-EpochStart)*(1.0/(24*3600)))
// Initialize the Star Management Subsystem
int fgStarsInit( void ) {
- fgPoint3d starlist[FG_MAX_STARS];
+ Point3D starlist[FG_MAX_STARS];
// struct CelestialCoord pltPos;
double right_ascension, declination, magnitude;
double min_magnitude[FG_STAR_LEVELS];
// 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;
// read in each line of the file
while ( ! in.eof() && starcount < FG_MAX_STARS )
{
- in.eat_comments();
+ in >> skipcomment;
string name;
- char c = 0;
- getline( in.stream(), name, ',' );
- in.stream() >> starlist[starcount].x >> c;
- in.stream() >> starlist[starcount].y >> c;
- // in.stream() >> starlist[starcount].x; in.get(c);
- // in.stream() >> starlist[starcount].y; in.get(c);
- in.stream() >> starlist[starcount].z;
+ getline( in, name, ',' );
+ in >> starlist[starcount];
++starcount;
}
timer.stop();
- cerr << "Loaded " << starcount << " stars in "
- << timer.elapsedSeconds() << " seconds" << endl;
+ FG_LOG( FG_ASTRO, FG_INFO,
+ "Loaded " << starcount << " stars in "
+ << timer.elapsedSeconds() << " seconds" );
min_magnitude[0] = 4.2;
min_magnitude[1] = 3.6;
count = 0;
for ( j = 0; j < starcount; j++ ) {
- magnitude = starlist[j].z;
+ magnitude = starlist[j].z();
// printf("magnitude = %.2f\n", magnitude);
if ( magnitude < min_magnitude[i] ) {
- right_ascension = starlist[j].x;
- declination = starlist[j].y;
+ right_ascension = starlist[j].x();
+ declination = starlist[j].y();
count++;
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.
// Draw the Stars
void fgStarsRender( void ) {
- fgFLIGHT *f;
- fgVIEW *v;
+ FGInterface *f;
fgLIGHT *l;
fgTIME *t;
int i;
- f = current_aircraft.flight;
+ f = current_aircraft.fdm_state;
l = &cur_light_params;
t = &cur_time_params;
- v = ¤t_view;
// FG_PI_2 + 0.1 is about 6 degrees after sundown and before sunrise
// $Log$
+// Revision 1.27 1999/02/05 21:28:52 curt
+// Modifications to incorporate Jon S. Berndts flight model code.
+//
+// Revision 1.26 1999/02/02 20:13:30 curt
+// MSVC++ portability changes by Bernie Bright:
+//
+// Lib/Serial/serial.[ch]xx: Initial Windows support - incomplete.
+// Simulator/Astro/stars.cxx: typo? included <stdio> instead of <cstdio>
+// Simulator/Cockpit/hud.cxx: Added Standard headers
+// Simulator/Cockpit/panel.cxx: Redefinition of default parameter
+// Simulator/Flight/flight.cxx: Replaced cout with FG_LOG. Deleted <stdio.h>
+// Simulator/Main/fg_init.cxx:
+// Simulator/Main/GLUTmain.cxx:
+// Simulator/Main/options.hxx: Shuffled <fg_serial.hxx> dependency
+// Simulator/Objects/material.hxx:
+// Simulator/Time/timestamp.hxx: VC++ friend kludge
+// Simulator/Scenery/tile.[ch]xx: Fixed using std::X declarations
+// Simulator/Main/views.hxx: Added a constant
+//
+// Revision 1.25 1998/12/09 18:50:15 curt
+// Converted "class fgVIEW" to "class FGView" and updated to make data
+// members private and make required accessor functions.
+//
+// Revision 1.24 1998/12/05 15:54:04 curt
+// Renamed class fgFLIGHT to class FGState as per request by JSB.
+//
+// Revision 1.23 1998/11/23 21:48:28 curt
+// Borland portability tweaks.
+//
+// Revision 1.22 1998/11/07 19:07:07 curt
+// Enable release builds using the --without-logging option to the configure
+// script. Also a couple log message cleanups, plus some C to C++ comment
+// conversion.
+//
+// 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.
+//
+// Revision 1.19 1998/10/16 23:27:21 curt
+// C++-ifying.
+//
+// Revision 1.18 1998/10/16 00:52:20 curt
+// Converted to Point3D class.
+//
// Revision 1.17 1998/09/24 15:36:19 curt
// Converted to c++ style comments.
//