Changes by David Megginson.
This commit is contained in:
parent
e8d1596ec7
commit
90707efd3f
4 changed files with 74 additions and 9 deletions
|
@ -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);
|
||||
|
@ -722,6 +754,11 @@ void reInit(puObject *cb)
|
|||
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
|
||||
};
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -80,7 +80,12 @@
|
|||
#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 = ¤t_view;
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue