Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 26, 2011, 12:58:09 AM (13 years ago)
Author:
dafrick
Message:

Merging bigships branch into presentation branch.

Location:
code/branches/presentation
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation

  • code/branches/presentation/src/orxonox/gametypes/Dynamicmatch.cc

    r8327 r8589  
    151151                //Give new pig boost
    152152                SpaceShip* spaceship = dynamic_cast<SpaceShip*>(victim);
    153                 if (spaceship && spaceship->getEngine())
    154                 {
    155                     spaceship->getEngine()->setSpeedFactor(5);
    156                     WeakPtr<Engine>* ptr = new WeakPtr<Engine>(spaceship->getEngine());
    157                     ExecutorPtr executor = createExecutor(createFunctor(&Dynamicmatch::resetSpeedFactor, this));
    158                     executor->setDefaultValue(0, ptr);
    159                     new Timer(10, false, executor, true);
    160                 }
     153                grantPigBoost(spaceship);
    161154            }
    162155
     
    252245                //Give new pig boost
    253246                SpaceShip* spaceship = dynamic_cast<SpaceShip*>(victim);
    254                 if (spaceship && spaceship->getEngine())
    255                 {
    256                     spaceship->getEngine()->setSpeedFactor(5);
    257                     WeakPtr<Engine>* ptr = new WeakPtr<Engine>(spaceship->getEngine());
    258                     ExecutorPtr executor = createExecutor(createFunctor(&Dynamicmatch::resetSpeedFactor, this));
    259                     executor->setDefaultValue(0, ptr);
    260                     new Timer(10, false, executor, true);
    261                 }
    262 
     247                grantPigBoost(spaceship);
    263248            }
    264249            // killer vs piggy
     
    321306    }
    322307
     308    void Dynamicmatch::grantPigBoost(orxonox::SpaceShip* spaceship)
     309    {
     310        // Give pig boost
     311        if (spaceship)
     312        {
     313            spaceship->setSpeedFactor(5);
     314            WeakPtr<SpaceShip>* ptr = new WeakPtr<SpaceShip>(spaceship);
     315            ExecutorPtr executor = createExecutor(createFunctor(&Dynamicmatch::resetSpeedFactor, this));
     316            executor->setDefaultValue(0, ptr);
     317            new Timer(10, false, executor, true);
     318        }
     319    }
     320
    323321    void Dynamicmatch::playerStartsControllingPawn(PlayerInfo* player, Pawn* pawn) //set party + colouring
    324322    {
     
    597595    }
    598596
    599     void Dynamicmatch::resetSpeedFactor(WeakPtr<Engine>* ptr)// helper function
     597    void Dynamicmatch::resetSpeedFactor(WeakPtr<SpaceShip>* ptr)// helper function
    600598    {
    601599        if (*ptr)
Note: See TracChangeset for help on using the changeset viewer.