Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5829 for code/branches/core5


Ignore:
Timestamp:
Sep 28, 2009, 9:31:24 PM (15 years ago)
Author:
landauf
Message:

replaced most occurrences of setObject(o) in combination with createFunctor(f) with the more convenient createFunctor(f, o)

Location:
code/branches/core5/src
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core5/src/libraries/core/BaseObject.h

    r5806 r5829  
    4040    if (this->getMainStateName() == statename) \
    4141    { \
    42         this->functorSetMainState_ = createFunctor(&classname::setfunction)->setObject(this); \
    43         this->functorGetMainState_ = createFunctor(&classname::getfunction)->setObject(this); \
     42        this->functorSetMainState_ = createFunctor(&classname::setfunction, this); \
     43        this->functorGetMainState_ = createFunctor(&classname::getfunction, this); \
    4444    }
    4545
  • code/branches/core5/src/libraries/core/EventIncludes.h

    r5738 r5829  
    4949    if (!containername) \
    5050    { \
    51         ExecutorMember<classname>* executor = orxonox::createExecutor(orxonox::createFunctor(&classname::functionname), std::string( #classname ) + "::" + #functionname); \
    52         executor->setObject(this); \
     51        ExecutorMember<classname>* executor = orxonox::createExecutor(orxonox::createFunctor(&classname::functionname, this), std::string( #classname ) + "::" + #functionname); \
    5352        containername = new orxonox::EventContainer(std::string(eventname), executor, orxonox::ClassIdentifier<subclassname>::getIdentifier()); \
    5453        this->addEventContainer(eventname, containername); \
     
    6160    if (!containername) \
    6261    { \
    63         ExecutorMember<classname>* executor = orxonox::createExecutor(orxonox::createFunctor<classname, __VA_ARGS__ >(&classname::functionname), std::string( #classname ) + "::" + #functionname); \
    64         executor->setObject(this); \
     62        ExecutorMember<classname>* executor = orxonox::createExecutor(orxonox::createFunctor<classname, __VA_ARGS__ >(&classname::functionname, this), std::string( #classname ) + "::" + #functionname); \
    6563        containername = new orxonox::EventContainer(std::string(eventname), executor, orxonox::ClassIdentifier<subclassname>::getIdentifier()); \
    6664        this->addEventContainer(eventname, containername); \
  • code/branches/core5/src/libraries/core/GraphicsManager.cc

    r5810 r5829  
    318318
    319319        // add console commands
    320         FunctorMember<GraphicsManager>* functor1 = createFunctor(&GraphicsManager::printScreen);
    321         ccPrintScreen_ = createConsoleCommand(functor1->setObject(this), "printScreen");
     320        ccPrintScreen_ = createConsoleCommand(createFunctor(&GraphicsManager::printScreen, this), "printScreen");
    322321        CommandExecutor::addConsoleCommandShortcut(ccPrintScreen_);
    323322    }
  • code/branches/core5/src/libraries/core/input/InputManager.cc

    r5796 r5829  
    109109        InputState* detector = createInputState("detector", false, false, InputStatePriority::Detector);
    110110        // Create a callback to avoid buttonHeld events after the key has been detected
    111         FunctorMember<InputManager>* bufferFunctor = createFunctor(&InputManager::clearBuffers);
    112         bufferFunctor->setObject(this);
    113         detector->setLeaveFunctor(bufferFunctor);
     111        detector->setLeaveFunctor(createFunctor(&InputManager::clearBuffers, this));
    114112        keyDetector_ = new KeyDetector();
    115113        detector->setHandler(keyDetector_);
     
    124122        this->updateActiveStates();
    125123
    126         {
    127             // calibrate console command
    128             FunctorMember<InputManager>* functor = createFunctor(&InputManager::calibrate);
    129             functor->setObject(this);
    130             this->getIdentifier()->addConsoleCommand(createConsoleCommand(functor, "calibrate"), true);
    131         }
    132         {
    133             // reload console command
    134             FunctorMember<InputManager>* functor = createFunctor(&InputManager::reload);
    135             functor->setObject(this);
    136             this->getIdentifier()->addConsoleCommand(createConsoleCommand(functor, "reload"), false);
    137         }
     124        // calibrate console command
     125        this->getIdentifier()->addConsoleCommand(createConsoleCommand(createFunctor(&InputManager::calibrate, this), "calibrate"), true);
     126        // reload console command
     127        this->getIdentifier()->addConsoleCommand(createConsoleCommand(createFunctor(&InputManager::reload, this), "reload"), false);
    138128
    139129        CCOUT(4) << "Construction complete." << std::endl;
  • code/branches/core5/src/libraries/core/input/Mouse.cc

    r5738 r5829  
    4848
    4949#ifdef ORXONOX_PLATFORM_LINUX
    50         {
    51             // Mouse grab console command
    52             FunctorMember<Mouse>* functor = createFunctor(&Mouse::grab);
    53             functor->setObject(this);
    54             this->getIdentifier()->addConsoleCommand(createConsoleCommand(functor, "grab"), false);
    55         }
    56         {
    57             // Mouse ungrab console command
    58             FunctorMember<Mouse>* functor = createFunctor(&Mouse::ungrab);
    59             functor->setObject(this);
    60             this->getIdentifier()->addConsoleCommand(createConsoleCommand(functor, "ungrab"), false);
    61         }
     50        // Mouse grab console command
     51        this->getIdentifier()->addConsoleCommand(createConsoleCommand(createFunctor(&Mouse::grab, this), "grab"), false);
     52        // Mouse ungrab console command
     53        this->getIdentifier()->addConsoleCommand(createConsoleCommand(createFunctor(&Mouse::ungrab, this), "ungrab"), false);
    6254#endif
    6355    }
  • code/branches/core5/src/libraries/network/GamestateManager.cc

    r5797 r5829  
    160160      finishGamestate( cid, &clientGamestates.back(), client, reference );
    161161      //FunctorMember<GamestateManager>* functor =
    162 //       ExecutorMember<GamestateManager>* executor = createExecutor( createFunctor(&GamestateManager::finishGamestate) );
    163 //       executor->setObject(this);
     162//       ExecutorMember<GamestateManager>* executor = createExecutor( createFunctor(&GamestateManager::finishGamestate, this) );
    164163//       executor->setDefaultValues( cid, &clientGamestates.back(), client, reference );
    165164//       (*static_cast<Executor*>(executor))();
  • code/branches/core5/src/modules/gamestates/GSGraphics.cc

    r5799 r5829  
    109109
    110110        // add console command to toggle GUI
    111         FunctorMember<GSGraphics>* functor = createFunctor(&GSGraphics::toggleGUI);
    112         functor->setObject(this);
    113         this->ccToggleGUI_ = createConsoleCommand(functor, "toggleGUI");
     111        this->ccToggleGUI_ = createConsoleCommand(createFunctor(&GSGraphics::toggleGUI, this), "toggleGUI");
    114112        CommandExecutor::addConsoleCommandShortcut(this->ccToggleGUI_);
    115113
  • code/branches/core5/src/modules/gamestates/GSIOConsole.cc

    r5738 r5829  
    5050    {
    5151        {
    52             FunctorMember<GSIOConsole>* functor = createFunctor(&GSIOConsole::loadMenu);
    53             functor->setObject(this);
    54             this->ccLoadMenu_ = createConsoleCommand(functor, "loadMenu");
     52            this->ccLoadMenu_ = createConsoleCommand(createFunctor(&GSIOConsole::loadMenu, this), "loadMenu");
    5553            CommandExecutor::addConsoleCommandShortcut(this->ccLoadMenu_);
    5654        }
  • code/branches/core5/src/modules/gamestates/GSLevel.cc

    r5820 r5829  
    116116        {
    117117            // keybind console command
    118             FunctorMember<GSLevel>* functor1 = createFunctor(&GSLevel::keybind);
    119             functor1->setObject(this);
    120             ccKeybind_ = createConsoleCommand(functor1, "keybind");
     118            ccKeybind_ = createConsoleCommand(createFunctor(&GSLevel::keybind, this), "keybind");
    121119            CommandExecutor::addConsoleCommandShortcut(ccKeybind_);
    122             FunctorMember<GSLevel>* functor2 = createFunctor(&GSLevel::tkeybind);
    123             functor2->setObject(this);
    124             ccTkeybind_ = createConsoleCommand(functor2, "tkeybind");
     120            ccTkeybind_ = createConsoleCommand(createFunctor(&GSLevel::tkeybind, this), "tkeybind");
    125121            CommandExecutor::addConsoleCommandShortcut(ccTkeybind_);
    126122            // set our console command as callback for the key detector
  • code/branches/core5/src/modules/gamestates/GSMainMenu.cc

    r5817 r5829  
    7575        GraphicsManager::getInstance().setCamera(this->camera_);
    7676
    77         {
    78             FunctorMember<GSMainMenu>* functor = createFunctor(&GSMainMenu::startStandalone);
    79             functor->setObject(this);
    80             this->ccStartStandalone_ = createConsoleCommand(functor, "startGame");
    81             CommandExecutor::addConsoleCommandShortcut(this->ccStartStandalone_);
    82         }
    83         {
    84             FunctorMember<GSMainMenu>* functor = createFunctor(&GSMainMenu::startServer);
    85             functor->setObject(this);
    86             this->ccStartServer_ = createConsoleCommand(functor, "startServer");
    87             CommandExecutor::addConsoleCommandShortcut(this->ccStartServer_);
    88         }
    89         {
    90             FunctorMember<GSMainMenu>* functor = createFunctor(&GSMainMenu::startClient);
    91             functor->setObject(this);
    92             this->ccStartClient_ = createConsoleCommand(functor, "startClient");
    93             CommandExecutor::addConsoleCommandShortcut(this->ccStartClient_);
    94         }
    95         {
    96             FunctorMember<GSMainMenu>* functor = createFunctor(&GSMainMenu::startDedicated);
    97             functor->setObject(this);
    98             this->ccStartDedicated_ = createConsoleCommand(functor, "startDedicated");
    99             CommandExecutor::addConsoleCommandShortcut(this->ccStartDedicated_);
    100         }
    101         {
    102             FunctorMember<GSMainMenu>* functor = createFunctor(&GSMainMenu::startMainMenu);
    103             functor->setObject(this);
    104             this->ccStartMainMenu_ = createConsoleCommand(functor, "startMainMenu");
    105             CommandExecutor::addConsoleCommandShortcut(this->ccStartMainMenu_);
    106         }
     77        this->ccStartStandalone_ = createConsoleCommand(createFunctor(&GSMainMenu::startStandalone, this), "startGame");
     78        CommandExecutor::addConsoleCommandShortcut(this->ccStartStandalone_);
     79        this->ccStartServer_ = createConsoleCommand(createFunctor(&GSMainMenu::startServer, this), "startServer");
     80        CommandExecutor::addConsoleCommandShortcut(this->ccStartServer_);
     81        this->ccStartClient_ = createConsoleCommand(createFunctor(&GSMainMenu::startClient, this), "startClient");
     82        CommandExecutor::addConsoleCommandShortcut(this->ccStartClient_);
     83        this->ccStartDedicated_ = createConsoleCommand(createFunctor(&GSMainMenu::startDedicated, this), "startDedicated");
     84        CommandExecutor::addConsoleCommandShortcut(this->ccStartDedicated_);
     85        this->ccStartMainMenu_ = createConsoleCommand(createFunctor(&GSMainMenu::startMainMenu, this), "startMainMenu");
     86        CommandExecutor::addConsoleCommandShortcut(this->ccStartMainMenu_);
    10787
    10888        InputManager::getInstance().enterState("mainMenu");
  • code/branches/core5/src/modules/gamestates/GSRoot.cc

    r5799 r5829  
    6363        this->timeFactor_ = 1.0f;
    6464
    65         {
    66             // time factor console command
    67             FunctorMember<GSRoot>* functor = createFunctor(&GSRoot::setTimeFactor);
    68             functor->setObject(this);
    69             this->ccSetTimeFactor_ = createConsoleCommand(functor, "setTimeFactor");
    70             CommandExecutor::addConsoleCommandShortcut(this->ccSetTimeFactor_).accessLevel(AccessLevel::Offline).defaultValue(0, 1.0);
    71         }
     65        // time factor console command
     66        this->ccSetTimeFactor_ = createConsoleCommand(createFunctor(&GSRoot::setTimeFactor, this), "setTimeFactor");
     67        CommandExecutor::addConsoleCommandShortcut(this->ccSetTimeFactor_).accessLevel(AccessLevel::Offline).defaultValue(0, 1.0);
    7268
    73         {
    74             // time factor console command
    75             FunctorMember<GSRoot>* functor = createFunctor(&GSRoot::pause);
    76             functor->setObject(this);
    77             this->ccPause_ = createConsoleCommand(functor, "pause");
    78             CommandExecutor::addConsoleCommandShortcut(this->ccPause_).accessLevel(AccessLevel::Offline);
    79         }
     69        // time factor console command
     70        this->ccPause_ = createConsoleCommand(createFunctor(&GSRoot::pause, this), "pause");
     71        CommandExecutor::addConsoleCommandShortcut(this->ccPause_).accessLevel(AccessLevel::Offline);
    8072
    8173        // create the LevelManager
  • code/branches/core5/src/orxonox/gametypes/UnderAttack.cc

    r5826 r5829  
    4646        this->teams_ = 2;
    4747        this->destroyer_ = 0;
    48         this->destroyer_.addCallback(createFunctor(&UnderAttack::killedDestroyer)->setObject(this));
     48        this->destroyer_.addCallback(createFunctor(&UnderAttack::killedDestroyer, this));
    4949        this->gameEnded_ = false;
    5050
Note: See TracChangeset for help on using the changeset viewer.