From ebc2fbd684c044c03327a60dd78c1dbc123d480b Mon Sep 17 00:00:00 2001 From: curt Date: Sat, 30 Nov 2002 20:10:16 +0000 Subject: [PATCH] Exposed the fg_commands though the httpd interface. Added a built in command to preset to what ever values are in /sim/presets/ Twiddling with preset code. --- src/GUI/preset_dlg.cxx | 64 ++++------------------------------------ src/Main/fg_commands.cxx | 35 ++++++++++++++++++++-- src/Main/fg_init.cxx | 36 ++++++++++++++++++---- src/Network/httpd.cxx | 26 +++++++++++++--- 4 files changed, 91 insertions(+), 70 deletions(-) diff --git a/src/GUI/preset_dlg.cxx b/src/GUI/preset_dlg.cxx index 32a6ed61c..91481716c 100644 --- a/src/GUI/preset_dlg.cxx +++ b/src/GUI/preset_dlg.cxx @@ -31,22 +31,10 @@ # include #endif -// #include - -// #include -// #include +#include #include -// #include - -// #include -// #include - -#include -#include -#include
#include
-#include #include "gui.h" #include "preset_dlg.hxx" @@ -239,52 +227,10 @@ void fgPresetAirspeed(puObject *cb) void fgPresetCommit(puObject *) { - static const SGPropertyNode *longitude - = fgGetNode("/sim/presets/longitude-deg"); - static const SGPropertyNode *latitude - = fgGetNode("/sim/presets/latitude-deg"); - static const SGPropertyNode *master_freeze - = fgGetNode("/sim/freeze/master"); - - SGPath path( globals->get_fg_root() ); - path.append( "Airports" ); - path.append( "simple.mk4" ); - FGAirports airports( path.c_str() ); - - FGAirport a; - - bool freeze = master_freeze->getBoolValue(); - if ( !freeze ) { - fgSetBool("/sim/freeze/master", true); - } - - // unbind the current fdm state so property changes - // don't get lost when we subsequently delete this fdm - // and create a new one. - cur_fdm_state->unbind(); - - // invalidate lon/lat if an airport is specified in the presets - string apt = fgGetString("/sim/presets/airport-id"); - if ( !apt.empty() ) { - fgSetDouble("/sim/presets/longitude-deg", -9999.0 ); - fgSetDouble("/sim/presets/latitude-deg", -9999.0 ); - } - - // set position from presets - fgInitPosition(); - - // BusyCursor(0); - fgReInitSubsystems(); - - cout << "before tile_mgr init " << longitude->getDoubleValue() << " " - << latitude->getDoubleValue() << endl; - - double visibility_meters = fgGetDouble("/environment/visibility-m"); - global_tile_mgr.update( visibility_meters ); - // BusyCursor(1); - - if ( !freeze ) { - fgSetBool("/sim/freeze/master", false); + SGPropertyNode args; + if ( !globals->get_commands()->execute("presets_commit", &args) ) + { + SG_LOG( SG_GENERAL, SG_ALERT, "Command: presets_commit failed."); } } diff --git a/src/Main/fg_commands.cxx b/src/Main/fg_commands.cxx index f408f06d6..bb5368183 100644 --- a/src/Main/fg_commands.cxx +++ b/src/Main/fg_commands.cxx @@ -12,13 +12,15 @@ #include #include -#include -#include #include #include +#include +#include +#include #include #include