Changed 'exit' command to quit immediately, rather than displaying a
built-in dialog (use an XML dialog instead). Added an fgExit() function to simplify exit and cleanup.
This commit is contained in:
parent
980eae6187
commit
9679c7da15
3 changed files with 40 additions and 3 deletions
|
@ -35,6 +35,7 @@ SG_USING_STD(ofstream);
|
|||
#include "fg_props.hxx"
|
||||
#include "fg_io.hxx"
|
||||
#include "globals.hxx"
|
||||
#include "util.hxx"
|
||||
#include "viewmgr.hxx"
|
||||
|
||||
|
||||
|
@ -169,13 +170,13 @@ do_script (const SGPropertyNode * arg)
|
|||
/**
|
||||
* Built-in command: exit FlightGear.
|
||||
*
|
||||
* TODO: show a confirm dialog.
|
||||
* status: the exit status to return to the operating system (defaults to 0)
|
||||
*/
|
||||
static bool
|
||||
do_exit (const SGPropertyNode * arg)
|
||||
{
|
||||
SG_LOG(SG_INPUT, SG_ALERT, "Program exit requested.");
|
||||
ConfirmExitDialog();
|
||||
SG_LOG(SG_INPUT, SG_INFO, "Program exit requested.");
|
||||
fgExit(arg->getIntValue("status", 0));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,8 +19,33 @@
|
|||
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include <simgear/debug/logstream.hxx>
|
||||
|
||||
#include "fg_io.hxx"
|
||||
#include "fg_props.hxx"
|
||||
#include "globals.hxx"
|
||||
#include "util.hxx"
|
||||
|
||||
#if defined(FG_NETWORK_OLK)
|
||||
#include <NetworkOLK/network.h>
|
||||
#endif
|
||||
|
||||
|
||||
void
|
||||
fgExit (int status)
|
||||
{
|
||||
SG_LOG(SG_GENERAL, SG_INFO, "Exiting FlightGear with status " << status);
|
||||
|
||||
#if defined(FG_NETWORK_OLK)
|
||||
if (fgGetBool("/sim/networking/network-olk"))
|
||||
fgd_send_com("8", FGFS_host);
|
||||
#endif
|
||||
|
||||
globals->get_io()->shutdown_all();
|
||||
exit(status);
|
||||
}
|
||||
|
||||
|
||||
// Originally written by Alex Perry.
|
||||
double
|
||||
|
|
|
@ -26,6 +26,17 @@
|
|||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* Clean up and exit FlightGear.
|
||||
*
|
||||
* This function makes sure that network connections and I/O streams
|
||||
* are cleaned up.
|
||||
*
|
||||
* @param status The exit status to pass to the operating system.
|
||||
*/
|
||||
extern void fgExit (int status = 0);
|
||||
|
||||
|
||||
/**
|
||||
* Move a value towards a target.
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue