1
0
Fork 0

Changes by David Megginson.

This commit is contained in:
curt 2000-05-16 18:21:08 +00:00
parent e8d1596ec7
commit 90707efd3f
4 changed files with 74 additions and 9 deletions

View file

@ -66,6 +66,8 @@
#include <Main/options.hxx> #include <Main/options.hxx>
#include <Main/fg_init.hxx> #include <Main/fg_init.hxx>
#include <Main/views.hxx> #include <Main/views.hxx>
#include <Main/save.hxx>
#include <Main/bfi.hxx>
#ifdef FG_NETWORK_OLK #ifdef FG_NETWORK_OLK
#include <NetworkOLK/network.h> #include <NetworkOLK/network.h>
#endif #endif
@ -713,6 +715,36 @@ void guiToggleMenu(void)
the Gui callback functions 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) void reInit(puObject *cb)
{ {
BusyCursor(0); BusyCursor(0);
@ -722,6 +754,11 @@ void reInit(puObject *cb)
BusyCursor(1); BusyCursor(1);
} }
static void toggleClouds(puObject *cb)
{
FGBFI::setClouds(!FGBFI::getClouds());
}
// This is the accessor function // This is the accessor function
void guiTogglePanel(puObject *cb) void guiTogglePanel(puObject *cb)
{ {
@ -1362,8 +1399,11 @@ char *fileSubmenu [] = {
"Print", "Print",
#endif #endif
"Snap Shot", "Snap Shot",
/* "---------", "Save", */ "---------",
"Reset", NULL "Reset",
"Load flight",
"Save flight",
NULL
}; };
puCallback fileSubmenuCb [] = { puCallback fileSubmenuCb [] = {
MayBeGoodBye, /* hideMenuCb, NULL, */ MayBeGoodBye, /* hideMenuCb, NULL, */
@ -1372,7 +1412,11 @@ puCallback fileSubmenuCb [] = {
#endif #endif
/* NULL, notCb, */ /* NULL, notCb, */
dumpSnapShot, dumpSnapShot,
reInit, NULL NULL,
reInit,
loadFlight,
saveFlight,
NULL
}; };
/* /*
@ -1406,9 +1450,11 @@ puCallback aircraftSubmenuCb [] = {
}; };
char *environmentSubmenu [] = { char *environmentSubmenu [] = {
"Airport", /* "Terrain", "Weather", */ NULL "Toggle Clouds",
"Goto Airport", /* "Terrain", "Weather", */ NULL
}; };
puCallback environmentSubmenuCb [] = { puCallback environmentSubmenuCb [] = {
toggleClouds,
NewAirport, /* notCb, notCb, */ NULL NewAirport, /* notCb, notCb, */ NULL
}; };

View file

@ -108,6 +108,16 @@ FGBFI::reinit ()
cout << "BFI: start reinit\n"; 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 // TODO: add more AP stuff
double elevator = getElevator(); double elevator = getElevator();
double aileron = getAileron(); double aileron = getAileron();
@ -1164,6 +1174,7 @@ FGBFI::setVisibility (double visibility)
void void
FGBFI::setClouds (bool clouds) FGBFI::setClouds (bool clouds)
{ {
cout << "Set clouds to " << clouds << endl;
current_options.set_clouds(clouds); current_options.set_clouds(clouds);
needReinit(); needReinit();
} }

View file

@ -80,7 +80,12 @@
#include <Cockpit/cockpit.hxx> #include <Cockpit/cockpit.hxx>
#include <Cockpit/radiostack.hxx> #include <Cockpit/radiostack.hxx>
#include <Cockpit/steam.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 <FDM/UIUCModel/uiuc_aircraftdir.h>
#include <GUI/gui.h> #include <GUI/gui.h>
#include <Joystick/joystick.hxx> #include <Joystick/joystick.hxx>
@ -268,6 +273,9 @@ void fgInitVisuals( void ) {
// Update all Visuals (redraws anything graphics related) // Update all Visuals (redraws anything graphics related)
void fgRenderFrame( void ) { void fgRenderFrame( void ) {
// Update the BFI.
FGBFI::update();
fgLIGHT *l = &cur_light_params; fgLIGHT *l = &cur_light_params;
FGTime *t = FGTime::cur_time_params; FGTime *t = FGTime::cur_time_params;
// FGView *v = &current_view; // FGView *v = &current_view;

View file

@ -70,11 +70,11 @@ fgSaveFlight (ostream &output)
SAVE("longitude", FGBFI::getLongitude()); SAVE("longitude", FGBFI::getLongitude());
// KLUDGE: deal with gear wierdness // KLUDGE: deal with gear wierdness
if (FGBFI::getAGL() < 6) { // if (FGBFI::getAGL() < 6) {
SAVE("altitude", FGBFI::getAltitude() - 6); // SAVE("altitude", FGBFI::getAltitude() - FGBFI::getAGL());
} else { // } else {
SAVE("altitude", FGBFI::getAltitude()); SAVE("altitude", FGBFI::getAltitude());
} // }
// //
// Orientation // Orientation