Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10348


Ignore:
Timestamp:
Apr 6, 2015, 10:00:37 PM (9 years ago)
Author:
landauf
Message:

removed unnecessary helper functions

Location:
code/branches/core7/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core7/src/libraries/core/command/CommandExecutor.cc

    r10347 r10348  
    296296            // create a new console command with the given alias as its name
    297297            if (tokens.size() == 1)
    298                 createConsoleCommand(tokens[0], executor);
     298                new ConsoleCommand(tokens[0], executor);
    299299            else if (tokens.size() == 2)
    300                 createConsoleCommand(tokens[0], tokens[1], executor);
     300                new ConsoleCommand(tokens[0], tokens[1], executor);
    301301            else
    302302                orxout(user_error) << "\"" << alias << "\" is not a valid alias name (must have one or two words)." << endl;
  • code/branches/core7/src/libraries/core/command/ConsoleCommand.cc

    r10347 r10348  
    4444{
    4545    /**
    46         @brief Constructor: Initializes all values and registers the command.
     46        @brief Constructor: Initializes all values and registers the command (without a group).
     47        @param name The name of the command
     48        @param executor The executor of the command
     49        @param bInitialized If true, the executor is used for both, the definition of the function-header AND to executute the command. If false, the command is inactive and needs to be assigned a function before it can be used.
     50    */
     51    ConsoleCommand::ConsoleCommand(const std::string& name, const ExecutorPtr& executor, bool bInitialized)
     52    {
     53        this->init("", name, executor, bInitialized);
     54    }
     55
     56    /**
     57        @brief Constructor: Initializes all values and registers the command (with a group).
    4758        @param group The group of the command
    4859        @param name The name of the command
     
    5162    */
    5263    ConsoleCommand::ConsoleCommand(const std::string& group, const std::string& name, const ExecutorPtr& executor, bool bInitialized)
     64    {
     65        this->init(group, name, executor, bInitialized);
     66    }
     67
     68    void ConsoleCommand::init(const std::string& group, const std::string& name, const ExecutorPtr& executor, bool bInitialized)
    5369    {
    5470        this->bActive_ = true;
  • code/branches/core7/src/libraries/core/command/ConsoleCommand.h

    r10347 r10348  
    261261
    262262        public:
     263            ConsoleCommand(const std::string& name, const ExecutorPtr& executor, bool bInitialized = true);
    263264            ConsoleCommand(const std::string& group, const std::string& name, const ExecutorPtr& executor, bool bInitialized = true);
    264265            ~ConsoleCommand();
     
    360361
    361362        private:
     363            void init(const std::string& group, const std::string& name, const ExecutorPtr& executor, bool bInitialized);
     364
    362365            bool headersMatch(const FunctorPtr& functor);
    363366            bool headersMatch(const ExecutorPtr& executor);
  • code/branches/core7/src/libraries/core/command/ConsoleCommandIncludes.h

    r10347 r10348  
    264264/// Internal macro
    265265#define SetConsoleCommandGeneric(group, name, functor) \
    266     static orxonox::ConsoleCommand& BOOST_PP_CAT(__consolecommand_, __UNIQUE_NUMBER__) = (*orxonox::createConsoleCommand(group, name, orxonox::createExecutor(functor)))
     266    static orxonox::ConsoleCommand& BOOST_PP_CAT(__consolecommand_, __UNIQUE_NUMBER__) = (*new orxonox::ConsoleCommand(group, name, orxonox::createExecutor(functor)))
    267267
    268268
     
    299299/// Internal macro
    300300#define DeclareConsoleCommandGeneric(group, name, functor) \
    301     static orxonox::ConsoleCommand& BOOST_PP_CAT(__consolecommand_, __UNIQUE_NUMBER__) = (*orxonox::createConsoleCommand(group, name, orxonox::createExecutor(functor), false))
     301    static orxonox::ConsoleCommand& BOOST_PP_CAT(__consolecommand_, __UNIQUE_NUMBER__) = (*new orxonox::ConsoleCommand(group, name, orxonox::createExecutor(functor), false))
    302302
    303303
    304304namespace orxonox
    305305{
    306     /**
    307         @brief Creates a new ConsoleCommand.
    308         @param name The name of the command
    309         @param executor The executor of the command
    310         @param bInitialized If true, the command is ready to be executed, otherwise it has to be activated first.
    311     */
    312     inline ConsoleCommand* createConsoleCommand(const std::string& name, const ExecutorPtr& executor, bool bInitialized = true)
    313         { return new ConsoleCommand("", name, executor, bInitialized); }
    314     /**
    315         @brief Creates a new ConsoleCommand.
    316         @param group The group of the command
    317         @param name The name of the command
    318         @param executor The executor of the command
    319         @param bInitialized If true, the command is ready to be executed, otherwise it has to be activated first.
    320     */
    321     inline ConsoleCommand* createConsoleCommand(const std::string& group, const std::string& name, const ExecutorPtr& executor, bool bInitialized = true)
    322         { return new ConsoleCommand(group, name, executor, bInitialized); }
    323 
    324 
    325306    /**
    326307        @brief Returns a manipulator for a command with the given name.
  • code/branches/core7/src/modules/towerdefense/TowerDefense.cc

    r10347 r10348  
    108108
    109109        /* Temporary hack to allow the player to add towers and upgrade them */
    110         this->dedicatedAddTower_ = createConsoleCommand( "addTower", createExecutor( createFunctor(&TowerDefense::addTower, this) ) );
    111         this->dedicatedUpgradeTower_ = createConsoleCommand( "upgradeTower", createExecutor( createFunctor(&TowerDefense::upgradeTower, this) ) );
     110        this->dedicatedAddTower_ = new ConsoleCommand( "addTower", createExecutor( createFunctor(&TowerDefense::addTower, this) ) );
     111        this->dedicatedUpgradeTower_ = new ConsoleCommand( "upgradeTower", createExecutor( createFunctor(&TowerDefense::upgradeTower, this) ) );
    112112    }
    113113
  • code/branches/core7/src/orxonox/gametypes/Gametype.cc

    r10347 r10348  
    8585
    8686        /* HACK HACK HACK */
    87         this->dedicatedAddBots_ = createConsoleCommand( "dedicatedAddBots", createExecutor( createFunctor(&Gametype::addBots, this) ) );
    88         this->dedicatedKillBots_ = createConsoleCommand( "dedicatedKillBots", createExecutor( createFunctor(&Gametype::killBots, this) ) );
     87        this->dedicatedAddBots_ = new ConsoleCommand( "dedicatedAddBots", createExecutor( createFunctor(&Gametype::addBots, this) ) );
     88        this->dedicatedKillBots_ = new ConsoleCommand( "dedicatedKillBots", createExecutor( createFunctor(&Gametype::killBots, this) ) );
    8989        /* HACK HACK HACK */
    9090    }
Note: See TracChangeset for help on using the changeset viewer.