#endif
#include <simgear/compiler.h>
+#include <simgear/misc/exception.hxx>
#ifdef SG_MATH_EXCEPTION_CLASH
# include <math.h>
// # include <GL/glext.h>
// #endif
+#include <plib/netChat.h>
#include <plib/pu.h>
#include <plib/ssg.h>
#include "fg_props.hxx"
#include "globals.hxx"
#include "splash.hxx"
+#include "viewmgr.hxx"
#ifdef macintosh
# include <console.h> // -dw- for command line dialog
// set up moving parts
if (flaps_selector != NULL) {
- flaps_selector->select( (controls.get_flaps() > 0.5f) ? 1 : 2 );
+ flaps_selector->select( (globals->get_controls()->get_flaps() > 0.5f) ? 1 : 2 );
}
if (prop_selector != NULL) {
current_input.update();
// update the controls subsystem
- controls.update();
+ globals->get_controls()->update();
hud_and_panel->apply();
fgCockpitUpdate();
s1->set_pitch( pitch );
s1->set_volume( volume );
} else {
- double param = controls.get_throttle( 0 ) * 2.0 + 1.0;
+ double param
+ = globals->get_controls()->get_throttle( 0 ) * 2.0 + 1.0;
s1->set_pitch( param );
s1->set_volume( param );
}
}
-// Main ...
-int main( int argc, char **argv ) {
+// Main loop
+int mainLoop( int argc, char **argv ) {
#if defined( macintosh )
freopen ("stdout.txt", "w", stdout );
SGRoute *route = new SGRoute;
globals->set_route( route );
+ FGControls *controls = new FGControls;
+ globals->set_controls( controls );
+
FGViewMgr *viewmgr = new FGViewMgr;
globals->set_viewmgr( viewmgr );
"GLUT event handler initialization failed ..." );
exit(-1);
}
-
+
+ // Initialize plib net interface
+ netInit( &argc, argv );
+
// Initialize ssg (from plib). Needs to come before we do any
// other ssg stuff, but after opengl/glut has been initialized.
ssgInit();
// $$$ end - added VS Renganathan, 15 Oct 2K
// - added Venky , 12 Nov 2K
+// Main entry point; catch any exceptions that have made it this far.
+int main ( int argc, char **argv ) {
+ // FIXME: add other, more specific
+ // exceptions.
+ try {
+ mainLoop(argc, argv);
+ } catch (sg_throwable &t) {
+ SG_LOG(SG_GENERAL, SG_ALERT,
+ "Fatal error: " << t.getFormattedMessage()
+ << "\n (received from " << t.getOrigin() << ')');
+ exit(1);
+ }
+}
+
+
void fgLoadDCS(void) {
ssgEntity *ship_obj = NULL;