#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
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);
fgReInitSubsystems();
BusyCursor(1);
}
+
+static void toggleClouds(puObject *cb)
+{
+ FGBFI::setClouds(!FGBFI::getClouds());
+}
// This is the accessor function
void guiTogglePanel(puObject *cb)
"Print",
#endif
"Snap Shot",
- /* "---------", "Save", */
- "Reset", NULL
+ "---------",
+ "Reset",
+ "Load flight",
+ "Save flight",
+ NULL
};
puCallback fileSubmenuCb [] = {
MayBeGoodBye, /* hideMenuCb, NULL, */
#endif
/* NULL, notCb, */
dumpSnapShot,
- reInit, NULL
+ NULL,
+ reInit,
+ loadFlight,
+ saveFlight,
+ NULL
};
/*
};
char *environmentSubmenu [] = {
- "Airport", /* "Terrain", "Weather", */ NULL
+ "Toggle Clouds",
+ "Goto Airport", /* "Terrain", "Weather", */ NULL
};
puCallback environmentSubmenuCb [] = {
+ toggleClouds,
NewAirport, /* notCb, notCb, */ NULL
};
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();
void
FGBFI::setClouds (bool clouds)
{
+ cout << "Set clouds to " << clouds << endl;
current_options.set_clouds(clouds);
needReinit();
}
#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>
// 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 = ¤t_view;
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