X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FMain%2Ffg_commands.cxx;h=e5d72f8a923fa5ef0cf1b6082cc96291280b6d11;hb=a704a6208131cad4f12123a72acdb1fb3dc6658f;hp=f9efa5b4794b83b039dbdafe4541f80ab5ceb5b1;hpb=ffbb0a0e5d8915df208dc8042fd3338f04b01dfe;p=flightgear.git diff --git a/src/Main/fg_commands.cxx b/src/Main/fg_commands.cxx index f9efa5b47..e5d72f8a9 100644 --- a/src/Main/fg_commands.cxx +++ b/src/Main/fg_commands.cxx @@ -206,95 +206,6 @@ do_reset (const SGPropertyNode * arg) return true; } - -/** - * Built-in command: reinitialize one or more subsystems. - * - * subsystem[*]: the name(s) of the subsystem(s) to reinitialize; if - * none is specified, reinitialize all of them. - */ -static bool -do_reinit (const SGPropertyNode * arg) -{ - bool result = true; - - vector subsystems = arg->getChildren("subsystem"); - if (subsystems.size() == 0) { - globals->get_subsystem_mgr()->reinit(); - } else { - for ( unsigned int i = 0; i < subsystems.size(); i++ ) { - const char * name = subsystems[i]->getStringValue(); - SGSubsystem * subsystem = globals->get_subsystem(name); - if (subsystem == 0) { - result = false; - SG_LOG( SG_GENERAL, SG_ALERT, - "Subsystem " << name << " not found" ); - } else { - subsystem->reinit(); - } - } - } - - globals->get_event_mgr()->reinit(); - - return result; -} - -#if 0 - // - // these routines look useful ??? but are never used in the code ??? - // - -/** - * Built-in command: suspend one or more subsystems. - * - * subsystem[*] - the name(s) of the subsystem(s) to suspend. - */ -static bool -do_suspend (const SGPropertyNode * arg) -{ - bool result = true; - - vector subsystems = arg->getChildren("subsystem"); - for ( unsigned int i = 0; i < subsystems.size(); i++ ) { - const char * name = subsystems[i]->getStringValue(); - SGSubsystem * subsystem = globals->get_subsystem(name); - if (subsystem == 0) { - result = false; - SG_LOG(SG_GENERAL, SG_ALERT, "Subsystem " << name << " not found"); - } else { - subsystem->suspend(); - } - } - return result; -} - -/** - * Built-in command: suspend one or more subsystems. - * - * subsystem[*] - the name(s) of the subsystem(s) to suspend. - */ -static bool -do_resume (const SGPropertyNode * arg) -{ - bool result = true; - - vector subsystems = arg->getChildren("subsystem"); - for ( unsigned int i = 0; i < subsystems.size(); i++ ) { - const char * name = subsystems[i]->getStringValue(); - SGSubsystem * subsystem = globals->get_subsystem(name); - if (subsystem == 0) { - result = false; - SG_LOG(SG_GENERAL, SG_ALERT, "Subsystem " << name << " not found"); - } else { - subsystem->resume(); - } - } - return result; -} - -#endif - /** * Built-in command: replay the FDR buffer */ @@ -1022,7 +933,10 @@ static bool do_dialog_new (const SGPropertyNode * arg) { NewGUI * gui = (NewGUI *)globals->get_subsystem("gui"); - + if (!gui) { + return false; + } + // Note the casting away of const: this is *real*. Doing a // "dialog-apply" command later on will mutate this property node. // I'm not convinced that this isn't the Right Thing though; it @@ -1192,6 +1106,12 @@ do_set_cursor (const SGPropertyNode * arg) static bool do_play_audio_sample (const SGPropertyNode * arg) { + SGSoundMgr *smgr = globals->get_soundmgr(); + if (!smgr) { + SG_LOG(SG_GENERAL, SG_WARN, "play-audio-sample: sound-manager not running"); + return false; + } + string path = arg->getStringValue("path"); string file = arg->getStringValue("file"); float volume = arg->getFloatValue("volume"); @@ -1199,7 +1119,6 @@ do_play_audio_sample (const SGPropertyNode * arg) try { static FGSampleQueue *queue = 0; if ( !queue ) { - SGSoundMgr *smgr = globals->get_soundmgr(); queue = new FGSampleQueue(smgr, "chatter"); queue->tie_to_listener(); } @@ -1523,9 +1442,6 @@ static struct { { "nasal", do_nasal }, { "exit", do_exit }, { "reset", do_reset }, - { "reinit", do_reinit }, - { "suspend", do_reinit }, - { "resume", do_reinit }, { "pause", do_pause }, { "load", do_load }, { "save", do_save },