Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 10, 2016, 1:54:11 PM (9 years ago)
Author:
landauf
Message:

merged branch cpp11_v2 into cpp11_v3

Location:
code/branches/cpp11_v3
Files:
28 edited

Legend:

Unmodified
Added
Removed
  • code/branches/cpp11_v3

  • code/branches/cpp11_v3/src/orxonox/worldentities/CameraPosition.h

    r9667 r11054  
    4141            virtual ~CameraPosition();
    4242
    43             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
     43            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
    4444
    4545            inline void setDrag(bool bDrag)
  • code/branches/cpp11_v3/src/orxonox/worldentities/ControllableEntity.cc

    r10624 r11054  
    6161        this->server_overwrite_ = 0;
    6262        this->client_overwrite_ = 0;
    63         this->player_ = 0;
    64         this->formerPlayer_ = NULL;
     63        this->player_ = nullptr;
     64        this->formerPlayer_ = nullptr;
    6565        this->playerID_ = OBJECTID_UNKNOWN;
    66         this->hud_ = 0;
    67         this->camera_ = 0;
    68         this->xmlcontroller_ = 0;
    69         //this->controller_ = 0;
    70         this->reverseCamera_ = 0;
     66        this->hud_ = nullptr;
     67        this->camera_ = nullptr;
     68        this->xmlcontroller_ = nullptr;
     69        //this->controller_ = nullptr;
     70        this->reverseCamera_ = nullptr;
    7171        this->bDestroyWhenPlayerLeft_ = false;
    7272        this->cameraPositionRootNode_ = this->node_->createChildSceneNode();
    73         this->currentCameraPosition_ = 0;
     73        this->currentCameraPosition_ = nullptr;
    7474        this->bMouseLook_ = false;
    7575        this->mouseLookSpeed_ = 200;
     
    108108                this->camera_->destroy();
    109109
    110             for (std::list<StrongPtr<CameraPosition> >::const_iterator it = this->cameraPositions_.begin(); it != this->cameraPositions_.end(); ++it)
    111                 (*it)->destroy();
     110            for (CameraPosition* cameraPosition : this->cameraPositions_)
     111                cameraPosition->destroy();
    112112
    113113            if (this->getScene()->getSceneManager())
     
    165165    {
    166166        unsigned int i = 0;
    167         for (std::list<StrongPtr<CameraPosition> >::const_iterator it = this->cameraPositions_.begin(); it != this->cameraPositions_.end(); ++it)
     167        for (CameraPosition* cameraPosition : this->cameraPositions_)
    168168        {
    169169            if (i == index)
    170                 return (*it);
     170                return cameraPosition;
    171171            ++i;
    172172        }
    173         return 0;
     173        return nullptr;
    174174    }
    175175
     
    180180
    181181        unsigned int counter = 0;
    182         for (std::list<StrongPtr<CameraPosition> >::const_iterator it = this->cameraPositions_.begin(); it != this->cameraPositions_.end(); ++it)
    183         {
    184             if ((*it) == this->currentCameraPosition_)
     182        for (CameraPosition* cameraPosition : this->cameraPositions_)
     183        {
     184            if (cameraPosition == this->currentCameraPosition_)
    185185                break;
    186186            counter++;
     
    194194    bool ControllableEntity::setCameraPosition(unsigned int index)
    195195    {
    196         if(this->camera_ != NULL && this->cameraPositions_.size() > 0)
     196        if(this->camera_ != nullptr && this->cameraPositions_.size() > 0)
    197197        {
    198198            if(index >= this->cameraPositions_.size())
     
    219219            else if (this->cameraPositions_.size() > 0)
    220220            {
    221                 for (std::list<StrongPtr<CameraPosition> >::const_iterator it = this->cameraPositions_.begin(); it != this->cameraPositions_.end(); ++it)
     221                for (std::list<StrongPtr<CameraPosition>>::const_iterator it = this->cameraPositions_.begin(); it != this->cameraPositions_.end(); ++it)
    222222                {
    223223                    if ((*it) == this->camera_->getParent())
     
    241241            {
    242242                this->camera_->attachToNode(this->cameraPositionRootNode_);
    243                 this->currentCameraPosition_ = 0;
     243                this->currentCameraPosition_ = nullptr;
    244244            }
    245245
     
    321321        if ( !GameMode::isMaster() )
    322322        {
    323             if ( target != 0 )
     323            if ( target != nullptr )
    324324            {
    325325                callMemberNetworkFunction(&ControllableEntity::setTargetInternal, this->getObjectID(), 0, target->getObjectID() );
     
    350350        this->bHasLocalController_ = player->isLocalPlayer();
    351351        this->bHasHumanController_ = player->isHumanPlayer();
    352         if(controller_ != NULL)
     352        if(controller_ != nullptr)
    353353            this->team_ = controller_->getTeam(); // forward controller team number
    354354
     
    372372            this->stopLocalHumanControl();
    373373
    374         this->player_ = 0;
     374        this->player_ = nullptr;
    375375        this->playerID_ = OBJECTID_UNKNOWN;
    376376        this->bHasLocalController_ = false;
     
    411411            {
    412412                this->camera_->attachToNode(this->cameraPositionRootNode_);
    413                 this->currentCameraPosition_ = 0;
     413                this->currentCameraPosition_ = nullptr;
    414414            }
    415415        }
     
    434434    void ControllableEntity::destroyHud(void)
    435435    {
    436         if (this->hud_ != NULL)
     436        if (this->hud_ != nullptr)
    437437        {
    438438            this->hud_->destroy();
    439             this->hud_ = NULL;
     439            this->hud_ = nullptr;
    440440        }
    441441    }
     
    447447            this->camera_->detachFromParent();
    448448            this->camera_->destroy();
    449             this->camera_ = 0;
     449            this->camera_ = nullptr;
    450450        }
    451451
     
    453453        {
    454454            this->hud_->destroy();
    455             this->hud_ = 0;
     455            this->hud_ = nullptr;
    456456        }
    457457    }
     
    477477        if (parent)
    478478        {
    479             for (std::list<StrongPtr<CameraPosition> >::iterator it = this->cameraPositions_.begin(); it != this->cameraPositions_.end(); ++it)
    480                 if ((*it)->getIsAbsolute())
    481                     parent->attach((*it));
     479            for (CameraPosition* cameraPosition : this->cameraPositions_)
     480                if (cameraPosition->getIsAbsolute())
     481                    parent->attach(cameraPosition);
    482482        }
    483483    }
  • code/branches/cpp11_v3/src/orxonox/worldentities/ControllableEntity.h

    r10624 r11054  
    5454            virtual ~ControllableEntity();
    5555
    56             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    57             virtual void tick(float dt);
     56            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
     57            virtual void tick(float dt) override;
    5858            void setConfigValues();
    5959
     
    121121            void addCameraPosition(CameraPosition* position);
    122122            CameraPosition* getCameraPosition(unsigned int index) const;
    123             inline const std::list<StrongPtr<CameraPosition> >& getCameraPositions() const
     123            inline const std::list<StrongPtr<CameraPosition>>& getCameraPositions() const
    124124                { return this->cameraPositions_; }
    125125            unsigned int getCurrentCameraIndex() const;
     
    141141            using MobileEntity::setAngularVelocity;
    142142
    143             void setPosition(const Vector3& position);
    144             void setOrientation(const Quaternion& orientation);
    145             void setVelocity(const Vector3& velocity);
    146             void setAngularVelocity(const Vector3& velocity);
     143            virtual void setPosition(const Vector3& position) override;
     144            virtual void setOrientation(const Quaternion& orientation) override;
     145            virtual void setVelocity(const Vector3& velocity) override;
     146            virtual void setAngularVelocity(const Vector3& velocity) override;
    147147
    148148            inline bool hasLocalController() const
     
    177177
    178178        protected:
    179             virtual void preDestroy();
     179            virtual void preDestroy() override;
    180180
    181181            virtual void setPlayer(PlayerInfo* player); // don't call this directly, use friend class PlayerInfo instead
     
    184184            virtual void startLocalHumanControl();
    185185            virtual void stopLocalHumanControl();
    186             virtual void parentChanged();
     186            virtual void parentChanged() override;
    187187
    188188            inline void setHudTemplate(const std::string& name)
     
    214214
    215215            // Bullet btMotionState related
    216             void setWorldTransform(const btTransform& worldTrans);
     216            virtual void setWorldTransform(const btTransform& worldTrans) override;
    217217
    218218            unsigned int server_overwrite_;
     
    242242            bool bMouseLook_;
    243243            float mouseLookSpeed_;
    244             std::list<StrongPtr<CameraPosition> > cameraPositions_;
     244            std::list<StrongPtr<CameraPosition>> cameraPositions_;
    245245            CameraPosition* currentCameraPosition_;
    246246            std::string cameraPositionTemplate_;
  • code/branches/cpp11_v3/src/orxonox/worldentities/Drone.cc

    r9667 r11054  
    3030
    3131#include "core/XMLPort.h"
     32#include "core/CoreIncludes.h"
    3233#include "BulletDynamics/Dynamics/btRigidBody.h"
    3334
     
    4344        RegisterObject(Drone);
    4445
    45         this->myController_ = 0;
     46        this->myController_ = nullptr;
    4647
    4748        this->localLinearAcceleration_.setValue(0, 0, 0);
  • code/branches/cpp11_v3/src/orxonox/worldentities/Drone.h

    r9667 r11054  
    5050            virtual ~Drone();
    5151
    52             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a Drone through XML.
    53             virtual void tick(float dt); //!< Defines which actions the Drone has to take in each tick.
     52            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; //!< Method for creating a Drone through XML.
     53            virtual void tick(float dt) override; //!< Defines which actions the Drone has to take in each tick.
    5454
    5555
    56             virtual void moveFrontBack(const Vector2& value);
    57             virtual void moveRightLeft(const Vector2& value);
    58             virtual void moveUpDown(const Vector2& value);
     56            virtual void moveFrontBack(const Vector2& value) override;
     57            virtual void moveRightLeft(const Vector2& value) override;
     58            virtual void moveUpDown(const Vector2& value) override;
    5959
    60             virtual void rotateYaw(const Vector2& value);
    61             virtual void rotatePitch(const Vector2& value);
    62             virtual void rotateRoll(const Vector2& value);
     60            virtual void rotateYaw(const Vector2& value) override;
     61            virtual void rotatePitch(const Vector2& value) override;
     62            virtual void rotateRoll(const Vector2& value) override;
    6363
    6464            /**
  • code/branches/cpp11_v3/src/orxonox/worldentities/EffectContainer.cc

    r9667 r11054  
    4444    EffectContainer::EffectContainer(Context* context)
    4545        : BaseObject(context)
    46         , lua_(NULL)
     46        , lua_(nullptr)
    4747    {
    4848        RegisterObject(EffectContainer);
     
    8989    {
    9090        unsigned int i = 0;
    91         for (std::vector<WorldEntity*>::const_iterator it = this->effects_.begin(); it != this->effects_.end(); ++it)
     91        for (WorldEntity* effect : this->effects_)
    9292            if (i == index)
    93                 return (*it);
    94         return NULL;
     93                return effect;
     94        return nullptr;
    9595    }
    9696
     
    103103            bool result = (bool)lua_toboolean(this->lua_->getInternalLuaState(), -1);
    104104            lua_pop(this->lua_->getInternalLuaState(), 1);
    105             for (std::vector<WorldEntity*>::const_iterator it = this->effects_.begin(); it != this->effects_.end(); ++it)
     105            for (WorldEntity* effect : this->effects_)
    106106            {
    107                 (*it)->setMainState(result);
     107                effect->setMainState(result);
    108108            }
    109109        }
  • code/branches/cpp11_v3/src/orxonox/worldentities/EffectContainer.h

    r9667 r11054  
    4343            virtual ~EffectContainer();
    4444
    45             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
     45            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
    4646
    4747            void setLuaState(LuaState* state, const std::string& functionName);
  • code/branches/cpp11_v3/src/orxonox/worldentities/ExplosionChunk.cc

    r9667 r11054  
    6262            {
    6363                orxout(internal_error) << "Couldn't load particle effect in ExplosionChunk: " << ex.what() << endl;
    64                 this->fire_ = 0;
    65                 this->smoke_ = 0;
     64                this->fire_ = nullptr;
     65                this->smoke_ = nullptr;
    6666            }
    6767        }
    6868        else
    6969        {
    70             this->fire_ = 0;
    71             this->smoke_ = 0;
     70            this->fire_ = nullptr;
     71            this->smoke_ = nullptr;
    7272        }
    7373
  • code/branches/cpp11_v3/src/orxonox/worldentities/ExplosionChunk.h

    r9667 r11054  
    4343            virtual ~ExplosionChunk();
    4444
    45             virtual void tick(float dt);
     45            virtual void tick(float dt) override;
    4646
    4747            inline void setLOD(LODParticle::Value level)
  • code/branches/cpp11_v3/src/orxonox/worldentities/MobileEntity.h

    r11052 r11054  
    5757            virtual ~MobileEntity();
    5858
    59             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    60             virtual void tick(float dt);
     59            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
     60            virtual void tick(float dt) override;
    6161
    62             virtual void setPosition(const Vector3& position);
    63             virtual void setOrientation(const Quaternion& orientation);
     62            virtual void setPosition(const Vector3& position) override;
     63            virtual void setOrientation(const Quaternion& orientation) override;
    6464
    6565            virtual void setVelocity(const Vector3& velocity);
    6666            inline void setVelocity(float x, float y, float z)
    6767                { this->setVelocity(Vector3(x, y, z)); }
    68             inline const Vector3& getVelocity() const
     68            virtual inline const Vector3& getVelocity() const override
    6969                { return this->linearVelocity_; }
    7070            /**
     
    110110        protected:
    111111            // Bullet btMotionState related
    112             virtual void setWorldTransform(const btTransform& worldTrans);
    113             void getWorldTransform(btTransform& worldTrans) const;
     112            virtual void setWorldTransform(const btTransform& worldTrans) override;
     113            virtual void getWorldTransform(btTransform& worldTrans) const override;
    114114
    115115            Vector3 linearAcceleration_;
     
    119119
    120120        private:
    121             virtual bool isCollisionTypeLegal(WorldEntity::CollisionType type) const;
     121            virtual bool isCollisionTypeLegal(WorldEntity::CollisionType type) const override;
    122122    };
    123123}
  • code/branches/cpp11_v3/src/orxonox/worldentities/MovableEntity.cc

    r11018 r11054  
    5050        this->overwrite_orientation_ = Quaternion::IDENTITY;
    5151
    52         this->continuousResynchroTimer_ = 0;
     52        this->continuousResynchroTimer_ = nullptr;
    5353
    5454        this->setPriority(Priority::Low);
     
    8080            {
    8181                float damage = this->collisionDamage_ * (victim->getVelocity() - this->getVelocity()).length();
    82                 victim->hit(0, contactPoint, ownCollisionShape, damage);
     82                victim->hit(nullptr, contactPoint, ownCollisionShape, damage);
    8383            }
    8484        }
  • code/branches/cpp11_v3/src/orxonox/worldentities/MovableEntity.h

    r10216 r11054  
    4646            virtual ~MovableEntity();
    4747
    48             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    49             virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint);
     48            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
     49            virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint) override;
    5050
    5151            using WorldEntity::setPosition;
    5252            using WorldEntity::setOrientation;
    5353
    54             inline void setPosition(const Vector3& position)
     54            virtual inline void setPosition(const Vector3& position) override
    5555                { MobileEntity::setPosition(position); this->overwrite_position_ = this->getPosition(); }
    56             inline void setOrientation(const Quaternion& orientation)
     56            virtual inline void setOrientation(const Quaternion& orientation) override
    5757                { MobileEntity::setOrientation(orientation); this->overwrite_orientation_ = this->getOrientation(); }
    5858
     
    7979        private:
    8080            void registerVariables();
    81             void clientConnected(unsigned int clientID);
    82             void clientDisconnected(unsigned int clientID);
     81            virtual void clientConnected(unsigned int clientID) override;
     82            virtual void clientDisconnected(unsigned int clientID) override;
    8383            void resynchronize();
    8484
  • code/branches/cpp11_v3/src/orxonox/worldentities/SpawnPoint.cc

    r9667 r11054  
    4343        RegisterObject(SpawnPoint);
    4444
    45         this->template_ = 0;
     45        this->template_ = nullptr;
    4646
    4747        if (this->getGametype())
  • code/branches/cpp11_v3/src/orxonox/worldentities/SpawnPoint.h

    r11052 r11054  
    4444            virtual ~SpawnPoint() {}
    4545
    46             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
     46            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
    4747
    4848            inline void setSpawnClass(Identifier* identifier)
  • code/branches/cpp11_v3/src/orxonox/worldentities/StaticEntity.h

    r11052 r11054  
    5757            using WorldEntity::setOrientation;
    5858
    59             void setPosition(const Vector3& position);
    60             void setOrientation(const Quaternion& orientation);
     59            virtual void setPosition(const Vector3& position) override;
     60            virtual void setOrientation(const Quaternion& orientation) override;
    6161
    6262        private:
    6363            void registerVariables();
    64             bool isCollisionTypeLegal(CollisionType type) const;
     64            virtual bool isCollisionTypeLegal(CollisionType type) const override;
    6565
    6666            // network callbacks
     
    7171
    7272            // Bullet btMotionState related
    73             void setWorldTransform(const btTransform& worldTrans);
    74             void getWorldTransform(btTransform& worldTrans) const;
     73            virtual void setWorldTransform(const btTransform& worldTrans) override;
     74            virtual void getWorldTransform(btTransform& worldTrans) const override;
    7575    };
    7676}
  • code/branches/cpp11_v3/src/orxonox/worldentities/TeamSpawnPoint.h

    r11052 r11054  
    4343            virtual ~TeamSpawnPoint() {}
    4444
    45             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
     45            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
    4646
    4747            void setTeamNumber(unsigned int team)
  • code/branches/cpp11_v3/src/orxonox/worldentities/WorldEntity.cc

    r10624 r11054  
    3737#include <OgreSceneNode.h>
    3838#include <BulletDynamics/Dynamics/btRigidBody.h>
    39 #include <boost/static_assert.hpp>
    4039
    4140#include "util/OrxAssert.h"
     
    5756
    5857    // Be sure we don't do bad conversions
    59     BOOST_STATIC_ASSERT((int)Ogre::Node::TS_LOCAL  == (int)WorldEntity::Local);
    60     BOOST_STATIC_ASSERT((int)Ogre::Node::TS_PARENT == (int)WorldEntity::Parent);
    61     BOOST_STATIC_ASSERT((int)Ogre::Node::TS_WORLD  == (int)WorldEntity::World);
     58    static_assert((int)Ogre::Node::TS_LOCAL  == (int)WorldEntity::Local,  "check enum");
     59    static_assert((int)Ogre::Node::TS_PARENT == (int)WorldEntity::Parent, "check enum");
     60    static_assert((int)Ogre::Node::TS_WORLD  == (int)WorldEntity::World,  "check enum");
    6261
    6362    RegisterAbstractClass(WorldEntity).inheritsFrom<BaseObject>().inheritsFrom<Synchronisable>();
     
    7776        this->node_ = this->getScene()->getRootSceneNode()->createChildSceneNode();
    7877
    79         this->parent_ = 0;
     78        this->parent_ = nullptr;
    8079        this->parentID_ = OBJECTID_UNKNOWN;
    8180        this->bDeleteWithParent_ = true;
     
    9089
    9190        // Default behaviour does not include physics
    92         this->physicalBody_   = 0;
     91        this->physicalBody_   = nullptr;
    9392        this->bPhysicsActive_ = false;
    9493        this->bPhysicsActiveSynchronised_    = false;
     
    234233
    235234            // iterate over all children and change their activity as well
    236             for (std::set<WorldEntity*>::const_iterator it = this->getAttachedObjects().begin(); it != this->getAttachedObjects().end(); it++)
     235            for (WorldEntity* object : this->getAttachedObjects())
    237236            {
    238237                if(!this->isActive())
    239238                {
    240                     (*it)->bActiveMem_ = (*it)->isActive();
    241                     (*it)->setActive(this->isActive());
     239                    object->bActiveMem_ = object->isActive();
     240                    object->setActive(this->isActive());
    242241                }
    243242                else
    244243                {
    245                     (*it)->setActive((*it)->bActiveMem_);
     244                    object->setActive(object->bActiveMem_);
    246245                }
    247246            }
     
    260259        {
    261260            // iterate over all children and change their visibility as well
    262             for (std::set<WorldEntity*>::const_iterator it = this->getAttachedObjects().begin(); it != this->getAttachedObjects().end(); it++)
     261            for (WorldEntity* object : this->getAttachedObjects())
    263262            {
    264263                if(!this->isVisible())
    265264                {
    266                     (*it)->bVisibleMem_ = (*it)->isVisible();
    267                     (*it)->setVisible(this->isVisible());
     265                    object->bVisibleMem_ = object->isVisible();
     266                    object->setVisible(this->isVisible());
    268267                }
    269268                else
    270269                {
    271                     (*it)->setVisible((*it)->bVisibleMem_);
     270                    object->setVisible(object->bVisibleMem_);
    272271                }
    273272            }
     
    498497    void WorldEntity::notifyDetached()
    499498    {
    500         this->parent_ = 0;
     499        this->parent_ = nullptr;
    501500        this->parentID_ = OBJECTID_UNKNOWN;
    502501
     
    519518    {
    520519        unsigned int i = 0;
    521         for (std::set<WorldEntity*>::const_iterator it = this->children_.begin(); it != this->children_.end(); ++it)
     520        for (WorldEntity* child : this->children_)
    522521        {
    523522            if (i == index)
    524                 return (*it);
     523                return child;
    525524            ++i;
    526525        }
    527         return 0;
     526        return nullptr;
    528527    }
    529528
     
    563562    void WorldEntity::detachOgreObject(Ogre::MovableObject* object)
    564563    {
    565         object->setUserAny(Ogre::Any(static_cast<OrxonoxClass*>(NULL)));
     564        object->setUserAny(Ogre::Any(static_cast<OrxonoxClass*>(nullptr)));
    566565        this->node_->detachObject(object);
    567566    }
     
    660659    {
    661660        // If physics is enabled scale the attached CollisionShape.
    662         /*if (this->hasPhysics() && this->collisionShape_ != NULL)
     661        /*if (this->hasPhysics() && this->collisionShape_ != nullptr)
    663662        {
    664663            this->collisionShape_->setScale3D(scale);
     
    856855            deactivatePhysics();
    857856            delete this->physicalBody_;
    858             this->physicalBody_ = 0;
     857            this->physicalBody_ = nullptr;
    859858            this->collisionType_ = None;
    860859            this->collisionTypeSynchronised_ = None;
     
    939938        // Recalculate mass
    940939        this->childrenMass_ = 0.0f;
    941         for (std::set<WorldEntity*>::const_iterator it = this->children_.begin(); it != this->children_.end(); ++it)
    942             this->childrenMass_ += (*it)->getMass();
     940        for (WorldEntity* child : this->children_)
     941            this->childrenMass_ += child->getMass();
    943942        recalculateMassProps();
    944943        // Notify parent WE
  • code/branches/cpp11_v3/src/orxonox/worldentities/WorldEntity.h

    r10726 r11054  
    9696            virtual ~WorldEntity();
    9797
    98             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
     98            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
    9999
    100100            inline const Ogre::SceneNode* getNode() const
     
    108108            static const Vector3 UP;
    109109
    110             virtual void changedActivity(void);
    111             virtual void changedVisibility(void);
     110            virtual void changedActivity(void) override;
     111            virtual void changedVisibility(void) override;
    112112
    113113            virtual void setPosition(const Vector3& position) = 0;
  • code/branches/cpp11_v3/src/orxonox/worldentities/pawns/FpsPlayer.cc

    r9667 r11054  
    282282    }
    283283
    284     bool FpsPlayer::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)
     284    bool FpsPlayer::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint)
    285285    {
    286286        if (contactPoint.m_normalWorldOnB.y() > 0.6)
  • code/branches/cpp11_v3/src/orxonox/worldentities/pawns/FpsPlayer.h

    r9667 r11054  
    6969            virtual void fire();
    7070
    71             bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint);
     71            virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) override;
    7272
    7373            virtual void addedWeaponPack(WeaponPack* wPack);
  • code/branches/cpp11_v3/src/orxonox/worldentities/pawns/ModularSpaceShip.cc

    r10624 r11054  
    5353    RegisterClass(ModularSpaceShip);
    5454
    55     std::map<StaticEntity*, ShipPart*>* ModularSpaceShip::partMap_s = 0;
     55    std::map<StaticEntity*, ShipPart*>* ModularSpaceShip::partMap_s = nullptr;
    5656
    5757    ModularSpaceShip::ModularSpaceShip(Context* context) : SpaceShip(context)
     
    9494        for (unsigned int i=0; i < this->getAttachedObjects().size(); i++)
    9595        {
    96             if (this->getAttachedObject(i) == NULL)
     96            if (this->getAttachedObject(i) == nullptr)
    9797            {
    9898                break;
    9999            }
    100100            // iterate through all attached parts
    101             for(unsigned int j = 0; j < this->partList_.size(); j++)
     101            for(ShipPart* part : this->partList_)
    102102            {
    103103                // if the name of the part matches the name of the object, add the object to that parts entitylist (unless it was already done).
    104                 if((this->partList_[j]->getName() == this->getAttachedObject(i)->getName()) && !this->partList_[j]->hasEntity(orxonox_cast<StaticEntity*>(this->getAttachedObject(i))))
     104                if((part->getName() == this->getAttachedObject(i)->getName()) && !part->hasEntity(orxonox_cast<StaticEntity*>(this->getAttachedObject(i))))
    105105                {
    106106                    // The Entity is added to the part's entityList_
    107                     this->partList_[j]->addEntity(orxonox_cast<StaticEntity*>(this->getAttachedObject(i)));
     107                    part->addEntity(orxonox_cast<StaticEntity*>(this->getAttachedObject(i)));
    108108                    // An entry in the partMap_ is created, assigning the part to the entity.
    109                     this->addPartEntityAssignment((StaticEntity*)(this->getAttachedObject(i)), this->partList_[j]);
     109                    this->addPartEntityAssignment((StaticEntity*)(this->getAttachedObject(i)), part);
    110110                }
    111111            }
     
    146146    ShipPart* ModularSpaceShip::getPartOfEntity(StaticEntity* entity) const
    147147    {
    148         for (std::map<StaticEntity*, ShipPart*>::const_iterator it = this->partMap_.begin(); it != this->partMap_.end(); ++it)
    149         {
    150             if (it->first == entity)
    151                 return it->second;
    152         }
    153         return NULL;
     148        for (const auto& mapEntry : this->partMap_)
     149        {
     150            if (mapEntry.first == entity)
     151                return mapEntry.second;
     152        }
     153        return nullptr;
    154154    }
    155155
     
    160160    void ModularSpaceShip::damage(float damage, float healthdamage, float shielddamage, Pawn* originator, const btCollisionShape* cs)
    161161    {
    162         if (cs != NULL && this->getPartOfEntity((StaticEntity*)(cs->getUserPointer())) != NULL)
     162        if (cs != nullptr && this->getPartOfEntity((StaticEntity*)(cs->getUserPointer())) != nullptr)
    163163            this->getPartOfEntity((StaticEntity*)(cs->getUserPointer()))->handleHit(damage, healthdamage, shielddamage, originator);
    164164        else
     
    174174    void ModularSpaceShip::killShipPartStatic(std::string name)
    175175    {
    176         for (std::map<StaticEntity*, ShipPart*>::const_iterator it = ModularSpaceShip::partMap_s->begin(); it != ModularSpaceShip::partMap_s->end(); ++it)
    177         {
    178             if (it->second->getName() == name)
    179             {
    180                 it->second->death();
     176        for (const auto& mapEntry : *ModularSpaceShip::partMap_s)
     177        {
     178            if (mapEntry.second->getName() == name)
     179            {
     180                mapEntry.second->death();
    181181                return;
    182182            }
     
    193193    void ModularSpaceShip::killShipPart(std::string name)
    194194    {
    195         for (std::map<StaticEntity*, ShipPart*>::const_iterator it = ModularSpaceShip::partMap_.begin(); it != ModularSpaceShip::partMap_.end(); ++it)
    196         {
    197             if (it->second->getName() == name)
    198             {
    199                 it->second->death();
     195        for (const auto& mapEntry : ModularSpaceShip::partMap_)
     196        {
     197            if (mapEntry.second->getName() == name)
     198            {
     199                mapEntry.second->death();
    200200                return;
    201201            }
     
    212212    void ModularSpaceShip::addShipPart(ShipPart* part)
    213213    {
    214         OrxAssert(part != NULL, "The ShipPart cannot be NULL.");
     214        OrxAssert(part != nullptr, "The ShipPart cannot be nullptr.");
    215215        this->partList_.push_back(part);
    216216        part->setParent(this);
     
    222222        Get the i-th ShipPart of the SpaceShip.
    223223    @return
    224         Returns a pointer to the i-the ShipPart. NULL if there is no ShipPart with that index.
     224        Returns a pointer to the i-the ShipPart. nullptr if there is no ShipPart with that index.
    225225    */
    226226    ShipPart* ModularSpaceShip::getShipPart(unsigned int index)
    227227    {
    228228        if(this->partList_.size() <= index)
    229             return NULL;
     229            return nullptr;
    230230        else
    231231            return this->partList_[index];
     
    238238        The name of the ShipPart to be returned.
    239239    @return
    240         Pointer to the ShipPart with the given name, or NULL if not found.
     240        Pointer to the ShipPart with the given name, or nullptr if not found.
    241241    */
    242242    ShipPart* ModularSpaceShip::getShipPartByName(std::string name)
    243243    {
    244         for(std::vector<ShipPart*>::iterator it = this->partList_.begin(); it != this->partList_.end(); ++it)
    245         {
    246             if(orxonox_cast<ShipPart*>(*it)->getName() == name)
    247             {
    248                 return orxonox_cast<ShipPart*>(*it);
     244        for(ShipPart* part : this->partList_)
     245        {
     246            if(orxonox_cast<ShipPart*>(part)->getName() == name)
     247            {
     248                return orxonox_cast<ShipPart*>(part);
    249249            }
    250250        }
    251251        orxout(internal_warning) << "Couldn't find ShipPart with name \"" << name << "\"." << endl;
    252         return NULL;
     252        return nullptr;
    253253    }
    254254
     
    256256    @brief
    257257        Check whether the SpaceShip has a particular Engine.
    258     @param engine
     258    @param search
    259259        A pointer to the Engine to be checked.
    260260    */
    261     bool ModularSpaceShip::hasShipPart(ShipPart* part) const
    262     {
    263         for(unsigned int i = 0; i < this->partList_.size(); i++)
    264         {
    265             if(this->partList_[i] == part)
     261    bool ModularSpaceShip::hasShipPart(ShipPart* search) const
     262    {
     263        for(ShipPart* part : this->partList_)
     264        {
     265            if(part == search)
    266266                return true;
    267267        }
  • code/branches/cpp11_v3/src/orxonox/worldentities/pawns/ModularSpaceShip.h

    r10262 r11054  
    109109            ShipPart* getPartOfEntity(StaticEntity* entity) const;
    110110
    111             virtual void damage(float damage, float healthdamage = 0.0f, float shielddamage = 0.0f, Pawn* originator = NULL, const btCollisionShape* cs = NULL);
     111            virtual void damage(float damage, float healthdamage = 0.0f, float shielddamage = 0.0f, Pawn* originator = nullptr, const btCollisionShape* cs = nullptr);
    112112
    113113            static void killShipPartStatic(std::string name);
  • code/branches/cpp11_v3/src/orxonox/worldentities/pawns/Pawn.cc

    r11052 r11054  
    7777        this->shieldRechargeWaitCountdown_ = 0;
    7878
    79         this->lastHitOriginator_ = 0;
     79        this->lastHitOriginator_ = nullptr;
    8080
    8181        // set damage multiplier to default value 1, meaning nominal damage
     
    9494        }
    9595        else
    96             this->weaponSystem_ = 0;
     96            this->weaponSystem_ = nullptr;
    9797
    9898        this->setRadarObjectColour(ColourValue::Red);
     
    112112        else
    113113        {
    114             this->explosionSound_ = 0;
     114            this->explosionSound_ = nullptr;
    115115        }
    116116    }
     
    373373                    {
    374374                        // delete the AIController // <-- TODO: delete? nothing is deleted here... should we delete the controller?
    375                         slave->setControllableEntity(0);
     375                        slave->setControllableEntity(nullptr);
    376376
    377377                        // set a new master within the formation
     
    468468            return this->weaponSystem_->getWeaponSlot(index);
    469469        else
    470             return 0;
     470            return nullptr;
    471471    }
    472472
     
    482482            return this->weaponSystem_->getWeaponSet(index);
    483483        else
    484             return 0;
     484            return nullptr;
    485485    }
    486486
     
    510510            return this->weaponSystem_->getWeaponPack(index);
    511511        else
    512             return 0;
     512            return nullptr;
    513513    }
    514514
     
    564564    bool Pawn::hasSlaves()
    565565    {
    566         for (ObjectList<FormationController>::iterator it =
    567              ObjectList<FormationController>::begin();
    568              it != ObjectList<FormationController>::end(); ++it )
     566        for (FormationController* controller : ObjectList<FormationController>())
    569567        {
    570568            // checks if the pawn's controller has a slave
    571             if (this->hasHumanController() && it->getMaster() == this->getPlayer()->getController())
     569            if (this->hasHumanController() && controller->getMaster() == this->getPlayer()->getController())
    572570                return true;
    573571        }
     
    577575    // A function that returns a slave of the pawn's controller
    578576    Controller* Pawn::getSlave(){
    579         for (ObjectList<FormationController>::iterator it =
    580                 ObjectList<FormationController>::begin();
    581                 it != ObjectList<FormationController>::end(); ++it )
    582         {
    583             if (this->hasHumanController() && it->getMaster() == this->getPlayer()->getController())
    584                 return it->getController();
    585         }
    586         return 0;
     577        for (FormationController* controller : ObjectList<FormationController>())
     578        {
     579            if (this->hasHumanController() && controller->getMaster() == this->getPlayer()->getController())
     580                return controller->getController();
     581        }
     582        return nullptr;
    587583    }
    588584
  • code/branches/cpp11_v3/src/orxonox/worldentities/pawns/Pawn.h

    r11052 r11054  
    6363            virtual ~Pawn();
    6464
    65             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    66             virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode);
    67             virtual void tick(float dt);
     65            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
     66            virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode) override;
     67            virtual void tick(float dt) override;
    6868
    6969            inline bool isAlive() const
     
    157157            virtual void kill();
    158158
    159             virtual void fired(unsigned int firemode);
     159            virtual void fired(unsigned int firemode) override;
    160160            virtual void postSpawn();
    161161
     
    201201
    202202
    203             virtual void startLocalHumanControl();
     203            virtual void startLocalHumanControl() override;
    204204
    205205            void setAimPosition( Vector3 position )
     
    208208                { return this->aimPosition_; }
    209209
    210             virtual const Vector3& getCarrierPosition(void) const
     210            virtual const Vector3& getCarrierPosition(void) const override
    211211                { return this->getWorldPosition(); };
    212212
    213             virtual void changedVisibility();
     213            virtual void changedVisibility() override;
    214214
    215215            void setExplosionSound(const std::string& engineSound);
     
    220220
    221221        protected:
    222             virtual void preDestroy();
    223 
    224             virtual void setPlayer(PlayerInfo* player);
    225             virtual void removePlayer();
     222            virtual void preDestroy() override;
     223
     224            virtual void setPlayer(PlayerInfo* player) override;
     225            virtual void removePlayer() override;
    226226
    227227            virtual void death();
     
    231231            virtual void spawneffect();
    232232
    233             virtual void damage(float damage, float healthdamage = 0.0f, float shielddamage = 0.0f, Pawn* originator = NULL, const btCollisionShape* cs = NULL);
     233            virtual void damage(float damage, float healthdamage = 0.0f, float shielddamage = 0.0f, Pawn* originator = nullptr, const btCollisionShape* cs = nullptr);
    234234
    235235            bool bAlive_;
    236236            bool bVulnerable_; ///< If false the pawn may not ged damaged
    237237
    238             virtual std::vector<PickupCarrier*>* getCarrierChildren(void) const
     238            virtual std::vector<PickupCarrier*>* getCarrierChildren(void) const override
    239239                { return new std::vector<PickupCarrier*>(); }
    240             virtual PickupCarrier* getCarrierParent(void) const
    241                 { return NULL; }
     240            virtual PickupCarrier* getCarrierParent(void) const override
     241                { return nullptr; }
    242242
    243243
  • code/branches/cpp11_v3/src/orxonox/worldentities/pawns/SpaceShip.cc

    r11052 r11054  
    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);
     
    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;
  • code/branches/cpp11_v3/src/orxonox/worldentities/pawns/Spectator.cc

    r10624 r11054  
    5858        this->localVelocity_ = Vector3::ZERO;
    5959        this->setHudTemplate("spectatorhud");
    60         this->greetingFlare_ = 0;
     60        this->greetingFlare_ = nullptr;
    6161
    6262        this->setDestroyWhenPlayerLeft(true);
  • code/branches/cpp11_v3/src/orxonox/worldentities/pawns/TeamBaseMatchBase.cc

    r10624 r11054  
    8080
    8181        std::set<WorldEntity*> attachments = this->getAttachedObjects();
    82         for (std::set<WorldEntity*>::iterator it = attachments.begin(); it != attachments.end(); ++it)
     82        for (WorldEntity* attachment : attachments)
    8383        {
    84             if ((*it)->isA(Class(TeamColourable)))
     84            if (attachment->isA(Class(TeamColourable)))
    8585            {
    86                 TeamColourable* tc = orxonox_cast<TeamColourable*>(*it);
     86                TeamColourable* tc = orxonox_cast<TeamColourable*>(attachment);
    8787                tc->setTeamColour(colour);
    8888            }
     
    9292
    9393        // Call this so bots stop shooting at the base after they converted it
    94         for (ObjectList<ArtificialController>::iterator it = ObjectList<ArtificialController>::begin(); it != ObjectList<ArtificialController>::end(); ++it)
    95             it->abandonTarget(this);
     94        for (ArtificialController* controller : ObjectList<ArtificialController>())
     95            controller->abandonTarget(this);
    9696    }
    9797}
Note: See TracChangeset for help on using the changeset viewer.