]> git.mxchange.org Git - flightgear.git/commitdiff
Changes by David Megginson.
authorcurt <curt>
Tue, 16 May 2000 18:21:08 +0000 (18:21 +0000)
committercurt <curt>
Tue, 16 May 2000 18:21:08 +0000 (18:21 +0000)
src/GUI/gui.cxx
src/Main/bfi.cxx
src/Main/main.cxx
src/Main/save.cxx

index 4c0799e9fbe73c0fc15f84e737be1b9e8435e1d9..8ce464eacc514f7fe135763dc6e9b5a215f57d2c 100644 (file)
@@ -66,6 +66,8 @@
 #include <Main/options.hxx>
 #include <Main/fg_init.hxx>
 #include <Main/views.hxx>
+#include <Main/save.hxx>
+#include <Main/bfi.hxx>
 #ifdef FG_NETWORK_OLK
 #include <NetworkOLK/network.h>
 #endif
@@ -713,6 +715,36 @@ void guiToggleMenu(void)
 the Gui callback functions 
 ____________________________________________________________________*/
 
+static void saveFlight(puObject *cv)
+{
+    BusyCursor(0);
+    ofstream output("fgfs.sav");
+    if (output.good() && fgSaveFlight(output)) {
+      output.close();
+      mkDialog("Saved flight to ./fgfs.sav");
+      FG_LOG(FG_INPUT, FG_INFO, "Saved flight to fgfs.sav");
+    } else {
+      mkDialog("Cannot save flight to ./fgfs.sav");
+      FG_LOG(FG_INPUT, FG_ALERT, "Cannot save flight to fgfs.sav");
+    }
+    BusyCursor(1);
+}
+
+static void loadFlight(puObject *cb)
+{
+    BusyCursor(0);
+    ifstream input("fgfs.sav");
+    if (input.good() && fgLoadFlight(input)) {
+      input.close();
+      mkDialog("Loaded flight from fgfs.sav");
+      FG_LOG(FG_INPUT, FG_INFO, "Restored flight from ./fgfs.sav");
+    } else {
+      mkDialog("Failed to load flight from fgfs.sav");
+      FG_LOG(FG_INPUT, FG_ALERT, "Cannot load flight from ./fgfs.sav");
+    }
+    BusyCursor(1);
+}
+
 void reInit(puObject *cb)
 {
     BusyCursor(0);
@@ -721,6 +753,11 @@ void reInit(puObject *cb)
     fgReInitSubsystems();
     BusyCursor(1);
 }
+
+static void toggleClouds(puObject *cb)
+{
+    FGBFI::setClouds(!FGBFI::getClouds());
+}
        
 // This is the accessor function
 void guiTogglePanel(puObject *cb)
@@ -1362,8 +1399,11 @@ char *fileSubmenu               [] = {
     "Print",
 #endif
     "Snap Shot",
-    /* "---------", "Save", */ 
-    "Reset", NULL
+    "---------", 
+    "Reset", 
+    "Load flight",
+    "Save flight",
+    NULL
 };
 puCallback fileSubmenuCb        [] = {
     MayBeGoodBye, /* hideMenuCb, NULL, */
@@ -1372,7 +1412,11 @@ puCallback fileSubmenuCb        [] = {
 #endif
     /* NULL, notCb, */
     dumpSnapShot,
-    reInit, NULL
+    NULL,
+    reInit, 
+    loadFlight,
+    saveFlight,
+    NULL
 };
 
 /*
@@ -1406,9 +1450,11 @@ puCallback aircraftSubmenuCb    [] = {
 };
 
 char *environmentSubmenu        [] = {
-    "Airport", /* "Terrain", "Weather", */ NULL
+    "Toggle Clouds",
+    "Goto Airport", /* "Terrain", "Weather", */ NULL
 };
 puCallback environmentSubmenuCb [] = {
+    toggleClouds,
     NewAirport, /* notCb, notCb, */ NULL
 };
 
index 46365b96f1c7ed13f30e6249a776888216910ae7..0a06cc4ec8c7cee9640afa5a2f59ab7427e825b4 100644 (file)
@@ -108,6 +108,16 @@ FGBFI::reinit ()
 
   cout << "BFI: start reinit\n";
 
+  setHeading(getHeading());
+  setPitch(getPitch());
+  setRoll(getRoll());
+  setSpeedNorth(getSpeedNorth());
+  setSpeedEast(getSpeedEast());
+  setSpeedDown(getSpeedDown());
+  setLatitude(getLatitude());
+  setLongitude(getLongitude());
+  setAltitude(getAltitude());
+  setTargetAirport("");
                                // TODO: add more AP stuff
   double elevator = getElevator();
   double aileron = getAileron();
@@ -1164,6 +1174,7 @@ FGBFI::setVisibility (double visibility)
 void
 FGBFI::setClouds (bool clouds)
 {
+  cout << "Set clouds to " << clouds << endl;
   current_options.set_clouds(clouds);
   needReinit();
 }
index 9446c7d47c6868129068004c5613227c6acb4e9b..d170f0dee46289331dd714bad098288864a35252 100644 (file)
 #include <Cockpit/cockpit.hxx>
 #include <Cockpit/radiostack.hxx>
 #include <Cockpit/steam.hxx>
-#include <FDM/UIUCModel/uiuc_aircraft.h>
+
+// bfi.hxx has to be included before uiuc_aircraft.h because of nasty
+// #defines in uiuc_aircraft.h
+#include "bfi.hxx"
+
+// #include <FDM/UIUCModel/uiuc_aircraft.h>
 #include <FDM/UIUCModel/uiuc_aircraftdir.h>
 #include <GUI/gui.h>
 #include <Joystick/joystick.hxx>
@@ -268,6 +273,9 @@ void fgInitVisuals( void ) {
 
 // Update all Visuals (redraws anything graphics related)
 void fgRenderFrame( void ) {
+    // Update the BFI.
+    FGBFI::update();
+
     fgLIGHT *l = &cur_light_params;
     FGTime *t = FGTime::cur_time_params;
     // FGView *v = &current_view;
index 9c17714bb84b6c75faa17b9af8b46f721a23c7ae..2cb9dedde35d804231c693231c14756c52f17e96 100644 (file)
@@ -70,11 +70,11 @@ fgSaveFlight (ostream &output)
   SAVE("longitude", FGBFI::getLongitude());
 
                                // KLUDGE: deal with gear wierdness
-  if (FGBFI::getAGL() < 6) {
-    SAVE("altitude", FGBFI::getAltitude() - 6);
-  } else {
+//   if (FGBFI::getAGL() < 6) {
+//     SAVE("altitude", FGBFI::getAltitude() - FGBFI::getAGL());
+//   } else {
     SAVE("altitude", FGBFI::getAltitude());
-  }
+//   }
 
   //
   // Orientation