Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Aug 26, 2010, 12:09:12 AM (14 years ago)
Author:
landauf
Message:

adapted all console commands to the new interface

Location:
code/branches/consolecommands3/src
Files:
36 edited

Legend:

Unmodified
Added
Removed
  • code/branches/consolecommands3/src/libraries/core/ConfigFileManager.cc

    r7204 r7219  
    425425    ////////////////////////
    426426
     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
    427439    SettingsConfigFile* SettingsConfigFile::singletonPtr_s = 0;
    428440
     
    430442        : ConfigFile(filename)
    431443    {
    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);
    442449    }
    443450
    444451    SettingsConfigFile::~SettingsConfigFile()
    445452    {
     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);
    446458    }
    447459
  • code/branches/consolecommands3/src/libraries/core/Core.cc

    r7207 r7219  
    6666#include "Language.h"
    6767#include "LuaState.h"
    68 #include "command/CommandExecutor.h"
     68#include "command/ConsoleCommand.h"
    6969#include "command/IOConsole.h"
    7070#include "command/TclBind.h"
     
    8888        : identifierDestroyer_(Identifier::destroyAllIdentifiers)
    8989        // Cleanup guard for external console commands that don't belong to an Identifier
    90         , consoleCommandDestroyer_(CommandExecutor::destroyExternalCommands)
     90        , consoleCommandDestroyer_(_ConsoleCommand::destroyAll)
    9191        , bGraphicsLoaded_(false)
    9292        , bStartIOConsole_(true)
  • code/branches/consolecommands3/src/libraries/core/CorePrereqs.h

    r7212 r7219  
    194194    class ArgumentCompletionListElement;
    195195    class CommandEvaluation;
    196     class ConsoleCommand;
     196    class _ConsoleCommand;
    197197    class Executor;
    198198    template <class T>
  • code/branches/consolecommands3/src/libraries/core/GUIManager.cc

    r7204 r7219  
    7171    static void key_esc()
    7272        { GUIManager::getInstance().keyESC(); }
    73     SetConsoleCommandShortcutExternAlias(key_esc, "keyESC");
     73    _SetConsoleCommand("keyESC", &key_esc);
    7474
    7575    class CEGUILogger : public CEGUI::DefaultLogger
     
    9999    GUIManager* GUIManager::singletonPtr_s = 0;
    100100
    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);
    103103
    104104    /**
  • code/branches/consolecommands3/src/libraries/core/Game.cc

    r7204 r7219  
    5757    static void stop_game()
    5858        { Game::getInstance().stop(); }
    59     SetConsoleCommandShortcutExternAlias(stop_game, "exit");
     59    _SetConsoleCommand("exit", &stop_game);
    6060    static void printFPS()
    6161        { COUT(0) << Game::getInstance().getAvgFPS() << std::endl; }
    62     SetConsoleCommandShortcutExternAlias(printFPS, "printFPS");
     62    _SetConsoleCommand("printFPS", &printFPS);
    6363    static void printTickTime()
    6464        { COUT(0) << Game::getInstance().getAvgTickTime() << std::endl; }
    65     SetConsoleCommandShortcutExternAlias(printTickTime, "printTickTime");
     65    _SetConsoleCommand("printTickTime", &printTickTime);
    6666
    6767    std::map<std::string, GameStateInfo> Game::gameStateDeclarations_s;
  • code/branches/consolecommands3/src/libraries/core/GraphicsManager.cc

    r7204 r7219  
    6565namespace orxonox
    6666{
     67    static const std::string __CC_printScreen_name = "printScreen";
     68    _DeclareConsoleCommand(__CC_printScreen_name, &prototype::void__void);
     69
    6770    class OgreWindowEventListener : public Ogre::WindowEventListener
    6871    {
     
    131134
    132135        Ogre::WindowEventUtilities::removeWindowEventListener(renderWindow_, ogreWindowEventListener_.get());
    133         // TODO: Destroy the console command
     136        _ModifyConsoleCommand(__CC_printScreen_name).resetFunction();
    134137
    135138        // Undeclare the resources
     
    321324
    322325        // add console commands
    323         ccPrintScreen_ = createConsoleCommand(createFunctor(&GraphicsManager::printScreen, this), "printScreen");
    324         CommandExecutor::addConsoleCommandShortcut(ccPrintScreen_);
     326        _ModifyConsoleCommand(__CC_printScreen_name).setFunction(&GraphicsManager::printScreen, this);
    325327    }
    326328
  • code/branches/consolecommands3/src/libraries/core/GraphicsManager.h

    r6417 r7219  
    114114        int                 ogreLogLevelCritical_;     //!< Corresponding Orxonox debug level for LL_CRITICAL
    115115
    116         // console commands
    117         ConsoleCommand*     ccPrintScreen_;
    118 
    119116        static GraphicsManager* singletonPtr_s;        //!< Pointer to the Singleton
    120117    };
  • code/branches/consolecommands3/src/libraries/core/command/ConsoleCommandCompilation.cc

    r7202 r7219  
    3737#include "util/StringUtils.h"
    3838#include "ConsoleCommand.h"
     39#include "CommandExecutor.h"
    3940
    4041namespace orxonox
    4142{
    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);
    4546
    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());
    4950
    50     SetConsoleCommandShortcutExtern(calculate);
     51    _SetConsoleCommand("calculate", calculate);
    5152
    5253    void source(const std::string& filename)
  • code/branches/consolecommands3/src/libraries/core/command/IRC.cc

    r7203 r7219  
    4242    static const unsigned int IRC_TCL_THREADID  = 1421421421;
    4343
    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);
    4747
    4848    IRC::IRC()
  • code/branches/consolecommands3/src/libraries/core/command/Shell.cc

    r7203 r7219  
    4040namespace orxonox
    4141{
    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  );
    4747
    4848    Shell::Shell(const std::string& consoleName, bool bScrollable)
  • code/branches/consolecommands3/src/libraries/core/command/TclBind.cc

    r7203 r7219  
    4444namespace orxonox
    4545{
    46     SetConsoleCommandShortcut(TclBind, tcl);
    47     SetConsoleCommandShortcut(TclBind, bgerror);
     46    _SetConsoleCommand("tcl", &TclBind::tcl);
     47    _SetConsoleCommand("bgerror", &TclBind::bgerror);
    4848
    4949    TclBind* TclBind::singletonPtr_s = 0;
  • code/branches/consolecommands3/src/libraries/core/command/TclThreadManager.cc

    r7203 r7219  
    5050    const float TCLTHREADMANAGER_MAX_CPU_USAGE = 0.50f;
    5151
    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());
    5959
    6060    /**
  • code/branches/consolecommands3/src/libraries/core/input/InputManager.cc

    r7204 r7219  
    6262    SetCommandLineSwitch(keyboard_no_grab).information("Whether not to exclusively grab the keyboard");
    6363
     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
    6471    // Abuse of this source file for the InputHandler
    6572    InputHandler InputHandler::EMPTY;
     
    118125        this->updateActiveStates();
    119126
    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);
    124129
    125130        CCOUT(4) << "Construction complete." << std::endl;
     
    287292        if (!(internalState_ & Bad))
    288293            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);
    289298
    290299        CCOUT(3) << "Destruction complete." << std::endl;
  • code/branches/consolecommands3/src/libraries/core/input/KeyBinderManager.cc

    r7207 r7219  
    4343    ManageScopedSingleton(KeyBinderManager, ScopeID::Graphics, false);
    4444
     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
    4555    KeyBinderManager::KeyBinderManager()
    4656        : currentBinder_(NULL)
     
    5262
    5363        // 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);
    6268
    6369        // Load default key binder
     
    7076        for (std::map<std::string, KeyBinder*>::const_iterator it = this->binders_.begin(); it != this->binders_.end(); ++it)
    7177            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);
    7284    }
    7385
  • code/branches/consolecommands3/src/libraries/core/input/KeyDetector.cc

    r7207 r7219  
    3838namespace orxonox
    3939{
    40     std::string KeyDetector::callbackCommand_s = "KeyDetectorKeyPressed";
    4140    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);
    4244
    4345    KeyDetector::KeyDetector()
     
    4648        RegisterObject(KeyDetector);
    4749
    48         CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(createFunctor(&KeyDetector::callback,  this), callbackCommand_s));
     50        _ModifyConsoleCommand(__CC_KeyDetector_callback_name).setFunction(&KeyDetector::callback, this);
     51
    4952        this->assignCommands();
    5053
     
    5962        inputState_->setHandler(NULL);
    6063        InputManager::getInstance().destroyState("detector");
     64        _ModifyConsoleCommand(__CC_KeyDetector_callback_name).resetFunction();
    6165    }
    6266
     
    6569        // Assign every button/axis the same command, but with its name as argument
    6670        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_);
    6872    }
    6973
  • code/branches/consolecommands3/src/libraries/core/input/KeyDetector.h

    r7198 r7219  
    5757        FunctorPtr callbackFunction_;
    5858        InputState* inputState_;
    59         static std::string callbackCommand_s;
    6059        static KeyDetector* singletonPtr_s;
    6160    };
  • code/branches/consolecommands3/src/libraries/network/Host.cc

    r7204 r7219  
    3838namespace orxonox {
    3939
    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);
    4144
    4245  // Host*               Host::instance_=0;
     
    5255  //   assert(instance_==0);
    5356    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);
    5658    this->bIsActive_ = false;
    5759  }
     
    6567    assert( std::find( instances_s.begin(), instances_s.end(), this )!=instances_s.end() );
    6668    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);
    6970  }
    7071
  • code/branches/consolecommands3/src/libraries/network/Host.h

    r7190 r7219  
    8585    bool isActive(){ return bIsActive_; }
    8686  private:
    87     ConsoleCommand* printRTTCC_;
    8887    static uint32_t clientID_s;
    8988    static uint32_t shipID_s;
  • code/branches/consolecommands3/src/libraries/tools/Timer.cc

    r7204 r7219  
    3939namespace orxonox
    4040{
    41     SetConsoleCommandShortcutExtern(delay);
    42     SetConsoleCommandShortcutExtern(killdelays);
     41    _SetConsoleCommand("delay", &delay);
     42    _SetConsoleCommand("killdelays", &killdelays);
    4343
    4444    static std::set<Timer*> delaytimerset;
  • code/branches/consolecommands3/src/modules/designtools/ScreenshotManager.cc

    r7207 r7219  
    2020{
    2121    ManageScopedSingleton(ScreenshotManager, ScopeID::Graphics, false);
    22     SetConsoleCommandAlias(ScreenshotManager, makeScreenshot_s, "printScreenHD", true);
     22    _SetConsoleCommand("printScreenHD", &ScreenshotManager::makeScreenshot_s);
    2323
    2424    ScreenshotManager::ScreenshotManager()
  • code/branches/consolecommands3/src/modules/designtools/SkyboxGenerator.cc

    r7207 r7219  
    5050{
    5151
    52     SetConsoleCommand(SkyboxGenerator, createSkybox, true);
     52    _SetConsoleCommand("SkyboxGenerator", "createSkybox", &SkyboxGenerator::createSkybox).addShortcut();
    5353
    5454    ManageScopedSingleton(SkyboxGenerator, ScopeID::Graphics, false);
     
    7979            if(!this->captionsRemoved_)
    8080            {
    81                 CommandExecutor::execute("setGametypeStatus false");
     81                CommandExecutor::execute("GametypeStatus displayCaption false");
    8282                this->captionsRemoved_ = true;
    8383                return;
     
    145145                takeScreenshot_ = false;
    146146                CommandExecutor::execute("pause");
    147                 CommandExecutor::execute("setGametypeStatus true");
     147                CommandExecutor::execute("GametypeStatus displayCaption true");
    148148                this->captionsRemoved_ = false;
    149149            }
  • code/branches/consolecommands3/src/modules/objects/triggers/Trigger.cc

    r7204 r7219  
    3838{
    3939
    40   SetConsoleCommand(Trigger, debugFlares, false).defaultValues(false);
     40  _SetConsoleCommand("Trigger", "debugFlares", &Trigger::debugFlares).defaultValues(false);
    4141
    4242  CreateFactory(Trigger);
  • code/branches/consolecommands3/src/modules/overlays/hud/GametypeStatus.cc

    r7204 r7219  
    4141    CreateFactory(GametypeStatus);
    4242
    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);
    4547
    4648    GametypeStatus::GametypeStatus(BaseObject* creator) : OverlayText(creator)
     
    4951
    5052        this->owner_ = 0;
     53        this->bNoCaption_ = false;
     54
     55        _ModifyConsoleCommand(__CC_GametypeStatus_name, __CC_displayCaption_name).setObject(this);
    5156    }
    5257
    5358    GametypeStatus::~GametypeStatus()
    5459    {
     60        _ModifyConsoleCommand(__CC_GametypeStatus_name, __CC_displayCaption_name).setObject(0);
    5561    }
    5662
     
    6470            ControllableEntity* ce = this->owner_->getControllableEntity();
    6571
    66             if(GametypeStatus::noCaption_s) // No captions are displayed.
     72            if (this->bNoCaption_) // No captions are displayed.
    6773            {
    6874                this->setCaption("");
     
    105111        If true captions are displayed, if false, not.
    106112    */
    107     /*static*/ void GametypeStatus::setGametypeStatus(bool bValue)
     113    void GametypeStatus::setDisplayCaption(bool bValue)
    108114    {
    109         GametypeStatus::noCaption_s = !bValue;
     115        this->bNoCaption_ = !bValue;
    110116    }
    111117
  • code/branches/consolecommands3/src/modules/overlays/hud/GametypeStatus.h

    r7163 r7219  
    4646            virtual void changedOwner();
    4747
    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.
    4949
    5050        private:
    5151            PlayerInfo* owner_;
    52             static bool noCaption_s;
     52            bool bNoCaption_;
    5353
    5454    };
  • code/branches/consolecommands3/src/orxonox/ChatInputHandler.cc

    r7207 r7219  
    4646
    4747  /* 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 );
    5250
    5351  /* constructor */
  • code/branches/consolecommands3/src/orxonox/Test.cc

    r7204 r7219  
    3838    CreateFactory ( Test );
    3939
    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();
    4646
    4747
  • code/branches/consolecommands3/src/orxonox/controllers/ArtificialController.cc

    r7204 r7219  
    4747namespace orxonox
    4848{
    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);
    5454
    5555    static const unsigned int STANDARD_MAX_FORMATION_SIZE = 7;
  • code/branches/consolecommands3/src/orxonox/controllers/HumanController.cc

    r7204 r7219  
    4040namespace orxonox
    4141{
    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();
    6262
    6363    CreateUnloadableFactory(HumanController);
  • code/branches/consolecommands3/src/orxonox/controllers/NewHumanController.cc

    r7204 r7219  
    4949namespace orxonox
    5050{
    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();
    5555
    5656    CreateUnloadableFactory(NewHumanController);
  • code/branches/consolecommands3/src/orxonox/gamestates/GSMainMenu.cc

    r7204 r7219  
    4848    DeclareGameState(GSMainMenu, "mainMenu", false, true);
    4949
     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
    5064    GSMainMenu::GSMainMenu(const GameStateInfo& info)
    5165        : GameState(info)
     
    89103        InputManager::getInstance().enterState("MainMenuHackery");
    90104
    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);
    99111
    100112        KeyBinderManager::getInstance().setToDefault();
     
    122134        GUIManager::hideGUI("MainMenu");
    123135        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);
    124143    }
    125144
  • code/branches/consolecommands3/src/orxonox/gamestates/GSRoot.cc

    r7204 r7219  
    4141{
    4242    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);
    4450
    4551    registerStaticNetworkFunction(&TimeFactorListener::setTimeFactor);
     
    7682        TimeFactorListener::setTimeFactor(1.0f);
    7783
    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);
    8586    }
    8687
    8788    void GSRoot::deactivate()
    8889    {
     90        _ModifyConsoleCommand(__CC_setTimeFactor_name).setObject(0);
     91        _ModifyConsoleCommand(__CC_pause_name).setObject(0);
    8992    }
    9093
  • code/branches/consolecommands3/src/orxonox/gametypes/Gametype.cc

    r7204 r7219  
    7979        else
    8080            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 */
    8881    }
    8982
     
    9386        {
    9487            this->gtinfo_->destroy();
    95             if( this->hackAddBots_ )
    96                 delete this->hackAddBots_;
    97             if( this->hackKillBots_ )
    98                 delete this->hackKillBots_;
    9988        }
    10089    }
  • code/branches/consolecommands3/src/orxonox/gametypes/Gametype.h

    r6417 r7219  
    184184            // Config Values
    185185            std::string scoreboardTemplate_;
    186 
    187             /* HACK HACK HACK */
    188             ConsoleCommand* hackAddBots_;
    189             ConsoleCommand* hackKillBots_;
    190             /* HACK HACK HACK */
    191186    };
    192187}
  • code/branches/consolecommands3/src/orxonox/overlays/InGameConsole.cc

    r7207 r7219  
    5858    const float CHAR_WIDTH = 7.45f; // fix this please - determine the char-width dynamically
    5959
    60     SetConsoleCommand(InGameConsole, openConsole, true);
    61     SetConsoleCommand(InGameConsole, closeConsole, true);
     60    _SetConsoleCommand("InGameConsole", "openConsole", &InGameConsole::openConsole).addShortcut();
     61    _SetConsoleCommand("InGameConsole", "closeConsole", &InGameConsole::closeConsole).addShortcut();
    6262
    6363    ManageScopedSingleton(InGameConsole, ScopeID::Graphics, false);
  • code/branches/consolecommands3/src/orxonox/overlays/OrxonoxOverlay.cc

    r7204 r7219  
    5757    std::map<std::string, OrxonoxOverlay*> OrxonoxOverlay::overlays_s;
    5858
    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);
    6363
    6464    OrxonoxOverlay::OrxonoxOverlay(BaseObject* creator)
  • code/branches/consolecommands3/src/orxonox/overlays/OverlayGroup.cc

    r7204 r7219  
    4343    CreateFactory(OverlayGroup);
    4444
    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);
    4848
    4949    OverlayGroup::OverlayGroup(BaseObject* creator)
Note: See TracChangeset for help on using the changeset viewer.