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/orxonox
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • 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.