Howto:Add new fgcommands to FlightGear: Difference between revisions

Jump to navigation Jump to search
Line 220: Line 220:
</syntaxhighlight>
</syntaxhighlight>


This is something that would be typicall done in your constructor or the SGSubsystem::init() method.  
This is something that would be typically done in your constructor or the SGSubsystem::init() method. Form more detailed examples, just refer to the source tree and look for occurences of "SGCommand":
 
<pre>./src/Model/panelnode.cxx:365:  SGCommandMgr::instance()->addCommand("panel-mouse-click", do_panel_mouse_click);
./src/Environment/realwx_ctrl.cxx:246:    SGCommandMgr::instance()->addCommand("request-metar", commandRequestMetar);
./src/Environment/realwx_ctrl.cxx:247:    SGCommandMgr::instance()->addCommand("clear-metar", commandClearMetar);
./src/Environment/realwx_ctrl.cxx:252:  //SGCommandMgr::instance()->removeCommand("request-metar");
./src/Autopilot/route_mgr.cxx:218:  SGCommandMgr* cmdMgr = SGCommandMgr::instance();
./src/Autopilot/route_mgr.cxx:237:  SGCommandMgr* cmdMgr = SGCommandMgr::instance();
./src/GUI/FGPUIMenuBar.cxx:45:    SGCommandMgr::command_t command;
./src/Scripting/NasalSys.cxx:599:class NasalCommand : public SGCommandMgr::Command
./src/Scripting/NasalSys.cxx:644:    SGCommandMgr::Command* cmd = globals->get_commands()->getCommand(naStr_data(args[0]));
./src/Scripting/NasalSys.cxx:646:  //  SGCommandMgr::Command* cmd = globals->get_commands()->removeCommand(naStr_data(args[0]))
./src/Time/TimeManager.cxx:63:  SGCommandMgr::instance()->addCommand("timeofday", do_timeofday);
./src/Main/subsystemFactory.hxx:26:class SGCommandMgr;
./src/Main/subsystemFactory.hxx:40:void registerSubsystemCommands(SGCommandMgr* cmdMgr);
./src/Main/fg_commands.cxx:1575:  SGCommandMgr::command_t command;
./src/Main/globals.hxx:48:class SGCommandMgr;
./src/Main/globals.hxx:125:    SGCommandMgr *commands;
./src/Main/globals.hxx:249:    inline SGCommandMgr *get_commands () { return commands; }
./src/Main/globals.cxx:152:    commands( SGCommandMgr::instance() ),
./src/Main/subsystemFactory.cxx:283:  SGCommandMgr::command_t command;
./src/Main/subsystemFactory.cxx:293:void registerSubsystemCommands(SGCommandMgr* cmdMgr)
 
</pre>


When you send patches or file merge requests for new fgcommands, please also make sure to send patches for README.commands, too - so that your new commands are documented there.
When you send patches or file merge requests for new fgcommands, please also make sure to send patches for README.commands, too - so that your new commands are documented there.

Navigation menu