Changeset 7219 for code/branches/consolecommands3/src
- Timestamp:
- Aug 26, 2010, 12:09:12 AM (14 years ago)
- Location:
- code/branches/consolecommands3/src
- Files:
-
- 36 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/consolecommands3/src/libraries/core/ConfigFileManager.cc
r7204 r7219 425 425 //////////////////////// 426 426 427 static const std::string __CC_load_name = "reloadSettings"; 428 static const std::string __CC_setFilename_name = "setSettingsFile"; 429 static const std::string __CC_config_name = "config"; 430 static const std::string __CC_tconfig_name = "tconfig"; 431 static const std::string __CC_getConfig_name = "getConfig"; 432 433 _SetConsoleCommand(__CC_load_name, &ConfigFile::load); 434 _SetConsoleCommand(__CC_setFilename_name, &SettingsConfigFile::setFilename); 435 _SetConsoleCommand(__CC_config_name, &SettingsConfigFile::config).argumentCompleter(0, autocompletion::settingssections()).argumentCompleter(1, autocompletion::settingsentries()).argumentCompleter(2, autocompletion::settingsvalue()); 436 _SetConsoleCommand(__CC_tconfig_name, &SettingsConfigFile::tconfig).argumentCompleter(0, autocompletion::settingssections()).argumentCompleter(1, autocompletion::settingsentries()).argumentCompleter(2, autocompletion::settingsvalue()); 437 _SetConsoleCommand(__CC_getConfig_name, &SettingsConfigFile::getConfig).argumentCompleter(0, autocompletion::settingssections()).argumentCompleter(1, autocompletion::settingsentries()); 438 427 439 SettingsConfigFile* SettingsConfigFile::singletonPtr_s = 0; 428 440 … … 430 442 : ConfigFile(filename) 431 443 { 432 ConsoleCommand* command = createConsoleCommand(createFunctor(&ConfigFile::load, this), "reloadSettings"); 433 CommandExecutor::addConsoleCommandShortcut(command); 434 command = createConsoleCommand(createFunctor(&SettingsConfigFile::setFilename, this), "setSettingsFile"); 435 CommandExecutor::addConsoleCommandShortcut(command); 436 command = createConsoleCommand(createFunctor(&SettingsConfigFile::config, this), "config"); 437 CommandExecutor::addConsoleCommandShortcut(command).argumentCompleter(0, autocompletion::settingssections()).argumentCompleter(1, autocompletion::settingsentries()).argumentCompleter(2, autocompletion::settingsvalue()); 438 command = createConsoleCommand(createFunctor(&SettingsConfigFile::tconfig, this), "tconfig"); 439 CommandExecutor::addConsoleCommandShortcut(command).argumentCompleter(0, autocompletion::settingssections()).argumentCompleter(1, autocompletion::settingsentries()).argumentCompleter(2, autocompletion::settingsvalue()); 440 command = createConsoleCommand(createFunctor(&SettingsConfigFile::getConfig, this), "getConfig"); 441 CommandExecutor::addConsoleCommandShortcut(command).argumentCompleter(0, autocompletion::settingssections()).argumentCompleter(1, autocompletion::settingsentries()); 444 _ModifyConsoleCommand(__CC_load_name).setObject(this); 445 _ModifyConsoleCommand(__CC_setFilename_name).setObject(this); 446 _ModifyConsoleCommand(__CC_config_name).setObject(this); 447 _ModifyConsoleCommand(__CC_tconfig_name).setObject(this); 448 _ModifyConsoleCommand(__CC_getConfig_name).setObject(this); 442 449 } 443 450 444 451 SettingsConfigFile::~SettingsConfigFile() 445 452 { 453 _ModifyConsoleCommand(__CC_load_name).setObject(0); 454 _ModifyConsoleCommand(__CC_setFilename_name).setObject(0); 455 _ModifyConsoleCommand(__CC_config_name).setObject(0); 456 _ModifyConsoleCommand(__CC_tconfig_name).setObject(0); 457 _ModifyConsoleCommand(__CC_getConfig_name).setObject(0); 446 458 } 447 459 -
code/branches/consolecommands3/src/libraries/core/Core.cc
r7207 r7219 66 66 #include "Language.h" 67 67 #include "LuaState.h" 68 #include "command/Co mmandExecutor.h"68 #include "command/ConsoleCommand.h" 69 69 #include "command/IOConsole.h" 70 70 #include "command/TclBind.h" … … 88 88 : identifierDestroyer_(Identifier::destroyAllIdentifiers) 89 89 // Cleanup guard for external console commands that don't belong to an Identifier 90 , consoleCommandDestroyer_( CommandExecutor::destroyExternalCommands)90 , consoleCommandDestroyer_(_ConsoleCommand::destroyAll) 91 91 , bGraphicsLoaded_(false) 92 92 , bStartIOConsole_(true) -
code/branches/consolecommands3/src/libraries/core/CorePrereqs.h
r7212 r7219 194 194 class ArgumentCompletionListElement; 195 195 class CommandEvaluation; 196 class ConsoleCommand;196 class _ConsoleCommand; 197 197 class Executor; 198 198 template <class T> -
code/branches/consolecommands3/src/libraries/core/GUIManager.cc
r7204 r7219 71 71 static void key_esc() 72 72 { GUIManager::getInstance().keyESC(); } 73 SetConsoleCommandShortcutExternAlias(key_esc, "keyESC");73 _SetConsoleCommand("keyESC", &key_esc); 74 74 75 75 class CEGUILogger : public CEGUI::DefaultLogger … … 99 99 GUIManager* GUIManager::singletonPtr_s = 0; 100 100 101 SetConsoleCommandShortcut(GUIManager, showGUI).accessLevel(AccessLevel::User).defaultValue(1, false).defaultValue(2, true);102 SetConsoleCommandShortcut(GUIManager, hideGUI).accessLevel(AccessLevel::User);101 _SetConsoleCommand("showGUI", &GUIManager::showGUI).defaultValue(1, false).defaultValue(2, true); 102 _SetConsoleCommand("hideGUI", &GUIManager::hideGUI); 103 103 104 104 /** -
code/branches/consolecommands3/src/libraries/core/Game.cc
r7204 r7219 57 57 static void stop_game() 58 58 { Game::getInstance().stop(); } 59 SetConsoleCommandShortcutExternAlias(stop_game, "exit");59 _SetConsoleCommand("exit", &stop_game); 60 60 static void printFPS() 61 61 { COUT(0) << Game::getInstance().getAvgFPS() << std::endl; } 62 SetConsoleCommandShortcutExternAlias(printFPS, "printFPS");62 _SetConsoleCommand("printFPS", &printFPS); 63 63 static void printTickTime() 64 64 { COUT(0) << Game::getInstance().getAvgTickTime() << std::endl; } 65 SetConsoleCommandShortcutExternAlias(printTickTime, "printTickTime");65 _SetConsoleCommand("printTickTime", &printTickTime); 66 66 67 67 std::map<std::string, GameStateInfo> Game::gameStateDeclarations_s; -
code/branches/consolecommands3/src/libraries/core/GraphicsManager.cc
r7204 r7219 65 65 namespace orxonox 66 66 { 67 static const std::string __CC_printScreen_name = "printScreen"; 68 _DeclareConsoleCommand(__CC_printScreen_name, &prototype::void__void); 69 67 70 class OgreWindowEventListener : public Ogre::WindowEventListener 68 71 { … … 131 134 132 135 Ogre::WindowEventUtilities::removeWindowEventListener(renderWindow_, ogreWindowEventListener_.get()); 133 // TODO: Destroy the console command136 _ModifyConsoleCommand(__CC_printScreen_name).resetFunction(); 134 137 135 138 // Undeclare the resources … … 321 324 322 325 // add console commands 323 ccPrintScreen_ = createConsoleCommand(createFunctor(&GraphicsManager::printScreen, this), "printScreen"); 324 CommandExecutor::addConsoleCommandShortcut(ccPrintScreen_); 326 _ModifyConsoleCommand(__CC_printScreen_name).setFunction(&GraphicsManager::printScreen, this); 325 327 } 326 328 -
code/branches/consolecommands3/src/libraries/core/GraphicsManager.h
r6417 r7219 114 114 int ogreLogLevelCritical_; //!< Corresponding Orxonox debug level for LL_CRITICAL 115 115 116 // console commands117 ConsoleCommand* ccPrintScreen_;118 119 116 static GraphicsManager* singletonPtr_s; //!< Pointer to the Singleton 120 117 }; -
code/branches/consolecommands3/src/libraries/core/command/ConsoleCommandCompilation.cc
r7202 r7219 37 37 #include "util/StringUtils.h" 38 38 #include "ConsoleCommand.h" 39 #include "CommandExecutor.h" 39 40 40 41 namespace orxonox 41 42 { 42 SetConsoleCommandShortcutExtern(source).argumentCompleter(0, autocompletion::files());43 SetConsoleCommandShortcutExtern(echo);44 SetConsoleCommandShortcutExtern(puts);43 _SetConsoleCommand("source", source).argumentCompleter(0, autocompletion::files()); 44 _SetConsoleCommand("echo", echo); 45 _SetConsoleCommand("puts", puts); 45 46 46 SetConsoleCommandShortcutExtern(read).argumentCompleter(0, autocompletion::files());47 SetConsoleCommandShortcutExtern(append).argumentCompleter(0, autocompletion::files());48 SetConsoleCommandShortcutExtern(write).argumentCompleter(0, autocompletion::files());47 _SetConsoleCommand("read", read).argumentCompleter(0, autocompletion::files()); 48 _SetConsoleCommand("append", append).argumentCompleter(0, autocompletion::files()); 49 _SetConsoleCommand("write", write).argumentCompleter(0, autocompletion::files()); 49 50 50 SetConsoleCommandShortcutExtern(calculate);51 _SetConsoleCommand("calculate", calculate); 51 52 52 53 void source(const std::string& filename) -
code/branches/consolecommands3/src/libraries/core/command/IRC.cc
r7203 r7219 42 42 static const unsigned int IRC_TCL_THREADID = 1421421421; 43 43 44 SetConsoleCommand(IRC, say, true).accessLevel(AccessLevel::User);45 SetConsoleCommand(IRC, msg, false).accessLevel(AccessLevel::User);46 SetConsoleCommand(IRC, nick, false).accessLevel(AccessLevel::User);44 _SetConsoleCommand("IRC", "say", &IRC::say); 45 _SetConsoleCommand("IRC", "msg", &IRC::msg); 46 _SetConsoleCommand("IRC", "nick", &IRC::nick); 47 47 48 48 IRC::IRC() -
code/branches/consolecommands3/src/libraries/core/command/Shell.cc
r7203 r7219 40 40 namespace orxonox 41 41 { 42 SetConsoleCommandShortcut(OutputHandler, log);43 SetConsoleCommandShortcut(OutputHandler, error);44 SetConsoleCommandShortcut(OutputHandler,warning);45 SetConsoleCommandShortcut(OutputHandler, info);46 SetConsoleCommandShortcut(OutputHandler, debug);42 _SetConsoleCommand("log", OutputHandler::log ); 43 _SetConsoleCommand("error", OutputHandler::error ); 44 _SetConsoleCommand("warning", OutputHandler::warning); 45 _SetConsoleCommand("info", OutputHandler::info ); 46 _SetConsoleCommand("debug", OutputHandler::debug ); 47 47 48 48 Shell::Shell(const std::string& consoleName, bool bScrollable) -
code/branches/consolecommands3/src/libraries/core/command/TclBind.cc
r7203 r7219 44 44 namespace orxonox 45 45 { 46 SetConsoleCommandShortcut(TclBind,tcl);47 SetConsoleCommandShortcut(TclBind,bgerror);46 _SetConsoleCommand("tcl", &TclBind::tcl); 47 _SetConsoleCommand("bgerror", &TclBind::bgerror); 48 48 49 49 TclBind* TclBind::singletonPtr_s = 0; -
code/branches/consolecommands3/src/libraries/core/command/TclThreadManager.cc
r7203 r7219 50 50 const float TCLTHREADMANAGER_MAX_CPU_USAGE = 0.50f; 51 51 52 SetConsoleCommandShortcutAlias(TclThreadManager, execute, "tclexecute").argumentCompleter(0, autocompletion::tclthreads());53 SetConsoleCommandShortcutAlias(TclThreadManager, query, "tclquery").argumentCompleter(0, autocompletion::tclthreads());54 SetConsoleCommand(TclThreadManager, create, false);55 SetConsoleCommand(TclThreadManager, destroy, false).argumentCompleter(0, autocompletion::tclthreads());56 SetConsoleCommand(TclThreadManager, execute, false).argumentCompleter(0, autocompletion::tclthreads());57 SetConsoleCommand(TclThreadManager, query, false).argumentCompleter(0, autocompletion::tclthreads());58 SetConsoleCommand(TclThreadManager, source, false).argumentCompleter(0, autocompletion::tclthreads());52 _SetConsoleCommand("tclexecute", &TclThreadManager::execute).argumentCompleter(0, autocompletion::tclthreads()); 53 _SetConsoleCommand("tclquery", &TclThreadManager::query ).argumentCompleter(0, autocompletion::tclthreads()); 54 _SetConsoleCommand("TclThreadManager", "create", &TclThreadManager::create); 55 _SetConsoleCommand("TclThreadManager", "destroy", &TclThreadManager::destroy).argumentCompleter(0, autocompletion::tclthreads()); 56 _SetConsoleCommand("TclThreadManager", "execute", &TclThreadManager::execute).argumentCompleter(0, autocompletion::tclthreads()); 57 _SetConsoleCommand("TclThreadManager", "query", &TclThreadManager::query ).argumentCompleter(0, autocompletion::tclthreads()); 58 _SetConsoleCommand("TclThreadManager", "source", &TclThreadManager::source ).argumentCompleter(0, autocompletion::tclthreads()); 59 59 60 60 /** -
code/branches/consolecommands3/src/libraries/core/input/InputManager.cc
r7204 r7219 62 62 SetCommandLineSwitch(keyboard_no_grab).information("Whether not to exclusively grab the keyboard"); 63 63 64 static const std::string __CC_InputManager_name = "InputManager"; 65 static const std::string __CC_calibrate_name = "calibrate"; 66 static const std::string __CC_reload_name = "reload"; 67 68 _SetConsoleCommand(__CC_InputManager_name, __CC_calibrate_name, &InputManager::calibrate).addShortcut(); 69 _SetConsoleCommand(__CC_InputManager_name, __CC_reload_name, &InputManager::reload ); 70 64 71 // Abuse of this source file for the InputHandler 65 72 InputHandler InputHandler::EMPTY; … … 118 125 this->updateActiveStates(); 119 126 120 // calibrate console command 121 this->getIdentifier()->addConsoleCommand(createConsoleCommand(createFunctor(&InputManager::calibrate, this), "calibrate"), true); 122 // reload console command 123 this->getIdentifier()->addConsoleCommand(createConsoleCommand(createFunctor(&InputManager::reload, this), "reload"), false); 127 _ModifyConsoleCommand(__CC_InputManager_name, __CC_calibrate_name).setObject(this); 128 _ModifyConsoleCommand(__CC_InputManager_name, __CC_reload_name).setObject(this); 124 129 125 130 CCOUT(4) << "Construction complete." << std::endl; … … 287 292 if (!(internalState_ & Bad)) 288 293 this->destroyDevices(); 294 295 // Reset console commands 296 _ModifyConsoleCommand(__CC_InputManager_name, __CC_calibrate_name).setObject(0); 297 _ModifyConsoleCommand(__CC_InputManager_name, __CC_reload_name).setObject(0); 289 298 290 299 CCOUT(3) << "Destruction complete." << std::endl; -
code/branches/consolecommands3/src/libraries/core/input/KeyBinderManager.cc
r7207 r7219 43 43 ManageScopedSingleton(KeyBinderManager, ScopeID::Graphics, false); 44 44 45 static const std::string __CC_keybind_name = "keybind"; 46 static const std::string __CC_tkeybind_name = "tkeybind"; 47 static const std::string __CC_unbind_name = "unbind"; 48 static const std::string __CC_tunbind_name = "tunbind"; 49 50 _SetConsoleCommand(__CC_keybind_name, &KeyBinderManager::keybind).defaultValues(""); 51 _SetConsoleCommand(__CC_tkeybind_name, &KeyBinderManager::tkeybind).defaultValues(""); 52 _SetConsoleCommand(__CC_unbind_name, &KeyBinderManager::unbind).defaultValues(""); 53 _SetConsoleCommand(__CC_tunbind_name, &KeyBinderManager::tunbind).defaultValues(""); 54 45 55 KeyBinderManager::KeyBinderManager() 46 56 : currentBinder_(NULL) … … 52 62 53 63 // keybind console commands 54 CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(createFunctor(&KeyBinderManager::keybind, this), "keybind" )) 55 .defaultValues(""); 56 CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(createFunctor(&KeyBinderManager::tkeybind, this), "tkeybind")) 57 .defaultValues(""); 58 CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(createFunctor(&KeyBinderManager::unbind, this), "unbind")) 59 .defaultValues(""); 60 CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(createFunctor(&KeyBinderManager::tunbind, this), "tunbind")) 61 .defaultValues(""); 64 _ModifyConsoleCommand(__CC_keybind_name ).setObject(this); 65 _ModifyConsoleCommand(__CC_tkeybind_name).setObject(this); 66 _ModifyConsoleCommand(__CC_unbind_name ).setObject(this); 67 _ModifyConsoleCommand(__CC_tunbind_name ).setObject(this); 62 68 63 69 // Load default key binder … … 70 76 for (std::map<std::string, KeyBinder*>::const_iterator it = this->binders_.begin(); it != this->binders_.end(); ++it) 71 77 delete it->second; 78 79 // Reset console commands 80 _ModifyConsoleCommand(__CC_keybind_name ).setObject(0); 81 _ModifyConsoleCommand(__CC_tkeybind_name).setObject(0); 82 _ModifyConsoleCommand(__CC_unbind_name ).setObject(0); 83 _ModifyConsoleCommand(__CC_tunbind_name ).setObject(0); 72 84 } 73 85 -
code/branches/consolecommands3/src/libraries/core/input/KeyDetector.cc
r7207 r7219 38 38 namespace orxonox 39 39 { 40 std::string KeyDetector::callbackCommand_s = "KeyDetectorKeyPressed";41 40 ManageScopedSingleton(KeyDetector, ScopeID::Graphics, false); 41 42 static const std::string __CC_KeyDetector_callback_name = "KeyDetectorKeyPressed"; 43 _DeclareConsoleCommand(__CC_KeyDetector_callback_name, &prototype::void__string); 42 44 43 45 KeyDetector::KeyDetector() … … 46 48 RegisterObject(KeyDetector); 47 49 48 CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(createFunctor(&KeyDetector::callback, this), callbackCommand_s)); 50 _ModifyConsoleCommand(__CC_KeyDetector_callback_name).setFunction(&KeyDetector::callback, this); 51 49 52 this->assignCommands(); 50 53 … … 59 62 inputState_->setHandler(NULL); 60 63 InputManager::getInstance().destroyState("detector"); 64 _ModifyConsoleCommand(__CC_KeyDetector_callback_name).resetFunction(); 61 65 } 62 66 … … 65 69 // Assign every button/axis the same command, but with its name as argument 66 70 for (std::map<std::string, Button*>::const_iterator it = allButtons_.begin(); it != allButtons_.end(); ++it) 67 it->second->parse( callbackCommand_s+ ' ' + it->second->groupName_ + "." + it->second->name_);71 it->second->parse(__CC_KeyDetector_callback_name + ' ' + it->second->groupName_ + "." + it->second->name_); 68 72 } 69 73 -
code/branches/consolecommands3/src/libraries/core/input/KeyDetector.h
r7198 r7219 57 57 FunctorPtr callbackFunction_; 58 58 InputState* inputState_; 59 static std::string callbackCommand_s;60 59 static KeyDetector* singletonPtr_s; 61 60 }; -
code/branches/consolecommands3/src/libraries/network/Host.cc
r7204 r7219 38 38 namespace orxonox { 39 39 40 SetConsoleCommandShortcut(Host, Chat); 40 static const std::string __CC_printRTT_name = "printRTT"; 41 42 _SetConsoleCommand("chat", &Host::Chat); 43 _SetConsoleCommand(__CC_printRTT_name, &Host::printRTT); 41 44 42 45 // Host* Host::instance_=0; … … 52 55 // assert(instance_==0); 53 56 instances_s.push_back(this); 54 this->printRTTCC_ = createConsoleCommand( createFunctor(&Host::printRTT, this), "printRTT" ); 55 CommandExecutor::addConsoleCommandShortcut( this->printRTTCC_ ); 57 _ModifyConsoleCommand(__CC_printRTT_name).setObject(this); 56 58 this->bIsActive_ = false; 57 59 } … … 65 67 assert( std::find( instances_s.begin(), instances_s.end(), this )!=instances_s.end() ); 66 68 instances_s.erase(std::find( instances_s.begin(), instances_s.end(), this )); 67 if( this->printRTTCC_ ) 68 delete this->printRTTCC_; 69 _ModifyConsoleCommand(__CC_printRTT_name).setObject(0); 69 70 } 70 71 -
code/branches/consolecommands3/src/libraries/network/Host.h
r7190 r7219 85 85 bool isActive(){ return bIsActive_; } 86 86 private: 87 ConsoleCommand* printRTTCC_;88 87 static uint32_t clientID_s; 89 88 static uint32_t shipID_s; -
code/branches/consolecommands3/src/libraries/tools/Timer.cc
r7204 r7219 39 39 namespace orxonox 40 40 { 41 SetConsoleCommandShortcutExtern(delay);42 SetConsoleCommandShortcutExtern(killdelays);41 _SetConsoleCommand("delay", &delay); 42 _SetConsoleCommand("killdelays", &killdelays); 43 43 44 44 static std::set<Timer*> delaytimerset; -
code/branches/consolecommands3/src/modules/designtools/ScreenshotManager.cc
r7207 r7219 20 20 { 21 21 ManageScopedSingleton(ScreenshotManager, ScopeID::Graphics, false); 22 SetConsoleCommandAlias(ScreenshotManager, makeScreenshot_s, "printScreenHD", true);22 _SetConsoleCommand("printScreenHD", &ScreenshotManager::makeScreenshot_s); 23 23 24 24 ScreenshotManager::ScreenshotManager() -
code/branches/consolecommands3/src/modules/designtools/SkyboxGenerator.cc
r7207 r7219 50 50 { 51 51 52 SetConsoleCommand(SkyboxGenerator, createSkybox, true);52 _SetConsoleCommand("SkyboxGenerator", "createSkybox", &SkyboxGenerator::createSkybox).addShortcut(); 53 53 54 54 ManageScopedSingleton(SkyboxGenerator, ScopeID::Graphics, false); … … 79 79 if(!this->captionsRemoved_) 80 80 { 81 CommandExecutor::execute(" setGametypeStatusfalse");81 CommandExecutor::execute("GametypeStatus displayCaption false"); 82 82 this->captionsRemoved_ = true; 83 83 return; … … 145 145 takeScreenshot_ = false; 146 146 CommandExecutor::execute("pause"); 147 CommandExecutor::execute(" setGametypeStatustrue");147 CommandExecutor::execute("GametypeStatus displayCaption true"); 148 148 this->captionsRemoved_ = false; 149 149 } -
code/branches/consolecommands3/src/modules/objects/triggers/Trigger.cc
r7204 r7219 38 38 { 39 39 40 SetConsoleCommand(Trigger, debugFlares, false).defaultValues(false);40 _SetConsoleCommand("Trigger", "debugFlares", &Trigger::debugFlares).defaultValues(false); 41 41 42 42 CreateFactory(Trigger); -
code/branches/consolecommands3/src/modules/overlays/hud/GametypeStatus.cc
r7204 r7219 41 41 CreateFactory(GametypeStatus); 42 42 43 /*static*/ bool GametypeStatus::noCaption_s = false; 44 SetConsoleCommand(GametypeStatus, setGametypeStatus, true); 43 static const std::string __CC_GametypeStatus_name = "GametypeStatus"; 44 static const std::string __CC_displayCaption_name = "displayCaption"; 45 46 _SetConsoleCommand(__CC_GametypeStatus_name, __CC_displayCaption_name, &GametypeStatus::setDisplayCaption); 45 47 46 48 GametypeStatus::GametypeStatus(BaseObject* creator) : OverlayText(creator) … … 49 51 50 52 this->owner_ = 0; 53 this->bNoCaption_ = false; 54 55 _ModifyConsoleCommand(__CC_GametypeStatus_name, __CC_displayCaption_name).setObject(this); 51 56 } 52 57 53 58 GametypeStatus::~GametypeStatus() 54 59 { 60 _ModifyConsoleCommand(__CC_GametypeStatus_name, __CC_displayCaption_name).setObject(0); 55 61 } 56 62 … … 64 70 ControllableEntity* ce = this->owner_->getControllableEntity(); 65 71 66 if (GametypeStatus::noCaption_s) // No captions are displayed.72 if (this->bNoCaption_) // No captions are displayed. 67 73 { 68 74 this->setCaption(""); … … 105 111 If true captions are displayed, if false, not. 106 112 */ 107 /*static*/ void GametypeStatus::setGametypeStatus(bool bValue)113 void GametypeStatus::setDisplayCaption(bool bValue) 108 114 { 109 GametypeStatus::noCaption_s= !bValue;115 this->bNoCaption_ = !bValue; 110 116 } 111 117 -
code/branches/consolecommands3/src/modules/overlays/hud/GametypeStatus.h
r7163 r7219 46 46 virtual void changedOwner(); 47 47 48 static void setGametypeStatus(bool bValue); //!< Toggles whether the gametype status is displayed.48 void setDisplayCaption(bool bValue); //!< Toggles whether the gametype status is displayed. 49 49 50 50 private: 51 51 PlayerInfo* owner_; 52 static bool noCaption_s;52 bool bNoCaption_; 53 53 54 54 }; -
code/branches/consolecommands3/src/orxonox/ChatInputHandler.cc
r7207 r7219 46 46 47 47 /* add commands to console */ 48 SetConsoleCommandAlias( ChatInputHandler, activate_static, "startchat", 49 true ); 50 SetConsoleCommandAlias( ChatInputHandler, activate_small_static, 51 "startchat_small", true ); 48 _SetConsoleCommand( "startchat", &ChatInputHandler::activate_static ); 49 _SetConsoleCommand( "startchat_small", &ChatInputHandler::activate_small_static ); 52 50 53 51 /* constructor */ -
code/branches/consolecommands3/src/orxonox/Test.cc
r7204 r7219 38 38 CreateFactory ( Test ); 39 39 40 SetConsoleCommand(Test, printV1, true).accessLevel(AccessLevel::User);41 SetConsoleCommand(Test, printV2, true).accessLevel(AccessLevel::User);42 SetConsoleCommand(Test, printV3, true).accessLevel(AccessLevel::User);43 SetConsoleCommand(Test, printV4, true).accessLevel(AccessLevel::User);44 SetConsoleCommand(Test, call, true).accessLevel(AccessLevel::User);45 SetConsoleCommand(Test, call2, true).accessLevel(AccessLevel::User);40 _SetConsoleCommand("Test", "printV1", &Test::printV1).addShortcut(); 41 _SetConsoleCommand("Test", "printV2", &Test::printV2).addShortcut(); 42 _SetConsoleCommand("Test", "printV3", &Test::printV3).addShortcut(); 43 _SetConsoleCommand("Test", "printV4", &Test::printV4).addShortcut(); 44 _SetConsoleCommand("Test", "call", &Test::call).addShortcut(); 45 _SetConsoleCommand("Test", "call2", &Test::call2).addShortcut(); 46 46 47 47 -
code/branches/consolecommands3/src/orxonox/controllers/ArtificialController.cc
r7204 r7219 47 47 namespace orxonox 48 48 { 49 SetConsoleCommand(ArtificialController, formationflight, true);50 SetConsoleCommand(ArtificialController, masteraction, true);51 SetConsoleCommand(ArtificialController, followme, true);52 SetConsoleCommand(ArtificialController, passivebehaviour, true);53 SetConsoleCommand(ArtificialController, formationsize, true);49 _SetConsoleCommand("ArtificialController", "formationflight", &ArtificialController::formationflight); 50 _SetConsoleCommand("ArtificialController", "masteraction", &ArtificialController::masteraction); 51 _SetConsoleCommand("ArtificialController", "followme", &ArtificialController::followme); 52 _SetConsoleCommand("ArtificialController", "passivebehaviour", &ArtificialController::passivebehaviour); 53 _SetConsoleCommand("ArtificialController", "formationsize", &ArtificialController::formationsize); 54 54 55 55 static const unsigned int STANDARD_MAX_FORMATION_SIZE = 7; -
code/branches/consolecommands3/src/orxonox/controllers/HumanController.cc
r7204 r7219 40 40 namespace orxonox 41 41 { 42 SetConsoleCommand(HumanController, moveFrontBack, true).setAsInputCommand();43 SetConsoleCommand(HumanController, moveRightLeft, true).setAsInputCommand();44 SetConsoleCommand(HumanController, moveUpDown, true).setAsInputCommand();45 SetConsoleCommand(HumanController, rotateYaw, true).setAsInputCommand();46 SetConsoleCommand(HumanController, rotatePitch, true).setAsInputCommand();47 SetConsoleCommand(HumanController, rotateRoll, true).setAsInputCommand();48 SetConsoleCommand(HumanController, fire, true).keybindMode(KeybindMode::OnHold);49 SetConsoleCommand(HumanController, reload, true);50 SetConsoleCommand(HumanController, boost, true).keybindMode(KeybindMode::OnHold);51 SetConsoleCommand(HumanController, greet, true);52 SetConsoleCommand(HumanController, switchCamera, true);53 SetConsoleCommand(HumanController, mouseLook, true);54 SetConsoleCommand(HumanController, suicide, true);55 SetConsoleCommand(HumanController, toggleGodMode, true);56 SetConsoleCommand(HumanController, addBots, true).defaultValues(1);57 SetConsoleCommand(HumanController, killBots, true).defaultValues(0);58 SetConsoleCommand(HumanController, dropItems, true);59 SetConsoleCommand(HumanController, useItem, true);60 SetConsoleCommand(HumanController, cycleNavigationFocus, true);61 SetConsoleCommand(HumanController, releaseNavigationFocus, true);42 _SetConsoleCommand("HumanController", "moveFrontBack", &HumanController::moveFrontBack ).addShortcut().setAsInputCommand(); 43 _SetConsoleCommand("HumanController", "moveRightLeft", &HumanController::moveRightLeft ).addShortcut().setAsInputCommand(); 44 _SetConsoleCommand("HumanController", "moveUpDown", &HumanController::moveUpDown ).addShortcut().setAsInputCommand(); 45 _SetConsoleCommand("HumanController", "rotateYaw", &HumanController::rotateYaw ).addShortcut().setAsInputCommand(); 46 _SetConsoleCommand("HumanController", "rotatePitch", &HumanController::rotatePitch ).addShortcut().setAsInputCommand(); 47 _SetConsoleCommand("HumanController", "rotateRoll", &HumanController::rotateRoll ).addShortcut().setAsInputCommand(); 48 _SetConsoleCommand("HumanController", "fire", &HumanController::fire ).addShortcut().keybindMode(KeybindMode::OnHold); 49 _SetConsoleCommand("HumanController", "reload", &HumanController::reload ).addShortcut(); 50 _SetConsoleCommand("HumanController", "boost", &HumanController::boost ).addShortcut().keybindMode(KeybindMode::OnHold); 51 _SetConsoleCommand("HumanController", "greet", &HumanController::greet ).addShortcut(); 52 _SetConsoleCommand("HumanController", "switchCamera", &HumanController::switchCamera ).addShortcut(); 53 _SetConsoleCommand("HumanController", "mouseLook", &HumanController::mouseLook ).addShortcut(); 54 _SetConsoleCommand("HumanController", "suicide", &HumanController::suicide ).addShortcut(); 55 _SetConsoleCommand("HumanController", "toggleGodMode", &HumanController::toggleGodMode ).addShortcut(); 56 _SetConsoleCommand("HumanController", "addBots", &HumanController::addBots ).addShortcut().defaultValues(1); 57 _SetConsoleCommand("HumanController", "killBots", &HumanController::killBots ).addShortcut().defaultValues(0); 58 _SetConsoleCommand("HumanController", "dropItems", &HumanController::dropItems ).addShortcut(); 59 _SetConsoleCommand("HumanController", "useItem", &HumanController::useItem ).addShortcut(); 60 _SetConsoleCommand("HumanController", "cycleNavigationFocus", &HumanController::cycleNavigationFocus).addShortcut(); 61 _SetConsoleCommand("HumanController", "releaseNavigationFocus", &HumanController::releaseNavigationFocus).addShortcut(); 62 62 63 63 CreateUnloadableFactory(HumanController); -
code/branches/consolecommands3/src/orxonox/controllers/NewHumanController.cc
r7204 r7219 49 49 namespace orxonox 50 50 { 51 SetConsoleCommand(NewHumanController, changeMode, false).keybindMode(KeybindMode::OnPress);52 SetConsoleCommand(NewHumanController, accelerate, false).keybindMode(KeybindMode::OnPress);53 SetConsoleCommand(NewHumanController, decelerate, false).keybindMode(KeybindMode::OnPress);54 SetConsoleCommand(NewHumanController, unfire, true).keybindMode(KeybindMode::OnRelease);51 _SetConsoleCommand("NewHumanController", "changeMode", &NewHumanController::changeMode).keybindMode(KeybindMode::OnPress); 52 _SetConsoleCommand("NewHumanController", "accelerate", &NewHumanController::accelerate).keybindMode(KeybindMode::OnPress); 53 _SetConsoleCommand("NewHumanController", "decelerate", &NewHumanController::decelerate).keybindMode(KeybindMode::OnPress); 54 _SetConsoleCommand("NewHumanController", "unfire", &NewHumanController::unfire ).keybindMode(KeybindMode::OnRelease).addShortcut(); 55 55 56 56 CreateUnloadableFactory(NewHumanController); -
code/branches/consolecommands3/src/orxonox/gamestates/GSMainMenu.cc
r7204 r7219 48 48 DeclareGameState(GSMainMenu, "mainMenu", false, true); 49 49 50 static const std::string __CC_startStandalone_name = "startGame"; 51 static const std::string __CC_startServer_name = "startServer"; 52 static const std::string __CC_startClient_name = "startClient"; 53 static const std::string __CC_startDedicated_name = "startDedicated"; 54 static const std::string __CC_startMainMenu_name = "startMainMenu"; 55 static const std::string __CC_setMainMenuSoundPath_name = "setMMSoundPath"; 56 57 _SetConsoleCommand(__CC_startStandalone_name, &GSMainMenu::startStandalone).deactivate(); 58 _SetConsoleCommand(__CC_startServer_name, &GSMainMenu::startServer ).deactivate(); 59 _SetConsoleCommand(__CC_startClient_name, &GSMainMenu::startClient ).deactivate(); 60 _SetConsoleCommand(__CC_startDedicated_name, &GSMainMenu::startDedicated ).deactivate(); 61 _SetConsoleCommand(__CC_startMainMenu_name, &GSMainMenu::startMainMenu ).deactivate(); 62 _SetConsoleCommand(__CC_setMainMenuSoundPath_name, &GSMainMenu::setMainMenuSoundPath); 63 50 64 GSMainMenu::GSMainMenu(const GameStateInfo& info) 51 65 : GameState(info) … … 89 103 InputManager::getInstance().enterState("MainMenuHackery"); 90 104 91 CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(createFunctor(&GSMainMenu::startStandalone), "startGame")); 92 CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(createFunctor(&GSMainMenu::startServer), "startServer")); 93 CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(createFunctor(&GSMainMenu::startClient), "startClient")); 94 CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(createFunctor(&GSMainMenu::startDedicated), "startDedicated")); 95 CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(createFunctor(&GSMainMenu::startMainMenu), "startMainMenu")); 96 97 // create command to change sound path 98 CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(createFunctor(&GSMainMenu::setMainMenuSoundPath, this), "setMMSoundPath")); 105 _ModifyConsoleCommand(__CC_startStandalone_name).activate(); 106 _ModifyConsoleCommand(__CC_startServer_name ).activate(); 107 _ModifyConsoleCommand(__CC_startClient_name ).activate(); 108 _ModifyConsoleCommand(__CC_startDedicated_name ).activate(); 109 _ModifyConsoleCommand(__CC_startMainMenu_name ).activate(); 110 _ModifyConsoleCommand(__CC_setMainMenuSoundPath_name).setObject(this); 99 111 100 112 KeyBinderManager::getInstance().setToDefault(); … … 122 134 GUIManager::hideGUI("MainMenu"); 123 135 GraphicsManager::getInstance().setCamera(0); 136 137 _ModifyConsoleCommand(__CC_startStandalone_name).deactivate(); 138 _ModifyConsoleCommand(__CC_startServer_name ).deactivate(); 139 _ModifyConsoleCommand(__CC_startClient_name ).deactivate(); 140 _ModifyConsoleCommand(__CC_startDedicated_name ).deactivate(); 141 _ModifyConsoleCommand(__CC_startMainMenu_name ).deactivate(); 142 _ModifyConsoleCommand(__CC_setMainMenuSoundPath_name).setObject(0); 124 143 } 125 144 -
code/branches/consolecommands3/src/orxonox/gamestates/GSRoot.cc
r7204 r7219 41 41 { 42 42 DeclareGameState(GSRoot, "root", false, false); 43 SetConsoleCommandShortcut(GSRoot, printObjects); 43 44 static const std::string __CC_setTimeFactor_name = "setTimeFactor"; 45 static const std::string __CC_pause_name = "pause"; 46 47 _SetConsoleCommand("printObjects", &GSRoot::printObjects); 48 _SetConsoleCommand(__CC_setTimeFactor_name, &GSRoot::setTimeFactor).accessLevel(AccessLevel::Master).defaultValues(1.0); 49 _SetConsoleCommand(__CC_pause_name, &GSRoot::pause ).accessLevel(AccessLevel::Master); 44 50 45 51 registerStaticNetworkFunction(&TimeFactorListener::setTimeFactor); … … 76 82 TimeFactorListener::setTimeFactor(1.0f); 77 83 78 // time factor console command 79 ConsoleCommand* command = createConsoleCommand(createFunctor(&GSRoot::setTimeFactor, this), "setTimeFactor"); 80 CommandExecutor::addConsoleCommandShortcut(command).accessLevel(AccessLevel::Offline).defaultValue(0, 1.0); 81 82 // time factor console command 83 command = createConsoleCommand(createFunctor(&GSRoot::pause, this), "pause"); 84 CommandExecutor::addConsoleCommandShortcut(command).accessLevel(AccessLevel::Offline); 84 _ModifyConsoleCommand(__CC_setTimeFactor_name).setObject(this); 85 _ModifyConsoleCommand(__CC_pause_name).setObject(this); 85 86 } 86 87 87 88 void GSRoot::deactivate() 88 89 { 90 _ModifyConsoleCommand(__CC_setTimeFactor_name).setObject(0); 91 _ModifyConsoleCommand(__CC_pause_name).setObject(0); 89 92 } 90 93 -
code/branches/consolecommands3/src/orxonox/gametypes/Gametype.cc
r7204 r7219 79 79 else 80 80 this->scoreboard_ = 0; 81 82 /* HACK HACK HACK */83 this->hackAddBots_ = createConsoleCommand( createFunctor(&Gametype::addBots, this), "hackAddBots");84 this->hackKillBots_ = createConsoleCommand( createFunctor(&Gametype::killBots, this), "hackKillBots");85 CommandExecutor::addConsoleCommandShortcut( this->hackAddBots_ );86 CommandExecutor::addConsoleCommandShortcut( this->hackKillBots_ );87 /* HACK HACK HACK */88 81 } 89 82 … … 93 86 { 94 87 this->gtinfo_->destroy(); 95 if( this->hackAddBots_ )96 delete this->hackAddBots_;97 if( this->hackKillBots_ )98 delete this->hackKillBots_;99 88 } 100 89 } -
code/branches/consolecommands3/src/orxonox/gametypes/Gametype.h
r6417 r7219 184 184 // Config Values 185 185 std::string scoreboardTemplate_; 186 187 /* HACK HACK HACK */188 ConsoleCommand* hackAddBots_;189 ConsoleCommand* hackKillBots_;190 /* HACK HACK HACK */191 186 }; 192 187 } -
code/branches/consolecommands3/src/orxonox/overlays/InGameConsole.cc
r7207 r7219 58 58 const float CHAR_WIDTH = 7.45f; // fix this please - determine the char-width dynamically 59 59 60 SetConsoleCommand(InGameConsole, openConsole, true);61 SetConsoleCommand(InGameConsole, closeConsole, true);60 _SetConsoleCommand("InGameConsole", "openConsole", &InGameConsole::openConsole).addShortcut(); 61 _SetConsoleCommand("InGameConsole", "closeConsole", &InGameConsole::closeConsole).addShortcut(); 62 62 63 63 ManageScopedSingleton(InGameConsole, ScopeID::Graphics, false); -
code/branches/consolecommands3/src/orxonox/overlays/OrxonoxOverlay.cc
r7204 r7219 57 57 std::map<std::string, OrxonoxOverlay*> OrxonoxOverlay::overlays_s; 58 58 59 SetConsoleCommand(OrxonoxOverlay, scaleOverlay, false).accessLevel(AccessLevel::User);60 SetConsoleCommand(OrxonoxOverlay, scrollOverlay, false).accessLevel(AccessLevel::User);61 SetConsoleCommand(OrxonoxOverlay, toggleVisibility, false).accessLevel(AccessLevel::User);62 SetConsoleCommand(OrxonoxOverlay, rotateOverlay, false).accessLevel(AccessLevel::User);59 _SetConsoleCommand("OrxonoxOverlay", "scaleOverlay", &OrxonoxOverlay::scaleOverlay); 60 _SetConsoleCommand("OrxonoxOverlay", "scrollOverlay", &OrxonoxOverlay::scrollOverlay); 61 _SetConsoleCommand("OrxonoxOverlay", "toggleVisibility", &OrxonoxOverlay::toggleVisibility); 62 _SetConsoleCommand("OrxonoxOverlay", "rotateOverlay", &OrxonoxOverlay::rotateOverlay); 63 63 64 64 OrxonoxOverlay::OrxonoxOverlay(BaseObject* creator) -
code/branches/consolecommands3/src/orxonox/overlays/OverlayGroup.cc
r7204 r7219 43 43 CreateFactory(OverlayGroup); 44 44 45 SetConsoleCommand(OverlayGroup, toggleVisibility, false).accessLevel(AccessLevel::User);46 SetConsoleCommand(OverlayGroup, scaleGroup, false).accessLevel(AccessLevel::User);47 SetConsoleCommand(OverlayGroup, scrollGroup, false).accessLevel(AccessLevel::User);45 _SetConsoleCommand("OverlayGroup", "toggleVisibility", &OverlayGroup::toggleVisibility); 46 _SetConsoleCommand("OverlayGroup", "scaleGroup", &OverlayGroup::scaleGroup); 47 _SetConsoleCommand("OverlayGroup", "scrollGroup", &OverlayGroup::scrollGroup); 48 48 49 49 OverlayGroup::OverlayGroup(BaseObject* creator)
Note: See TracChangeset
for help on using the changeset viewer.