Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 17, 2016, 10:29:21 PM (8 years ago)
Author:
landauf
Message:

merged branch cpp11_v3 back to trunk

Location:
code/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/orxonox/worldentities/pawns/SpaceShip.cc

    r11052 r11071  
    4848    RegisterClass(SpaceShip);
    4949
    50     SpaceShip::SpaceShip(Context* context) : Pawn(context), boostBlur_(NULL)
     50    SpaceShip::SpaceShip(Context* context) : Pawn(context), boostBlur_(nullptr)
    5151    {
    5252        RegisterObject(SpaceShip);
     
    8080        // SpaceShip is always a physical object per default
    8181        // Be aware of this call: The collision type legality check will not reach derived classes!
    82         this->setCollisionType(WorldEntity::Dynamic);
     82        this->setCollisionType(WorldEntity::CollisionType::Dynamic);
    8383        // Get notification about collisions
    8484        this->enableCollisionCallback();
     
    145145    bool SpaceShip::isCollisionTypeLegal(WorldEntity::CollisionType type) const
    146146    {
    147         if (type != WorldEntity::Dynamic)
     147        if (type != WorldEntity::CollisionType::Dynamic)
    148148        {
    149149            orxout(internal_warning) << "Cannot tell a SpaceShip not to be dynamic! Ignoring." << endl;
     
    160160
    161161        // Run the engines
    162         for(std::vector<Engine*>::iterator it = this->engineList_.begin(); it != this->engineList_.end(); it++)
    163             (*it)->run(dt);
     162        for(Engine* engine : this->engineList_)
     163            engine->run(dt);
    164164
    165165        if (this->hasLocalController())
     
    198198            if(this->bEnableMotionBlur_)
    199199            {
    200                 if (this->boostBlur_ == NULL && this->hasLocalController() && this->hasHumanController())
     200                if (this->boostBlur_ == nullptr && this->hasLocalController() && this->hasHumanController())
    201201                {
    202202                    this->boostBlur_ = new Shader(this->getScene()->getSceneManager());
     
    325325    void SpaceShip::addEngine(orxonox::Engine* engine)
    326326    {
    327         OrxAssert(engine != NULL, "The engine cannot be NULL.");
     327        OrxAssert(engine != nullptr, "The engine cannot be nullptr.");
    328328        this->engineList_.push_back(engine);
    329329        engine->addToSpaceShip(this);
     
    333333    @brief
    334334        Check whether the SpaceShip has a particular Engine.
    335     @param engine
     335    @param search
    336336        A pointer to the Engine to be checked.
    337337    */
    338     bool SpaceShip::hasEngine(Engine* engine) const
    339     {
    340         for(unsigned int i = 0; i < this->engineList_.size(); i++)
    341         {
    342             if(this->engineList_[i] == engine)
     338    bool SpaceShip::hasEngine(Engine* search) const
     339    {
     340        for(Engine* engine : this->engineList_)
     341        {
     342            if(engine == search)
    343343                return true;
    344344        }
     
    350350        Get the i-th Engine of the SpaceShip.
    351351    @return
    352         Returns a pointer to the i-the Engine. NULL if there is no Engine with that index.
     352        Returns a pointer to the i-the Engine. nullptr if there is no Engine with that index.
    353353    */
    354354    Engine* SpaceShip::getEngine(unsigned int i)
    355355    {
    356356        if(this->engineList_.size() >= i)
    357             return NULL;
     357            return nullptr;
    358358        else
    359359            return this->engineList_[i];
     
    366366        The name of the engine to be returned.
    367367    @return
    368         Pointer to the engine with the given name, or NULL if not found.
     368        Pointer to the engine with the given name, or nullptr if not found.
    369369    */
    370370    Engine* SpaceShip::getEngineByName(const std::string& name)
    371371    {
    372         for(size_t i = 0; i < this->engineList_.size(); ++i)
    373             if(this->engineList_[i]->getName() == name)
    374                 return this->engineList_[i];
     372        for(Engine* engine : this->engineList_)
     373            if(engine->getName() == name)
     374                return engine;
    375375
    376376        orxout(internal_warning) << "Couldn't find Engine with name \"" << name << "\"." << endl;
    377         return NULL;
     377        return nullptr;
    378378    }
    379379
     
    416416    void SpaceShip::addSpeedFactor(float factor)
    417417    {
    418         for(unsigned int i=0; i<this->engineList_.size(); i++)
    419             this->engineList_[i]->addSpeedMultiply(factor);
     418        for(Engine* engine : this->engineList_)
     419            engine->addSpeedMultiply(factor);
    420420    }
    421421
     
    428428    void SpaceShip::addSpeed(float speed)
    429429    {
    430         for(unsigned int i=0; i<this->engineList_.size(); i++)
    431             this->engineList_[i]->addSpeedAdd(speed);
     430        for(Engine* engine : this->engineList_)
     431            engine->addSpeedAdd(speed);
    432432    }
    433433
     
    456456    {
    457457        float speed=0;
    458         for(unsigned int i=0; i<this->engineList_.size(); i++)
    459         {
    460             if(this->engineList_[i]->getMaxSpeedFront() > speed)
    461                 speed = this->engineList_[i]->getMaxSpeedFront();
     458        for(Engine* engine : this->engineList_)
     459        {
     460            if(engine->getMaxSpeedFront() > speed)
     461                speed = engine->getMaxSpeedFront();
    462462        }
    463463        return speed;
     
    485485    void SpaceShip::changedEnableMotionBlur()
    486486    {
    487         if (!this->bEnableMotionBlur_ && this->boostBlur_ != NULL)
     487        if (!this->bEnableMotionBlur_ && this->boostBlur_ != nullptr)
    488488        {
    489489            delete this->boostBlur_;
    490             this->boostBlur_ = NULL;
     490            this->boostBlur_ = nullptr;
    491491        }
    492492    }
     
    514514            Camera* camera = this->getCamera();
    515515            //Shaking Camera effect
    516             if (camera != 0)
     516            if (camera != nullptr)
    517517                camera->setOrientation(Vector3::UNIT_X, angle);
    518518
     
    530530    {
    531531        Camera* camera = CameraManager::getInstance().getActiveCamera();
    532         if(camera != NULL)
     532        if(camera != nullptr)
    533533        {
    534534            this->cameraOriginalPosition_ = camera->getPosition();
     
    546546        {
    547547            Camera *camera = this->getCamera();
    548             if (camera == 0)
     548            if (camera == nullptr)
    549549            {
    550550                orxout(internal_warning) << "Failed to reset camera!" << endl;
Note: See TracChangeset for help on using the changeset viewer.