Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

merged branch cpp11_v2 into cpp11_v3

Location:
code/branches/cpp11_v3
Files:
185 edited

Legend:

Unmodified
Added
Removed
  • code/branches/cpp11_v3

  • code/branches/cpp11_v3/src/orxonox/CameraManager.cc

    r10624 r11054  
    6060            return this->cameraList_.front();
    6161        else
    62             return 0;
     62            return nullptr;
    6363    }
    6464
     
    9393                this->cameraList_.front()->setFocus();
    9494            else
    95                 this->useCamera(NULL);
     95                this->useCamera(nullptr);
    9696        }
    9797        else
  • code/branches/cpp11_v3/src/orxonox/CameraManager.h

    r9667 r11054  
    5959
    6060        private:
    61             CameraManager(const CameraManager&); // don't use
     61            // non-copyable:
     62            CameraManager(const CameraManager&) = delete;
     63            CameraManager& operator=(const CameraManager&) = delete;
    6264
    6365            std::list<Camera*>    cameraList_;
  • code/branches/cpp11_v3/src/orxonox/Level.cc

    r10624 r11054  
    3030
    3131#include "util/Math.h"
     32#include "util/SubString.h"
    3233#include "core/CoreIncludes.h"
    3334#include "core/Loader.h"
     
    5455        this->registerVariables();
    5556        this->xmlfilename_ = this->getFilename();
    56         this->xmlfile_ = 0;
     57        this->xmlfile_ = nullptr;
    5758    }
    5859
     
    105106    void Level::networkCallbackTemplatesChanged()
    106107    {
    107         for( std::set<std::string>::iterator it = this->networkTemplateNames_.begin(); it!=this->networkTemplateNames_.end(); ++it )
    108         {
    109             assert(Template::getTemplate(*it));
    110             Template::getTemplate(*it)->applyOn(this);
     108        for(const std::string& name : this->networkTemplateNames_)
     109        {
     110            assert(Template::getTemplate(name));
     111            Template::getTemplate(name)->applyOn(this);
    111112        }
    112113    }
     
    134135        //       objects alive when ~Level is called. This is the reason why we cannot directly destroy() the Plugins - instead we need
    135136        //       to call destroyLater() to ensure that no instances from this plugin exist anymore.
    136         for (std::list<PluginReference*>::iterator it = this->plugins_.begin(); it != this->plugins_.end(); ++it)
    137             (*it)->destroyLater();
     137        for (PluginReference* plugin : this->plugins_)
     138            plugin->destroyLater();
    138139        this->plugins_.clear();
    139140    }
     
    172173    {
    173174        unsigned int i = 0;
    174         for (std::list<BaseObject*>::const_iterator it = this->objects_.begin(); it != this->objects_.end(); ++it)
     175        for (BaseObject* object : this->objects_)
    175176        {
    176177            if (i == index)
    177                 return (*it);
     178                return object;
    178179            ++i;
    179180        }
    180         return 0;
     181        return nullptr;
    181182    }
    182183
     
    195196            return this->lodInformation_.find(meshName)->second;
    196197
    197         return 0;
     198        return nullptr;
    198199    }
    199200
     
    207208    {
    208209        orxout(internal_info) << "player left level (id: " << player->getClientID() << ", name: " << player->getName() << ')' << endl;
    209         player->switchGametype(0);
     210        player->switchGametype(nullptr);
    210211    }
    211212}
  • code/branches/cpp11_v3/src/orxonox/Level.h

    r10624 r11054  
    3737#include "core/BaseObject.h"
    3838#include "network/synchronisable/Synchronisable.h"
     39#include "core/object/Context.h"
    3940#include "graphics/MeshLodInformation.h"
    4041
     
    4748            virtual ~Level();
    4849
    49             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
     50            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
    5051
    5152            void playerEntered(PlayerInfo* player);
  • code/branches/cpp11_v3/src/orxonox/LevelInfo.cc

    r9667 r11054  
    106106    {
    107107        SubString substr = SubString(tags, ",", " "); // Split the string into tags.
    108         const std::vector<std::string>& strings = substr.getAllStrings();
    109         for (std::vector<std::string>::const_iterator it = strings.begin(); it != strings.end(); it++)
    110             this->addTag(*it, false);
     108        const std::vector<std::string>& tokens = substr.getAllStrings();
     109        for (const std::string& token : tokens)
     110            this->addTag(token, false);
    111111
    112112        this->tagsUpdated();
     
    121121    {
    122122        SubString substr = SubString(ships, ",", " "); // Split the string into tags.
    123         const std::vector<std::string>& strings = substr.getAllStrings();
    124         for(std::vector<std::string>::const_iterator it = strings.begin(); it != strings.end(); it++)
    125             this->addStartingShip(*it, false);
     123        const std::vector<std::string>& tokens = substr.getAllStrings();
     124        for(const std::string& token : tokens)
     125            this->addStartingShip(token, false);
    126126
    127127        this->startingshipsUpdated();
  • code/branches/cpp11_v3/src/orxonox/LevelInfo.h

    r9667 r11054  
    207207            virtual ~LevelInfo();
    208208
    209             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Creates a LevelInfo object through XML.
     209            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; //!< Creates a LevelInfo object through XML.
    210210
    211211            /**
  • code/branches/cpp11_v3/src/orxonox/LevelManager.cc

    r11020 r11054  
    7878    {
    7979        // Delete all the LevelInfoItem objects because the LevelManager created them
    80         std::set<LevelInfoItem*, LevelInfoCompare>::iterator it = availableLevels_.begin();
    81         for (; it != availableLevels_.end(); ++it)
    82             (*it)->destroy();
     80        for (LevelInfoItem* info : availableLevels_)
     81            info->destroy();
    8382    }
    8483
     
    154153        Get the currently active Level.
    155154    @return
    156         Returns a pointer to the currently active level or NULL if there currently are no active Levels.
     155        Returns a pointer to the currently active level or nullptr if there currently are no active Levels.
    157156    */
    158157    Level* LevelManager::getActiveLevel()
     
    161160            return this->levels_.front();
    162161        else
    163             return 0;
     162            return nullptr;
    164163    }
    165164
     
    175174            this->levels_.front()->setActive(true);
    176175            // Make every player enter the newly activated level.
    177             for (std::map<unsigned int, PlayerInfo*>::const_iterator it = PlayerManager::getInstance().getClients().begin(); it != PlayerManager::getInstance().getClients().end(); ++it)
    178                 this->levels_.front()->playerEntered(it->second);
     176            for (const auto& mapEntry : PlayerManager::getInstance().getClients())
     177                this->levels_.front()->playerEntered(mapEntry.second);
    179178        }
    180179    }
     
    218217    {
    219218        if(index >= this->availableLevels_.size())
    220             return NULL;
     219            return nullptr;
    221220
    222221        // If this index directly follows the last we can optimize a lot.
     
    272271            if (it->find("old/") != 0)
    273272            {
    274                 LevelInfoItem* info = NULL;
     273                LevelInfoItem* info = nullptr;
    275274
    276275                // Load the LevelInfo object from the level file.
     
    279278
    280279                // Find the LevelInfo object we've just loaded (if there was one)
    281                 for(ObjectList<LevelInfo>::iterator item = ObjectList<LevelInfo>::begin(); item != ObjectList<LevelInfo>::end(); ++item)
    282                     if(item->getXMLFilename() == *it)
    283                         info = item->copy();
     280                for(LevelInfo* levelInfo : ObjectList<LevelInfo>())
     281                    if(levelInfo->getXMLFilename() == *it)
     282                        info = levelInfo->copy();
    284283
    285284                // We don't need the loaded stuff anymore
    286285                Loader::getInstance().unload(&file);
    287286
    288                 if(info == NULL)
     287                if(info == nullptr)
    289288                {
    290289                    // Create a default LevelInfoItem object that merely contains the name
  • code/branches/cpp11_v3/src/orxonox/LevelManager.h

    r10258 r11054  
    109109
    110110        private:
    111             LevelManager(const LevelManager&);
     111            // non-copyable:
     112            LevelManager(const LevelManager&) = delete;
     113            LevelManager& operator=(const LevelManager&) = delete;
    112114
    113115            void activateNextLevel(); //!< Activate the next level.
  • code/branches/cpp11_v3/src/orxonox/MoodManager.cc

    r10624 r11054  
    103103    /*static*/ void MoodListener::changedMood(const std::string& mood)
    104104    {
    105         for (ObjectList<MoodListener>::iterator it = ObjectList<MoodListener>::begin(); it; ++it)
    106             it->moodChanged(mood);
     105        for (MoodListener* listener : ObjectList<MoodListener>())
     106            listener->moodChanged(mood);
    107107    }
    108108}
  • code/branches/cpp11_v3/src/orxonox/PlayerManager.cc

    r10624 r11054  
    6262
    6363            // create new HumanPlayer instance
    64             HumanPlayer* player = new HumanPlayer(0);
     64            HumanPlayer* player = new HumanPlayer(nullptr);
    6565            player->setClientID(clientID);
    6666
     
    111111        else
    112112        {
    113             for (ObjectList<PlayerInfo>::iterator it = ObjectList<PlayerInfo>::begin(); it != ObjectList<PlayerInfo>::end(); ++it)
    114                 if (it->getClientID() == clientID)
    115                     return (*it);
     113            for (PlayerInfo* info : ObjectList<PlayerInfo>())
     114                if (info->getClientID() == clientID)
     115                    return info;
    116116        }
    117         return 0;
     117        return nullptr;
    118118    }
    119119}
  • code/branches/cpp11_v3/src/orxonox/PlayerManager.h

    r5966 r11054  
    5050                { return this->clients_; }
    5151
    52             void clientConnected(unsigned int clientID);
    53             void clientDisconnected(unsigned int clientID);
     52            virtual void clientConnected(unsigned int clientID) override;
     53            virtual void clientDisconnected(unsigned int clientID) override;
    5454            void disconnectAllClients();
    5555
  • code/branches/cpp11_v3/src/orxonox/Radar.cc

    r10624 r11054  
    4949
    5050    Radar::Radar()
    51         : itFocus_(0)
    52         , focus_(0)
     51        : itFocus_(nullptr)
     52        , focus_(nullptr)
    5353        , objectTypeCounter_(0)
    5454    {
     
    8484        this->radarObjects_.insert(rv);
    8585        // iterate through all radarlisteners and notify them
    86         for (ObjectList<RadarListener>::iterator itListener = ObjectList<RadarListener>::begin(); itListener; ++itListener)
    87         {
    88             (*itListener)->addObject(rv);
     86        for (RadarListener* listener : ObjectList<RadarListener>())
     87        {
     88            listener->addObject(rv);
    8989        }
    9090    }
     
    9595        this->radarObjects_.erase(rv);
    9696        // iterate through all radarlisteners and notify them
    97         for (ObjectList<RadarListener>::iterator itListener = ObjectList<RadarListener>::begin(); itListener; ++itListener)
    98         {
    99             (*itListener)->removeObject(rv);
     97        for (RadarListener* listener : ObjectList<RadarListener>())
     98        {
     99            listener->removeObject(rv);
    100100        }
    101101    }
     
    106106            return *(this->itFocus_);
    107107        else
    108             return 0;
     108            return nullptr;
    109109    }
    110110
     
    126126        {
    127127            // focus object was deleted, release focus
    128             this->focus_ = 0;
    129             this->itFocus_ = 0;
    130         }
    131 
    132         for (ObjectList<RadarListener>::iterator itListener = ObjectList<RadarListener>::begin(); itListener; ++itListener)
    133         {
    134             (*itListener)->radarTick(dt);
     128            this->focus_ = nullptr;
     129            this->itFocus_ = nullptr;
     130        }
     131
     132        for (RadarListener* listener : ObjectList<RadarListener>())
     133        {
     134            listener->radarTick(dt);
    135135        }
    136136    }
     
    138138    void Radar::cycleFocus()
    139139    {
    140         if (ObjectList<RadarViewable>::begin() == ObjectList<RadarViewable>::end())
     140        ObjectList<RadarViewable> listRadarViewable;
     141        if (listRadarViewable.size() == 0)
    141142        {
    142143            // list is empty
    143             this->itFocus_ = 0;
    144             this->focus_ = 0;
     144            this->itFocus_ = nullptr;
     145            this->focus_ = nullptr;
    145146        }
    146147
     
    156157            float nextDistance = FLT_MAX;
    157158            float minimumDistance = FLT_MAX;
    158             ObjectList<RadarViewable>::iterator itFallback = 0;
    159 
    160             for (ObjectList<RadarViewable>::iterator it = ObjectList<RadarViewable>::begin(); it; ++it)
     159            ObjectList<RadarViewable>::iterator itFallback = nullptr;
     160
     161            for (ObjectList<RadarViewable>::iterator it = listRadarViewable.begin(); it; ++it)
    161162            {
    162163                if (*it == static_cast<RadarViewable*>(HumanController::getLocalControllerEntityAsPawn()))
     
    191192    void Radar::releaseFocus()
    192193    {
    193         this->itFocus_ = 0;
    194         this->focus_ = 0;
     194        this->itFocus_ = nullptr;
     195        this->focus_ = nullptr;
    195196    }
    196197
     
    200201        // iterate through all Radar Objects
    201202        unsigned int i = 0;
    202         for (ObjectList<RadarViewable>::iterator it = ObjectList<RadarViewable>::begin(); it; ++it, ++i)
    203         {
    204             orxout(debug_output) << i++ << ": " << (*it)->getRVWorldPosition() << endl;
     203        for (RadarViewable* viewable : ObjectList<RadarViewable>())
     204        {
     205            orxout(debug_output) << i++ << ": " << viewable->getRVWorldPosition() << endl;
     206            ++i;
    205207        }
    206208    }
     
    208210    void Radar::radarObjectChanged(RadarViewable* rv)
    209211    {
    210         for (ObjectList<RadarListener>::iterator itListener = ObjectList<RadarListener>::begin(); itListener; ++itListener)
    211         {
    212           (*itListener)->objectChanged(rv);
     212        for (RadarListener* listener : ObjectList<RadarListener>())
     213        {
     214            listener->objectChanged(rv);
    213215        }
    214216    }
  • code/branches/cpp11_v3/src/orxonox/Radar.h

    r9667 r11054  
    5454        virtual ~Radar();
    5555
    56         virtual void tick(float dt);
     56        virtual void tick(float dt) override;
    5757
    5858        const RadarViewable* getFocus();
  • code/branches/cpp11_v3/src/orxonox/Scene.cc

    r10727 r11054  
    6666        this->bShadows_ = true;
    6767        this->bDebugDrawPhysics_ = false;
    68         this->debugDrawer_ = NULL;
     68        this->debugDrawer_ = nullptr;
    6969        this->soundReferenceDistance_ = 20.0;
    7070        this->bIsUpdatingPhysics_ = false;
     
    8484            this->rootSceneNode_ = this->sceneManager_->getRootSceneNode();
    8585
    86             this->radar_ = 0;
     86            this->radar_ = nullptr;
    8787        }
    8888
     
    9292        this->positiveWorldRange_ = Vector3::UNIT_SCALE *  defaultMaxWorldSize;
    9393        this->gravity_ = Vector3::ZERO;
    94         this->physicalWorld_   = 0;
    95         this->solver_          = 0;
    96         this->dispatcher_      = 0;
    97         this->collisionConfig_ = 0;
    98         this->broadphase_      = 0;
     94        this->physicalWorld_   = nullptr;
     95        this->solver_          = nullptr;
     96        this->dispatcher_      = nullptr;
     97        this->collisionConfig_ = nullptr;
     98        this->broadphase_      = nullptr;
    9999
    100100        this->registerVariables();
     
    220220        {
    221221            // Remove all WorldEntities and shove them to the queue since they would still like to be in a physical world.
    222             for (std::set<WorldEntity*>::const_iterator it = this->physicalObjects_.begin();
    223                 it != this->physicalObjects_.end(); ++it)
     222            for (WorldEntity* object : this->physicalObjects_)
    224223            {
    225                 this->physicalWorld_->removeRigidBody((*it)->physicalBody_);
    226                 this->physicalObjectQueue_.insert(*it);
     224                this->physicalWorld_->removeRigidBody(object->physicalBody_);
     225                this->physicalObjectQueue_.insert(object);
    227226            }
    228227            this->physicalObjects_.clear();
     
    234233            delete this->collisionConfig_;
    235234            delete this->broadphase_;
    236             this->physicalWorld_   = 0;
    237             this->solver_          = 0;
    238             this->dispatcher_      = 0;
    239             this->collisionConfig_ = 0;
    240             this->broadphase_      = 0;
     235            this->physicalWorld_   = nullptr;
     236            this->solver_          = nullptr;
     237            this->dispatcher_      = nullptr;
     238            this->collisionConfig_ = nullptr;
     239            this->broadphase_      = nullptr;
    241240        }
    242241    }
     
    256255            {
    257256                // Add all scheduled WorldEntities
    258                 for (std::set<WorldEntity*>::const_iterator it = this->physicalObjectQueue_.begin();
    259                     it != this->physicalObjectQueue_.end(); ++it)
     257                for (WorldEntity* object : this->physicalObjectQueue_)
    260258                {
    261                     this->physicalWorld_->addRigidBody((*it)->physicalBody_);
    262                     this->physicalObjects_.insert(*it);
     259                    this->physicalWorld_->addRigidBody(object->physicalBody_);
     260                    this->physicalObjects_.insert(object);
    263261                }
    264262                this->physicalObjectQueue_.clear();
     
    321319    {
    322320        unsigned int i = 0;
    323         for (std::list<BaseObject*>::const_iterator it = this->objects_.begin(); it != this->objects_.end(); ++it)
     321        for (BaseObject* object : this->objects_)
    324322        {
    325323            if (i == index)
    326                 return (*it);
     324                return object;
    327325            ++i;
    328326        }
    329         return 0;
     327        return nullptr;
    330328    }
    331329
     
    391389    /*static*/ void Scene::consoleCommand_debugDrawPhysics(bool bDraw, bool bFill, float fillAlpha)
    392390    {
    393         for (ObjectListIterator<Scene> it = ObjectList<Scene>::begin(); it != ObjectList<Scene>::end(); ++it)
    394             it->setDebugDrawPhysics(bDraw, bFill, fillAlpha);
     391        for (Scene* scene : ObjectList<Scene>())
     392            scene->setDebugDrawPhysics(bDraw, bFill, fillAlpha);
    395393    }
    396394}
  • code/branches/cpp11_v3/src/orxonox/Scene.h

    r10624 r11054  
    4040#include "util/OgreForwardRefs.h"
    4141#include "core/BaseObject.h"
     42#include "core/object/Context.h"
    4243#include "network/synchronisable/Synchronisable.h"
    4344#include "tools/interfaces/Tickable.h"
     
    5152            virtual ~Scene();
    5253
    53             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
     54            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
    5455            void registerVariables();
    5556
     
    7980                { return this->radar_; }
    8081
    81             inline virtual uint32_t getSceneID() const { return this->getObjectID(); }
     82            virtual inline uint32_t getSceneID() const override { return this->getObjectID(); }
    8283
    83             virtual void tick(float dt);
     84            virtual void tick(float dt) override;
    8485
    8586        private:
     
    111112        public:
    112113            inline bool hasPhysics() const
    113                 { return this->physicalWorld_ != 0; }
     114                { return this->physicalWorld_ != nullptr; }
    114115            void setPhysicalWorld(bool wantsPhysics);
    115116
  • code/branches/cpp11_v3/src/orxonox/Test.cc

    r10624 r11054  
    5454    registerMemberNetworkFunction( Test, printBlaBla );
    5555
    56     Test* Test::instance_ = 0;
     56    Test* Test::instance_ = nullptr;
    5757
    5858    Test::Test(Context* context) : BaseObject(context), Synchronisable(context)
    5959    {
    60         assert(instance_==0);
     60        assert(instance_==nullptr);
    6161        instance_=this;
    6262        RegisterObject ( Test );
     
    6464        registerVariables();
    6565        setSyncMode(0x3);
    66         this->pointer_ = 0;
     66        this->pointer_ = nullptr;
    6767    }
    6868
    6969    Test::~Test()
    7070    {
    71         instance_=0;
     71        instance_=nullptr;
    7272    }
    7373
  • code/branches/cpp11_v3/src/orxonox/chat/ChatHistory.cc

    r10624 r11054  
    3030#include "core/singleton/ScopedSingletonIncludes.h"
    3131#include "core/ConfigurablePaths.h"
     32#include "core/CoreIncludes.h"
    3233
    3334#ifndef CHATTEST
     
    159160  void ChatHistory::debug_printhist()
    160161  {
    161     /* create deque iterator */
    162     std::deque<std::string>::iterator it;
    163 
    164162    /* output all the strings */
    165     for( it = this->hist_buffer.begin(); it != this->hist_buffer.end();
    166       ++it )
    167       orxout(debug_output) << *it << endl;
     163    for( const std::string& hist : this->hist_buffer )
     164      orxout(debug_output) << hist << endl;
    168165
    169166    /* output size */
  • code/branches/cpp11_v3/src/orxonox/chat/ChatHistory.h

    r10624 r11054  
    8282       * \param senderID Identification number of the sender
    8383       */
    84       virtual void incomingChat(const std::string& message, const std::string& name);
     84      virtual void incomingChat(const std::string& message, const std::string& name) override;
    8585
    8686      /** Synchronize logfile onto the hard drive
  • code/branches/cpp11_v3/src/orxonox/chat/ChatInputHandler.cc

    r10624 r11054  
    7979    this->inpbuf = new InputBuffer();
    8080    this->disp_offset = 0;
    81     assert( this->inpbuf != NULL );
     81    assert( this->inpbuf != nullptr );
    8282
    8383    /* generate chatbox ui and chatbox-inputonly ui */
  • code/branches/cpp11_v3/src/orxonox/chat/ChatInputHandler.h

    r9675 r11054  
    125125       * history window of the full chat window)
    126126       */
    127       void incomingChat(const std::string& message, const std::string& name);
     127      virtual void incomingChat(const std::string& message, const std::string& name) override;
    128128
    129129      /** \param full true means show full chat window with history,
  • code/branches/cpp11_v3/src/orxonox/chat/ChatManager.cc

    r10624 r11054  
    107107
    108108        // notify all listeners
    109         for (ObjectList<ChatListener>::iterator it = ObjectList<ChatListener>::begin(); it != ObjectList<ChatListener>::end(); ++it)
    110             it->incomingChat(text, name);
     109        for (ChatListener* listener : ObjectList<ChatListener>())
     110            listener->incomingChat(text, name);
    111111    }
    112112
  • code/branches/cpp11_v3/src/orxonox/chat/ChatManager.h

    r8858 r11054  
    4747        public:
    4848            ChatManager();
    49             virtual ~ChatManager() {}
     49            virtual ~ChatManager() = default;
    5050
    5151            static void message(const std::string& message, unsigned int targetID = NETWORK_PEER_ID_BROADCAST);
     
    5353
    5454        protected:
    55             ChatManager(const ChatManager&);
     55            // non-copyable:
     56            ChatManager(const ChatManager&) = delete;
     57            ChatManager& operator=(const ChatManager&) = delete;
    5658
    57             virtual void incomingChat(const std::string& message, unsigned int sourceID);
     59            virtual void incomingChat(const std::string& message, unsigned int sourceID) override;
    5860
    5961            static ChatManager* singletonPtr_s;
  • code/branches/cpp11_v3/src/orxonox/collisionshapes/CollisionShape.cc

    r10624 r11054  
    5757        RegisterObject(CollisionShape);
    5858
    59         this->parent_ = 0;
     59        this->parent_ = nullptr;
    6060        this->parentID_ = OBJECTID_UNKNOWN;
    61         this->collisionShape_ = 0;
     61        this->collisionShape_ = nullptr;
    6262        this->position_ = Vector3::ZERO;
    6363        this->orientation_ = Quaternion::IDENTITY;
     
    154154    void CollisionShape::notifyDetached()
    155155    {
    156         this->parent_ = 0;
     156        this->parent_ = nullptr;
    157157        this->parentID_ = OBJECTID_UNKNOWN;
    158158    }
  • code/branches/cpp11_v3/src/orxonox/collisionshapes/CollisionShape.h

    r9667 r11054  
    6161            virtual ~CollisionShape();
    6262
    63             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
     63            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
    6464
    6565            /**
     
    181181
    182182            btCollisionShape*       collisionShape_; //!< The bullet collision shape of this CollisionShape.
    183             CompoundCollisionShape* parent_; //!< The CompoundCollisionShape this CollisionShape belongs to, NULL if it doesn't belong to one.
     183            CompoundCollisionShape* parent_; //!< The CompoundCollisionShape this CollisionShape belongs to, nullptr if it doesn't belong to one.
    184184            unsigned int            parentID_; //!< The objectID of the parent of this CollisionShape, which can either be a CompoundCollisionShape or a WorldEntity.
    185185
  • code/branches/cpp11_v3/src/orxonox/collisionshapes/CompoundCollisionShape.cc

    r10624 r11054  
    6565        {
    6666            // Delete all children
    67             for (std::map<CollisionShape*, btCollisionShape*>::iterator it = this->attachedShapes_.begin();
    68                 it != this->attachedShapes_.end(); ++it)
     67            for (const auto& mapEntry : this->attachedShapes_)
    6968            {
    7069                // make sure that the child doesn't want to detach itself --> speedup because of the missing update
    71                 it->first->notifyDetached();
    72                 it->first->destroy();
    73                 if (this->collisionShape_ == it->second)
    74                     this->collisionShape_ = NULL; // don't destroy it twice
     70                mapEntry.first->notifyDetached();
     71                mapEntry.first->destroy();
     72                if (this->collisionShape_ == mapEntry.second)
     73                    this->collisionShape_ = nullptr; // don't destroy it twice
    7574            }
    7675
    7776            delete this->compoundShape_;
    7877            if (this->collisionShape_ == this->compoundShape_)
    79                 this->collisionShape_ = NULL; // don't destroy it twice
     78                this->collisionShape_ = nullptr; // don't destroy it twice
    8079        }
    8180    }
     
    9695    void CompoundCollisionShape::attach(CollisionShape* shape)
    9796    {
    98         // If either the input shape is NULL or we try to attach the CollisionShape to itself.
     97        // If either the input shape is nullptr or we try to attach the CollisionShape to itself.
    9998        if (!shape || static_cast<CollisionShape*>(this) == shape)
    10099            return;
     
    197196    void CompoundCollisionShape::updatePublicShape()
    198197    {
    199         btCollisionShape* primitive = 0; // The primitive shape, if there is one.
     198        btCollisionShape* primitive = nullptr; // The primitive shape, if there is one.
    200199        bool bPrimitive = true; // Whether the CompoundCollisionShape has just one non-empty CollisionShape. And that shape also has no transformation.
    201200        bool bEmpty = true; // Whether the CompoundCollisionShape is empty.
    202201        // Iterate over all CollisionShapes that belong to this CompoundCollisionShape.
    203         for (std::map<CollisionShape*, btCollisionShape*>::const_iterator it = this->attachedShapes_.begin(); it != this->attachedShapes_.end(); ++it)
     202        for (const auto& mapEntry : this->attachedShapes_)
    204203        {
    205204            // TODO: Make sure this is correct.
    206             if (it->second)
     205            if (mapEntry.second)
    207206            {
    208207                bEmpty = false;
    209                 if (!it->first->hasTransform() && bPrimitive)
    210                     primitive = it->second;
     208                if (!mapEntry.first->hasTransform() && bPrimitive)
     209                    primitive = mapEntry.second;
    211210                else
    212211                {
     
    221220        {
    222221            // If there was none all along, nothing needs to be changed.
    223             if (this->collisionShape_ == 0)
     222            if (this->collisionShape_ == nullptr)
    224223                return;
    225             this->collisionShape_ = 0;
     224            this->collisionShape_ = nullptr;
    226225        }
    227226        // If the CompoundCollisionShape is just a primitive.
     
    247246    {
    248247        unsigned int i = 0;
    249         for (std::map<CollisionShape*, btCollisionShape*>::const_iterator it = this->attachedShapes_.begin(); it != this->attachedShapes_.end(); ++it)
     248        for (const auto& mapEntry : this->attachedShapes_)
    250249        {
    251250            if (i == index)
    252                 return it->first;
     251                return mapEntry.first;
    253252            ++i;
    254253        }
    255         return 0;
     254        return nullptr;
    256255    }
    257256
     
    267266        std::vector<CollisionShape*> shapes;
    268267        // Iterate through all attached CollisionShapes and add them to the list of shapes.
    269         for(std::map<CollisionShape*, btCollisionShape*>::iterator it = this->attachedShapes_.begin(); it != this->attachedShapes_.end(); it++)
    270             shapes.push_back(it->first);
     268        for(const auto& mapEntry : this->attachedShapes_)
     269            shapes.push_back(mapEntry.first);
    271270
    272271        // Delete the compound shape and create a new one.
     
    275274
    276275        // Re-attach all CollisionShapes.
    277         for(std::vector<CollisionShape*>::iterator it = shapes.begin(); it != shapes.end(); it++)
    278         {
    279             CollisionShape* shape = *it;
     276        for(CollisionShape* shape : shapes)
     277        {
    280278            shape->setScale3D(this->getScale3D());
    281279            // Only actually attach if we didn't pick a CompoundCollisionShape with no content.
  • code/branches/cpp11_v3/src/orxonox/collisionshapes/CompoundCollisionShape.h

    r9667 r11054  
    6161            virtual ~CompoundCollisionShape();
    6262
    63             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
     63            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
    6464
    6565            void attach(CollisionShape* shape);
     
    7070            void updateAttachedShape(CollisionShape* shape);
    7171
    72             virtual void changedScale();
     72            virtual void changedScale() override;
    7373
    7474        private:
    7575            void updatePublicShape();
    76             inline virtual btCollisionShape* createNewShape() const
    77                 { assert(false); return 0; }
     76            virtual inline btCollisionShape* createNewShape() const override
     77                { assert(false); return nullptr; }
    7878
    7979            btCompoundShape* compoundShape_;
  • code/branches/cpp11_v3/src/orxonox/collisionshapes/WorldEntityCollisionShape.cc

    r10624 r11054  
    4343        RegisterObject(WorldEntityCollisionShape);
    4444
    45         this->worldEntityOwner_ = NULL;
     45        this->worldEntityOwner_ = nullptr;
    4646        // suppress synchronisation
    4747        this->setSyncMode(ObjectDirection::None);
     
    5454        CollisionShape::updateParent();
    5555
    56         assert(this->worldEntityOwner_ != 0);
     56        assert(this->worldEntityOwner_ != nullptr);
    5757        this->worldEntityOwner_->notifyCollisionShapeChanged();
    5858    }
  • code/branches/cpp11_v3/src/orxonox/collisionshapes/WorldEntityCollisionShape.h

    r10624 r11054  
    4646
    4747        protected:
    48             virtual void updateParent();
     48            virtual void updateParent() override;
    4949
    5050        private:
    51             void parentChanged();
     51            virtual void parentChanged() override;
    5252
    5353            WorldEntity* worldEntityOwner_;
  • code/branches/cpp11_v3/src/orxonox/controllers/AIController.cc

    r9667 r11054  
    249249            }
    250250            else
    251                 this->setPreviousMode();//If bot dies -> getControllableEntity == NULL -> get out of ROCKET mode
     251                this->setPreviousMode();//If bot dies -> getControllableEntity == nullptr -> get out of ROCKET mode
    252252        }//END_OF ROCKET MODE
    253253
  • code/branches/cpp11_v3/src/orxonox/controllers/AIController.h

    r9667 r11054  
    4444            virtual ~AIController();
    4545
    46             virtual void tick(float dt); //<! Carrying out the targets set in action().
     46            virtual void tick(float dt) override; //<! Carrying out the targets set in action().
    4747
    4848        protected:
  • code/branches/cpp11_v3/src/orxonox/controllers/ActionpointController.cc

    r11052 r11054  
    506506                if (targetName == "")
    507507                    break;
    508                 for (ObjectList<Pawn>::iterator itP = ObjectList<Pawn>::begin(); itP; ++itP)
     508                for (ObjectList<Pawn>::iterator itP = ObjectList<Pawn>().begin(); itP; ++itP)
    509509                {
    510510                    if (!this || !this->getControllableEntity())
     
    541541                if (protectName == "reservedKeyword:human")
    542542                {
    543                     for (ObjectList<Pawn>::iterator itP = ObjectList<Pawn>::begin(); itP; ++itP)
     543                    for (ObjectList<Pawn>::iterator itP = ObjectList<Pawn>().begin(); itP; ++itP)
    544544                    {
    545545                        if (orxonox_cast<ControllableEntity*>(*itP) && ((*itP)->getController()) && ((*itP)->getController()->getIdentifier()->getName() == "NewHumanController"))
     
    551551                else
    552552                {
    553                     for (ObjectList<Pawn>::iterator itP = ObjectList<Pawn>::begin(); itP; ++itP)
     553                    for (ObjectList<Pawn>::iterator itP = ObjectList<Pawn>().begin(); itP; ++itP)
    554554                    {
    555555                        if (CommonController::getName(*itP) == protectName)
     
    578578                std::string targetName = p.name;
    579579
    580                 for (ObjectList<Pawn>::iterator itP = ObjectList<Pawn>::begin(); itP; ++itP)
     580                for (ObjectList<Pawn>::iterator itP = ObjectList<Pawn>().begin(); itP; ++itP)
    581581                {
    582582                    if (CommonController::getName(*itP) == targetName)
     
    707707        float minDistance =  std::numeric_limits<float>::infinity();
    708708        Gametype* gt = this->getGametype();
    709         for (ObjectList<Pawn>::iterator itP = ObjectList<Pawn>::begin(); itP; ++itP)
     709        for (ObjectList<Pawn>::iterator itP = ObjectList<Pawn>().begin(); itP; ++itP)
    710710        {
    711711            if (!this || !this->getControllableEntity())
  • code/branches/cpp11_v3/src/orxonox/controllers/ArtificialController.cc

    r11052 r11054  
    5656        this->currentWaypoint_ = 0;
    5757        this->setAccuracy(5);
    58         this->defaultWaypoint_ = NULL;
     58        this->defaultWaypoint_ = nullptr;
    5959        this->mode_ = DEFAULT;//Vector-implementation: mode_.push_back(DEFAULT);
    6060    }
     
    177177            {
    178178                this->weaponModes_.clear(); // reset previous weapon information
    179                 WeaponSlot* wSlot = 0;
     179                WeaponSlot* wSlot = nullptr;
    180180                for(int l=0; (wSlot = pawn->getWeaponSlot(l)) ; l++)
    181181                {
    182                     WeaponMode* wMode = 0;
     182                    WeaponMode* wMode = nullptr;
    183183                    for(int i=0; (wMode = wSlot->getWeapon()->getWeaponmode(i)) ; i++)
    184184                    {
     
    207207    void ArtificialController::setAllBotLevel(float level)
    208208    {
    209         for (ObjectList<ArtificialController>::iterator it = ObjectList<ArtificialController>::begin(); it != ObjectList<ArtificialController>::end(); ++it)
    210             it->setBotLevel(level);
     209        for (ArtificialController* controller : ObjectList<ArtificialController>())
     210            controller->setBotLevel(level);
    211211    }
    212212
     
    222222    {
    223223        SpaceShip* ship = orxonox_cast<SpaceShip*>(this->getControllableEntity());
    224         if(ship == NULL) return;
     224        if(ship == nullptr) return;
    225225        if(ship->getBoostPower()*1.5f > ship->getInitialBoostPower() ) //upper limit ->boost
    226226            this->getControllableEntity()->boost(true);
     
    231231    int ArtificialController::getFiremode(std::string name)
    232232    {
    233         for (std::map< std::string, int >::iterator it = this->weaponModes_.begin(); it != this->weaponModes_.end(); ++it)
    234         {
    235             if (it->first == name)
    236                 return it->second;
     233        for (const auto& mapEntry : this->weaponModes_)
     234        {
     235            if (mapEntry.first == name)
     236                return mapEntry.second;
    237237        }
    238238        return -1;
     
    249249            return this->waypoints_[index];
    250250        else
    251             return 0;
     251            return nullptr;
    252252    }
    253253
     
    258258    void ArtificialController::updatePointsOfInterest(std::string name, float searchDistance)
    259259    {
    260         WorldEntity* waypoint = NULL;
    261         for (ObjectList<WorldEntity>::iterator it = ObjectList<WorldEntity>::begin(); it != ObjectList<WorldEntity>::end(); ++it)
    262         {
    263             if((*it)->getIdentifier() == ClassByString(name))
     260        WorldEntity* waypoint = nullptr;
     261        for (WorldEntity* we : ObjectList<WorldEntity>())
     262        {
     263            if(we->getIdentifier() == ClassByString(name))
    264264            {
    265265                ControllableEntity* controllable = this->getControllableEntity();
    266266                if(!controllable) continue;
    267                 float actualDistance = ( (*it)->getPosition() - controllable->getPosition() ).length();
     267                float actualDistance = ( we->getPosition() - controllable->getPosition() ).length();
    268268                if(actualDistance > searchDistance || actualDistance < 5.0f) continue;
    269269                    // TODO: PickupSpawner: adjust waypoint accuracy to PickupSpawner's triggerdistance
     
    271271                else
    272272                {
    273                     waypoint = *it;
     273                    waypoint = we;
    274274                    break;
    275275                }
  • code/branches/cpp11_v3/src/orxonox/controllers/ArtificialController.h

    r9667 r11054  
    4242            virtual ~ArtificialController();
    4343
    44             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
     44            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
    4545
    4646            void abandonTarget(Pawn* target);
    4747
    48             virtual void changedControllableEntity();
     48            virtual void changedControllableEntity() override;
    4949
    5050            virtual void doFire();
     
    8989
    9090            //WAYPOINT DATA
    91             std::vector<WeakPtr<WorldEntity> > waypoints_;
     91            std::vector<WeakPtr<WorldEntity>> waypoints_;
    9292            size_t currentWaypoint_;
    9393            float squaredaccuracy_;
  • code/branches/cpp11_v3/src/orxonox/controllers/Controller.cc

    r9797 r11054  
    4040        RegisterObject(Controller);
    4141
    42         this->player_ = 0;
    43         this->controllableEntity_ = 0;
     42        this->player_ = nullptr;
     43        this->controllableEntity_ = nullptr;
    4444        this->bGodMode_ = false;
    4545        this->team_=-1;
  • code/branches/cpp11_v3/src/orxonox/controllers/Controller.h

    r9797 r11054  
    4545            Controller(Context* context);
    4646            virtual ~Controller();
    47             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
     47            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
    4848            inline void setPlayer(PlayerInfo* player)
    4949                { this->player_ = player; }
  • code/branches/cpp11_v3/src/orxonox/controllers/ControllerDirector.cc

    r10622 r11054  
    3232
    3333        // Initialize member variables
    34         this->player_ = NULL;
    35         this->entity_ = NULL;
    36         this->pTrigger_ = NULL;
     34        this->player_ = nullptr;
     35        this->entity_ = nullptr;
     36        this->pTrigger_ = nullptr;
    3737        this->context_ = context;
    3838    }
     
    110110    {
    111111        this->pTrigger_ = orxonox_cast<PlayerTrigger*>(trigger);
    112         this->player_ = NULL;
     112        this->player_ = nullptr;
    113113
    114114        orxout(verbose) << "Preparation to take Control!" << endl;
    115115
    116116        // Check whether it is a player trigger and extract pawn from it
    117         if(this->pTrigger_ != NULL)
     117        if(this->pTrigger_ != nullptr)
    118118        {
    119119            // Get the object which triggered the event.
     
    121121
    122122            // Check if there actually was a player returned.
    123             if( this->player_ == NULL) return false;
     123            if( this->player_ == nullptr) return false;
    124124        }
    125125        else
  • code/branches/cpp11_v3/src/orxonox/controllers/ControllerDirector.h

    r10622 r11054  
    4343            virtual ~ControllerDirector() { }
    4444
    45             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
     45            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
    4646            bool party(bool bTriggered, BaseObject* trigger);
    47             virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode);
     47            virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode) override;
    4848
    4949            inline void setScriptName(const std::string& name) { this->scriptname_ = name; }
  • code/branches/cpp11_v3/src/orxonox/controllers/DroneController.cc

    r9667 r11054  
    4949        RegisterObject(DroneController);
    5050
    51         this->owner_ = 0;
    52         this->drone_ = 0;
     51        this->owner_ = nullptr;
     52        this->drone_ = nullptr;
    5353        this->isShooting_ = false;
    5454        this->setAccuracy(10);
  • code/branches/cpp11_v3/src/orxonox/controllers/DroneController.h

    r9667 r11054  
    5353            virtual ~DroneController();
    5454
    55             virtual void tick(float dt); //!< The controlling happens here. This method defines what the controller has to do each tick.
     55            virtual void tick(float dt) override; //!< The controlling happens here. This method defines what the controller has to do each tick.
    5656
    5757            void setOwner(Pawn* owner);
  • code/branches/cpp11_v3/src/orxonox/controllers/FightingController.cc

    r11052 r11054  
    248248        float minDistance =  std::numeric_limits<float>::infinity();
    249249        Gametype* gt = this->getGametype();
    250         for (ObjectList<Pawn>::iterator itP = ObjectList<Pawn>::begin(); itP; ++itP)
     250        for (ObjectList<Pawn>::iterator itP = ObjectList<Pawn>().begin(); itP; ++itP)
    251251        {
    252252            if ( CommonController::sameTeam (this->getControllableEntity(), static_cast<ControllableEntity*>(*itP), gt) )
  • code/branches/cpp11_v3/src/orxonox/controllers/FormationController.cc

    r11052 r11054  
    5858    RegisterClass(FormationController);
    5959
    60     static const unsigned int STANDARD_MAX_FORMATION_SIZE = 9;
    61     static const int RADIUS_TO_SEARCH_FOR_MASTERS = 5000;
    62     static const float FORMATION_LENGTH =  110;
    63     static const float FORMATION_WIDTH =  110;
    64     static const int FREEDOM_COUNT = 4; //seconds the slaves in a formation will be set free when master attacks an enemy
    65     static const float SPEED_MASTER = 0.6f;
    66     static const float ROTATEFACTOR_MASTER = 0.2f;
    67     static const float SPEED_FREE = 0.8f;
    68     static const float ROTATEFACTOR_FREE = 0.8f;
     60    static constexpr unsigned int STANDARD_MAX_FORMATION_SIZE = 9;
     61    static constexpr int RADIUS_TO_SEARCH_FOR_MASTERS = 5000;
     62    static constexpr float FORMATION_LENGTH =  110;
     63    static constexpr float FORMATION_WIDTH =  110;
     64    static constexpr int FREEDOM_COUNT = 4; //seconds the slaves in a formation will be set free when master attacks an enemy
     65    static constexpr float SPEED_MASTER = 0.6f;
     66    static constexpr float ROTATEFACTOR_MASTER = 0.2f;
     67    static constexpr float SPEED_FREE = 0.8f;
     68    static constexpr float ROTATEFACTOR_FREE = 0.8f;
    6969
    7070    FormationController::FormationController(Context* context) : Controller(context)
     
    7272        RegisterObject(FormationController);
    7373
    74         this->target_ = 0;
     74        this->target_ = nullptr;
    7575        this->formationFlight_ = false;
    7676        this->passive_ = false;
    7777        this->maxFormationSize_ = STANDARD_MAX_FORMATION_SIZE;
    78         this->myMaster_ = 0;
     78        this->myMaster_ = nullptr;
    7979        this->freedomCount_ = 0;
    8080
     
    9797            this->removeFromFormation();
    9898
    99             for (ObjectList<FormationController>::iterator it = ObjectList<FormationController>::begin(); it; ++it)
    100             {
    101                 if (*it != this)
     99            for (FormationController* controller : ObjectList<FormationController>())
     100            {
     101                if (controller != this)
    102102                {
    103                     if (it->myMaster_ == this)
     103                    if (controller->myMaster_ == this)
    104104                    {
    105                         orxout(internal_error) << this << " is still master in " << (*it) << endl;
    106                         it->myMaster_ = 0;
     105                        orxout(internal_error) << this << " is still master in " << controller << endl;
     106                        controller->myMaster_ = nullptr;
    107107                    }
    108108
    109109                    while (true)
    110110                    {
    111                         std::vector<FormationController*>::iterator it2 = std::find(it->slaves_.begin(), it->slaves_.end(), this);
    112                         if (it2 != it->slaves_.end())
     111                        std::vector<FormationController*>::iterator it2 = std::find(controller->slaves_.begin(), controller->slaves_.end(), this);
     112                        if (it2 != controller->slaves_.end())
    113113                        {
    114                             orxout(internal_error) << this << " is still slave in " << (*it) << endl;
    115                             it->slaves_.erase(it2);
     114                            orxout(internal_error) << this << " is still slave in " << controller << endl;
     115                            controller->slaves_.erase(it2);
    116116                        }
    117117                        else
     
    140140    void FormationController::formationflight(const bool form)
    141141    {
    142         for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it; ++it)
    143         {
    144             Controller* controller = 0;
    145 
    146             if (it->getController())
    147                 controller = it->getController();
    148             else if (it->getXMLController())
    149                 controller = it->getXMLController();
     142        for (Pawn* pawn : ObjectList<Pawn>())
     143        {
     144            Controller* controller = nullptr;
     145
     146            if (pawn->getController())
     147                controller = pawn->getController();
     148            else if (pawn->getXMLController())
     149                controller = pawn->getXMLController();
    150150
    151151            if (!controller)
     
    171171    void FormationController::masteraction(const int action)
    172172    {
    173         for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it; ++it)
    174         {
    175             Controller* controller = 0;
    176 
    177             if (it->getController())
    178                 controller = it->getController();
    179             else if (it->getXMLController())
    180                 controller = it->getXMLController();
     173        for (Pawn* pawn : ObjectList<Pawn>())
     174        {
     175            Controller* controller = nullptr;
     176
     177            if (pawn->getController())
     178                controller = pawn->getController();
     179            else if (pawn->getXMLController())
     180                controller = pawn->getXMLController();
    181181
    182182            if (!controller)
     
    201201    void FormationController::passivebehaviour(const bool passive)
    202202    {
    203         for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it; ++it)
    204         {
    205             Controller* controller = 0;
    206 
    207             if (it->getController())
    208                 controller = it->getController();
    209             else if (it->getXMLController())
    210                 controller = it->getXMLController();
     203        for (Pawn* pawn : ObjectList<Pawn>())
     204        {
     205            Controller* controller = nullptr;
     206
     207            if (pawn->getController())
     208                controller = pawn->getController();
     209            else if (pawn->getXMLController())
     210                controller = pawn->getXMLController();
    211211
    212212            if (!controller)
     
    228228    void FormationController::formationsize(const int size)
    229229    {
    230         for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it; ++it)
    231         {
    232             Controller* controller = 0;
    233 
    234             if (it->getController())
    235                 controller = it->getController();
    236             else if (it->getXMLController())
    237                 controller = it->getXMLController();
     230        for (Pawn* pawn : ObjectList<Pawn>())
     231        {
     232            Controller* controller = nullptr;
     233
     234            if (pawn->getController())
     235                controller = pawn->getController();
     236            else if (pawn->getXMLController())
     237                controller = pawn->getXMLController();
    238238
    239239            if (!controller)
     
    383383        }
    384384
    385         this->myMaster_ = 0;
     385        this->myMaster_ = nullptr;
    386386        this->state_ = FREE;
    387387    }
     
    398398        int teamSize = 0;
    399399        //go through all pawns
    400         for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it; ++it)
     400        for (Pawn* pawn : ObjectList<Pawn>())
    401401        {
    402402
     
    405405            if (!gt)
    406406            {
    407                 gt=it->getGametype();
    408             }
    409             if (!FormationController::sameTeam(this->getControllableEntity(), static_cast<ControllableEntity*>(*it),gt))
     407                gt=pawn->getGametype();
     408            }
     409            if (!FormationController::sameTeam(this->getControllableEntity(), static_cast<ControllableEntity*>(pawn),gt))
    410410                continue;
    411411
    412412            //has it an FormationController?
    413             Controller* controller = 0;
    414 
    415             if (it->getController())
    416                 controller = it->getController();
    417             else if (it->getXMLController())
    418                 controller = it->getXMLController();
     413            Controller* controller = nullptr;
     414
     415            if (pawn->getController())
     416                controller = pawn->getController();
     417            else if (pawn->getXMLController())
     418                controller = pawn->getXMLController();
    419419
    420420            if (!controller)
     
    422422
    423423            //is pawn oneself?
    424             if (orxonox_cast<ControllableEntity*>(*it) == this->getControllableEntity())
     424            if (orxonox_cast<ControllableEntity*>(pawn) == this->getControllableEntity())
    425425                continue;
    426426
     
    433433                continue;
    434434
    435             float distance = (it->getPosition() - this->getControllableEntity()->getPosition()).length();
     435            float distance = (pawn->getPosition() - this->getControllableEntity()->getPosition()).length();
    436436
    437437            // is pawn in range?
     
    440440                if(newMaster->slaves_.size() > this->maxFormationSize_) continue;
    441441
    442                 for(std::vector<FormationController*>::iterator itSlave = this->slaves_.begin(); itSlave != this->slaves_.end(); itSlave++)
     442                for(FormationController* slave : this->slaves_)
    443443                {
    444                     (*itSlave)->myMaster_ = newMaster;
    445                     newMaster->slaves_.push_back(*itSlave);
     444                    slave->myMaster_ = newMaster;
     445                    newMaster->slaves_.push_back(slave);
    446446                }
    447447                this->slaves_.clear();
     
    458458        {
    459459            this->state_ = MASTER;
    460             this->myMaster_ = 0;
     460            this->myMaster_ = nullptr;
    461461        }
    462462    }
     
    486486            int i = 1;
    487487
    488             for(std::vector<FormationController*>::iterator it = slaves_.begin(); it != slaves_.end(); it++)
     488            for(FormationController* slave : slaves_)
    489489            {
    490490                pos = Vector3::ZERO;
     
    497497                    dest+=FORMATION_LENGTH*(orient*WorldEntity::BACK);
    498498                }
    499                 (*it)->setTargetOrientation(orient);
    500                 (*it)->setTargetPosition(pos);
     499                slave->setTargetOrientation(orient);
     500                slave->setTargetPosition(pos);
    501501                left=!left;
    502502            }
     
    518518            newMaster->state_ = MASTER;
    519519            newMaster->slaves_ = this->slaves_;
    520             newMaster->myMaster_ = 0;
    521 
    522             for(std::vector<FormationController*>::iterator it = newMaster->slaves_.begin(); it != newMaster->slaves_.end(); it++)
    523             {
    524                 (*it)->myMaster_ = newMaster;
     520            newMaster->myMaster_ = nullptr;
     521
     522            for(FormationController* slave : newMaster->slaves_)
     523            {
     524                slave->myMaster_ = newMaster;
    525525            }
    526526        }
     
    547547                newMaster->state_ = MASTER;
    548548                newMaster->slaves_ = this->slaves_;
    549                 newMaster->myMaster_ = 0;
    550 
    551                 for(std::vector<FormationController*>::iterator it = newMaster->slaves_.begin(); it != newMaster->slaves_.end(); it++)
     549                newMaster->myMaster_ = nullptr;
     550
     551                for(FormationController* slave : newMaster->slaves_)
    552552                {
    553                     (*it)->myMaster_ = newMaster;
     553                    slave->myMaster_ = newMaster;
    554554                }
    555555            }
     
    569569        if(this->state_ != MASTER) return;
    570570
    571         for(std::vector<FormationController*>::iterator it = slaves_.begin(); it != slaves_.end(); it++)
    572         {
    573             (*it)->state_ = FREE;
    574             (*it)->myMaster_ = 0;
     571        for(FormationController* slave : slaves_)
     572        {
     573            slave->state_ = FREE;
     574            slave->myMaster_ = nullptr;
    575575        }
    576576        this->slaves_.clear();
     
    584584        if(this->state_ != MASTER) return;
    585585
    586         for(std::vector<FormationController*>::iterator it = slaves_.begin(); it != slaves_.end(); it++)
    587         {
    588             (*it)->state_ = FREE;
    589             (*it)->forceFreedom();
    590             (*it)->targetPosition_ = this->targetPosition_;
    591             (*it)->bShooting_ = true;
     586        for(FormationController* slave : slaves_)
     587        {
     588            slave->state_ = FREE;
     589            slave->forceFreedom();
     590            slave->targetPosition_ = this->targetPosition_;
     591            slave->bShooting_ = true;
    592592//             (*it)->getControllableEntity()->fire(0);// fire once for fun
    593593        }
     
    629629
    630630        //search new Master, then take lead
    631         if (this->state_==FREE && this->myMaster_==0)
     631        if (this->state_==FREE && this->myMaster_==nullptr)
    632632        {
    633633          searchNewMaster();
     
    650650            this->slaves_.push_back(this->myMaster_);
    651651            //set this as new master
    652             for(std::vector<FormationController*>::iterator it = slaves_.begin(); it != slaves_.end(); it++)
    653             {
    654                  (*it)->myMaster_=this;
    655             }
    656             this->myMaster_=0;
     652            for(FormationController* slave : slaves_)
     653            {
     654                 slave->myMaster_=this;
     655            }
     656            this->myMaster_=nullptr;
    657657            this->state_=MASTER;
    658658        }
     
    694694        if (this->state_ == MASTER)
    695695        {
    696             for(std::vector<FormationController*>::iterator it = slaves_.begin(); it != slaves_.end(); it++)
    697             {
    698                  (*it)->formationMode_ = val;
     696            for(FormationController* slave : slaves_)
     697            {
     698                 slave->formationMode_ = val;
    699699                 if (val == ATTACK)
    700                      (*it)->forgetTarget();
     700                     slave->forgetTarget();
    701701            }
    702702        }
     
    773773    {
    774774
    775         Pawn *humanPawn = NULL;
    776         NewHumanController *currentHumanController = NULL;
     775        Pawn *humanPawn = nullptr;
     776        NewHumanController *currentHumanController = nullptr;
    777777        std::vector<FormationController*> allMasters;
    778778
    779         for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it; ++it)
    780         {
    781             Controller* controller = 0;
    782 
    783             if (it->getController())
    784                 controller = it->getController();
    785             else if (it->getXMLController())
    786                 controller = it->getXMLController();
     779        for (Pawn* pawn : ObjectList<Pawn>())
     780        {
     781            Controller* controller = nullptr;
     782
     783            if (pawn->getController())
     784                controller = pawn->getController();
     785            else if (pawn->getXMLController())
     786                controller = pawn->getXMLController();
    787787
    788788            if (!controller)
     
    791791            currentHumanController = orxonox_cast<NewHumanController*>(controller);
    792792
    793             if(currentHumanController) humanPawn = *it;
     793            if(currentHumanController) humanPawn = pawn;
    794794
    795795            FormationController *aiController = orxonox_cast<FormationController*>(controller);
     
    800800        }
    801801
    802         if((humanPawn != NULL) && (allMasters.size() != 0))
     802        if((humanPawn != nullptr) && (allMasters.size() != 0))
    803803        {
    804804            float posHuman = humanPawn->getPosition().length();
     
    808808            int i = 0;
    809809
    810             for(std::vector<FormationController*>::iterator it = allMasters.begin(); it != allMasters.end(); it++, i++)
    811             {
    812                 if (!FormationController::sameTeam((*it)->getControllableEntity(), humanPawn, (*it)->getGametype())) continue;
    813                 distance = posHuman - (*it)->getControllableEntity()->getPosition().length();
     810            for(FormationController* master : allMasters)
     811            {
     812                if (!FormationController::sameTeam(master->getControllableEntity(), humanPawn, master->getGametype())) continue;
     813                distance = posHuman - master->getControllableEntity()->getPosition().length();
    814814                if(distance < minDistance) index = i;
     815                i++;
    815816            }
    816817            allMasters[index]->followInit(humanPawn);
     
    826827    void FormationController::followInit(Pawn* pawn, const bool always, const int secondsToFollow)
    827828    {
    828         if (pawn == NULL || this->state_ != MASTER)
     829        if (pawn == nullptr || this->state_ != MASTER)
    829830            return;
    830831        this->specificMasterAction_  =  FOLLOW;
     
    844845    {
    845846
    846         Pawn *humanPawn = NULL;
    847         NewHumanController *currentHumanController = NULL;
    848 
    849         for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it; ++it)
    850         {
    851             if (!it->getController())
     847        Pawn *humanPawn = nullptr;
     848        NewHumanController *currentHumanController = nullptr;
     849
     850        for (Pawn* pawn : ObjectList<Pawn>())
     851        {
     852            if (!pawn->getController())
    852853                continue;
    853854
    854             currentHumanController = orxonox_cast<NewHumanController*>(it->getController());
     855            currentHumanController = orxonox_cast<NewHumanController*>(pawn->getController());
    855856            if(currentHumanController)
    856857            {
    857                 if (!FormationController::sameTeam(this->getControllableEntity(), *it, this->getGametype())) continue;
    858                 humanPawn = *it;
     858                if (!FormationController::sameTeam(this->getControllableEntity(), pawn, this->getGametype())) continue;
     859                humanPawn = pawn;
    859860                break;
    860861            }
    861862        }
    862863
    863         if((humanPawn != NULL))
     864        if((humanPawn != nullptr))
    864865                this->followInit(humanPawn);
    865866    }
     
    918919        this->forgetTarget();
    919920
    920         for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it; ++it)
    921         {
    922             if (FormationController::sameTeam(this->getControllableEntity(), static_cast<ControllableEntity*>(*it), this->getGametype()))
     921        for (Pawn* pawn : ObjectList<Pawn>())
     922        {
     923            if (FormationController::sameTeam(this->getControllableEntity(), static_cast<ControllableEntity*>(pawn), this->getGametype()))
    923924                continue;
    924925
    925926            /* So AI won't choose invisible Spaceships as target */
    926             if (!it->getRadarVisibility())
     927            if (!pawn->getRadarVisibility())
    927928                continue;
    928929
    929             if (static_cast<ControllableEntity*>(*it) != this->getControllableEntity())
     930            if (static_cast<ControllableEntity*>(pawn) != this->getControllableEntity())
    930931            {
    931932                float speed = this->getControllableEntity()->getVelocity().length();
    932933                Vector3 distanceCurrent = this->targetPosition_ - this->getControllableEntity()->getPosition();
    933                 Vector3 distanceNew = it->getPosition() - this->getControllableEntity()->getPosition();
    934                 if (!this->target_ || it->getPosition().squaredDistance(this->getControllableEntity()->getPosition()) * (1.5f + acos((this->getControllableEntity()->getOrientation() * WorldEntity::FRONT).dotProduct(distanceNew) / speed / distanceNew.length()) / math::twoPi)
     934                Vector3 distanceNew = pawn->getPosition() - this->getControllableEntity()->getPosition();
     935                if (!this->target_ || pawn->getPosition().squaredDistance(this->getControllableEntity()->getPosition()) * (1.5f + acos((this->getControllableEntity()->getOrientation() * WorldEntity::FRONT).dotProduct(distanceNew) / speed / distanceNew.length()) / math::twoPi)
    935936                        < this->targetPosition_.squaredDistance(this->getControllableEntity()->getPosition()) * (1.5f + acos((this->getControllableEntity()->getOrientation() * WorldEntity::FRONT).dotProduct(distanceCurrent) / speed / distanceCurrent.length()) / math::twoPi) + rnd(-250, 250))
    936937                {
    937                     this->setTarget(*it);
     938                    this->setTarget(pawn);
    938939                }
    939940            }
     
    943944    void FormationController::forgetTarget()
    944945    {
    945         this->target_ = 0;
     946        this->target_ = nullptr;
    946947        this->bShooting_ = false;
    947948    }
     
    963964        int team2 = entity2->getTeam();
    964965
    965         Controller* controller = 0;
     966        Controller* controller = nullptr;
    966967        if (entity1->getController())
    967968            controller = entity1->getController();
     
    10001001        }
    10011002
    1002         TeamBaseMatchBase* base = 0;
     1003        TeamBaseMatchBase* base = nullptr;
    10031004        base = orxonox_cast<TeamBaseMatchBase*>(entity1);
    10041005        if (base)
     
    10341035        }
    10351036
    1036         DroneController* droneController = 0;
     1037        DroneController* droneController = nullptr;
    10371038        droneController = orxonox_cast<DroneController*>(entity1->getController());
    10381039        if (droneController && static_cast<ControllableEntity*>(droneController->getOwner()) == entity2)
  • code/branches/cpp11_v3/src/orxonox/controllers/FormationController.h

    r10631 r11054  
    5050      virtual ~FormationController();
    5151
    52       virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
     52      virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
    5353
    5454
     
    9393           { return this->formationMode_; }
    9494
    95       virtual void hit(Pawn* originator, btManifoldPoint& contactpoint, float damage);
     95      virtual void hit(Pawn* originator, btManifoldPoint& contactpoint, float damage) override;
    9696
    9797      FormationController* getMaster( void ) { return myMaster_; }
     
    9999      FormationController* getSlave( void ) { return this->slaves_.back(); }
    100100
    101       virtual void changedControllableEntity();
     101      virtual void changedControllableEntity() override;
    102102
    103103  protected:
  • code/branches/cpp11_v3/src/orxonox/controllers/HumanController.cc

    r11052 r11054  
    6565    RegisterUnloadableClass(HumanController);
    6666
    67     HumanController* HumanController::localController_s = 0;
     67    HumanController* HumanController::localController_s = nullptr;
    6868
    6969    HumanController::HumanController(Context* context) : FormationController(context)
     
    8181            HumanController::localController_s->removeFromFormation();
    8282        }
    83         HumanController::localController_s = 0;
     83        HumanController::localController_s = nullptr;
    8484    }
    8585
     
    321321            return orxonox_cast<Pawn*>(HumanController::localController_s->getControllableEntity());
    322322        else
    323             return NULL;
     323            return nullptr;
    324324    }
    325325
  • code/branches/cpp11_v3/src/orxonox/controllers/HumanController.h

    r10624 r11054  
    4747            virtual ~HumanController();
    4848
    49             virtual void tick(float dt);
     49            virtual void tick(float dt) override;
    5050
    5151            static void moveFrontBack(const Vector2& value);
  • code/branches/cpp11_v3/src/orxonox/controllers/MasterController.cc

    r11052 r11054  
    5858        {
    5959            //fill the vector in the first tick
    60             for (ObjectList<ActionpointController>::iterator it = ObjectList<ActionpointController>::begin(); it; ++it)
     60            for (ObjectList<ActionpointController>::iterator it = ObjectList<ActionpointController>().begin(); it; ++it)
    6161            {
    6262                //----0ptr?----
  • code/branches/cpp11_v3/src/orxonox/controllers/NewHumanController.cc

    r10631 r11054  
    5858    RegisterUnloadableClass(NewHumanController);
    5959
    60     NewHumanController* NewHumanController::localController_s = 0;
     60    NewHumanController* NewHumanController::localController_s = nullptr;
    6161
    6262    NewHumanController::NewHumanController(Context* context)
    6363        : HumanController(context)
    64         , crossHairOverlay_(NULL)
    65         , centerOverlay_(NULL)
    66         , damageOverlayTop_(NULL)
    67         , damageOverlayRight_(NULL)
    68         , damageOverlayBottom_(NULL)
    69         , damageOverlayLeft_(NULL)
     64        , crossHairOverlay_(nullptr)
     65        , centerOverlay_(nullptr)
     66        , damageOverlayTop_(nullptr)
     67        , damageOverlayRight_(nullptr)
     68        , damageOverlayBottom_(nullptr)
     69        , damageOverlayLeft_(nullptr)
    7070        , damageOverlayTT_(0)
    7171        , damageOverlayTR_(0)
    7272        , damageOverlayTB_(0)
    7373        , damageOverlayTL_(0)
    74         , arrowsOverlay1_(NULL)
    75         , arrowsOverlay2_(NULL)
    76         , arrowsOverlay3_(NULL)
    77         , arrowsOverlay4_(NULL)
     74        , arrowsOverlay1_(nullptr)
     75        , arrowsOverlay2_(nullptr)
     76        , arrowsOverlay3_(nullptr)
     77        , arrowsOverlay4_(nullptr)
    7878    {
    7979        RegisterObject(NewHumanController);
     
    445445            pawn->setAimPosition( mouseRay.getOrigin() + mouseRay.getDirection() * 3000 );
    446446
    447         if( this->getControllableEntity() && this->getControllableEntity()->getTarget() != 0 )
    448             this->getControllableEntity()->setTarget( 0 );
     447        if( this->getControllableEntity() && this->getControllableEntity()->getTarget() != nullptr )
     448            this->getControllableEntity()->setTarget( nullptr );
    449449
    450450        //return this->controllableEntity_->getWorldPosition() + (this->controllableEntity_->getWorldOrientation() * Vector3::NEGATIVE_UNIT_Z * 2000);
  • code/branches/cpp11_v3/src/orxonox/controllers/NewHumanController.h

    r9667 r11054  
    4545            virtual ~NewHumanController();
    4646
    47             virtual void tick(float dt);
     47            virtual void tick(float dt) override;
    4848
    49             virtual void frontback(const Vector2& value);
    50             virtual void yaw(const Vector2& value);
    51             virtual void pitch(const Vector2& value);
     49            virtual void frontback(const Vector2& value) override;
     50            virtual void yaw(const Vector2& value) override;
     51            virtual void pitch(const Vector2& value) override;
    5252
    5353            static void accelerate();
    5454            static void decelerate();
    5555
    56             virtual void doFire(unsigned int firemode);
     56            virtual void doFire(unsigned int firemode) override;
    5757
    58             virtual void hit(Pawn* originator, btManifoldPoint& contactpoint, float damage);
     58            virtual void hit(Pawn* originator, btManifoldPoint& contactpoint, float damage) override;
    5959
    6060            static void unfire();
     
    6565            static void changeMode();
    6666
    67             virtual void changedControllableEntity();
    68             virtual void doPauseControl();
    69             virtual void doResumeControl();
     67            virtual void changedControllableEntity() override;
     68            virtual void doPauseControl() override;
     69            virtual void doResumeControl() override;
    7070
    7171            float getCurrentYaw(){ return this->currentYaw_; }
  • code/branches/cpp11_v3/src/orxonox/controllers/ScriptController.cc

    r10622 r11054  
    6464        /* Set default values for all variables */
    6565        /* - pointers to zero */
    66         this->player_ = NULL;
    67         this->entity_ = NULL;
     66        this->player_ = nullptr;
     67        this->entity_ = nullptr;
    6868
    6969        /* - times */
     
    121121
    122122      /* Debugging: print all the scriptcontroller object pointers */
    123       for(ObjectList<ScriptController>::iterator it =
    124         ObjectList<ScriptController>::begin();
    125         it != ObjectList<ScriptController>::end(); ++it)
    126       { orxout(verbose) << "Have object in list: " << *it << endl; }
     123      for(ScriptController* controller : ObjectList<ScriptController>())
     124      { orxout(verbose) << "Have object in list: " << controller << endl; }
    127125
    128126      /* Find the first one with a nonzero ID */
    129       for(ObjectList<ScriptController>::iterator it =
    130         ObjectList<ScriptController>::begin();
    131         it != ObjectList<ScriptController>::end(); ++it)
     127      for(ScriptController* controller : ObjectList<ScriptController>())
    132128      {
    133129        // TODO: do some selection here. Currently just returns the first one
    134         if( (*it)->getID() > 0 )
    135         { orxout(verbose) << "Controller to return: " << *it << endl;
    136           return *it;
     130        if( controller->getID() > 0 )
     131        { orxout(verbose) << "Controller to return: " << controller << endl;
     132          return controller;
    137133        }
    138134     
    139135      }
    140       return NULL;
     136      return nullptr;
    141137    }
    142138
  • code/branches/cpp11_v3/src/orxonox/controllers/ScriptController.h

    r10622 r11054  
    7171            void setPlayer(PlayerInfo* player) { this->player_ = player; }
    7272           
    73             virtual void tick(float dt);
     73            virtual void tick(float dt) override;
    7474
    7575            // LUA interface
  • code/branches/cpp11_v3/src/orxonox/controllers/SectionController.cc

    r11052 r11054  
    147147                    Vector3 divisionTargetPosition = this->myDivisionLeader_->getTarget()->getWorldPosition();
    148148                    Gametype* gt = this->getGametype();
    149                     for (ObjectList<Pawn>::iterator itP = ObjectList<Pawn>::begin(); itP; ++itP)
     149                    for (ObjectList<Pawn>::iterator itP = ObjectList<Pawn>().begin(); itP; ++itP)
    150150                    {
    151151                        //----is enemy?----
     
    231231        float minDistance =  std::numeric_limits<float>::infinity();
    232232        //go through all pawns
    233         for (ObjectList<ActionpointController>::iterator it = ObjectList<ActionpointController>::begin(); it; ++it)
     233        for (ObjectList<ActionpointController>::iterator it = ObjectList<ActionpointController>().begin(); it; ++it)
    234234        {
    235235            //0ptr or not DivisionController?
  • code/branches/cpp11_v3/src/orxonox/controllers/WaypointController.cc

    r9667 r11054  
    4444    WaypointController::~WaypointController()
    4545    {
    46         for (size_t i = 0; i < this->waypoints_.size(); ++i)
     46        for (WorldEntity* waypoint : this->waypoints_)
    4747        {
    48             if(this->waypoints_[i])
    49                 this->waypoints_[i]->destroy();
     48            if(waypoint)
     49                waypoint->destroy();
    5050        }
    5151    }
  • code/branches/cpp11_v3/src/orxonox/controllers/WaypointController.h

    r9667 r11054  
    4444            virtual ~WaypointController();
    4545
    46             virtual void tick(float dt);
     46            virtual void tick(float dt) override;
    4747
    4848        protected:
  • code/branches/cpp11_v3/src/orxonox/controllers/WaypointPatrolController.cc

    r9716 r11054  
    8787        float shortestsqdistance = (float)static_cast<unsigned int>(-1);
    8888
    89         for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it != ObjectList<Pawn>::end(); ++it)
     89        for (Pawn* pawn : ObjectList<Pawn>())
    9090        {
    91             if (ArtificialController::sameTeam(this->getControllableEntity(), static_cast<ControllableEntity*>(*it), this->getGametype()))
     91            if (ArtificialController::sameTeam(this->getControllableEntity(), static_cast<ControllableEntity*>(pawn), this->getGametype()))
    9292                continue;
    9393
    94             float sqdistance = it->getPosition().squaredDistance(myposition);
     94            float sqdistance = pawn->getPosition().squaredDistance(myposition);
    9595            if (sqdistance < shortestsqdistance)
    9696            {
    9797                shortestsqdistance = sqdistance;
    98                 this->target_ = (*it);
     98                this->target_ = pawn;
    9999            }
    100100        }
    101101
    102102        if (shortestsqdistance > (this->alertnessradius_ * this->alertnessradius_))
    103             this->target_ = 0;
     103            this->target_ = nullptr;
    104104    }
    105105}
  • code/branches/cpp11_v3/src/orxonox/controllers/WaypointPatrolController.h

    r9716 r11054  
    4343            virtual ~WaypointPatrolController() {}
    4444
    45             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    46             virtual void tick(float dt);
     45            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
     46            virtual void tick(float dt) override;
    4747
    4848            inline void setAlertnessRadius(float radius)
  • code/branches/cpp11_v3/src/orxonox/controllers/WingmanController.cc

    r11052 r11054  
    192192        Gametype* gt = this->getGametype();
    193193
    194         for (ObjectList<ActionpointController>::iterator it = ObjectList<ActionpointController>::begin(); it; ++it)
     194        for (ObjectList<ActionpointController>::iterator it = ObjectList<ActionpointController>().begin(); it; ++it)
    195195        {
    196196            //----0ptr or not a leader or dead?----
  • code/branches/cpp11_v3/src/orxonox/gamestates/GSClient.h

    r7163 r11054  
    4343        ~GSClient();
    4444
    45         void activate();
    46         void deactivate();
    47         void update(const Clock& time);
     45        virtual void activate() override;
     46        virtual void deactivate() override;
     47        virtual void update(const Clock& time) override;
    4848    };
    4949}
  • code/branches/cpp11_v3/src/orxonox/gamestates/GSGraphics.h

    r6417 r11054  
    5353        ~GSGraphics();
    5454
    55         void activate();
    56         void deactivate();
    57         void update(const Clock& time);
     55        virtual void activate() override;
     56        virtual void deactivate() override;
     57        virtual void update(const Clock& time) override;
    5858
    5959    private:
  • code/branches/cpp11_v3/src/orxonox/gamestates/GSLevel.cc

    r10624 r11054  
    6565    GSLevel::GSLevel(const GameStateInfo& info)
    6666        : GameState(info)
    67         , gameInputState_(0)
    68         , guiMouseOnlyInputState_(0)
    69         , guiKeysOnlyInputState_(0)
    70         , startFile_(0)
     67        , gameInputState_(nullptr)
     68        , guiMouseOnlyInputState_(nullptr)
     69        , guiKeysOnlyInputState_(nullptr)
     70        , startFile_(nullptr)
    7171        , bShowIngameGUI_(false)
    7272    {
     
    143143#endif
    144144
    145             gameInputState_->setHandler(0);
    146             guiMouseOnlyInputState_->setHandler(0);
    147             guiKeysOnlyInputState_->setHandler(0);
     145            gameInputState_->setHandler(nullptr);
     146            guiMouseOnlyInputState_->setHandler(nullptr);
     147            guiKeysOnlyInputState_->setHandler(nullptr);
    148148            InputManager::getInstance().destroyState("game");
    149149            InputManager::getInstance().destroyState("guiKeysOnly");
     
    156156        {
    157157            ModifyConsoleCommand(__CC_changeGame_name).deactivate();
    158             ModifyConsoleCommand(__CC_reloadLevel_name).setObject(NULL).deactivate();
     158            ModifyConsoleCommand(__CC_reloadLevel_name).setObject(nullptr).deactivate();
    159159        }
    160160    }
     
    164164        // Note: Temporarily moved to GSRoot.
    165165        //// Call the scene objects
    166         //for (ObjectList<Tickable>::iterator it = ObjectList<Tickable>::begin(); it; ++it)
    167         //    it->tick(time.getDeltaTime() * this->timeFactor_);
     166        //for (Tickable* tickable : ObjectList<Tickable>())
     167        //    tickable->tick(time.getDeltaTime() * this->timeFactor_);
    168168    }
    169169
    170170    void GSLevel::prepareObjectTracking()
    171171    {
    172         for (ObjectList<BaseObject>::iterator it = ObjectList<BaseObject>::begin(); it != ObjectList<BaseObject>::end(); ++it)
    173             this->staticObjects_.insert(*it);
     172        for (BaseObject* baseObject : ObjectList<BaseObject>())
     173            this->staticObjects_.insert(baseObject);
    174174    }
    175175
     
    178178        orxout(internal_info) << "Remaining objects:" << endl;
    179179        unsigned int i = 0;
    180         for (ObjectList<BaseObject>::iterator it = ObjectList<BaseObject>::begin(); it != ObjectList<BaseObject>::end(); ++it)
    181         {
    182             std::set<BaseObject*>::const_iterator find = this->staticObjects_.find(*it);
     180        for (BaseObject* baseObject : ObjectList<BaseObject>())
     181        {
     182            std::set<BaseObject*>::const_iterator find = this->staticObjects_.find(baseObject);
    183183            if (find == this->staticObjects_.end())
    184184            {
    185                 orxout(internal_warning) << ++i << ": " << it->getIdentifier()->getName() << " (" << *it << "), references: " << it->getReferenceCount() << endl;
     185                orxout(internal_warning) << ++i << ": " << baseObject->getIdentifier()->getName() << " (" << baseObject << "), references: " << baseObject->getReferenceCount() << endl;
    186186            }
    187187        }
     
    215215    void GSLevel::unloadLevelAsClient()
    216216    {
    217         for (ObjectList<Level>::iterator it = ObjectList<Level>::begin(); it != ObjectList<Level>::end(); )
     217        ObjectList<Level> listLevel;
     218        for (ObjectList<Level>::iterator it = listLevel.begin(); it != listLevel.end(); )
    218219        {
    219220            StrongPtr<Level> level = *(it++); // StrongPtr prevents that the Level gets destroyed while we loop over it
    220             for (ObjectList<BaseObject>::iterator it = ObjectList<BaseObject>::begin(level); it != ObjectList<BaseObject>::end(level); )
     221            ObjectList<BaseObject> listBaseObject(level);
     222            for (ObjectList<BaseObject>::iterator it = listBaseObject.begin(); it != listBaseObject.end(); )
    221223                (it++)->destroy();
    222224        }
    223225
    224         for (ObjectList<Synchronisable>::iterator it = ObjectList<Synchronisable>::begin(); it != ObjectList<Synchronisable>::end(); )
     226        ObjectList<Synchronisable> listSynchronisable;
     227        for (ObjectList<Synchronisable>::iterator it = listSynchronisable.begin(); it != listSynchronisable.end(); )
    225228        {
    226229            if (it->getSyncMode() != 0x0)
     
    235238        // export all states
    236239        std::vector<GSLevelMementoState*> states;
    237         for (ObjectList<GSLevelMemento>::iterator it = ObjectList<GSLevelMemento>::begin(); it != ObjectList<GSLevelMemento>::end(); ++it)
    238         {
    239             GSLevelMementoState* state = it->exportMementoState();
     240        for (GSLevelMemento* memento : ObjectList<GSLevelMemento>())
     241        {
     242            GSLevelMementoState* state = memento->exportMementoState();
    240243            if (state)
    241244                states.push_back(state);
     
    247250
    248251        // import all states
    249         for (ObjectList<GSLevelMemento>::iterator it = ObjectList<GSLevelMemento>::begin(); it != ObjectList<GSLevelMemento>::end(); ++it)
    250             it->importMementoState(states);
     252        for (GSLevelMemento* memento : ObjectList<GSLevelMemento>())
     253            memento->importMementoState(states);
    251254
    252255        // delete states
    253         for (size_t i = 0; i < states.size(); ++i)
    254             delete states[i];
     256        for (GSLevelMementoState* state : states)
     257            delete state;
    255258    }
    256259
  • code/branches/cpp11_v3/src/orxonox/gamestates/GSLevel.h

    r10624 r11054  
    4444        ~GSLevel();
    4545
    46         void activate();
    47         void deactivate();
    48         void update(const Clock& time);
     46        virtual void activate() override;
     47        virtual void deactivate() override;
     48        virtual void update(const Clock& time) override;
    4949
    5050        static void startMainMenu(void); //!< Starts the MainMenu
  • code/branches/cpp11_v3/src/orxonox/gamestates/GSLevelMemento.h

    r10281 r11054  
    4848        protected:
    4949            /**
    50              * Returns the state of this memento. Returns NULL if no state needed to persist.
     50             * Returns the state of this memento. Returns nullptr if no state needed to persist.
    5151             */
    5252            virtual GSLevelMementoState* exportMementoState() = 0;
  • code/branches/cpp11_v3/src/orxonox/gamestates/GSMainMenu.cc

    r10624 r11054  
    7373
    7474        // create an empty Scene
    75         this->scene_ = new Scene(NULL);
     75        this->scene_ = new Scene(nullptr);
    7676        this->scene_->setSyncMode( 0x0 );
    7777        // and a Camera
     
    132132        InputManager::getInstance().leaveState("MainMenuHackery");
    133133
    134         GraphicsManager::getInstance().setCamera(0);
     134        GraphicsManager::getInstance().setCamera(nullptr);
    135135        GUIManager::getInstance().setBackgroundImage("");
    136136        GUIManager::hideGUI("MainMenu");
     
    140140        ModifyConsoleCommand(__CC_startClient_name    ).deactivate();
    141141        ModifyConsoleCommand(__CC_startDedicated_name ).deactivate();
    142         ModifyConsoleCommand(__CC_setMainMenuSoundPath_name).setObject(0);
     142        ModifyConsoleCommand(__CC_setMainMenuSoundPath_name).setObject(nullptr);
    143143    }
    144144
  • code/branches/cpp11_v3/src/orxonox/gamestates/GSMainMenu.h

    r9667 r11054  
    4444        ~GSMainMenu();
    4545
    46         void activate();
    47         void deactivate();
    48         void update(const Clock& time);
     46        virtual void activate() override;
     47        virtual void deactivate() override;
     48        virtual void update(const Clock& time) override;
    4949
    5050        void setConfigValues();
  • code/branches/cpp11_v3/src/orxonox/gamestates/GSMasterServer.h

    r7801 r11054  
    4545      ~GSMasterServer();
    4646
    47       void activate();
    48       void deactivate();
    49       void update(const Clock& time);
     47      virtual void activate() override;
     48      virtual void deactivate() override;
     49      virtual void update(const Clock& time) override;
    5050
    5151    private:
  • code/branches/cpp11_v3/src/orxonox/gamestates/GSRoot.cc

    r10624 r11054  
    3434#include "core/GameMode.h"
    3535#include "core/command/ConsoleCommandIncludes.h"
     36#include "core/object/ObjectList.h"
    3637#include "network/NetworkFunctionIncludes.h"
    3738#include "tools/Timer.h"
     
    7374    {
    7475        unsigned int nr=0;
    75         for (ObjectList<BaseObject>::iterator it = ObjectList<BaseObject>::begin(); it; ++it)
    76         {
    77             Synchronisable* synchronisable = orxonox_cast<Synchronisable*>(*it);
     76        for (BaseObject* baseObject : ObjectList<BaseObject>())
     77        {
     78            Synchronisable* synchronisable = orxonox_cast<Synchronisable*>(baseObject);
    7879            if (synchronisable)
    79                 orxout(debug_output) << "object: " << it->getIdentifier()->getName() << " id: " << synchronisable->getObjectID() << endl;
     80                orxout(debug_output) << "object: " << baseObject->getIdentifier()->getName() << " id: " << synchronisable->getObjectID() << endl;
    8081            else
    81                 orxout(debug_output) << "object: " << it->getIdentifier()->getName() << endl;
     82                orxout(debug_output) << "object: " << baseObject->getIdentifier()->getName() << endl;
    8283            nr++;
    8384        }
     
    9899    void GSRoot::deactivate()
    99100    {
    100         ModifyConsoleCommand(__CC_setTimeFactor_name).setObject(0);
    101         ModifyConsoleCommand(__CC_getTimeFactor_name).setObject(0);
    102         ModifyConsoleCommand(__CC_setPause_name).setObject(0);
    103         ModifyConsoleCommand(__CC_pause_name).setObject(0);
     101        ModifyConsoleCommand(__CC_setTimeFactor_name).setObject(nullptr);
     102        ModifyConsoleCommand(__CC_getTimeFactor_name).setObject(nullptr);
     103        ModifyConsoleCommand(__CC_setPause_name).setObject(nullptr);
     104        ModifyConsoleCommand(__CC_pause_name).setObject(nullptr);
    104105    }
    105106
     
    112113        }
    113114
    114         for (ObjectList<Timer>::iterator it = ObjectList<Timer>::begin(); it; )
     115        ObjectList<Timer> listTimer;
     116        for (ObjectList<Timer>::iterator it = listTimer.begin(); it; )
    115117        {
    116118            Timer* object = *it;
     
    128130        }
    129131        float realdt = leveldt * TimeFactorListener::getTimeFactor();
    130         for (ObjectList<Tickable>::iterator it = ObjectList<Tickable>::begin(); it; )
     132        ObjectList<Tickable> listTickable;
     133        for (ObjectList<Tickable>::iterator it = listTickable.begin(); it; )
    131134        {
    132135            Tickable* object = *it;
  • code/branches/cpp11_v3/src/orxonox/gamestates/GSRoot.h

    r8706 r11054  
    4444        static void printObjects();
    4545
    46         void activate();
    47         void deactivate();
    48         void update(const Clock& time);
     46        virtual void activate() override;
     47        virtual void deactivate() override;
     48        virtual void update(const Clock& time) override;
    4949
    5050        // this has to be public because proteced triggers a bug in msvc
     
    5959
    6060    protected:
    61         virtual void changedTimeFactor(float factor_new, float factor_old);
     61        virtual void changedTimeFactor(float factor_new, float factor_old) override;
    6262
    6363    private:
  • code/branches/cpp11_v3/src/orxonox/gamestates/GSServer.cc

    r10624 r11054  
    4444    GSServer::GSServer(const GameStateInfo& info)
    4545        : GameState(info)
    46         , server_(0)
     46        , server_(nullptr)
    4747    {
    4848    }
  • code/branches/cpp11_v3/src/orxonox/gamestates/GSServer.h

    r5929 r11054  
    4343        ~GSServer();
    4444
    45         void activate();
    46         void deactivate();
    47         void update(const Clock& time);
     45        virtual void activate() override;
     46        virtual void deactivate() override;
     47        virtual void update(const Clock& time) override;
    4848
    4949    private:
  • code/branches/cpp11_v3/src/orxonox/gamestates/GSStandalone.h

    r5929 r11054  
    4141        ~GSStandalone();
    4242
    43         void activate();
    44         void deactivate();
    45         void update(const Clock& time);
     43        virtual void activate() override;
     44        virtual void deactivate() override;
     45        virtual void update(const Clock& time) override;
    4646
    4747    private:
  • code/branches/cpp11_v3/src/orxonox/gametypes/Asteroids.h

    r9667 r11054  
    4141            virtual ~Asteroids() {}
    4242
    43             virtual void tick(float dt);
     43            virtual void tick(float dt) override;
    4444
    45             virtual void start();
    46             virtual void end();
     45            virtual void start() override;
     46            virtual void end() override;
    4747
    4848            inline void firstCheckpointReached(bool reached)
     
    5050
    5151        protected:
    52             virtual void pawnKilled(Pawn* victim, Pawn* killer = 0);
     52            virtual void pawnKilled(Pawn* victim, Pawn* killer = nullptr) override;
    5353
    5454        private:
  • code/branches/cpp11_v3/src/orxonox/gametypes/Deathmatch.h

    r9667 r11054  
    4141            virtual ~Deathmatch() {}
    4242
    43             virtual void start();
    44             virtual void end();
    45             virtual void playerEntered(PlayerInfo* player);
    46             virtual bool playerLeft(PlayerInfo* player);
    47             virtual bool playerChangedName(PlayerInfo* player);
     43            virtual void start() override;
     44            virtual void end() override;
     45            virtual void playerEntered(PlayerInfo* player) override;
     46            virtual bool playerLeft(PlayerInfo* player) override;
     47            virtual bool playerChangedName(PlayerInfo* player) override;
    4848
    49             virtual void pawnKilled(Pawn* victim, Pawn* killer = 0);
    50             virtual void playerScored(PlayerInfo* player, int score = 1);
     49            virtual void pawnKilled(Pawn* victim, Pawn* killer = nullptr) override;
     50            virtual void playerScored(PlayerInfo* player, int score = 1) override;
    5151    };
    5252}
  • code/branches/cpp11_v3/src/orxonox/gametypes/Dynamicmatch.cc

    r11052 r11054  
    413413    void Dynamicmatch::rewardPig()
    414414    {
    415         for (std::map< PlayerInfo*, int >::iterator it = this->playerParty_.begin(); it != this->playerParty_.end(); ++it) //durch alle Spieler iterieren und alle piggys finden
    416         {
    417             if (it->second==piggy)//Spieler mit der Pig-party frags++
    418             {
    419                  this->playerScored(it->first);
     415        for (const auto& mapEntry : this->playerParty_) //durch alle Spieler iterieren und alle piggys finden
     416        {
     417            if (mapEntry.second==piggy)//Spieler mit der Pig-party frags++
     418            {
     419                 this->playerScored(mapEntry.first);
    420420            }
    421421        }
     
    430430
    431431                std::set<WorldEntity*> pawnAttachments = pawn->getAttachedObjects();
    432                 for (std::set<WorldEntity*>::iterator it = pawnAttachments.begin(); it != pawnAttachments.end(); ++it)
    433                 {
    434                     if ((*it)->isA(Class(TeamColourable)))
     432                for (WorldEntity* pawnAttachment : pawnAttachments)
     433                {
     434                    if (pawnAttachment->isA(Class(TeamColourable)))
    435435                    {
    436                         TeamColourable* tc = orxonox_cast<TeamColourable*>(*it);
     436                        TeamColourable* tc = orxonox_cast<TeamColourable*>(pawnAttachment);
    437437                        tc->setTeamColour(this->partyColours_[it_player->second]);
    438438                    }
     
    449449            if (tutorial) // Announce selectionphase
    450450            {
    451              for (std::map<PlayerInfo*, int>::iterator it = this->playerParty_.begin(); it != this->playerParty_.end(); ++it)
    452                 {
    453                     if (!it->first)//in order to catch nullpointer
     451             for (const auto& mapEntry : this->playerParty_)
     452                {
     453                    if (!mapEntry.first)//in order to catch nullpointer
    454454                        continue;
    455                     if (it->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
     455                    if (mapEntry.first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
    456456                        continue;
    457                     this->gtinfo_->sendStaticMessage("Selection phase: Shoot at everything that moves.",it->first->getClientID(),ColourValue(1.0f, 1.0f, 0.5f));
     457                    this->gtinfo_->sendStaticMessage("Selection phase: Shoot at everything that moves.",mapEntry.first->getClientID(),ColourValue(1.0f, 1.0f, 0.5f));
    458458                }
    459459            }
     
    464464             if(tutorial&&(!notEnoughKillers)&&(!notEnoughChasers)) //Selection phase over
    465465             {
    466                   for (std::map<PlayerInfo*, int>::iterator it = this->playerParty_.begin(); it != this->playerParty_.end(); ++it)
     466                  for (const auto& mapEntry : this->playerParty_)
    467467                  {
    468                        if (!it->first)//in order to catch nullpointer
     468                       if (!mapEntry.first)//in order to catch nullpointer
    469469                           continue;
    470                        if (it->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
     470                       if (mapEntry.first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
    471471                           continue;
    472                        else if (it->second==chaser)
     472                       else if (mapEntry.second==chaser)
    473473                       {
    474474                           if (numberOf[killer]>0)
    475                                this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible. Defend yourself against the killers.",it->first->getClientID(),partyColours_[piggy]);
     475                               this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible. Defend yourself against the killers.",mapEntry.first->getClientID(),partyColours_[piggy]);
    476476                           else
    477                                this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible.",it->first->getClientID(),partyColours_[piggy]);
     477                               this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible.",mapEntry.first->getClientID(),partyColours_[piggy]);
    478478                           //this->gtinfo_->sendFadingMessage("You're now a chaser.",it->first->getClientID());
    479479                       }
    480                        else if (it->second==piggy)
    481                        {
    482                            this->gtinfo_->sendStaticMessage("Either hide or shoot a chaser.",it->first->getClientID(),partyColours_[chaser]);
     480                       else if (mapEntry.second==piggy)
     481                       {
     482                           this->gtinfo_->sendStaticMessage("Either hide or shoot a chaser.",mapEntry.first->getClientID(),partyColours_[chaser]);
    483483                           //this->gtinfo_->sendFadingMessage("You're now a victim.",it->first->getClientID());
    484484                       }
    485                        else if (it->second==killer)
    486                        {
    487                            this->gtinfo_->sendStaticMessage("Take the chasers down.",it->first->getClientID(),partyColours_[chaser]);
     485                       else if (mapEntry.second==killer)
     486                       {
     487                           this->gtinfo_->sendStaticMessage("Take the chasers down.",mapEntry.first->getClientID(),partyColours_[chaser]);
    488488                           //this->gtinfo_->sendFadingMessage("You're now a killer.",it->first->getClientID());
    489489                       }
     
    498498            if (tutorial) // Announce selectionphase
    499499            {
    500              for (std::map<PlayerInfo*, int>::iterator it = this->playerParty_.begin(); it != this->playerParty_.end(); ++it)
    501                 {
    502                     if (!it->first)//in order to catch nullpointer
     500             for (const auto& mapEntry : this->playerParty_)
     501                {
     502                    if (!mapEntry.first)//in order to catch nullpointer
    503503                        continue;
    504                     if (it->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
     504                    if (mapEntry.first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
    505505                        continue;
    506                     this->gtinfo_->sendStaticMessage("Selection phase: Shoot at everything that moves.",it->first->getClientID(),ColourValue(1.0f, 1.0f, 0.5f));
     506                    this->gtinfo_->sendStaticMessage("Selection phase: Shoot at everything that moves.",mapEntry.first->getClientID(),ColourValue(1.0f, 1.0f, 0.5f));
    507507                }
    508508            }
     
    513513            if(tutorial&&(!notEnoughPigs)&&(!notEnoughChasers)) //Selection phase over
    514514             {
    515                   for (std::map<PlayerInfo*, int>::iterator it = this->playerParty_.begin(); it != this->playerParty_.end(); ++it)
     515                  for (const auto& mapEntry : this->playerParty_)
    516516                  {
    517                        if (!it->first)
     517                       if (!mapEntry.first)
    518518                           continue;
    519                        if (it->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
     519                       if (mapEntry.first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
    520520                           continue;
    521                        else if (it->second==chaser)
     521                       else if (mapEntry.second==chaser)
    522522                       {
    523523                           if (numberOf[killer]>0)
    524                                this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible. Defend yourself against the killers.",it->first->getClientID(),partyColours_[piggy]);
     524                               this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible. Defend yourself against the killers.",mapEntry.first->getClientID(),partyColours_[piggy]);
    525525                           else
    526                                this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible.",it->first->getClientID(),partyColours_[piggy]);
     526                               this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible.",mapEntry.first->getClientID(),partyColours_[piggy]);
    527527                           //this->gtinfo_->sendFadingMessage("You're now a chaser.",it->first->getClientID());
    528528                       }
    529                        else if (it->second==piggy)
    530                        {
    531                            this->gtinfo_->sendStaticMessage("Either hide or shoot a chaser.",it->first->getClientID(),partyColours_[piggy]);
     529                       else if (mapEntry.second==piggy)
     530                       {
     531                           this->gtinfo_->sendStaticMessage("Either hide or shoot a chaser.",mapEntry.first->getClientID(),partyColours_[piggy]);
    532532                           //this->gtinfo_->sendFadingMessage("You're now a victim.",it->first->getClientID());
    533533                       }
    534                        else if (it->second==killer)
    535                        {
    536                            this->gtinfo_->sendStaticMessage("Take the chasers down.",it->first->getClientID(),partyColours_[piggy]);
     534                       else if (mapEntry.second==killer)
     535                       {
     536                           this->gtinfo_->sendStaticMessage("Take the chasers down.",mapEntry.first->getClientID(),partyColours_[piggy]);
    537537                           //this->gtinfo_->sendFadingMessage("You're now a killer.",it->first->getClientID());
    538538                       }
     
    548548            if (tutorial) // Announce selectionphase
    549549            {
    550              for (std::map<PlayerInfo*, int>::iterator it = this->playerParty_.begin(); it != this->playerParty_.end(); ++it)
    551                 {
    552                     if (!it->first)//in order to catch nullpointer
     550             for (const auto& mapEntry : this->playerParty_)
     551                {
     552                    if (!mapEntry.first)//in order to catch nullpointer
    553553                        continue;
    554                     if (it->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
     554                    if (mapEntry.first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
    555555                        continue;
    556                     this->gtinfo_->sendStaticMessage("Selection phase: Shoot at everything that moves.",it->first->getClientID(),ColourValue(1.0f, 1.0f, 0.5f));
     556                    this->gtinfo_->sendStaticMessage("Selection phase: Shoot at everything that moves.",mapEntry.first->getClientID(),ColourValue(1.0f, 1.0f, 0.5f));
    557557                }
    558558            }
     
    563563             if(tutorial&&(!notEnoughPigs)&&(!notEnoughKillers)) //Selection phase over
    564564             {
    565                   for (std::map<PlayerInfo*, int>::iterator it = this->playerParty_.begin(); it != this->playerParty_.end(); ++it)
     565                  for (const auto& mapEntry : this->playerParty_)
    566566                  {
    567                        if (!it->first)
     567                       if (!mapEntry.first)
    568568                           continue;
    569                        if (it->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
     569                       if (mapEntry.first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
    570570                           continue;
    571                        else if (it->second==chaser)
     571                       else if (mapEntry.second==chaser)
    572572                       {
    573573                           if (numberOf[killer]>0)
    574                                this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible. Defend yourself against the killers.",it->first->getClientID(),partyColours_[piggy]);
     574                               this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible. Defend yourself against the killers.",mapEntry.first->getClientID(),partyColours_[piggy]);
    575575                           else
    576                                this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible.",it->first->getClientID(),partyColours_[piggy]);
     576                               this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible.",mapEntry.first->getClientID(),partyColours_[piggy]);
    577577                           //this->gtinfo_->sendFadingMessage("You're now a chaser.",it->first->getClientID());
    578578                       }
    579                        else if (it->second==piggy)
    580                        {
    581                            this->gtinfo_->sendStaticMessage("Either hide or shoot a chaser.",it->first->getClientID(),partyColours_[chaser]);
     579                       else if (mapEntry.second==piggy)
     580                       {
     581                           this->gtinfo_->sendStaticMessage("Either hide or shoot a chaser.",mapEntry.first->getClientID(),partyColours_[chaser]);
    582582                           //this->gtinfo_->sendFadingMessage("You're now a victim.",it->first->getClientID());
    583583                       }
    584                        else if (it->second==killer)
    585                        {
    586                            this->gtinfo_->sendStaticMessage("Take the chasers down.",it->first->getClientID(),partyColours_[chaser]);
     584                       else if (mapEntry.second==killer)
     585                       {
     586                           this->gtinfo_->sendStaticMessage("Take the chasers down.",mapEntry.first->getClientID(),partyColours_[chaser]);
    587587                           //this->gtinfo_->sendFadingMessage("You're now a killer.",it->first->getClientID());
    588588                       }
     
    631631        else if(tutorial) // Announce selectionphase
    632632        {
    633             for (std::map<PlayerInfo*, int>::iterator it = this->playerParty_.begin(); it != this->playerParty_.end(); ++it)
    634             {
    635                 if (it->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
     633            for (const auto& mapEntry : this->playerParty_)
     634            {
     635                if (mapEntry.first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
    636636                    continue;
    637                 this->gtinfo_->sendStaticMessage("Selection phase: Shoot at everything that moves.",it->first->getClientID(),ColourValue(1.0f, 1.0f, 0.5f));
     637                this->gtinfo_->sendStaticMessage("Selection phase: Shoot at everything that moves.",mapEntry.first->getClientID(),ColourValue(1.0f, 1.0f, 0.5f));
    638638            }
    639639        }
     
    687687            unsigned int randomspawn = static_cast<unsigned int>(rnd(static_cast<float>(teamSpawnPoints.size())));
    688688            unsigned int index = 0;
    689             for (std::set<SpawnPoint*>::const_iterator it = teamSpawnPoints.begin(); it != teamSpawnPoints.end(); ++it)
     689            for (SpawnPoint* teamSpawnPoint : teamSpawnPoints)
    690690            {
    691691                if (index == randomspawn)
    692                     return (*it);
     692                    return teamSpawnPoint;
    693693
    694694                ++index;
     
    696696        }
    697697
    698         return 0;
     698        return nullptr;
    699699    }
    700700
  • code/branches/cpp11_v3/src/orxonox/gametypes/Dynamicmatch.h

    r11052 r11054  
    6565            bool tutorial; //goal: new players receive messages how the new gametype works - later it can be switched off.
    6666
    67             virtual bool allowPawnDamage(Pawn* victim, Pawn* originator = 0); //ok - score function and management of parties
    68             virtual bool allowPawnDeath(Pawn* victim, Pawn* originator = 0); //ok - simple
    69             virtual void start();
    70             virtual void end(); //Wie geht das mit der Punkteausgabe aendern? Z.B: Persoenliche Nachricht?
    71             virtual void playerEntered(PlayerInfo* player);
    72             virtual void playerStartsControllingPawn(PlayerInfo* player, Pawn* pawn);//is used to initialize the player's party and colour
    73             virtual bool playerLeft(PlayerInfo* player);
    74             virtual bool playerChangedName(PlayerInfo* player);//unchanged
     67            virtual bool allowPawnDamage(Pawn* victim, Pawn* originator = nullptr) override; //ok - score function and management of parties
     68            virtual bool allowPawnDeath(Pawn* victim, Pawn* originator = nullptr) override; //ok - simple
     69            virtual void start() override;
     70            virtual void end() override; //Wie geht das mit der Punkteausgabe aendern? Z.B: Persoenliche Nachricht?
     71            virtual void playerEntered(PlayerInfo* player) override;
     72            virtual void playerStartsControllingPawn(PlayerInfo* player, Pawn* pawn) override;//is used to initialize the player's party and colour
     73            virtual bool playerLeft(PlayerInfo* player) override;
     74            virtual bool playerChangedName(PlayerInfo* player) override;//unchanged
    7575
    7676            /*virtual void instructions();
     
    7979            void grantPigBoost(SpaceShip* spaceship); // Grant the piggy a boost.
    8080            void resetSpeedFactor(SpaceShip* spaceship, Timer* timer);
    81             void tick (float dt);// used to end the game
    82             SpawnPoint* getBestSpawnPoint(PlayerInfo* player) const;
     81            virtual void tick (float dt) override;// used to end the game
     82            virtual SpawnPoint* getBestSpawnPoint(PlayerInfo* player) const override;
    8383
    8484
  • code/branches/cpp11_v3/src/orxonox/gametypes/Gametype.cc

    r10624 r11054  
    6666
    6767        this->defaultControllableEntity_ = Class(Spectator);
    68         this->scoreboard_ = 0;
     68        this->scoreboard_ = nullptr;
    6969
    7070        this->bAutoStart_ = false;
     
    9292                this->gtinfo_->destroy();
    9393
    94             ModifyConsoleCommand(__CC_addBots_name).setObject(NULL);
    95             ModifyConsoleCommand(__CC_killBots_name).setObject(NULL);
     94            ModifyConsoleCommand(__CC_addBots_name).setObject(nullptr);
     95            ModifyConsoleCommand(__CC_killBots_name).setObject(nullptr);
    9696        }
    9797    }
     
    139139        if (!this->gtinfo_->hasStarted())
    140140        {
    141             for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
     141            for (const auto& mapEntry : this->players_)
    142142            {
    143143                // Inform the GametypeInfo that the player is ready to spawn.
    144                 if(it->first->isHumanPlayer() && it->first->isReadyToSpawn())
    145                     this->gtinfo_->playerReadyToSpawn(it->first);
     144                if(mapEntry.first->isHumanPlayer() && mapEntry.first->isReadyToSpawn())
     145                    this->gtinfo_->playerReadyToSpawn(mapEntry.first);
    146146            }
    147147
     
    169169        }
    170170
    171         for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
    172         {
    173             if (it->first->getControllableEntity())
    174             {
    175                 ControllableEntity* oldentity = it->first->getControllableEntity();
     171        for (const auto& mapEntry : this->players_)
     172        {
     173            if (mapEntry.first->getControllableEntity())
     174            {
     175                ControllableEntity* oldentity = mapEntry.first->getControllableEntity();
    176176
    177177                ControllableEntity* entity = this->defaultControllableEntity_.fabricate(oldentity->getContext());
     
    186186                    entity->setOrientation(oldentity->getWorldOrientation());
    187187                }
    188                 it->first->startControl(entity);
     188                mapEntry.first->startControl(entity);
    189189            }
    190190            else
    191                 this->spawnPlayerAsDefaultPawn(it->first);
     191                this->spawnPlayerAsDefaultPawn(mapEntry.first);
    192192        }
    193193    }
     
    337337        {
    338338            // Fallback spawn point if there is no active one, choose a random one.
    339             SpawnPoint* fallbackSpawnPoint = NULL;
     339            SpawnPoint* fallbackSpawnPoint = nullptr;
    340340            unsigned int randomspawn = static_cast<unsigned int>(rnd(static_cast<float>(this->spawnpoints_.size())));
    341341            unsigned int index = 0;
    342342            std::vector<SpawnPoint*> activeSpawnPoints;
    343             for (std::set<SpawnPoint*>::const_iterator it = this->spawnpoints_.begin(); it != this->spawnpoints_.end(); ++it)
     343            for (SpawnPoint* spawnpoint : this->spawnpoints_)
    344344            {
    345345                if (index == randomspawn)
    346                     fallbackSpawnPoint = (*it);
    347 
    348                 if (*it != NULL && (*it)->isActive())
    349                     activeSpawnPoints.push_back(*it);
     346                    fallbackSpawnPoint = spawnpoint;
     347
     348                if (spawnpoint != nullptr && spawnpoint->isActive())
     349                    activeSpawnPoints.push_back(spawnpoint);
    350350
    351351                ++index;
     
    361361            return fallbackSpawnPoint;
    362362        }
    363         return 0;
     363        return nullptr;
    364364    }
    365365
    366366    void Gametype::assignDefaultPawnsIfNeeded()
    367367    {
    368         for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
    369         {
    370             if (!it->first->getControllableEntity())
    371             {
    372                 it->second.state_ = PlayerState::Dead;
    373 
    374                 if (!it->first->isReadyToSpawn() || !this->gtinfo_->hasStarted())
    375                 {
    376                     this->spawnPlayerAsDefaultPawn(it->first);
    377                     it->second.state_ = PlayerState::Dead;
     368        for (auto& mapEntry : this->players_)
     369        {
     370            if (!mapEntry.first->getControllableEntity())
     371            {
     372                mapEntry.second.state_ = PlayerState::Dead;
     373
     374                if (!mapEntry.first->isReadyToSpawn() || !this->gtinfo_->hasStarted())
     375                {
     376                    this->spawnPlayerAsDefaultPawn(mapEntry.first);
     377                    mapEntry.second.state_ = PlayerState::Dead;
    378378                }
    379379            }
     
    404404                    bool allplayersready = true;
    405405                    bool hashumanplayers = false;
    406                     for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
     406                    for (const auto& mapEntry : this->players_)
    407407                    {
    408                         if (!it->first->isReadyToSpawn())
     408                        if (!mapEntry.first->isReadyToSpawn())
    409409                            allplayersready = false;
    410                         if (it->first->isHumanPlayer())
     410                        if (mapEntry.first->isHumanPlayer())
    411411                            hashumanplayers = true;
    412412                    }
     
    430430    void Gametype::spawnPlayersIfRequested()
    431431    {
    432         for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
    433         {
    434             if (it->first->isReadyToSpawn() || this->bForceSpawn_)
    435                 this->spawnPlayer(it->first);
     432        for (const auto& mapEntry : this->players_)
     433        {
     434            if (mapEntry.first->isReadyToSpawn() || this->bForceSpawn_)
     435                this->spawnPlayer(mapEntry.first);
    436436        }
    437437    }
     
    439439    void Gametype::spawnDeadPlayersIfRequested()
    440440    {
    441         for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
    442             if (it->second.state_ == PlayerState::Dead)
    443                 if (it->first->isReadyToSpawn() || this->bForceSpawn_)
    444                     this->spawnPlayer(it->first);
     441        for (const auto& mapEntry : this->players_)
     442            if (mapEntry.second.state_ == PlayerState::Dead)
     443                if (mapEntry.first->isReadyToSpawn() || this->bForceSpawn_)
     444                    this->spawnPlayer(mapEntry.first);
    445445    }
    446446
     
    492492    {
    493493        unsigned int i = 0;
    494         for (ObjectList<Bot>::iterator it = ObjectList<Bot>::begin(); (it != ObjectList<Bot>::end()) && ((amount == 0) || (i < amount)); )
     494        ObjectList<Bot> list;
     495        for (ObjectList<Bot>::iterator it = list.begin(); (it != list.end()) && ((amount == 0) || (i < amount)); )
    495496        {
    496497            if (it->getGametype() == this)
     
    538539    GSLevelMementoState* Gametype::exportMementoState()
    539540    {
    540         for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
    541         {
    542             if (it->first->isHumanPlayer() && it->first->getControllableEntity() && it->first->getControllableEntity()->getCamera())
    543             {
    544                 Camera* camera = it->first->getControllableEntity()->getCamera();
     541        for (const auto& mapEntry : this->players_)
     542        {
     543            if (mapEntry.first->isHumanPlayer() && mapEntry.first->getControllableEntity() && mapEntry.first->getControllableEntity()->getCamera())
     544            {
     545                Camera* camera = mapEntry.first->getControllableEntity()->getCamera();
    545546
    546547                GametypeMementoState* state = new GametypeMementoState();
     
    552553        }
    553554
    554         return NULL;
     555        return nullptr;
    555556    }
    556557
     
    558559    {
    559560        // find correct memento state
    560         GametypeMementoState* state = NULL;
    561         for (size_t i = 0; i < states.size(); ++i)
    562         {
    563             state = dynamic_cast<GametypeMementoState*>(states[i]);
     561        GametypeMementoState* state = nullptr;
     562        for (GSLevelMementoState* temp : states)
     563        {
     564            state = dynamic_cast<GametypeMementoState*>(temp);
    564565            if (state)
    565566                break;
     
    570571
    571572        // find correct scene
    572         Scene* scene = NULL;
    573         for (ObjectList<Scene>::iterator it = ObjectList<Scene>::begin(); it != ObjectList<Scene>::end(); ++it)
    574         {
    575             if (it->getName() == state->sceneName_)
    576             {
    577                 scene = *it;
     573        Scene* scene = nullptr;
     574        for (Scene* someScene : ObjectList<Scene>())
     575        {
     576            if (someScene->getName() == state->sceneName_)
     577            {
     578                scene = someScene;
    578579                break;
    579580            }
     
    587588
    588589        // find correct player and assign default entity with original position & orientation
    589         for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
    590         {
    591             if (it->first->isHumanPlayer())
     590        for (const auto& mapEntry : this->players_)
     591        {
     592            if (mapEntry.first->isHumanPlayer())
    592593            {
    593594                ControllableEntity* entity = this->defaultControllableEntity_.fabricate(scene->getContext());
    594595                entity->setPosition(state->cameraPosition_);
    595596                entity->setOrientation(state->cameraOrientation_);
    596                 it->first->startControl(entity);
     597                mapEntry.first->startControl(entity);
    597598                break;
    598599            }
  • code/branches/cpp11_v3/src/orxonox/gametypes/Gametype.h

    r10624 r11054  
    7676            void setConfigValues();
    7777
    78             virtual void tick(float dt);
     78            virtual void tick(float dt) override;
    7979
    8080            inline const GametypeInfo* getGametypeInfo() const
     
    9696            virtual void playerScored(PlayerInfo* player, int score = 1);
    9797
    98             virtual bool allowPawnHit(Pawn* victim, Pawn* originator = 0);
    99             virtual bool allowPawnDamage(Pawn* victim, Pawn* originator = 0);
    100             virtual bool allowPawnDeath(Pawn* victim, Pawn* originator = 0);
    101 
    102             virtual void pawnKilled(Pawn* victim, Pawn* killer = 0);
     98            virtual bool allowPawnHit(Pawn* victim, Pawn* originator = nullptr);
     99            virtual bool allowPawnDamage(Pawn* victim, Pawn* originator = nullptr);
     100            virtual bool allowPawnDeath(Pawn* victim, Pawn* originator = nullptr);
     101
     102            virtual void pawnKilled(Pawn* victim, Pawn* killer = nullptr);
    103103            virtual void pawnPreSpawn(Pawn* pawn);
    104104            virtual void pawnPostSpawn(Pawn* pawn);
     
    175175            virtual void spawnDeadPlayersIfRequested();
    176176
    177             virtual GSLevelMementoState* exportMementoState();
    178             virtual void importMementoState(const std::vector<GSLevelMementoState*>& states);
     177            virtual GSLevelMementoState* exportMementoState() override;
     178            virtual void importMementoState(const std::vector<GSLevelMementoState*>& states) override;
    179179
    180180            WeakPtr<GametypeInfo> gtinfo_;
  • code/branches/cpp11_v3/src/orxonox/gametypes/LastManStanding.cc

    r9667 r11054  
    5656    void LastManStanding::spawnDeadPlayersIfRequested()
    5757    {
    58         for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
    59             if (it->second.state_ == PlayerState::Dead)
    60             {
    61                 bool alive = (0<playerLives_[it->first]&&(inGame_[it->first]));
    62                 if (alive&&(it->first->isReadyToSpawn() || this->bForceSpawn_))
    63                 {
    64                     this->spawnPlayer(it->first);
     58        for (const auto& mapEntry : this->players_)
     59            if (mapEntry.second.state_ == PlayerState::Dead)
     60            {
     61                bool alive = (0<playerLives_[mapEntry.first]&&(inGame_[mapEntry.first]));
     62                if (alive&&(mapEntry.first->isReadyToSpawn() || this->bForceSpawn_))
     63                {
     64                    this->spawnPlayer(mapEntry.first);
    6565                }
    6666            }
     
    114114    {
    115115        int min=lives;
    116         for (std::map<PlayerInfo*, int>::iterator it = this->playerLives_.begin(); it != this->playerLives_.end(); ++it)
    117         {
    118             if (it->second<=0)
     116        for (const auto& mapEntry : this->playerLives_)
     117        {
     118            if (mapEntry.second<=0)
    119119                continue;
    120             if (it->second<lives)
    121                 min=it->second;
     120            if (mapEntry.second<lives)
     121                min=mapEntry.second;
    122122        }
    123123        return min;
     
    128128        Gametype::end();
    129129
    130         for (std::map<PlayerInfo*, int>::iterator it = this->playerLives_.begin(); it != this->playerLives_.end(); ++it)
    131         {
    132             if (it->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
     130        for (const auto& mapEntry : this->playerLives_)
     131        {
     132            if (mapEntry.first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
    133133                continue;
    134134
    135             if (it->second > 0)
    136                 this->gtinfo_->sendAnnounceMessage("You have won the match!", it->first->getClientID());
     135            if (mapEntry.second > 0)
     136                this->gtinfo_->sendAnnounceMessage("You have won the match!", mapEntry.first->getClientID());
    137137            else
    138                 this->gtinfo_->sendAnnounceMessage("You have lost the match!", it->first->getClientID());
     138                this->gtinfo_->sendAnnounceMessage("You have lost the match!", mapEntry.first->getClientID());
    139139        }
    140140    }
     
    237237                this->end();
    238238            }
    239             for (std::map<PlayerInfo*, float>::iterator it = this->timeToAct_.begin(); it != this->timeToAct_.end(); ++it)
    240             {
    241                 if (playerGetLives(it->first)<=0)//Players without lives shouldn't be affected by time.
     239            for (auto& mapEntry : this->timeToAct_)
     240            {
     241                if (playerGetLives(mapEntry.first)<=0)//Players without lives shouldn't be affected by time.
    242242                    continue;
    243                 it->second-=dt;//Decreases punishment time.
    244                 if (!inGame_[it->first])//Manages respawn delay - player is forced to respawn after the delaytime is used up.
    245                 {
    246                     playerDelayTime_[it->first]-=dt;
    247                     if (playerDelayTime_[it->first]<=0)
    248                     this->inGame_[it->first]=true;
    249 
    250                     if (it->first->getClientID()== NETWORK_PEER_ID_UNKNOWN)
     243                mapEntry.second-=dt;//Decreases punishment time.
     244                if (!inGame_[mapEntry.first])//Manages respawn delay - player is forced to respawn after the delaytime is used up.
     245                {
     246                    playerDelayTime_[mapEntry.first]-=dt;
     247                    if (playerDelayTime_[mapEntry.first]<=0)
     248                    this->inGame_[mapEntry.first]=true;
     249
     250                    if (mapEntry.first->getClientID()== NETWORK_PEER_ID_UNKNOWN)
    251251                        continue;
    252                     int output=1+(int)playerDelayTime_[it->first];
     252                    int output=1+(int)playerDelayTime_[mapEntry.first];
    253253                    const std::string& message = "Respawn in " +multi_cast<std::string>(output)+ " seconds." ;//Countdown
    254                     this->gtinfo_->sendFadingMessage(message,it->first->getClientID());
    255                 }
    256                 else if (it->second<0.0f)
    257                 {
    258                     it->second=timeRemaining+3.0f;//reset punishment-timer
    259                     if (playerGetLives(it->first)>0)
     254                    this->gtinfo_->sendFadingMessage(message,mapEntry.first->getClientID());
     255                }
     256                else if (mapEntry.second<0.0f)
     257                {
     258                    mapEntry.second=timeRemaining+3.0f;//reset punishment-timer
     259                    if (playerGetLives(mapEntry.first)>0)
    260260                    {
    261                         this->punishPlayer(it->first);
    262                         if (it->first->getClientID()== NETWORK_PEER_ID_UNKNOWN)
     261                        this->punishPlayer(mapEntry.first);
     262                        if (mapEntry.first->getClientID()== NETWORK_PEER_ID_UNKNOWN)
    263263                            return;
    264264                        const std::string& message = ""; // resets Camper-Warning-message
    265                         this->gtinfo_->sendFadingMessage(message,it->first->getClientID());
     265                        this->gtinfo_->sendFadingMessage(message,mapEntry.first->getClientID());
    266266                    }
    267267                }
    268                 else if (it->second<timeRemaining/5)//Warning message
    269                 {
    270                     if (it->first->getClientID()== NETWORK_PEER_ID_UNKNOWN)
     268                else if (mapEntry.second<timeRemaining/5)//Warning message
     269                {
     270                    if (mapEntry.first->getClientID()== NETWORK_PEER_ID_UNKNOWN)
    271271                        continue;
    272272                    const std::string& message = "Camper Warning! Don't forget to shoot.";
    273                     this->gtinfo_->sendFadingMessage(message,it->first->getClientID());
     273                    this->gtinfo_->sendFadingMessage(message,mapEntry.first->getClientID());
    274274                }
    275275            }
  • code/branches/cpp11_v3/src/orxonox/gametypes/LastManStanding.h

    r9667 r11054  
    6161            bool bHardPunishment; //!< Switches between damage and death as punishment.
    6262            float punishDamageRate; //!< Makes Damage adjustable.
    63             virtual void spawnDeadPlayersIfRequested(); //!< Prevents dead players to respawn.
     63            virtual void spawnDeadPlayersIfRequested() override; //!< Prevents dead players to respawn.
    6464            virtual int getMinLives(); //!< Returns minimum of each player's lives; players with 0 lives are skipped;
    6565
     
    6969            void setConfigValues(); //!< Makes values configurable.
    7070
    71             virtual bool allowPawnDamage(Pawn* victim, Pawn* originator = 0); //!< If a player shoot's an opponent, his punishment countdown will be resetted.
    72             virtual bool allowPawnDeath(Pawn* victim, Pawn* originator = 0); //!< Manages each players lives.
     71            virtual bool allowPawnDamage(Pawn* victim, Pawn* originator = nullptr) override; //!< If a player shoot's an opponent, his punishment countdown will be resetted.
     72            virtual bool allowPawnDeath(Pawn* victim, Pawn* originator = nullptr) override; //!< Manages each players lives.
    7373
    74             virtual void end(); //!< Sends an end message.
     74            virtual void end() override; //!< Sends an end message.
    7575            int playerGetLives(PlayerInfo* player); //!< getFunction for the map "playerLives_".
    7676            int getNumPlayersAlive() const; //!< Returns the number of players that are still alive.
    77             virtual void playerEntered(PlayerInfo* player); //!< Initializes values.
    78             virtual bool playerLeft(PlayerInfo* player); //!< Manages all local variables.
    79             virtual void playerStartsControllingPawn(PlayerInfo* player, Pawn* pawn); //!< Resets punishment time and respawn delay.
     77            virtual void playerEntered(PlayerInfo* player) override; //!< Initializes values.
     78            virtual bool playerLeft(PlayerInfo* player) override; //!< Manages all local variables.
     79            virtual void playerStartsControllingPawn(PlayerInfo* player, Pawn* pawn) override; //!< Resets punishment time and respawn delay.
    8080
    8181            void punishPlayer(PlayerInfo* player); //!< Function in order to kill a player. Punishment for hiding longer than "timeRemaining".
    82             void tick (float dt); //!< used to end the game
     82            virtual void tick (float dt) override; //!< used to end the game
    8383    };
    8484}
  • code/branches/cpp11_v3/src/orxonox/gametypes/LastTeamStanding.cc

    r9941 r11054  
    145145    void LastTeamStanding::spawnDeadPlayersIfRequested()
    146146    {
    147         for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
    148             if (it->second.state_ == PlayerState::Dead)
    149             {
    150                 bool alive = (0 < playerLives_[it->first]&&(inGame_[it->first]));
    151                 if (alive&&(it->first->isReadyToSpawn() || this->bForceSpawn_))
    152                 {
    153                     this->spawnPlayer(it->first);
     147        for (const auto& mapEntry : this->players_)
     148            if (mapEntry.second.state_ == PlayerState::Dead)
     149            {
     150                bool alive = (0 < playerLives_[mapEntry.first]&&(inGame_[mapEntry.first]));
     151                if (alive&&(mapEntry.first->isReadyToSpawn() || this->bForceSpawn_))
     152                {
     153                    this->spawnPlayer(mapEntry.first);
    154154                }
    155155            }
     
    184184                this->end();
    185185            }
    186             for (std::map<PlayerInfo*, float>::iterator it = this->timeToAct_.begin(); it != this->timeToAct_.end(); ++it)
    187             {
    188                 if (playerGetLives(it->first) <= 0)//Players without lives shouldn't be affected by time.
     186            for (auto& mapEntry : this->timeToAct_)
     187            {
     188                if (playerGetLives(mapEntry.first) <= 0)//Players without lives shouldn't be affected by time.
    189189                    continue;
    190                 it->second -= dt;//Decreases punishment time.
    191                 if (!inGame_[it->first])//Manages respawn delay - player is forced to respawn after the delaytime is used up.
    192                 {
    193                     playerDelayTime_[it->first] -= dt;
    194                     if (playerDelayTime_[it->first] <= 0)
    195                     this->inGame_[it->first] = true;
    196 
    197                     if (it->first->getClientID()== NETWORK_PEER_ID_UNKNOWN)
     190                mapEntry.second -= dt;//Decreases punishment time.
     191                if (!inGame_[mapEntry.first])//Manages respawn delay - player is forced to respawn after the delaytime is used up.
     192                {
     193                    playerDelayTime_[mapEntry.first] -= dt;
     194                    if (playerDelayTime_[mapEntry.first] <= 0)
     195                    this->inGame_[mapEntry.first] = true;
     196
     197                    if (mapEntry.first->getClientID()== NETWORK_PEER_ID_UNKNOWN)
    198198                        continue;
    199                     int output = 1 + (int)playerDelayTime_[it->first];
     199                    int output = 1 + (int)playerDelayTime_[mapEntry.first];
    200200                    const std::string& message = "Respawn in " +multi_cast<std::string>(output)+ " seconds." ;//Countdown
    201                     this->gtinfo_->sendFadingMessage(message,it->first->getClientID());
    202                 }
    203                 else if (it->second < 0.0f)
    204                 {
    205                     it->second = timeRemaining + 3.0f;//reset punishment-timer
    206                     if (playerGetLives(it->first) > 0)
     201                    this->gtinfo_->sendFadingMessage(message,mapEntry.first->getClientID());
     202                }
     203                else if (mapEntry.second < 0.0f)
     204                {
     205                    mapEntry.second = timeRemaining + 3.0f;//reset punishment-timer
     206                    if (playerGetLives(mapEntry.first) > 0)
    207207                    {
    208                         this->punishPlayer(it->first);
    209                         if (it->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
     208                        this->punishPlayer(mapEntry.first);
     209                        if (mapEntry.first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
    210210                            return;
    211211                        const std::string& message = ""; // resets Camper-Warning-message
    212                         this->gtinfo_->sendFadingMessage(message, it->first->getClientID());
     212                        this->gtinfo_->sendFadingMessage(message, mapEntry.first->getClientID());
    213213                    }
    214214                }
    215                 else if (it->second < timeRemaining/5)//Warning message
    216                 {
    217                   if (it->first->getClientID()== NETWORK_PEER_ID_UNKNOWN)
     215                else if (mapEntry.second < timeRemaining/5)//Warning message
     216                {
     217                  if (mapEntry.first->getClientID()== NETWORK_PEER_ID_UNKNOWN)
    218218                        continue;
    219219                    const std::string& message = "Camper Warning! Don't forget to shoot.";
    220                     this->gtinfo_->sendFadingMessage(message, it->first->getClientID());
     220                    this->gtinfo_->sendFadingMessage(message, mapEntry.first->getClientID());
    221221                }
    222222            }
     
    229229        int party = -1;
    230230        //find a player who survived
    231         for (std::map<PlayerInfo*, int>::iterator it = this->playerLives_.begin(); it != this->playerLives_.end(); ++it)
    232         {
    233           if (it->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
     231        for (const auto& mapEntry : this->playerLives_)
     232        {
     233          if (mapEntry.first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
    234234                continue;
    235235
    236             if (it->second > 0)//a player that is alive
     236            if (mapEntry.second > 0)//a player that is alive
    237237            {
    238238                //which party has survived?
    239                 std::map<PlayerInfo*, int>::iterator it2 = this->teamnumbers_.find(it->first);
     239                std::map<PlayerInfo*, int>::iterator it2 = this->teamnumbers_.find(mapEntry.first);
    240240                if (it2 != this->teamnumbers_.end())
    241241                {
     
    255255    {
    256256        int min = lives;
    257         for (std::map<PlayerInfo*, int>::iterator it = this->playerLives_.begin(); it != this->playerLives_.end(); ++it)
    258         {
    259             if (it->second <= 0)
     257        for (const auto& mapEntry : this->playerLives_)
     258        {
     259            if (mapEntry.second <= 0)
    260260                continue;
    261             if (it->second < lives)
    262                 min = it->second;
     261            if (mapEntry.second < lives)
     262                min = mapEntry.second;
    263263        }
    264264        return min;
  • code/branches/cpp11_v3/src/orxonox/gametypes/LastTeamStanding.h

    r9667 r11054  
    6767            std::map<PlayerInfo*, bool> inGame_; //!< Indicates each Player's state.
    6868
    69             virtual void spawnDeadPlayersIfRequested(); //!< Prevents dead players to respawn.
     69            virtual void spawnDeadPlayersIfRequested() override; //!< Prevents dead players to respawn.
    7070            virtual int getMinLives(); //!< Returns minimum of each player's lives; players with 0 lives are skipped;
    7171
     
    7474            virtual ~LastTeamStanding(); //!< Default Destructor.
    7575
    76             virtual void playerEntered(PlayerInfo* player); //!< Initializes values.
    77             virtual bool playerLeft(PlayerInfo* player); //!< Manages all local variables.
     76            virtual void playerEntered(PlayerInfo* player) override; //!< Initializes values.
     77            virtual bool playerLeft(PlayerInfo* player) override; //!< Manages all local variables.
    7878
    79             virtual bool allowPawnDeath(Pawn* victim, Pawn* originator = 0); //!< Manages each player's lost lives.
    80             virtual bool allowPawnDamage(Pawn* victim, Pawn* originator = 0); //!< If a player shoot's an opponent, his punishment countdown will be resetted.
    81             virtual void playerStartsControllingPawn(PlayerInfo* player, Pawn* pawn); //!< Resets punishment time and respawn delay.
    82             void tick (float dt); //!< used to end the game
    83             virtual void end(); //!< Sends an end message.
     79            virtual bool allowPawnDeath(Pawn* victim, Pawn* originator = nullptr) override; //!< Manages each player's lost lives.
     80            virtual bool allowPawnDamage(Pawn* victim, Pawn* originator = nullptr) override; //!< If a player shoot's an opponent, his punishment countdown will be resetted.
     81            virtual void playerStartsControllingPawn(PlayerInfo* player, Pawn* pawn) override; //!< Resets punishment time and respawn delay.
     82            virtual void tick (float dt) override; //!< used to end the game
     83            virtual void end() override; //!< Sends an end message.
    8484            void punishPlayer(PlayerInfo* player); //!< Function in order to kill a player. Punishment for hiding longer than "timeRemaining".
    8585            int playerGetLives(PlayerInfo* player); //!< getFunction for the map "playerLives_".
  • code/branches/cpp11_v3/src/orxonox/gametypes/Mission.cc

    r10624 r11054  
    101101    void Mission::setTeams()
    102102    { //Set pawn-colours
    103         for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it != ObjectList<Pawn>::end(); ++it)
     103        for (Pawn* pawn : ObjectList<Pawn>())
    104104        {
    105             Pawn* pawn = static_cast<Pawn*>(*it);
    106105            if (!pawn)
    107106                continue;
     
    111110    void Mission::endMission(bool accomplished)
    112111    {
    113         for (ObjectList<Mission>::iterator it = ObjectList<Mission>::begin(); it != ObjectList<Mission>::end(); ++it)
     112        for (Mission* mission : ObjectList<Mission>())
    114113        { //TODO: make sure that only the desired mission is ended !! This is a dirty HACK, that would end ALL missions!
    115             it->setMissionAccomplished(accomplished);
    116             it->end();
     114            mission->setMissionAccomplished(accomplished);
     115            mission->end();
    117116        }
    118117    }
     
    120119    void Mission::setLivesWrapper(unsigned int amount)
    121120    {
    122         for (ObjectList<Mission>::iterator it = ObjectList<Mission>::begin(); it != ObjectList<Mission>::end(); ++it)
     121        for (Mission* mission : ObjectList<Mission>())
    123122        { //TODO: make sure that only the desired mission is ended !! This is a dirty HACK, that would affect ALL missions!
    124             it->setLives(amount);
     123            mission->setLives(amount);
    125124        }
    126125    }
  • code/branches/cpp11_v3/src/orxonox/gametypes/Mission.h

    r9729 r11054  
    4242            virtual ~Mission() {}
    4343
    44             virtual void tick(float dt);
     44            virtual void tick(float dt) override;
    4545
    46             virtual void start();
    47             virtual void end();
     46            virtual void start() override;
     47            virtual void end() override;
    4848            virtual void setTeams();
    49             virtual void addBots(unsigned int amount){} //<! overwrite function in order to bypass the addbots command
     49            virtual void addBots(unsigned int amount) override{} //<! overwrite function in order to bypass the addbots command
    5050            inline void setLives(unsigned int amount)
    5151                {this->lives_ = amount;}
     
    5858
    5959        protected:
    60             virtual void pawnKilled(Pawn* victim, Pawn* killer = 0);
     60            virtual void pawnKilled(Pawn* victim, Pawn* killer = nullptr) override;
    6161            bool missionAccomplished_; //<! indicates if player successfully finsihed the mission;
    6262            int lives_; //<! amount of player's lives <-> nr. of retries
  • code/branches/cpp11_v3/src/orxonox/gametypes/TeamBaseMatch.cc

    r9667 r11054  
    152152        int amountControlled2 = 0;
    153153
    154         for (std::set<TeamBaseMatchBase*>::const_iterator it = this->bases_.begin(); it != this->bases_.end(); ++it)
    155         {
    156             if((*it)->getState() == BaseState::ControlTeam1)
     154        for (TeamBaseMatchBase* base : this->bases_)
     155        {
     156            if(base->getState() == BaseState::ControlTeam1)
    157157            {
    158158                amountControlled++;
    159159            }
    160             if((*it)->getState() == BaseState::ControlTeam2)
     160            if(base->getState() == BaseState::ControlTeam2)
    161161            {
    162162                amountControlled2++;
     
    187187            }
    188188
    189             for (std::map<PlayerInfo*, int>::iterator it = this->teamnumbers_.begin(); it != this->teamnumbers_.end(); ++it)
    190             {
    191                 if (it->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
     189            for (const auto& mapEntry : this->teamnumbers_)
     190            {
     191                if (mapEntry.first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
    192192                    continue;
    193193
    194                 if (it->second == winningteam)
    195                     this->gtinfo_->sendAnnounceMessage("You have won the match!", it->first->getClientID());
     194                if (mapEntry.second == winningteam)
     195                    this->gtinfo_->sendAnnounceMessage("You have won the match!", mapEntry.first->getClientID());
    196196                else
    197                     this->gtinfo_->sendAnnounceMessage("You have lost the match!", it->first->getClientID());
     197                    this->gtinfo_->sendAnnounceMessage("You have lost the match!", mapEntry.first->getClientID());
    198198            }
    199199
     
    238238        int count = 0;
    239239
    240         for (std::set<TeamBaseMatchBase*>::const_iterator it = this->bases_.begin(); it != this->bases_.end(); ++it)
    241         {
    242             if ((*it)->getState() == BaseState::ControlTeam1 && team == 0)
     240        for (TeamBaseMatchBase* base : this->bases_)
     241        {
     242            if (base->getState() == BaseState::ControlTeam1 && team == 0)
    243243                count++;
    244             if ((*it)->getState() == BaseState::ControlTeam2 && team == 1)
     244            if (base->getState() == BaseState::ControlTeam2 && team == 1)
    245245                count++;
    246246        }
     
    258258    {
    259259        unsigned int i = 0;
    260         for (std::set<TeamBaseMatchBase*>::const_iterator it = this->bases_.begin(); it != this->bases_.end(); ++it)
     260        for (TeamBaseMatchBase* base : this->bases_)
    261261        {
    262262            i++;
    263263            if (i > index)
    264                 return (*it);
    265         }
    266         return 0;
     264                return base;
     265        }
     266        return nullptr;
    267267    }
    268268
  • code/branches/cpp11_v3/src/orxonox/gametypes/TeamBaseMatch.h

    r9667 r11054  
    4444            virtual ~TeamBaseMatch() {}
    4545
    46             virtual bool allowPawnDeath(Pawn* victim, Pawn* originator = 0);
    47             virtual bool allowPawnDamage(Pawn* victim, Pawn* originator);
     46            virtual bool allowPawnDeath(Pawn* victim, Pawn* originator = nullptr) override;
     47            virtual bool allowPawnDamage(Pawn* victim, Pawn* originator) override;
    4848
    49             virtual void playerScored(PlayerInfo* player, int score = 1);
     49            virtual void playerScored(PlayerInfo* player, int score = 1) override;
    5050            virtual void showPoints();
    5151            virtual void endGame();
  • code/branches/cpp11_v3/src/orxonox/gametypes/TeamDeathmatch.cc

    r9941 r11054  
    6969        int winnerTeam = 0;
    7070        int highestScore = 0;
    71         for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
     71        for (const auto& mapEntry : this->players_)
    7272        {
    73             if ( this->getTeamScore(it->first) > highestScore )
     73            if ( this->getTeamScore(mapEntry.first) > highestScore )
    7474            {
    75                 winnerTeam = this->getTeam(it->first);
    76                 highestScore = this->getTeamScore(it->first);
     75                winnerTeam = this->getTeam(mapEntry.first);
     76                highestScore = this->getTeamScore(mapEntry.first);
    7777            }
    7878        }
  • code/branches/cpp11_v3/src/orxonox/gametypes/TeamDeathmatch.h

    r9941 r11054  
    4242
    4343            void setConfigValues();
    44             virtual void start();
    45             virtual void end();
    46             virtual void playerEntered(PlayerInfo* player);
    47             virtual bool playerLeft(PlayerInfo* player);
    48             virtual bool playerChangedName(PlayerInfo* player);
     44            virtual void start() override;
     45            virtual void end() override;
     46            virtual void playerEntered(PlayerInfo* player) override;
     47            virtual bool playerLeft(PlayerInfo* player) override;
     48            virtual bool playerChangedName(PlayerInfo* player) override;
    4949
    50             virtual void pawnKilled(Pawn* victim, Pawn* killer = 0);
    51             virtual void playerScored(PlayerInfo* player, int score = 1);
     50            virtual void pawnKilled(Pawn* victim, Pawn* killer = nullptr) override;
     51            virtual void playerScored(PlayerInfo* player, int score = 1) override;
    5252       protected:
    5353            int maxScore_;
  • code/branches/cpp11_v3/src/orxonox/gametypes/TeamGametype.cc

    r9941 r11054  
    7575    void TeamGametype::playerEntered(PlayerInfo* player)
    7676    {
    77         if(player == NULL) return; // catch null pointers
     77        if(player == nullptr) return; // catch null pointers
    7878        Gametype::playerEntered(player);
    7979        this->findAndSetTeam(player);
     
    9696    void TeamGametype::findAndSetTeam(PlayerInfo* player)
    9797    {
    98         if(player == NULL) return; // catch null pointers
     98        if(player == nullptr) return; // catch null pointers
    9999        std::vector<unsigned int> playersperteam(this->teams_, 0);
    100100
    101         for (std::map<PlayerInfo*, int>::iterator it = this->teamnumbers_.begin(); it != this->teamnumbers_.end(); ++it)
    102             if (it->second < static_cast<int>(this->teams_) && it->second >= 0)
    103                 playersperteam[it->second]++;
     101        for (const auto& mapEntry : this->teamnumbers_)
     102            if (mapEntry.second < static_cast<int>(this->teams_) && mapEntry.second >= 0)
     103                playersperteam[mapEntry.second]++;
    104104
    105105        unsigned int minplayers = static_cast<unsigned int>(-1);
     
    123123        if( (this->players_.size() >= maxPlayers_) && (allowedInGame_[player] == true) ) // if there's a "waiting list"
    124124        {
    125             for (std::map<PlayerInfo*, bool>::iterator it = this->allowedInGame_.begin(); it != this->allowedInGame_.end(); ++it)
    126             {
    127                  if(it->second == false) // waiting player found
    128                  {it->second = true; break;} // allow player to enter
     125            for (auto& mapEntry : this->allowedInGame_)
     126            {
     127                 if(mapEntry.second == false) // waiting player found
     128                 {mapEntry.second = true; break;} // allow player to enter
    129129            }
    130130        }
     
    141141    void TeamGametype::spawnDeadPlayersIfRequested()
    142142    {
    143         for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)\
    144         {
    145             if(allowedInGame_[it->first] == false)//check if dead player is allowed to enter
     143        for (const auto& mapEntry : this->players_)\
     144        {
     145            if(allowedInGame_[mapEntry.first] == false)//check if dead player is allowed to enter
    146146            {
    147147                continue;
    148148            }
    149             if (it->second.state_ == PlayerState::Dead)
    150             {
    151                 if ((it->first->isReadyToSpawn() || this->bForceSpawn_))
     149            if (mapEntry.second.state_ == PlayerState::Dead)
     150            {
     151                if ((mapEntry.first->isReadyToSpawn() || this->bForceSpawn_))
    152152                {
    153                    this->spawnPlayer(it->first);
     153                   this->spawnPlayer(mapEntry.first);
    154154                }
    155155            }
     
    178178        if(!player || this->getTeam(player) == -1)
    179179            return 0;
    180         for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
    181         {
    182             if ( this->getTeam(it->first) ==  this->getTeam(player) )
    183             {
    184                 teamscore += it->second.frags_;
     180        for (const auto& mapEntry : this->players_)
     181        {
     182            if ( this->getTeam(mapEntry.first) ==  this->getTeam(player) )
     183            {
     184                teamscore += mapEntry.second.frags_;
    185185            }
    186186        }
     
    191191    {
    192192        int teamSize = 0;
    193         for (std::map<PlayerInfo*, int>::iterator it = this->teamnumbers_.begin(); it != this->teamnumbers_.end(); ++it)
    194         {
    195             if (it->second == team)
     193        for (const auto& mapEntry : this->teamnumbers_)
     194        {
     195            if (mapEntry.second == team)
    196196                teamSize++;
    197197        }
     
    202202    {
    203203        int teamSize = 0;
    204         for (std::map<PlayerInfo*, int>::iterator it = this->teamnumbers_.begin(); it != this->teamnumbers_.end(); ++it)
    205         {
    206             if (it->second == team  && it->first->isHumanPlayer())
     204        for (const auto& mapEntry : this->teamnumbers_)
     205        {
     206            if (mapEntry.second == team  && mapEntry.first->isHumanPlayer())
    207207                teamSize++;
    208208        }
     
    235235        }
    236236
    237         SpawnPoint* fallbackSpawnPoint = NULL;
     237        SpawnPoint* fallbackSpawnPoint = nullptr;
    238238        if (teamSpawnPoints.size() > 0)
    239239        {
     
    241241            unsigned int index = 0;
    242242            // Get random fallback spawnpoint in case there is no active SpawnPoint.
    243             for (std::set<SpawnPoint*>::const_iterator it = teamSpawnPoints.begin(); it != teamSpawnPoints.end(); ++it)
     243            for (SpawnPoint* teamSpawnPoint : teamSpawnPoints)
    244244            {
    245245                if (index == randomspawn)
    246246                {
    247                     fallbackSpawnPoint = (*it);
     247                    fallbackSpawnPoint = teamSpawnPoint;
    248248                    break;
    249249                }
     
    266266            randomspawn = static_cast<unsigned int>(rnd(static_cast<float>(teamSpawnPoints.size())));
    267267            index = 0;
    268             for (std::set<SpawnPoint*>::const_iterator it = teamSpawnPoints.begin(); it != teamSpawnPoints.end(); ++it)
     268            for (SpawnPoint* teamSpawnPoint : teamSpawnPoints)
    269269            {
    270270                if (index == randomspawn)
    271                     return (*it);
     271                    return teamSpawnPoint;
    272272
    273273                ++index;
     
    277277        }
    278278
    279         return 0;
     279        return nullptr;
    280280    }
    281281
     
    328328    void TeamGametype::setDefaultObjectColour(Pawn* pawn)
    329329    {
    330         if(pawn == NULL)
     330        if(pawn == nullptr)
    331331            return;
    332332
     
    340340        ControllableEntity* entity = orxonox_cast<ControllableEntity*>(pawn);
    341341
    342         Controller* controller = 0;
     342        Controller* controller = nullptr;
    343343        if (entity->getController())
    344344            controller = entity->getController();
     
    350350        ArtificialController* artificial =  orxonox_cast<ArtificialController*>(controller);
    351351        //get Teamnumber - get the data
    352         if(artificial == NULL)
     352        if(artificial == nullptr)
    353353            return;
    354354        teamnumber= artificial->getTeam();
     
    360360    void TeamGametype::colourPawn(Pawn* pawn, int teamNr)
    361361    {// catch: no-colouring-case and wrong input
    362         if(teamNr < 0 || teamNr+1 > int(this->teamcolours_.size()) ||pawn == NULL) return;
     362        if(teamNr < 0 || teamNr+1 > int(this->teamcolours_.size()) ||pawn == nullptr) return;
    363363        pawn->setRadarObjectColour(this->teamcolours_[teamNr]);
    364364
    365365        std::set<WorldEntity*> pawnAttachments = pawn->getAttachedObjects();
    366         for (std::set<WorldEntity*>::iterator it = pawnAttachments.begin(); it != pawnAttachments.end(); ++it)
    367         {
    368             if ((*it)->isA(Class(TeamColourable)))
    369             {
    370                 TeamColourable* tc = orxonox_cast<TeamColourable*>(*it);
     366        for (WorldEntity* pawnAttachment : pawnAttachments)
     367        {
     368            if (pawnAttachment->isA(Class(TeamColourable)))
     369            {
     370                TeamColourable* tc = orxonox_cast<TeamColourable*>(pawnAttachment);
    371371                tc->setTeamColour(this->teamcolours_[teamNr]);
    372372            }
     
    376376    void TeamGametype::announceTeamWin(int winnerTeam)
    377377    {
    378         for (std::map<PlayerInfo*, int>::iterator it3 = this->teamnumbers_.begin(); it3 != this->teamnumbers_.end(); ++it3)
    379         {
    380             if (it3->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
     378        for (const auto& mapEntry : this->teamnumbers_)
     379        {
     380            if (mapEntry.first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
    381381                continue;
    382             if (it3->second == winnerTeam)
    383             {
    384                 this->gtinfo_->sendAnnounceMessage("Your team has won the match!", it3->first->getClientID());
     382            if (mapEntry.second == winnerTeam)
     383            {
     384                this->gtinfo_->sendAnnounceMessage("Your team has won the match!", mapEntry.first->getClientID());
    385385            }
    386386            else
    387387            {
    388                 this->gtinfo_->sendAnnounceMessage("Your team has lost the match!", it3->first->getClientID());
     388                this->gtinfo_->sendAnnounceMessage("Your team has lost the match!", mapEntry.first->getClientID());
    389389            }
    390390        }   
  • code/branches/cpp11_v3/src/orxonox/gametypes/TeamGametype.h

    r9941 r11054  
    4646            void setConfigValues();
    4747
    48             virtual void playerEntered(PlayerInfo* player);
     48            virtual void playerEntered(PlayerInfo* player) override;
    4949            virtual void findAndSetTeam(PlayerInfo* player);
    50             virtual bool playerLeft(PlayerInfo* player);
    51             virtual void spawnDeadPlayersIfRequested(); //!< Prevents players to respawn.
     50            virtual bool playerLeft(PlayerInfo* player) override;
     51            virtual void spawnDeadPlayersIfRequested() override; //!< Prevents players to respawn.
    5252
    53             virtual bool allowPawnHit(Pawn* victim, Pawn* originator = 0);
    54             virtual bool allowPawnDamage(Pawn* victim, Pawn* originator = 0);
    55             virtual bool allowPawnDeath(Pawn* victim, Pawn* originator = 0);
     53            virtual bool allowPawnHit(Pawn* victim, Pawn* originator = nullptr) override;
     54            virtual bool allowPawnDamage(Pawn* victim, Pawn* originator = nullptr) override;
     55            virtual bool allowPawnDeath(Pawn* victim, Pawn* originator = nullptr) override;
    5656
    57             virtual void playerStartsControllingPawn(PlayerInfo* player, Pawn* pawn);
     57            virtual void playerStartsControllingPawn(PlayerInfo* player, Pawn* pawn) override;
    5858
    5959
     
    6767
    6868        protected:
    69             virtual SpawnPoint* getBestSpawnPoint(PlayerInfo* player) const;
     69            virtual SpawnPoint* getBestSpawnPoint(PlayerInfo* player) const override;
    7070            bool pawnsAreInTheSameTeam(Pawn* pawn1, Pawn* pawn2);
    7171
  • code/branches/cpp11_v3/src/orxonox/gametypes/UnderAttack.cc

    r9941 r11054  
    4848        this->gameTime_ = 180;
    4949        this->teams_ = 2;
    50         this->destroyer_ = 0;
     50        this->destroyer_ = nullptr;
    5151        this->destroyer_.setCallback(createFunctor(&UnderAttack::killedDestroyer, this));
    5252        this->gameEnded_ = false;
     
    7474        this->gameEnded_ = true;
    7575
    76         for (std::map<PlayerInfo*, int>::iterator it = this->teamnumbers_.begin(); it != this->teamnumbers_.end(); ++it)
    77         {
    78             if (it->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
     76        for (const auto& mapEntry : this->teamnumbers_)
     77        {
     78            if (mapEntry.first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
    7979                continue;
    8080
    81             if (it->second == attacker_)
    82                 this->gtinfo_->sendAnnounceMessage("You have won the match!", it->first->getClientID());
     81            if (mapEntry.second == attacker_)
     82                this->gtinfo_->sendAnnounceMessage("You have won the match!", mapEntry.first->getClientID());
    8383            else
    84                 this->gtinfo_->sendAnnounceMessage("You have lost the match!", it->first->getClientID());
     84                this->gtinfo_->sendAnnounceMessage("You have lost the match!", mapEntry.first->getClientID());
    8585        }
    8686    }
     
    155155                ChatManager::message(message);
    156156
    157                 for (std::map<PlayerInfo*, int>::iterator it = this->teamnumbers_.begin(); it != this->teamnumbers_.end(); ++it)
    158                 {
    159                     if (it->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
     157                for (const auto& mapEntry : this->teamnumbers_)
     158                {
     159                    if (mapEntry.first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
    160160                        continue;
    161161
    162                     if (it->second == 1)
    163                         this->gtinfo_->sendAnnounceMessage("You have won the match!", it->first->getClientID());
     162                    if (mapEntry.second == 1)
     163                        this->gtinfo_->sendAnnounceMessage("You have won the match!", mapEntry.first->getClientID());
    164164                    else
    165                         this->gtinfo_->sendAnnounceMessage("You have lost the match!", it->first->getClientID());
     165                        this->gtinfo_->sendAnnounceMessage("You have lost the match!", mapEntry.first->getClientID());
    166166                }
    167167            }
     
    202202    void UnderAttack::setTransporterHealth()
    203203    {
    204         if (this->destroyer_ != 0)
     204        if (this->destroyer_ != nullptr)
    205205        {
    206206            //Calculation: Each attacker deals about 3500 damage. A human attacker deals 1500 damage additionally.
  • code/branches/cpp11_v3/src/orxonox/gametypes/UnderAttack.h

    r9941 r11054  
    4343
    4444            void setConfigValues();
    45             void tick (float dt);
     45            virtual void tick (float dt) override;
    4646            void addDestroyer(Destroyer* destroyer);
    4747            inline Destroyer* getDestroyer() const
    4848                { return this->destroyer_; }
    4949
    50             virtual bool allowPawnHit(Pawn* victim, Pawn* originator = 0);
    51             virtual bool allowPawnDamage(Pawn* victim, Pawn* originator = 0);
    52             virtual bool allowPawnDeath(Pawn* victim, Pawn* originator = 0);
    53             virtual void playerEntered(PlayerInfo* player);
     50            virtual bool allowPawnHit(Pawn* victim, Pawn* originator = nullptr) override;
     51            virtual bool allowPawnDamage(Pawn* victim, Pawn* originator = nullptr) override;
     52            virtual bool allowPawnDeath(Pawn* victim, Pawn* originator = nullptr) override;
     53            virtual void playerEntered(PlayerInfo* player) override;
    5454
    5555        protected:
  • code/branches/cpp11_v3/src/orxonox/graphics/AnimatedModel.h

    r9667 r11054  
    4444            virtual ~AnimatedModel();
    4545
    46             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
     46            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
    4747            void registerVariables();
    4848
     
    5151            virtual void setAnimEnabled(bool enabled);
    5252            virtual void setAnimLoop(bool loop);
    53             virtual void tick(float dt);
     53            virtual void tick(float dt) override;
    5454            virtual void changedMesh();
    5555
  • code/branches/cpp11_v3/src/orxonox/graphics/Backlight.cc

    r9667 r11054  
    5151        RegisterObject(Backlight);
    5252
    53         this->ribbonTrail_ = 0;
    54         this->ribbonTrailNode_ = 0;
     53        this->ribbonTrail_ = nullptr;
     54        this->ribbonTrailNode_ = nullptr;
    5555
    5656        this->width_ = 0;
  • code/branches/cpp11_v3/src/orxonox/graphics/Backlight.h

    r9667 r11054  
    4444            virtual ~Backlight();
    4545
    46             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
     46            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
    4747
    48             virtual void tick(float dt);
    49             virtual void changedVisibility();
     48            virtual void tick(float dt) override;
     49            virtual void changedVisibility() override;
    5050
    5151            inline void setWidth(float width)
     
    7474                { return this->trailmaterial_; }
    7575
    76             virtual void changedScale();
     76            virtual void changedScale() override;
    7777
    7878        protected:
    79             virtual void changedTimeFactor(float factor_new, float factor_old);
     79            virtual void changedTimeFactor(float factor_new, float factor_old) override;
    8080
    8181        private:
    8282            void registerVariables();
    83             virtual void startturnonoff();
    84             virtual void stopturnonoff();
    85             virtual void poststopturnonoff();
    86             virtual void changedColour();
     83            virtual void startturnonoff() override;
     84            virtual void stopturnonoff() override;
     85            virtual void poststopturnonoff() override;
     86            virtual void changedColour() override;
    8787            void update_width();
    8888            void update_lifetime();
  • code/branches/cpp11_v3/src/orxonox/graphics/Billboard.cc

    r9667 r11054  
    139139    {
    140140        Ogre::BillboardSet* bSet = this->billboard_.getBillboardSet();
    141         if( bSet != NULL )
     141        if( bSet != nullptr )
    142142        {
    143143            bSet->setBillboardType(bbt);
     
    148148    {
    149149        Ogre::BillboardSet* bSet = this->billboard_.getBillboardSet();
    150         if( bSet != NULL )
     150        if( bSet != nullptr )
    151151        {
    152152            bSet->setCommonDirection( vec );
     
    157157    {
    158158        Ogre::BillboardSet* bSet = this->billboard_.getBillboardSet();
    159         if( bSet != NULL )
     159        if( bSet != nullptr )
    160160        {
    161161            bSet->setCommonUpVector( vec );
     
    166166    {
    167167        Ogre::BillboardSet* bSet = this->billboard_.getBillboardSet();
    168         if( bSet != NULL )
     168        if( bSet != nullptr )
    169169        {
    170170            bSet->setDefaultDimensions(width, height);
  • code/branches/cpp11_v3/src/orxonox/graphics/Billboard.h

    r9667 r11054  
    4747            virtual ~Billboard();
    4848
    49             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
     49            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
    5050
    51             virtual void changedVisibility();
     51            virtual void changedVisibility() override;
    5252
    5353            inline const BillboardSet& getBillboardSet() const
     
    7171
    7272
    73             virtual void setTeamColour(const ColourValue& colour)
     73            virtual void setTeamColour(const ColourValue& colour) override
    7474                { this->setColour(colour); }
    7575               
  • code/branches/cpp11_v3/src/orxonox/graphics/BlinkingBillboard.h

    r9667 r11054  
    4444            virtual ~BlinkingBillboard();
    4545
    46             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
     46            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
    4747
    48             virtual void tick(float dt);
     48            virtual void tick(float dt) override;
    4949
    5050            inline void setAmplitude(float amplitude)
  • code/branches/cpp11_v3/src/orxonox/graphics/Camera.h

    r9667 r11054  
    5050
    5151            void setConfigValues();
    52             virtual void tick(float dt);
     52            virtual void tick(float dt) override;
    5353
    5454            void requestFocus();
     
    7272            void configvaluecallback_changedNearClipDistance();
    7373
    74             void windowResized(unsigned int newWidth, unsigned int newHeight);
     74            virtual void windowResized(unsigned int newWidth, unsigned int newHeight) override;
    7575
    7676            Ogre::Camera*    camera_;
  • code/branches/cpp11_v3/src/orxonox/graphics/FadingBillboard.h

    r9667 r11054  
    4545            virtual ~FadingBillboard();
    4646
    47             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
     47            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
    4848
    49             virtual void tick(float dt);
    50             virtual void changedActivity();
    51             virtual void changedVisibility();
     49            virtual void tick(float dt) override;
     50            virtual void changedActivity() override;
     51            virtual void changedVisibility() override;
    5252
    5353            inline void setTurnOnTime(float turnontime)
     
    6969            virtual void stopturnonoff();
    7070            virtual void poststopturnonoff();
    71             virtual void changedColour();
     71            virtual void changedColour() override;
    7272
    7373            float turnontime_;
  • code/branches/cpp11_v3/src/orxonox/graphics/GlobalShader.h

    r9667 r11054  
    4444            virtual ~GlobalShader();
    4545
    46             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
     46            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
    4747
    48             virtual void changedVisibility();
     48            virtual void changedVisibility() override;
    4949
    5050            inline const Shader& getShader() const
  • code/branches/cpp11_v3/src/orxonox/graphics/Light.cc

    r9667 r11054  
    3131#include <OgreSceneManager.h>
    3232#include <OgreLight.h>
    33 #include <boost/static_assert.hpp>
    3433
    3534#include "util/StringUtils.h"
     
    4544
    4645    // Be sure we don't do bad conversions
    47     BOOST_STATIC_ASSERT((int)Ogre::Light::LT_POINT       == (int)Light::Point);
    48     BOOST_STATIC_ASSERT((int)Ogre::Light::LT_DIRECTIONAL == (int)Light::Directional);
    49     BOOST_STATIC_ASSERT((int)Ogre::Light::LT_SPOTLIGHT   == (int)Light::Spotlight);
     46    static_assert((int)Ogre::Light::LT_POINT       == (int)Light::Point,       "check enum");
     47    static_assert((int)Ogre::Light::LT_DIRECTIONAL == (int)Light::Directional, "check enum");
     48    static_assert((int)Ogre::Light::LT_SPOTLIGHT   == (int)Light::Spotlight,   "check enum");
    5049
    5150    Light::Light(Context* context) : StaticEntity(context)
     
    5352        RegisterObject(Light);
    5453
    55         this->light_ = 0;
     54        this->light_ = nullptr;
    5655        this->diffuse_ = ColourValue::White;
    5756        this->specular_ = ColourValue::White;
  • code/branches/cpp11_v3/src/orxonox/graphics/Light.h

    r9667 r11054  
    5656            virtual ~Light();
    5757
    58             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
     58            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
    5959
    60             virtual void changedVisibility();
     60            virtual void changedVisibility() override;
    6161
    6262            inline Ogre::Light* getLight()
     
    7878                { return this->specular_; }
    7979
    80             virtual void setTeamColour(const ColourValue& colour)
     80            virtual void setTeamColour(const ColourValue& colour) override
    8181                { this->setDiffuseColour(colour); this->setSpecularColour(colour); }
    8282
  • code/branches/cpp11_v3/src/orxonox/graphics/MeshLodInformation.h

    r9667 r11054  
    5050            float getReductionRate(){ return this->reductionRate_; }
    5151
    52             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
     52            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
    5353
    5454        private:
  • code/branches/cpp11_v3/src/orxonox/graphics/Model.cc

    r10728 r11054  
    134134            Level* level = this->getLevel();
    135135
    136             assert( level != 0 );
     136            assert( level != nullptr );
    137137
    138138            MeshLodInformation* lodInfo = level->getLodInfo(this->meshSrc_);
     
    157157                BaseObject* creatorPtr = this;
    158158
    159                 while(creatorPtr!=NULL&&orxonox_cast<WorldEntity*>(creatorPtr))
     159                while(creatorPtr!=nullptr&&orxonox_cast<WorldEntity*>(creatorPtr))
    160160                {
    161161                    scaleFactor *= getBiggestScale(((WorldEntity*) creatorPtr)->getScale3D());
  • code/branches/cpp11_v3/src/orxonox/graphics/Model.h

    r9667 r11054  
    4646            void setConfigValues();
    4747
    48             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
     48            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
    4949
    50             virtual void changedVisibility();
     50            virtual void changedVisibility() override;
    5151
    5252            inline const Mesh& getMesh() const
  • code/branches/cpp11_v3/src/orxonox/graphics/ParticleEmitter.cc

    r9950 r11054  
    5252            ThrowException(AbortLoading, "Can't create ParticleEmitter, no scene or no scene manager given.");
    5353
    54         this->particles_ = 0;
     54        this->particles_ = nullptr;
    5555        this->LOD_ = LODParticle::Normal;
    5656
     
    102102        {
    103103            delete this->particles_;
    104             this->particles_ = 0;
     104            this->particles_ = nullptr;
    105105        }
    106106
  • code/branches/cpp11_v3/src/orxonox/graphics/ParticleEmitter.h

    r9950 r11054  
    4343            virtual ~ParticleEmitter();
    4444
    45             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
     45            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
    4646
    47             virtual void changedVisibility();
    48             virtual void changedActivity();
     47            virtual void changedVisibility() override;
     48            virtual void changedActivity() override;
    4949
    5050            inline ParticleInterface* getParticleInterface() const
  • code/branches/cpp11_v3/src/orxonox/graphics/ParticleSpawner.h

    r9667 r11054  
    4343            virtual ~ParticleSpawner();
    4444
    45             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    46             virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode);
     45            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
     46            virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode) override;
    4747
    4848            inline void stop(bool bDestroy)
  • code/branches/cpp11_v3/src/orxonox/infos/Bot.h

    r9667 r11054  
    4545            void setConfigValues();
    4646
    47             inline bool isInitialized() const
     47            virtual inline bool isInitialized() const override
    4848                { return true; }
    49             inline float getPing() const
     49            virtual inline float getPing() const override
    5050                { return 0; }
    51             inline float getPacketLossRatio() const
     51            virtual inline float getPacketLossRatio() const override
    5252                { return 0; }
    5353
  • code/branches/cpp11_v3/src/orxonox/infos/GametypeInfo.cc

    r10624 r11054  
    461461    void GametypeInfo::dispatchAnnounceMessage(const std::string& message) const
    462462    {
    463         for (ObjectList<GametypeMessageListener>::iterator it = ObjectList<GametypeMessageListener>::begin(); it != ObjectList<GametypeMessageListener>::end(); ++it)
    464             it->announcemessage(this, message);
     463        for (GametypeMessageListener* listener : ObjectList<GametypeMessageListener>())
     464            listener->announcemessage(this, message);
    465465    }
    466466
    467467    void GametypeInfo::dispatchKillMessage(const std::string& message) const
    468468    {
    469         for (ObjectList<GametypeMessageListener>::iterator it = ObjectList<GametypeMessageListener>::begin(); it != ObjectList<GametypeMessageListener>::end(); ++it)
    470             it->killmessage(this, message);
     469        for (GametypeMessageListener* listener : ObjectList<GametypeMessageListener>())
     470            listener->killmessage(this, message);
    471471    }
    472472
    473473    void GametypeInfo::dispatchDeathMessage(const std::string& message) const
    474474    {
    475         for (ObjectList<GametypeMessageListener>::iterator it = ObjectList<GametypeMessageListener>::begin(); it != ObjectList<GametypeMessageListener>::end(); ++it)
    476             it->deathmessage(this, message);
     475        for (GametypeMessageListener* listener : ObjectList<GametypeMessageListener>())
     476            listener->deathmessage(this, message);
    477477    }
    478478
    479479     void GametypeInfo::dispatchStaticMessage(const std::string& message, const ColourValue& colour) const
    480480    {
    481         for (ObjectList<GametypeMessageListener>::iterator it = ObjectList<GametypeMessageListener>::begin(); it != ObjectList<GametypeMessageListener>::end(); ++it)
    482             it->staticmessage(this, message, colour);
     481        for (GametypeMessageListener* listener : ObjectList<GametypeMessageListener>())
     482            listener->staticmessage(this, message, colour);
    483483    }
    484484
    485485     void GametypeInfo::dispatchFadingMessage(const std::string& message) const
    486486    {
    487         for (ObjectList<GametypeMessageListener>::iterator it = ObjectList<GametypeMessageListener>::begin(); it != ObjectList<GametypeMessageListener>::end(); ++it)
    488             it->fadingmessage(this, message);
     487        for (GametypeMessageListener* listener : ObjectList<GametypeMessageListener>())
     488            listener->fadingmessage(this, message);
    489489    }
    490490}
  • code/branches/cpp11_v3/src/orxonox/infos/HumanPlayer.cc

    r10624 r11054  
    5353        this->defaultController_ = Class(NewHumanController);
    5454
    55         this->humanHud_ = 0;
    56         this->gametypeHud_ = 0;
     55        this->humanHud_ = nullptr;
     56        this->gametypeHud_ = nullptr;
    5757
    5858        this->setConfigValues();
     
    178178        {
    179179            this->humanHud_->destroy();
    180             this->humanHud_ = 0;
     180            this->humanHud_ = nullptr;
    181181        }
    182182
     
    194194        {
    195195            this->gametypeHud_->destroy();
    196             this->gametypeHud_ = 0;
     196            this->gametypeHud_ = nullptr;
    197197        }
    198198
  • code/branches/cpp11_v3/src/orxonox/infos/HumanPlayer.h

    r10624 r11054  
    4545            void setConfigValues();
    4646
    47             bool isInitialized() const;
    48             float getPing() const;
    49             float getPacketLossRatio() const;
     47            virtual bool isInitialized() const override;
     48            virtual float getPing() const override;
     49            virtual float getPacketLossRatio() const override;
    5050
    5151            void setClientID(unsigned int clientID);
    5252
    53             virtual void switchGametype(Gametype* gametype);
     53            virtual void switchGametype(Gametype* gametype) override;
    5454
    5555            inline void setHumanHUDTemplate(const std::string& name)
  • code/branches/cpp11_v3/src/orxonox/infos/PlayerInfo.cc

    r11052 r11054  
    5151        this->bReadyToSpawn_ = false;
    5252        this->bSetUnreadyAfterSpawn_ = true;
    53         this->controller_ = 0;
    54         this->controllableEntity_ = 0;
     53        this->controller_ = nullptr;
     54        this->controllableEntity_ = nullptr;
    5555        this->controllableEntityID_ = OBJECTID_UNKNOWN;
    5656
    57         this->gtinfo_ = 0;
     57        this->gtinfo_ = nullptr;
    5858        this->gtinfoID_ = OBJECTID_UNKNOWN;
    5959        this->updateGametypeInfo(this->getGametype());
     
    7272            {
    7373                this->controller_->destroy();
    74                 this->controller_ = 0;
     74                this->controller_ = nullptr;
    7575            }
    7676
     
    126126    void PlayerInfo::updateGametypeInfo(Gametype* gametype)
    127127    {
    128         this->gtinfo_ = 0;
     128        this->gtinfo_ = nullptr;
    129129        this->gtinfoID_ = OBJECTID_UNKNOWN;
    130130
     
    141141        {
    142142            this->controller_->destroy();
    143             this->controller_ = 0;
     143            this->controller_ = nullptr;
    144144        }
    145145        this->controller_ = this->defaultController_.fabricate(this->getContext());
     
    181181
    182182        RadarViewable* radarviewable = orxonox_cast<RadarViewable*>(entity);
    183         if (radarviewable != NULL)
     183        if (radarviewable != nullptr)
    184184            radarviewable->setRadarName(this->getName());
    185185    }
     
    218218            return;
    219219
    220         this->controllableEntity_->setController(0);
    221         this->controllableEntity_ = 0;
     220        this->controllableEntity_->setController(nullptr);
     221        this->controllableEntity_ = nullptr;
    222222        this->controllableEntityID_ = OBJECTID_UNKNOWN;
    223223
    224224        if (this->controller_)
    225             this->controller_->setControllableEntity(0);
     225            this->controller_->setControllableEntity(nullptr);
    226226
    227227        if ( GameMode::isMaster() )
     
    239239
    240240        Controller* tmp =this->controllableEntity_->getController();
    241         if (tmp == NULL)
    242         {
    243             orxout(verbose) <<  "PlayerInfo: pauseControl, Controller is NULL " << endl;
     241        if (tmp == nullptr)
     242        {
     243            orxout(verbose) <<  "PlayerInfo: pauseControl, Controller is nullptr " << endl;
    244244            return;
    245245        }
    246246        tmp->setActive(false);
    247         //this->controllableEntity_->getController()->setControllableEntity(NULL);
    248         this->controllableEntity_->setController(0);
     247        //this->controllableEntity_->getController()->setControllableEntity(nullptr);
     248        this->controllableEntity_->setController(nullptr);
    249249    }
    250250
     
    253253        ControllableEntity* entity = this->controllableEntity_;
    254254
    255         assert(this->controllableEntity_ != NULL);
     255        assert(this->controllableEntity_ != nullptr);
    256256        if( !entity || this->previousControllableEntity_.size() == 0 )
    257257            return;
     
    259259        entity->destroyHud(); // HACK-ish
    260260
    261         this->controllableEntity_->setController(0);
     261        this->controllableEntity_->setController(nullptr);
    262262        if(this->isHumanPlayer()) // TODO: Multiplayer?
    263263            this->controllableEntity_->destroyHud(); // HACK-ish
     
    266266        do {
    267267            this->controllableEntity_ = this->previousControllableEntity_.back();
    268         } while(this->controllableEntity_ == NULL && this->previousControllableEntity_.size() > 0);
     268        } while(this->controllableEntity_ == nullptr && this->previousControllableEntity_.size() > 0);
    269269        this->controllableEntityID_ = this->controllableEntity_->getObjectID();
    270270        this->previousControllableEntity_.pop_back();
    271271
    272         if ( this->controllableEntity_ != NULL && this->controller_ != NULL)
     272        if ( this->controllableEntity_ != nullptr && this->controller_ != nullptr)
    273273            this->controller_->setControllableEntity(this->controllableEntity_);
    274274
    275275         // HACK-ish
    276         if(this->controllableEntity_ != NULL && this->isHumanPlayer())
     276        if(this->controllableEntity_ != nullptr && this->isHumanPlayer())
    277277            this->controllableEntity_->createHud();
    278278
  • code/branches/cpp11_v3/src/orxonox/infos/PlayerInfo.h

    r10624 r11054  
    4444            virtual ~PlayerInfo();
    4545
    46             virtual void changedName();
     46            virtual void changedName() override;
    4747            virtual void switchGametype(Gametype* gametype);
    4848
     
    9999            Controller* controller_;
    100100            ControllableEntity* controllableEntity_;
    101             std::vector< WeakPtr<ControllableEntity> > previousControllableEntity_; //!< List of the previous ControllableEntities if repeatedly startTemporary control was called. The ControllableEntity at the back is the most recent.
     101            std::vector<WeakPtr<ControllableEntity>> previousControllableEntity_; //!< List of the previous ControllableEntities if repeatedly startTemporary control was called. The ControllableEntity at the back is the most recent.
    102102            unsigned int controllableEntityID_;
    103103
  • code/branches/cpp11_v3/src/orxonox/interfaces/NotificationListener.cc

    r10624 r11054  
    108108    {
    109109        // Iterate through all NotificationListeners and notify them by calling the method they overloaded.
    110         for(ObjectList<NotificationListener>::iterator it = ObjectList<NotificationListener>::begin(); it != ObjectList<NotificationListener>::end(); ++it)
     110        for(NotificationListener* listener : ObjectList<NotificationListener>())
    111111        {
    112112            // If the notification is a message.
    113113            if(!isCommand)
    114                 it->registerNotification(message, sender, notificationMessageType::Value(messageType));
     114                listener->registerNotification(message, sender, notificationMessageType::Value(messageType));
    115115
    116116            // If the notification is a command.
     
    119119                notificationCommand::Value command = str2Command(message);
    120120                if(command != notificationCommand::none)
    121                     it->executeCommand(command, sender);
     121                    listener->executeCommand(command, sender);
    122122            }
    123123        }
  • code/branches/cpp11_v3/src/orxonox/interfaces/PickupCarrier.cc

    r10624 r11054  
    101101        // Go recursively through all children to check whether they are a target.
    102102        std::vector<PickupCarrier*>* children = this->getCarrierChildren();
    103         for(std::vector<PickupCarrier*>::const_iterator it = children->begin(); it != children->end(); it++)
     103        for(PickupCarrier* carrier : *children)
    104104        {
    105             if((*it)->isTarget(pickup))
     105            if(carrier->isTarget(pickup))
    106106            {
    107107                isTarget = true;
     
    127127    {
    128128        if(!this->isTarget(pickup))
    129             return NULL;
     129            return nullptr;
    130130
    131131        if(pickup->isTarget(this)) // If the PickupCarrier itself is a target.
    132132            return this;
    133133
    134         PickupCarrier* target = NULL;
     134        PickupCarrier* target = nullptr;
    135135        // Go recursively through all children to check whether they are the target.
    136136        std::vector<PickupCarrier*>* children = this->getCarrierChildren();
    137         for(std::vector<PickupCarrier*>::iterator it = children->begin(); it != children->end(); it++)
     137        for(PickupCarrier* child : *children)
    138138        {
    139             if(pickup->isTarget(*it))
     139            if(pickup->isTarget(child))
    140140            {
    141                 target = *it;
     141                target = child;
    142142                break;
    143143            }
  • code/branches/cpp11_v3/src/orxonox/interfaces/PickupCarrier.h

    r9667 r11054  
    5959        But this structure has to be established first.
    6060        - <b>getCarrierChildren()</b> To this end a PickupCarrier needs to implement getCarrierChildren() which returns a list of its direct PickupCarrier children. If you need an example, have a look at @ref orxonox::Pawn "Pawn" and @ref orxonox::Engine "Engine".
    61         - <b>getCarrierParent()</b> This is the method in the other direction. It returns the parent of this PickupCarrier, or NULL if the PickupCarrier is a root node in this hierarchy.
     61        - <b>getCarrierParent()</b> This is the method in the other direction. It returns the parent of this PickupCarrier, or nullptr if the PickupCarrier is a root node in this hierarchy.
    6262
    6363    @author
     
    7777            PickupCarrier(); //!< Constructor.
    7878            virtual ~PickupCarrier(); //!< Destructor.
    79             void preDestroy(void); //!< Is called before the PickupCarrier is effectively destroyed.
     79            virtual void preDestroy(void) override; //!< Is called before the PickupCarrier is effectively destroyed.
    8080
    8181            bool isTarget(const Pickupable* pickup) const; //!< Can be used to check whether the PickupCarrier or a child of his is a target ot the input Pickupable.
  • code/branches/cpp11_v3/src/orxonox/interfaces/PickupListener.cc

    r10624 r11054  
    7474
    7575        // Iterate through all PickupListeners and notify them by calling the method they overloaded.
    76         for(ObjectList<PickupListener>::iterator it = ObjectList<PickupListener>::begin(); it != ObjectList<PickupListener>::end(); ++it)
    77             it->pickupChangedUsed(pickup, used);
     76        for(PickupListener* listener : ObjectList<PickupListener>())
     77            listener->pickupChangedUsed(pickup, used);
    7878    }
    7979
     
    9292
    9393        // Iterate through all PickupListeners and notify them by calling the method they overloaded.
    94         for(ObjectList<PickupListener>::iterator it = ObjectList<PickupListener>::begin(); it != ObjectList<PickupListener>::end(); ++it)
    95             it->pickupChangedPickedUp(pickup, pickedUp);
     94        for(PickupListener* listener : ObjectList<PickupListener>())
     95            listener->pickupChangedPickedUp(pickup, pickedUp);
    9696    }
    9797
  • code/branches/cpp11_v3/src/orxonox/interfaces/Pickupable.cc

    r10624 r11054  
    5656        RegisterObject(Pickupable);
    5757
    58         this->carrier_ = NULL;
     58        this->carrier_ = nullptr;
    5959
    6060        this->beingDestroyed_ = false;
     
    143143    bool Pickupable::isTarget(const PickupCarrier* carrier) const
    144144    {
    145         if(carrier == NULL)
     145        if(carrier == nullptr)
    146146            return false;
    147147
     
    160160    {
    161161        // Iterate through all targets of this Pickupable.
    162         for(std::list<Identifier*>::const_iterator it = this->targets_.begin(); it != this->targets_.end(); it++)
     162        for(Identifier* target : this->targets_)
    163163        {
    164             if(identifier->isA(*it))
     164            if(identifier->isA(target))
    165165                return true;
    166166        }
     
    210210    bool Pickupable::pickup(PickupCarrier* carrier)
    211211    {
    212         if(carrier == NULL || this->isPickedUp()) // If carrier is NULL or the Pickupable is already picked up.
     212        if(carrier == nullptr || this->isPickedUp()) // If carrier is nullptr or the Pickupable is already picked up.
    213213            return false;
    214214
     
    237237            return false;
    238238
    239         assert(this->getCarrier()); // The Carrier cannot be NULL at this point.
     239        assert(this->getCarrier()); // The Carrier cannot be nullptr at this point.
    240240        if(!this->getCarrier()->removePickup(this)) //TODO Shouldn't this be a little later?
    241241            orxout(internal_warning, context::pickups) << "Pickupable (&" << this << ", " << this->getIdentifier()->getName() << ") is being dropped, but it was not present in the PickupCarriers list of pickups." << endl;
     
    249249            created = this->createSpawner();
    250250
    251         this->setCarrier(NULL);
     251        this->setCarrier(nullptr);
    252252
    253253        if(!created && createSpawner) // If a PickupSpawner should have been created but wasn't.
     
    301301        orxout(verbose, context::pickups) << "Pickupable (&" << this << ") changed Carrier (& " << carrier << ")." << endl;
    302302
    303         if(carrier != NULL && tell)
     303        if(carrier != nullptr && tell)
    304304        {
    305305            if(!carrier->addPickup(this))
  • code/branches/cpp11_v3/src/orxonox/interfaces/Pickupable.h

    r10624 r11054  
    144144
    145145        protected:
    146             virtual void preDestroy(void); //!< A method that is called by Destroyable::destroy() before the object is actually destroyed.
     146            virtual void preDestroy(void) override; //!< A method that is called by Destroyable::destroy() before the object is actually destroyed.
    147147            virtual void destroyPickup(void); //!< Destroys a Pickupable.
    148148            virtual void carrierDestroyed(void); //!< Is called by the PickupCarrier when it is being destroyed.
     
    182182        // For implementing the Rewardable interface:
    183183        public:
    184             virtual bool reward(PlayerInfo* player); //!< Method to transcribe a Pickupable as a Rewardable to the player.
     184            virtual bool reward(PlayerInfo* player) override; //!< Method to transcribe a Pickupable as a Rewardable to the player.
    185185
    186186    };
  • code/branches/cpp11_v3/src/orxonox/interfaces/RadarViewable.h

    r10624 r11054  
    6666                if (name == "HIDDEN")
    6767                {
    68                     this->bVisibility_ = 0;
     68                    this->bVisibility_ = false;
    6969                    this->settingsChanged();
    7070                }
  • code/branches/cpp11_v3/src/orxonox/items/Engine.cc

    r9667 r11054  
    5050        RegisterObject(Engine);
    5151
    52         this->ship_ = 0;
     52        this->ship_ = nullptr;
    5353        this->shipID_ = OBJECTID_UNKNOWN;
    5454        this->relativePosition_ = Vector3::ZERO;
     
    136136    void Engine::networkcallback_shipID()
    137137    {
    138         this->ship_ = 0;
     138        this->ship_ = nullptr;
    139139
    140140        if (this->shipID_ != OBJECTID_UNKNOWN)
     
    155155    void Engine::run(float dt)
    156156    {
    157         if (this->ship_ == NULL)
     157        if (this->ship_ == nullptr)
    158158        {
    159159            if (this->shipID_ != 0)
     
    161161                this->networkcallback_shipID();
    162162
    163                 if (this->ship_ == NULL)
     163                if (this->ship_ == nullptr)
    164164                    return;
    165165            }
  • code/branches/cpp11_v3/src/orxonox/items/Engine.h

    r9667 r11054  
    5959            virtual ~Engine();
    6060
    61             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
     61            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
    6262            void setConfigValues();
    6363
     
    6767            /**
    6868            @brief Get the SpaceShip this Engine is mounted on.
    69             @return Returns a pointer to the SpaceShip. NULL if it isn't mounted on any ship.
     69            @return Returns a pointer to the SpaceShip. nullptr if it isn't mounted on any ship.
    7070            */
    7171            inline SpaceShip* getShip() const
  • code/branches/cpp11_v3/src/orxonox/items/MultiStateEngine.cc

    r9939 r11054  
    6767        else
    6868        {
    69             this->defEngineSndBoost_ = 0;
    70             this->defEngineSndNormal_ = 0;
    71             this->lua_ = 0;
     69            this->defEngineSndBoost_ = nullptr;
     70            this->defEngineSndNormal_ = nullptr;
     71            this->lua_ = nullptr;
    7272        }
    7373        this->state_ = 0;
     
    8585            {
    8686                // We have no ship, so the effects are not attached and won't be destroyed automatically
    87                 for (std::vector<EffectContainer*>::const_iterator it = this->effectContainers_.begin(); it != this->effectContainers_.end(); ++it)
    88                     for (std::vector<WorldEntity*>::const_iterator it2 = (*it)->getEffectsBegin(); it2 != (*it)->getEffectsBegin(); ++it2)
    89                         (*it2)->destroy();
     87                for (EffectContainer* container : this->effectContainers_)
     88                    for (std::vector<WorldEntity*>::const_iterator it = container->getEffectsBegin(); it != container->getEffectsBegin(); ++it)
     89                        (*it)->destroy();
    9090                if (this->defEngineSndNormal_)
    9191                    this->defEngineSndNormal_->destroy();
     
    178178
    179179                // Update all effect conditions
    180                 for (std::vector<EffectContainer*>::const_iterator it = this->effectContainers_.begin(); it != this->effectContainers_.end(); ++it)
    181                     (*it)->updateCondition();
     180                for (EffectContainer* container : this->effectContainers_)
     181                    container->updateCondition();
    182182            }
    183183        }
     
    198198            this->getShip()->attach(defEngineSndBoost_);
    199199
    200         for (std::vector<EffectContainer*>::const_iterator it = this->effectContainers_.begin(); it != this->effectContainers_.end(); ++it)
    201             for (std::vector<WorldEntity*>::const_iterator it2 = (*it)->getEffectsBegin(); it2 != (*it)->getEffectsEnd(); ++it2)
    202                 this->getShip()->attach(*it2);
     200        for (EffectContainer* container : this->effectContainers_)
     201            for (std::vector<WorldEntity*>::const_iterator it = container->getEffectsBegin(); it != container->getEffectsEnd(); ++it)
     202                this->getShip()->attach(*it);
    203203    }
    204204
    205205    void MultiStateEngine::addEffectContainer(EffectContainer* effect)
    206206    {
    207         if (effect == NULL)
     207        if (effect == nullptr)
    208208            return;
    209209        effect->setLuaState(this->lua_, 'f' + multi_cast<std::string>(this->effectContainers_.size()));
     
    219219    {
    220220        unsigned int i = 0;
    221         for (std::vector<EffectContainer*>::const_iterator it = this->effectContainers_.begin(); it != this->effectContainers_.end(); ++it)
     221        for (EffectContainer* effectContainer : this->effectContainers_)
    222222        {
    223223            if (i == index)
    224                 return (*it);
    225         }
    226         return NULL;
     224                return effectContainer;
     225            i++;
     226        }
     227        return nullptr;
    227228    }
    228229
  • code/branches/cpp11_v3/src/orxonox/items/MultiStateEngine.h

    r9667 r11054  
    5252            virtual ~MultiStateEngine();
    5353
    54             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
     54            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
    5555
    56             virtual void run(float dt);
     56            virtual void run(float dt) override;
    5757
    58             virtual void addToSpaceShip(SpaceShip* ship);
     58            virtual void addToSpaceShip(SpaceShip* ship) override;
    5959
    6060            void addEffectContainer(EffectContainer* effect);
  • code/branches/cpp11_v3/src/orxonox/items/PartDestructionEvent.h

    r10262 r11054  
    100100            virtual ~PartDestructionEvent();
    101101
    102             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
     102            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
    103103
    104104            void execute();
  • code/branches/cpp11_v3/src/orxonox/items/ShipPart.cc

    r11052 r11054  
    4949
    5050    ShipPart::ShipPart(Context* context)
    51         : Item(context), parent_(NULL)
     51        : Item(context), parent_(nullptr)
    5252    {
    5353        RegisterObject(ShipPart);
     
    121121    void ShipPart::addEntity(StaticEntity* entity)
    122122    {
    123         OrxAssert(entity != NULL, "The Entity cannot be NULL.");
     123        OrxAssert(entity != nullptr, "The Entity cannot be nullptr.");
    124124        this->entityList_.push_back(entity);
    125125    }
     
    129129        Get the i-th StaticEntity of the ShipPart.
    130130    @return
    131         Returns a pointer to the i-the StaticEntity. NULL if there is no StaticEntity with that index.
     131        Returns a pointer to the i-the StaticEntity. nullptr if there is no StaticEntity with that index.
    132132    */
    133133    StaticEntity* ShipPart::getEntity(unsigned int index)
    134134    {
    135135        if(this->entityList_.size() >= index)
    136             return NULL;
     136            return nullptr;
    137137        else
    138138            return this->entityList_[index];
     
    142142    @brief
    143143        Check whether the ShipPart has a particular Entity.
    144     @param engine
     144    @param search
    145145        A pointer to the Entity to be checked.
    146146    */
    147     bool ShipPart::hasEntity(StaticEntity* entity) const
    148     {
    149         for(unsigned int i = 0; i < this->entityList_.size(); i++)
    150         {
    151             if(this->entityList_[i] == entity)
     147    bool ShipPart::hasEntity(StaticEntity* search) const
     148    {
     149        for(StaticEntity* entity : this->entityList_)
     150        {
     151            if(entity == search)
    152152                return true;
    153153        }
     
    163163    void ShipPart::addDestructionEvent(PartDestructionEvent* event)
    164164    {
    165         OrxAssert(event != NULL, "The PartDestructionEvent cannot be NULL.");
     165        OrxAssert(event != nullptr, "The PartDestructionEvent cannot be nullptr.");
    166166        event->setParent(this);
    167167        this->eventList_.push_back(event);
     
    172172        Get the i-th PartDestructionEvent of the ShipPart.
    173173    @return
    174         Returns a pointer to the i-the PartDestructionEvent. NULL if there is no PartDestructionEvent with that index.
     174        Returns a pointer to the i-the PartDestructionEvent. nullptr if there is no PartDestructionEvent with that index.
    175175    */
    176176    PartDestructionEvent* ShipPart::getDestructionEvent(unsigned int index)
    177177    {
    178178        if(this->eventList_.size() <= index)
    179             return NULL;
     179            return nullptr;
    180180        else
    181181            return this->eventList_[index];
  • code/branches/cpp11_v3/src/orxonox/items/ShipPart.h

    r10624 r11054  
    4747            virtual ~ShipPart();
    4848
    49             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
     49            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
    5050
    5151            virtual void handleHit(float damage, float healthdamage, float shielddamage, Pawn* originator);
  • code/branches/cpp11_v3/src/orxonox/overlays/GUISheet.h

    r9667 r11054  
    4444        ~GUISheet();
    4545
    46         void XMLPort(Element& xmlelement, XMLPort::Mode mode);
     46        virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
    4747
    4848        void show();
  • code/branches/cpp11_v3/src/orxonox/overlays/InGameConsole.cc

    r10624 r11054  
    7575        : shell_(new Shell("InGameConsole", true))
    7676        , bShowCursor_(false)
    77         , consoleOverlay_(0)
    78         , consoleOverlayContainer_(0)
    79         , consoleOverlayNoise_(0)
    80         , consoleOverlayCursor_(0)
    81         , consoleOverlayBorder_(0)
    82         , consoleOverlayTextAreas_(0)
    83         , inputState_(0)
     77        , consoleOverlay_(nullptr)
     78        , consoleOverlayContainer_(nullptr)
     79        , consoleOverlayNoise_(nullptr)
     80        , consoleOverlayCursor_(nullptr)
     81        , consoleOverlayBorder_(nullptr)
     82        , consoleOverlayTextAreas_(nullptr)
     83        , inputState_(nullptr)
    8484    {
    8585        RegisterObject(InGameConsole);
     
    130130                    if (this->consoleOverlayTextAreas_[i])
    131131                        Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->consoleOverlayTextAreas_[i]);
    132                     this->consoleOverlayTextAreas_[i] = 0;
     132                    this->consoleOverlayTextAreas_[i] = nullptr;
    133133                }
    134134
     
    140140        {
    141141            delete[] this->consoleOverlayTextAreas_;
    142             this->consoleOverlayTextAreas_ = 0;
     142            this->consoleOverlayTextAreas_ = nullptr;
    143143        }
    144144
     
    175175            else
    176176            {
    177                 inputState_->setMouseHandler(0);
    178                 inputState_->setJoyStickHandler(0);
     177                inputState_->setMouseHandler(nullptr);
     178                inputState_->setJoyStickHandler(nullptr);
    179179            }
    180180        }
  • code/branches/cpp11_v3/src/orxonox/overlays/InGameConsole.h

    r10624 r11054  
    5353        void setConfigValues();
    5454
    55         void preUpdate(const Clock& time);
    56         void postUpdate(const Clock& time) { /*no action*/ }
     55        virtual void preUpdate(const Clock& time) override;
     56        virtual void postUpdate(const Clock& time) override { /*no action*/ }
    5757
    5858        static void openConsole();
     
    6565        void deactivate();
    6666
    67         void linesChanged();
    68         void lineAdded();
    69         void inputChanged();
    70         void cursorChanged();
    71         void executed();
    72         void exit();
     67        virtual void linesChanged() override;
     68        virtual void lineAdded() override;
     69        virtual void inputChanged() override;
     70        virtual void cursorChanged() override;
     71        virtual void executed() override;
     72        virtual void exit() override;
    7373
    7474        void shiftLines();
     
    7777        void print(const std::string& text, Shell::LineType type, int index, bool alwaysShift = false);
    7878
    79         void windowResized(unsigned int newWidth, unsigned int newHeight);
     79        virtual void windowResized(unsigned int newWidth, unsigned int newHeight) override;
    8080
    8181        // config value related
  • code/branches/cpp11_v3/src/orxonox/overlays/OrxonoxOverlay.cc

    r11052 r11054  
    7070        RegisterObject(OrxonoxOverlay);
    7171
    72         this->owner_ = 0;
    73         this->group_ = 0;
     72        this->owner_ = nullptr;
     73        this->group_ = nullptr;
    7474
    7575        if (!GameMode::showsGraphics())
  • code/branches/cpp11_v3/src/orxonox/overlays/OrxonoxOverlay.h

    r11052 r11054  
    9090        virtual ~OrxonoxOverlay();
    9191
    92         virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    93 
    94         virtual void changedName();
     92        virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
     93
     94        virtual void changedName() override;
    9595
    9696        //! Shows the overlay with an detour to BaseObject::visibility_
     
    167167        void setBackgroundColour(ColourValue colour);
    168168
    169         virtual void changedVisibility();
     169        virtual void changedVisibility() override;
    170170
    171171        inline void setOwner(BaseObject* owner)
     
    207207
    208208    private:
    209         void windowResized(unsigned int newWidth, unsigned int newHeight);
     209        virtual void windowResized(unsigned int newWidth, unsigned int newHeight) override;
    210210
    211211        static unsigned int hudOverlayCounter_s;   //!< Static counter for hud elements
  • code/branches/cpp11_v3/src/orxonox/overlays/OverlayGroup.cc

    r11052 r11054  
    5151        {
    5252            ArgumentCompletionList names;
    53             for (ObjectList<OverlayGroup>::iterator it = ObjectList<OverlayGroup>::begin(); it; ++it)
     53            for (ObjectList<OverlayGroup>::iterator it = ObjectList<OverlayGroup>().begin(); it; ++it)
    5454                names.push_back(ArgumentCompletionListElement(it->getName(), getLowercase(it->getName())));
    5555            return names;
     
    6969        RegisterObject(OverlayGroup);
    7070
    71         this->owner_ = 0;
     71        this->owner_ = nullptr;
    7272
    7373        setScale(Vector2(1.0, 1.0));
     
    7777    OverlayGroup::~OverlayGroup()
    7878    {
    79         for (std::set< StrongPtr<OrxonoxOverlay> >::iterator it = hudElements_.begin(); it != hudElements_.end(); ++it)
    80             (*it)->destroy();
     79        for (OrxonoxOverlay* hudElement : hudElements_)
     80            hudElement->destroy();
    8181        this->hudElements_.clear();
    8282    }
     
    101101    void OverlayGroup::setScale(const Vector2& scale)
    102102    {
    103         for (std::set< StrongPtr<OrxonoxOverlay> >::iterator it = hudElements_.begin(); it != hudElements_.end(); ++it)
    104             (*it)->scale(scale / this->scale_);
     103        for (OrxonoxOverlay* hudElement : hudElements_)
     104            hudElement->scale(scale / this->scale_);
    105105        this->scale_ = scale;
    106106    }
     
    109109    void OverlayGroup::setScroll(const Vector2& scroll)
    110110    {
    111         for (std::set< StrongPtr<OrxonoxOverlay> >::iterator it = hudElements_.begin(); it != hudElements_.end(); ++it)
    112             (*it)->scroll(scroll - this->scroll_);
     111        for (OrxonoxOverlay* hudElement : hudElements_)
     112            hudElement->scroll(scroll - this->scroll_);
    113113        this->scroll_ = scroll;
    114114    }
     
    148148        if (index < this->hudElements_.size())
    149149        {
    150             std::set< StrongPtr<OrxonoxOverlay> >::const_iterator it = hudElements_.begin();
     150            std::set<StrongPtr<OrxonoxOverlay>>::const_iterator it = hudElements_.begin();
    151151            for (unsigned int i = 0; i != index; ++it, ++i)
    152152                ;
     
    154154        }
    155155        else
    156             return 0;
     156            return nullptr;
    157157    }
    158158
     
    162162        SUPER( OverlayGroup, changedVisibility );
    163163
    164         for (std::set< StrongPtr<OrxonoxOverlay> >::iterator it = hudElements_.begin(); it != hudElements_.end(); ++it)
    165             (*it)->changedVisibility(); //inform all Child Overlays that our visibility has changed
     164        for (OrxonoxOverlay* hudElement : hudElements_)
     165            hudElement->changedVisibility(); //inform all Child Overlays that our visibility has changed
    166166    }
    167167
     
    170170        this->owner_ = owner;
    171171
    172         for (std::set< StrongPtr<OrxonoxOverlay> >::iterator it = hudElements_.begin(); it != hudElements_.end(); ++it)
    173             (*it)->setOwner(owner);
     172        for (OrxonoxOverlay* hudElement : hudElements_)
     173            hudElement->setOwner(owner);
    174174    }
    175175
     
    185185    /*static*/ void OverlayGroup::toggleVisibility(const std::string& name)
    186186    {
    187         for (ObjectList<OverlayGroup>::iterator it = ObjectList<OverlayGroup>::begin(); it; ++it)
    188         {
    189             if ((*it)->getName() == name)
    190                 (*it)->setVisible(!((*it)->isVisible()));
     187        for (OverlayGroup* group : ObjectList<OverlayGroup>())
     188        {
     189            if (group->getName() == name)
     190                group->setVisible(!(group->isVisible()));
    191191        }
    192192    }
     
    200200    /*static*/ void OverlayGroup::show(const std::string& name)
    201201    {
    202         for (ObjectList<OverlayGroup>::iterator it = ObjectList<OverlayGroup>::begin(); it; ++it)
    203         {
    204             if ((*it)->getName() == name)
     202        for (OverlayGroup* group : ObjectList<OverlayGroup>())
     203        {
     204            if (group->getName() == name)
    205205            {
    206                 if((*it)->isVisible())
    207                     (*it)->changedVisibility();
     206                if(group->isVisible())
     207                    group->changedVisibility();
    208208                else
    209                     (*it)->setVisible(!((*it)->isVisible()));
     209                    group->setVisible(!(group->isVisible()));
    210210            }
    211211        }
     
    223223    /*static*/ void OverlayGroup::scaleGroup(const std::string& name, float scale)
    224224    {
    225         for (ObjectList<OverlayGroup>::iterator it = ObjectList<OverlayGroup>::begin(); it; ++it)
    226         {
    227             if ((*it)->getName() == name)
    228                 (*it)->scale(Vector2(scale, scale));
     225        for (OverlayGroup* group : ObjectList<OverlayGroup>())
     226        {
     227            if (group->getName() == name)
     228                group->scale(Vector2(scale, scale));
    229229        }
    230230    }
     
    241241    /*static*/ void OverlayGroup::scrollGroup(const std::string& name, const Vector2& scroll)
    242242    {
    243         for (ObjectList<OverlayGroup>::iterator it = ObjectList<OverlayGroup>::begin(); it; ++it)
    244         {
    245             if ((*it)->getName() == name)
    246                 (*it)->scroll(scroll);
     243        for (OverlayGroup* group : ObjectList<OverlayGroup>())
     244        {
     245            if (group->getName() == name)
     246                group->scroll(scroll);
    247247        }
    248248    }
  • code/branches/cpp11_v3/src/orxonox/overlays/OverlayGroup.h

    r10624 r11054  
    5858        ~OverlayGroup();
    5959
    60         virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
     60        virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
    6161
    6262        static void toggleVisibility(const std::string& name);
     
    6565        static void scrollGroup(const std::string& name, const Vector2& scroll);
    6666
    67         inline const std::set< StrongPtr<OrxonoxOverlay> >& getOverlays() const
     67        inline const std::set<StrongPtr<OrxonoxOverlay>>& getOverlays() const
    6868            { return this->hudElements_; }
    6969
    70         virtual void changedVisibility();
     70        virtual void changedVisibility() override;
    7171
    7272        void setOwner(BaseObject* owner);
     
    9191
    9292    private:
    93         std::set< StrongPtr<OrxonoxOverlay> > hudElements_;    //!< Contains all the OrxonoxOverlays of the this group.
     93        std::set<StrongPtr<OrxonoxOverlay>> hudElements_;    //!< Contains all the OrxonoxOverlays of the this group.
    9494        Vector2 scale_;                            //!< Current scale (independent of the elements).
    9595        Vector2 scroll_;                           //!< Current scrolling offset.
  • code/branches/cpp11_v3/src/orxonox/sound/AmbientSound.cc

    r10624 r11054  
    9292        {
    9393            const std::string& path = "ambient/" + mood + '/' + this->ambientSource_;
    94             shared_ptr<ResourceInfo> fileInfo = Resource::getInfo(path);
    95             if (fileInfo != NULL)
     94            std::shared_ptr<ResourceInfo> fileInfo = Resource::getInfo(path);
     95            if (fileInfo != nullptr)
    9696            {
    9797                orxout(user_info) << "Loading ambient sound " << path << "..." << endl; // TODO: make this output internal if we implement sound streaming
  • code/branches/cpp11_v3/src/orxonox/sound/AmbientSound.h

    r9939 r11054  
    5050        AmbientSound();
    5151
    52         void play();
    53         bool stop();
    54         void pause();
     52        virtual void play() override;
     53        virtual bool stop() override;
     54        virtual void pause() override;
    5555
    5656        bool setAmbientSource(const std::string& source);
     
    6666
    6767    private:
    68         void preDestroy();
    69         float getRealVolume();
    70         bool moodChanged(const std::string& mood);
     68        virtual void preDestroy() override;
     69        virtual float getRealVolume() override;
     70        virtual bool moodChanged(const std::string& mood) override;
    7171        inline void ambientSourceChanged()
    7272            { this->setAmbientSource(this->ambientSource_); }
  • code/branches/cpp11_v3/src/orxonox/sound/BaseSound.cc

    r10624 r11054  
    6666            this->stop();
    6767        // Release buffer
    68         if (this->soundBuffer_ != NULL)
     68        if (this->soundBuffer_ != nullptr)
    6969        {
    7070            assert(GameMode::playsSound());
     
    8484    {
    8585        this->state_ = Playing;
    86         if (GameMode::playsSound() && this->getSourceState() != AL_PLAYING && this->soundBuffer_ != NULL)
     86        if (GameMode::playsSound() && this->getSourceState() != AL_PLAYING && this->soundBuffer_ != nullptr)
    8787        {
    8888            if (!alIsSource(this->audioSource_))
     
    151151            orxout(internal_warning, context::sound) << "Setting source parameters to 0 failed: "
    152152                                                     << SoundManager::getALErrorString(error) << endl;
    153         assert(this->soundBuffer_ != NULL);
     153        assert(this->soundBuffer_ != nullptr);
    154154        alSourcei(this->audioSource_, AL_BUFFER, this->soundBuffer_->getBuffer());
    155155        if (ALuint error = alGetError())
     
    209209        }
    210210
    211         if (this->soundBuffer_ != NULL)
     211        if (this->soundBuffer_ != nullptr)
    212212        {
    213213            if (this->soundBuffer_->getFilename() == source)
     
    233233        // Get new sound buffer
    234234        this->soundBuffer_ = SoundManager::getInstance().getSoundBuffer(this->source_);
    235         if (this->soundBuffer_ == NULL)
     235        if (this->soundBuffer_ == nullptr)
    236236            return;
    237237
  • code/branches/cpp11_v3/src/orxonox/sound/BaseSound.h

    r9667 r11054  
    3333
    3434#include <string>
    35 #include <boost/shared_ptr.hpp>
     35#include <memory>
    3636#include <OgreDataStream.h>
    3737#include "core/object/Listable.h"
     
    107107        ALuint          audioSource_;
    108108        bool            bPooling_;
    109         shared_ptr<SoundBuffer> soundBuffer_;
     109        std::shared_ptr<SoundBuffer> soundBuffer_;
    110110        std::string     source_;
    111111        float           volume_;
  • code/branches/cpp11_v3/src/orxonox/sound/SoundBuffer.cc

    r8858 r11054  
    3939namespace orxonox
    4040{
    41     SoundBuffer::SoundBuffer(const std::string& filename, std::list<shared_ptr<SoundBuffer> >::iterator poolIterator)
     41    SoundBuffer::SoundBuffer(const std::string& filename, std::list<std::shared_ptr<SoundBuffer>>::iterator poolIterator)
    4242        : filename_(filename)
    4343        , audioBuffer_(AL_NONE)
     
    4545    {
    4646        if (this->filename_.empty())
    47             ThrowException(General, "SoundBuffer construction: fileInfo was NULL");
     47            ThrowException(General, "SoundBuffer construction: fileInfo was nullptr");
    4848
    4949        // Get resource info
    50         shared_ptr<ResourceInfo> fileInfo = Resource::getInfo(filename);
    51         if (fileInfo == NULL)
     50        std::shared_ptr<ResourceInfo> fileInfo = Resource::getInfo(filename);
     51        if (fileInfo == nullptr)
    5252        {
    5353            orxout(internal_error, context::sound) << "Sound file '" << filename << "' not found" << endl;
     
    8383    }
    8484
    85     void SoundBuffer::loadStandard(const shared_ptr<ResourceInfo>& fileInfo, DataStreamPtr dataStream)
     85    void SoundBuffer::loadStandard(const std::shared_ptr<ResourceInfo>& fileInfo, DataStreamPtr dataStream)
    8686    {
    8787        // Read everything into a temporary buffer
     
    127127    }
    128128
    129     void SoundBuffer::loadOgg(const shared_ptr<ResourceInfo>& fileInfo, DataStreamPtr dataStream)
     129    void SoundBuffer::loadOgg(const std::shared_ptr<ResourceInfo>& fileInfo, DataStreamPtr dataStream)
    130130    {
    131131        char inbuffer[256*1024];
     
    138138        vorbisCallbacks.seek_func  = &seekVorbis;
    139139        vorbisCallbacks.tell_func  = &tellVorbis;
    140         vorbisCallbacks.close_func = NULL;
     140        vorbisCallbacks.close_func = nullptr;
    141141
    142142        OggVorbis_File vf;
    143         int ret = ov_open_callbacks(dataStream.get(), &vf, NULL, 0, vorbisCallbacks);
     143        int ret = ov_open_callbacks(dataStream.get(), &vf, nullptr, 0, vorbisCallbacks);
    144144        if (ret < 0)
    145145        {
  • code/branches/cpp11_v3/src/orxonox/sound/SoundBuffer.h

    r10624 r11054  
    3333
    3434#include <list>
    35 #include <boost/shared_ptr.hpp>
     35#include <memory>
    3636#include "core/Resource.h"
    3737
     
    4545    {
    4646        friend class SoundManager;
    47 #if !defined(_MSC_VER) || _MSC_VER >= 1500
    48         // Make sure nobody deletes an instance (using strong pointers)
    49         template <class T>
    50         friend void boost::checked_delete(T*);
    51 #endif
    5247
    5348    public:
    54 #if defined(_MSC_VER) && _MSC_VER < 1500
    5549        ~SoundBuffer();
    56 #endif
    5750        inline ALuint getBuffer()
    5851            { return this->audioBuffer_; }
     
    6457
    6558    private:
    66         SoundBuffer(const std::string& filename, std::list<shared_ptr<SoundBuffer> >::iterator poolIterator);
    67 #if !defined(_MSC_VER) || _MSC_VER >= 1500
    68         ~SoundBuffer();
    69 #endif
    70         void loadStandard(const shared_ptr<ResourceInfo>& fileInfo, DataStreamPtr dataStream);
    71         void loadOgg(const shared_ptr<ResourceInfo>& fileInfo, DataStreamPtr dataStream);
     59        SoundBuffer(const std::string& filename, std::list<std::shared_ptr<SoundBuffer>>::iterator poolIterator);
     60        void loadStandard(const std::shared_ptr<ResourceInfo>& fileInfo, DataStreamPtr dataStream);
     61        void loadOgg(const std::shared_ptr<ResourceInfo>& fileInfo, DataStreamPtr dataStream);
    7262
    7363        std::string filename_;
    7464        ALuint audioBuffer_;
    75         std::list<shared_ptr<SoundBuffer> >::iterator poolIterator_;
     65        std::list<std::shared_ptr<SoundBuffer>>::iterator poolIterator_;
    7666    };
    7767}
  • code/branches/cpp11_v3/src/orxonox/sound/SoundManager.cc

    r10624 r11054  
    8383            ThrowException(InitialisationAborted, "Sound: Not loading at all");
    8484#if !defined(ORXONOX_PLATFORM_APPLE)
    85         if (!alutInitWithoutContext(NULL, NULL))
     85        if (!alutInitWithoutContext(nullptr, nullptr))
    8686            ThrowException(InitialisationFailed, "Sound Error: ALUT initialisation failed: " << alutGetErrorString(alutGetError()));
    8787        Loki::ScopeGuard alutExitGuard = Loki::MakeGuard(&alutExit);
     
    9090/*
    9191        // Get list of available sound devices and display them
    92         const char* devices = alcGetString(NULL, ALC_DEVICE_SPECIFIER);
     92        const char* devices = alcGetString(nullptr, ALC_DEVICE_SPECIFIER);
    9393        char* device = new char[strlen(devices)+1];
    9494        strcpy(device, devices);
     
    110110        this->device_ = alcOpenDevice(renderDevice.c_str());
    111111*/
    112         this->device_ = alcOpenDevice(NULL);
    113         if (this->device_ == NULL)
     112        this->device_ = alcOpenDevice(nullptr);
     113        if (this->device_ == nullptr)
    114114            ThrowException(InitialisationFailed, "Sound Error: Could not open sound device.");
    115115        Loki::ScopeGuard closeDeviceGuard = Loki::MakeGuard(&alcCloseDevice, this->device_);
    116116
    117117        // Create sound context and make it the currently used one
    118         this->context_ = alcCreateContext(this->device_, NULL);
    119         if (this->context_ == NULL)
     118        this->context_ = alcCreateContext(this->device_, nullptr);
     119        if (this->context_ == nullptr)
    120120            ThrowException(InitialisationFailed, "Sound Error: Could not create ALC context");
    121121        Loki::ScopeGuard desroyContextGuard = Loki::MakeGuard(&alcDestroyContext, this->context_);
     
    189189
    190190        // Relieve context to destroy it
    191         if (!alcMakeContextCurrent(NULL))
     191        if (!alcMakeContextCurrent(nullptr))
    192192            orxout(internal_error, context::sound) << "Could not unset ALC context" << endl;
    193193        alcDestroyContext(this->context_);
     
    294294        {
    295295        case SoundType::All:
    296             for (ObjectList<BaseSound>::iterator it = ObjectList<BaseSound>::begin(); it != ObjectList<BaseSound>::end(); ++it)
    297                 (*it)->updateVolume();
     296            for (BaseSound* sound : ObjectList<BaseSound>())
     297                sound->updateVolume();
    298298            break;
    299299        case SoundType::Music:
    300             for (ObjectList<AmbientSound>::iterator it = ObjectList<AmbientSound>::begin(); it != ObjectList<AmbientSound>::end(); ++it)
    301                 (*it)->updateVolume();
     300            for (AmbientSound* sound : ObjectList<AmbientSound>())
     301                sound->updateVolume();
    302302            break;
    303303        case SoundType::Effects:
    304             for (ObjectList<WorldSound>::iterator it = ObjectList<WorldSound>::begin(); it != ObjectList<WorldSound>::end(); ++it)
    305                 (*it)->updateVolume();
     304            for (WorldSound* sound : ObjectList<WorldSound>())
     305                sound->updateVolume();
    306306            break;
    307307        default:
     
    350350    void SoundManager::registerAmbientSound(AmbientSound* newAmbient)
    351351    {
    352         if (newAmbient != NULL && !this->bDestructorCalled_)
     352        if (newAmbient != nullptr && !this->bDestructorCalled_)
    353353        {
    354354            for (AmbientList::const_iterator it = this->ambientSounds_.begin(); it != this->ambientSounds_.end(); ++it)
     
    373373    void SoundManager::unregisterAmbientSound(AmbientSound* oldAmbient)
    374374    {
    375         if (oldAmbient == NULL || ambientSounds_.empty() || this->bDestructorCalled_)
     375        if (oldAmbient == nullptr || ambientSounds_.empty() || this->bDestructorCalled_)
    376376            return;
    377377
     
    405405    void SoundManager::pauseAmbientSound(AmbientSound* ambient)
    406406    {
    407         if (ambient != NULL)
    408         {
    409             for (AmbientList::iterator it = this->ambientSounds_.begin(); it != this->ambientSounds_.end(); ++it)
    410             {
    411                 if (it->first == ambient)
     407        if (ambient != nullptr)
     408        {
     409            for (std::pair<AmbientSound*, bool>& pair : this->ambientSounds_)
     410            {
     411                if (pair.first == ambient)
    412412                {
    413                     it->second = true;
    414                     this->fadeOut(it->first);
     413                    pair.second = true;
     414                    this->fadeOut(pair.first);
    415415                    return;
    416416                }
     
    422422    {
    423423        // If we're already fading out --> remove that
    424         for (std::list<StrongPtr<AmbientSound> >::iterator it = this->fadeOutList_.begin(); it != this->fadeOutList_.end(); it++)
     424        for (std::list<StrongPtr<AmbientSound>>::iterator it = this->fadeOutList_.begin(); it != this->fadeOutList_.end(); it++)
    425425        {
    426426            if (*it == sound)
     
    438438    {
    439439        // If we're already fading in --> remove that
    440         for (std::list<StrongPtr<AmbientSound> >::iterator it = this->fadeInList_.begin(); it != this->fadeInList_.end(); it++)
     440        for (std::list<StrongPtr<AmbientSound>>::iterator it = this->fadeInList_.begin(); it != this->fadeInList_.end(); it++)
    441441        {
    442442            if (*it == sound)
     
    461461
    462462        // FADE IN
    463         for (std::list<StrongPtr<AmbientSound> >::iterator it= this->fadeInList_.begin(); it != this->fadeInList_.end(); )
     463        for (std::list<StrongPtr<AmbientSound>>::iterator it= this->fadeInList_.begin(); it != this->fadeInList_.end(); )
    464464        {
    465465            if ((*it)->getVolume() + this->crossFadeStep_*dt > 1.0f)
     
    476476
    477477        // FADE OUT
    478         for (std::list<StrongPtr<AmbientSound> >::iterator it = this->fadeOutList_.begin(); it != this->fadeOutList_.end(); )
     478        for (std::list<StrongPtr<AmbientSound>>::iterator it = this->fadeOutList_.begin(); it != this->fadeOutList_.end(); )
    479479        {
    480480            if ((*it)->getVolume() - this->crossFadeStep_*dt < 0.0f)
     
    505505    }
    506506
    507     shared_ptr<SoundBuffer> SoundManager::getSoundBuffer(const std::string& filename)
    508     {
    509         shared_ptr<SoundBuffer> buffer;
     507    std::shared_ptr<SoundBuffer> SoundManager::getSoundBuffer(const std::string& filename)
     508    {
     509        std::shared_ptr<SoundBuffer> buffer;
    510510        // Check active or pooled buffers
    511511        SoundBufferMap::const_iterator it = this->soundBuffers_.find(filename);
     
    538538    }
    539539
    540     void SoundManager::releaseSoundBuffer(const shared_ptr<SoundBuffer>& buffer, bool bPoolBuffer)
     540    void SoundManager::releaseSoundBuffer(const std::shared_ptr<SoundBuffer>& buffer, bool bPoolBuffer)
    541541    {
    542542        // Check if others are still using the buffer
     
    551551                while (this->effectsPoolSize_ + it->second->getSize() > this->maxEffectsPoolSize_s && !this->effectsPool_.empty())
    552552                {
    553                     shared_ptr<SoundBuffer> bufferDel = this->effectsPool_.back();
     553                    std::shared_ptr<SoundBuffer> bufferDel = this->effectsPool_.back();
    554554                    this->effectsPoolSize_ -= bufferDel->getSize();
    555555                    bufferDel->poolIterator_ = this->effectsPool_.end();
     
    576576            ALuint source = this->availableSoundSources_.back();
    577577            this->availableSoundSources_.pop_back();
    578             this->usedSoundSources_.push_back(std::make_pair(source, object));
     578            this->usedSoundSources_.emplace_back(source, object);
    579579            return source;
    580580        }
     
    588588                if (alIsSource(source) && !alGetError())
    589589                {
    590                     this->usedSoundSources_.push_back(std::make_pair(source, object));
     590                    this->usedSoundSources_.emplace_back(source, object);
    591591                    return source;
    592592                }
     
    606606#endif
    607607        this->availableSoundSources_.push_back(source);
    608         for (std::vector<std::pair<ALuint, BaseSound*> >::iterator it = this->usedSoundSources_.begin();
     608        for (std::vector<std::pair<ALuint, BaseSound*>>::iterator it = this->usedSoundSources_.begin();
    609609            it != this->usedSoundSources_.end(); ++it)
    610610        {
  • code/branches/cpp11_v3/src/orxonox/sound/SoundManager.h

    r10624 r11054  
    3636#include <map>
    3737#include <string>
    38 #include <boost/shared_ptr.hpp>
     38#include <memory>
    3939
    4040#include "util/Singleton.h"
     
    6868        ~SoundManager();
    6969
    70         void preUpdate(const Clock& time);
    71         void postUpdate(const Clock& time) { /*no action*/ }
     70        virtual void preUpdate(const Clock& time) override;
     71        virtual void postUpdate(const Clock& time) override { /*no action*/ }
    7272        void setConfigValues();
    7373
     
    9696        // tolua_end
    9797
    98         shared_ptr<SoundBuffer> getSoundBuffer(const std::string& filename);
    99         void releaseSoundBuffer(const shared_ptr<SoundBuffer>& buffer, bool bPoolBuffer);
     98        std::shared_ptr<SoundBuffer> getSoundBuffer(const std::string& filename);
     99        void releaseSoundBuffer(const std::shared_ptr<SoundBuffer>& buffer, bool bPoolBuffer);
    100100
    101101        ALuint getSoundSource(BaseSound* object);
     
    125125
    126126        // Ambient sound related
    127         typedef std::list<std::pair<AmbientSound*, bool> > AmbientList;
     127        typedef std::list<std::pair<AmbientSound*, bool>> AmbientList;
    128128        AmbientList                        ambientSounds_;
    129129        //! Absolute change per second (0.1 means 10% of the nominal volume) for cross fading
    130130        float                              crossFadeStep_;
    131         std::list<StrongPtr<AmbientSound> > fadeInList_;
    132         std::list<StrongPtr<AmbientSound> > fadeOutList_;
     131        std::list<StrongPtr<AmbientSound>> fadeInList_;
     132        std::list<StrongPtr<AmbientSound>> fadeOutList_;
    133133
    134134        // Volume related
     
    139139        static const unsigned int maxEffectsPoolSize_s = 40 * 1024 * 1024;
    140140        unsigned int effectsPoolSize_;
    141         typedef std::list<shared_ptr<SoundBuffer> > EffectsPoolList;
     141        typedef std::list<std::shared_ptr<SoundBuffer>> EffectsPoolList;
    142142        EffectsPoolList effectsPool_;
    143         typedef std::map<std::string, shared_ptr<SoundBuffer> > SoundBufferMap;
     143        typedef std::map<std::string, std::shared_ptr<SoundBuffer>> SoundBufferMap;
    144144        SoundBufferMap soundBuffers_;
    145145
     
    148148        unsigned int maxSources_;
    149149        std::vector<ALuint> availableSoundSources_;
    150         std::vector<std::pair<ALuint, BaseSound*> > usedSoundSources_;
     150        std::vector<std::pair<ALuint, BaseSound*>> usedSoundSources_;
    151151
    152152        bool bDestructorCalled_; ///< Becomes true if the destructor is called - used to prevent ambient sounds from registering after the lists were cleared
  • code/branches/cpp11_v3/src/orxonox/sound/SoundStreamer.cc

    r8858 r11054  
    4545        vorbisCallbacks.seek_func  = &seekVorbis;
    4646        vorbisCallbacks.tell_func  = &tellVorbis;
    47         vorbisCallbacks.close_func = NULL;
     47        vorbisCallbacks.close_func = nullptr;
    4848
    4949        OggVorbis_File vf;
    50         int ret = ov_open_callbacks(dataStream.get(), &vf, NULL, 0, vorbisCallbacks);
     50        int ret = ov_open_callbacks(dataStream.get(), &vf, nullptr, 0, vorbisCallbacks);
    5151        if (ret < 0)
    5252        {
     
    6868        int current_section;
    6969
    70         for(int i = 0; i < 4; i++)
     70        for(ALuint& initbuffer : initbuffers)
    7171        {
    7272            long ret = ov_read(&vf, inbuffer, sizeof(inbuffer), 0, 2, 1, &current_section);
     
    8282            }
    8383
    84             alBufferData(initbuffers[i], format, &inbuffer, ret, vorbisInfo->rate);
     84            alBufferData(initbuffer, format, &inbuffer, ret, vorbisInfo->rate);
    8585        }
    8686        alSourceQueueBuffers(audioSource, 4, initbuffers);
  • code/branches/cpp11_v3/src/orxonox/sound/WorldAmbientSound.cc

    r10624 r11054  
    4949        this->ambientSound_ = new AmbientSound();
    5050        this->registerVariables();
    51         soundList_.push_back("Earth.ogg");
    52         soundList_.push_back("Jupiter.ogg");
    53         soundList_.push_back("Mars.ogg");
    54         soundList_.push_back("allgorythm-lift_up.ogg");
    55         soundList_.push_back("allgorythm-resonance_blaster.ogg");
    56         soundList_.push_back("AlphaCentauri.ogg");
    57         soundList_.push_back("Asteroid_rocks.ogg");
    58         soundList_.push_back("Ganymede.ogg");
    59         soundList_.push_back("luke_grey_-_hypermode.ogg");
     51        soundList_.emplace_back("Earth.ogg");
     52        soundList_.emplace_back("Jupiter.ogg");
     53        soundList_.emplace_back("Mars.ogg");
     54        soundList_.emplace_back("allgorythm-lift_up.ogg");
     55        soundList_.emplace_back("allgorythm-resonance_blaster.ogg");
     56        soundList_.emplace_back("AlphaCentauri.ogg");
     57        soundList_.emplace_back("Asteroid_rocks.ogg");
     58        soundList_.emplace_back("Ganymede.ogg");
     59        soundList_.emplace_back("luke_grey_-_hypermode.ogg");
    6060
    6161    }
     
    114114
    115115        //HACK: Assuption - there is only one WorldAmbientSound in a level and only one level is used.
    116         for (ObjectList<WorldAmbientSound>::iterator it = ObjectList<WorldAmbientSound>::begin();
    117              it != ObjectList<WorldAmbientSound>::end(); ++it)
     116        for (WorldAmbientSound* sound : ObjectList<WorldAmbientSound>())
    118117        {
    119             while(it->ambientSound_->setAmbientSource(WorldAmbientSound::soundList_[WorldAmbientSound::soundNumber_]) == false){
     118            while(sound->ambientSound_->setAmbientSource(WorldAmbientSound::soundList_[WorldAmbientSound::soundNumber_]) == false){
    120119                WorldAmbientSound::soundNumber_ = (WorldAmbientSound::soundNumber_ + 1) % WorldAmbientSound::soundList_.size();
    121120            }
  • code/branches/cpp11_v3/src/orxonox/sound/WorldAmbientSound.h

    r9939 r11054  
    5050            virtual ~WorldAmbientSound();
    5151
    52             void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    53             void XMLEventPort(Element& xmlelement, XMLPort::Mode mode);
     52            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
     53            virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode) override;
    5454
    55             virtual void changedActivity();
     55            virtual void changedActivity() override;
    5656
    5757            void play();
  • code/branches/cpp11_v3/src/orxonox/sound/WorldSound.h

    r9667 r11054  
    4747        WorldSound(Context* context);
    4848
    49         void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    50         void XMLEventPort(Element& xmlelement, XMLPort::Mode mode);
    51         void changedActivity();
     49        virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
     50        virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode) override;
     51        virtual void changedActivity() override;
    5252
    53         void tick(float dt);
     53        virtual void tick(float dt) override;
    5454
    5555    protected:
     
    5858    private:
    5959        void registerVariables();
    60         void initialiseSource();
    61         float getRealVolume();
     60        virtual void initialiseSource() override;
     61        virtual float getRealVolume() override;
    6262    };
    6363}
  • code/branches/cpp11_v3/src/orxonox/weaponsystem/DefaultWeaponmodeLink.h

    r9667 r11054  
    4242            virtual ~DefaultWeaponmodeLink();
    4343
    44             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
     44            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
    4545
    4646            inline void setFiremode(const unsigned int firemode)
  • code/branches/cpp11_v3/src/orxonox/weaponsystem/Munition.cc

    r11052 r11054  
    5757    Munition::~Munition()
    5858    {
    59         for (std::map<WeaponMode*, Magazine*>::iterator it = this->assignedMagazines_.begin(); it != this->assignedMagazines_.end(); ++it)
    60             delete it->second;
     59        for (const auto& mapEntry : this->assignedMagazines_)
     60            delete mapEntry.second;
    6161    }
    6262
     
    7676            // For separated magazines we definitively need a given user
    7777            if (!user)
    78                 return 0;
     78                return nullptr;
    7979
    8080            // Use the map to get the magazine assigned to the given user
     
    9090        }
    9191
    92         return 0;
     92        return nullptr;
    9393    }
    9494
     
    262262        if (deployment_ != MunitionDeployment::Separate)
    263263        {
    264             user = NULL;
     264            user = nullptr;
    265265        }
    266266
     
    299299        {
    300300            // Return true if any of the current magazines is not full (loading counts as full although it returns 0 munition)
    301             for (std::map<WeaponMode*, Magazine*>::const_iterator it = this->assignedMagazines_.begin(); it != this->assignedMagazines_.end(); ++it)
    302                 if (it->second->munition_ < this->maxMunitionPerMagazine_ && it->second->bLoaded_)
     301            for (const auto& mapEntry : this->assignedMagazines_)
     302                if (mapEntry.second->munition_ < this->maxMunitionPerMagazine_ && mapEntry.second->bLoaded_)
    303303                    return true;
    304304        }
     
    515515        // If we don't use separate magazines, set user to 0
    516516        if (deployment_ != MunitionDeployment::Separate)
    517             user = NULL;
     517            user = nullptr;
    518518
    519519        // Remove the current magazine for the given user
  • code/branches/cpp11_v3/src/orxonox/weaponsystem/Weapon.cc

    r11052 r11054  
    4545        RegisterObject(Weapon);
    4646
    47         this->weaponPack_ = 0;
    48         this->weaponSlot_ = 0;
     47        this->weaponPack_ = nullptr;
     48        this->weaponSlot_ = nullptr;
    4949        this->bReloading_ = false;
    5050        this->reloadingWeaponmode_ = WeaponSystem::WEAPON_MODE_UNASSIGNED;
     
    6161                this->weaponPack_->removeWeapon(this);
    6262
    63             for (std::multimap<unsigned int, WeaponMode*>::iterator it = this->weaponmodes_.begin(); it != this->weaponmodes_.end(); ++it)
    64                 it->second->destroy();
     63            for (const auto& mapEntry : this->weaponmodes_)
     64                mapEntry.second->destroy();
    6565        }
    6666    }
     
    8585    {
    8686        unsigned int i = 0;
    87         for (std::multimap<unsigned int, WeaponMode*>::const_iterator it = this->weaponmodes_.begin(); it != this->weaponmodes_.end(); ++it)
     87        for (const auto& mapEntry : this->weaponmodes_)
    8888        {
    8989            if (i == index)
    90                 return it->second;
     90                return mapEntry.second;
    9191
    9292            ++i;
    9393        }
    94         return 0;
     94        return nullptr;
    9595    }
    9696
     
    140140    void Weapon::reload()
    141141    {
    142         for (std::multimap<unsigned int, WeaponMode*>::iterator it = this->weaponmodes_.begin(); it != this->weaponmodes_.end(); ++it)
    143             it->second->reload();
     142        for (const auto& mapEntry : this->weaponmodes_)
     143            mapEntry.second->reload();
    144144    }
    145145
     
    152152    void Weapon::notifyWeaponModes()
    153153    {
    154         for (std::multimap<unsigned int, WeaponMode*>::iterator it = this->weaponmodes_.begin(); it != this->weaponmodes_.end(); ++it)
    155             it->second->setWeapon(this);
     154        for (const auto& mapEntry : this->weaponmodes_)
     155            mapEntry.second->setWeapon(this);
    156156    }
    157157
  • code/branches/cpp11_v3/src/orxonox/weaponsystem/Weapon.h

    r11052 r11054  
    5050            virtual ~Weapon();
    5151
    52             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
     52            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
    5353
    5454            void fire(unsigned int mode);
  • code/branches/cpp11_v3/src/orxonox/weaponsystem/WeaponMode.cc

    r11052 r11054  
    5151        RegisterObject(WeaponMode);
    5252
    53         this->weapon_ = 0;
     53        this->weapon_ = nullptr;
    5454        this->mode_ = WeaponSystem::WEAPON_MODE_UNASSIGNED;
    5555
    56         this->munition_ = 0;
     56        this->munition_ = nullptr;
    5757        this->initialMunition_ = 0;
    5858        this->initialMagazines_ = 0;
     
    244244        else
    245245        {
    246             this->munition_ = NULL;
     246            this->munition_ = nullptr;
    247247        }
    248248    }
  • code/branches/cpp11_v3/src/orxonox/weaponsystem/WeaponMode.h

    r11052 r11054  
    5252            virtual ~WeaponMode();
    5353
    54             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
     54            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
    5555
    5656            bool fire(float* reloadTime);
  • code/branches/cpp11_v3/src/orxonox/weaponsystem/WeaponPack.cc

    r11052 r11054  
    4444        RegisterObject(WeaponPack);
    4545
    46         this->weaponSystem_ = 0;
     46        this->weaponSystem_ = nullptr;
    4747    }
    4848
     
    7676    void WeaponPack::fire(unsigned int weaponmode)
    7777    {
    78         for (std::vector<Weapon *>::iterator it = this->weapons_.begin(); it != this->weapons_.end(); ++it)
    79             (*it)->fire(weaponmode);
     78        for (Weapon* weapon : this->weapons_)
     79            weapon->fire(weaponmode);
    8080    }
    8181
     
    8686    void WeaponPack::reload()
    8787    {
    88         for (std::vector<Weapon *>::iterator it = this->weapons_.begin(); it != this->weapons_.end(); ++it)
    89             (*it)->reload();
     88        for (Weapon* weapon : this->weapons_)
     89            weapon->reload();
    9090    }
    9191
     
    107107        assert(it != this->weapons_.end());
    108108        this->weapons_.erase(it);
    109         weapon->setWeaponPack(0);
     109        weapon->setWeaponPack(nullptr);
    110110    }
    111111
     
    114114        unsigned int i = 0;
    115115
    116         for (std::vector<Weapon *>::const_iterator it = this->weapons_.begin(); it != this->weapons_.end(); ++it)
     116        for (Weapon* weapon : this->weapons_)
    117117        {
    118118            if (i == index)
    119                 return (*it);
     119                return weapon;
    120120            ++i;
    121121        }
    122122
    123         return 0;
     123        return nullptr;
    124124    }
    125125
     
    137137    {
    138138        unsigned int i = 0;
    139         for (std::set<DefaultWeaponmodeLink*>::const_iterator it = this->links_.begin(); it != this->links_.end(); ++it)
     139        for (DefaultWeaponmodeLink* link : this->links_)
    140140        {
    141141            if (i == index)
    142                 return (*it);
     142                return link;
    143143
    144144            ++i;
    145145        }
    146         return 0;
     146        return nullptr;
    147147    }
    148148
    149149    unsigned int WeaponPack::getDesiredWeaponmode(unsigned int firemode) const
    150150    {
    151         for (std::set<DefaultWeaponmodeLink*>::const_iterator it = this->links_.begin(); it != this->links_.end(); ++it)
    152             if ((*it)->getFiremode() == firemode)
    153                 return (*it)->getWeaponmode();
     151        for (DefaultWeaponmodeLink* link : this->links_)
     152            if (link->getFiremode() == firemode)
     153                return link->getWeaponmode();
    154154
    155155        return WeaponSystem::WEAPON_MODE_UNASSIGNED;
     
    158158    void WeaponPack::notifyWeapons()
    159159    {
    160         for (std::vector<Weapon *>::const_iterator it = this->weapons_.begin(); it != this->weapons_.end(); ++it)
    161             (*it)->setWeaponPack(this);
     160        for (Weapon* weapon : this->weapons_)
     161            weapon->setWeaponPack(this);
    162162    }
    163163
  • code/branches/cpp11_v3/src/orxonox/weaponsystem/WeaponPack.h

    r11052 r11054  
    4444            virtual ~WeaponPack();
    4545
    46             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
     46            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
    4747
    4848            void fire(unsigned int weaponmode);
  • code/branches/cpp11_v3/src/orxonox/weaponsystem/WeaponSet.cc

    r10650 r11054  
    4343        RegisterObject(WeaponSet);
    4444
    45         this->weaponSystem_ = 0;
     45        this->weaponSystem_ = nullptr;
    4646        this->desiredFiremode_ = WeaponSystem::FIRE_MODE_UNASSIGNED;
    4747    }
     
    6363    {
    6464        // Fire all WeaponPacks with their defined weaponmode
    65         for (std::map<WeaponPack*, unsigned int>::iterator it = this->weaponpacks_.begin(); it != this->weaponpacks_.end(); ++it)
    66             if (it->second != WeaponSystem::WEAPON_MODE_UNASSIGNED)
    67                 it->first->fire(it->second);
     65        for (const auto& mapEntry : this->weaponpacks_)
     66            if (mapEntry.second != WeaponSystem::WEAPON_MODE_UNASSIGNED)
     67                mapEntry.first->fire(mapEntry.second);
    6868    }
    6969
     
    7171    {
    7272        // Reload all WeaponPacks with their defined weaponmode
    73         for (std::map<WeaponPack*, unsigned int>::iterator it = this->weaponpacks_.begin(); it != this->weaponpacks_.end(); ++it)
    74             it->first->reload();
     73        for (const auto& mapEntry : this->weaponpacks_)
     74            mapEntry.first->reload();
    7575    }
    7676
  • code/branches/cpp11_v3/src/orxonox/weaponsystem/WeaponSet.h

    r9667 r11054  
    4444            virtual ~WeaponSet();
    4545
    46             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
     46            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
    4747
    4848            void fire();
  • code/branches/cpp11_v3/src/orxonox/weaponsystem/WeaponSlot.cc

    r10648 r11054  
    4343        RegisterObject(WeaponSlot);
    4444
    45         this->weaponSystem_ = 0;
    46         this->weapon_ = 0;
     45        this->weaponSystem_ = nullptr;
     46        this->weapon_ = nullptr;
    4747
    4848        this->setSyncMode(ObjectDirection::None);
     
    8888        if (this->weapon_)
    8989        {
    90             this->weapon_->setWeaponSlot(0);
    91             this->weapon_ = 0;
     90            this->weapon_->setWeaponSlot(nullptr);
     91            this->weapon_ = nullptr;
    9292        }
    9393    }
  • code/branches/cpp11_v3/src/orxonox/weaponsystem/WeaponSlot.h

    r10650 r11054  
    6262            virtual ~WeaponSlot();
    6363
    64             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
     64            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
    6565
    6666            void attachWeapon(Weapon * weapon);
     
    7474            */
    7575            inline bool isOccupied() const
    76                 { return (this->weapon_ != 0); }
     76                { return (this->weapon_ != nullptr); }
    7777
    7878            inline void setWeaponSystem(WeaponSystem * weaponSystem)
  • code/branches/cpp11_v3/src/orxonox/weaponsystem/WeaponSystem.cc

    r11052 r11054  
    5252        RegisterObject(WeaponSystem);
    5353
    54         this->pawn_ = 0;
     54        this->pawn_ = nullptr;
    5555    }
    5656
     
    6060        {
    6161            if (this->pawn_)
    62                 this->pawn_->setWeaponSystem(0);
     62                this->pawn_->setWeaponSystem(nullptr);
    6363
    6464            while (!this->weaponSets_.empty())
     
    106106    {
    107107        unsigned int i = 0;
    108         for (std::vector<WeaponSlot*>::const_iterator it = this->weaponSlots_.begin(); it != this->weaponSlots_.end(); ++it)
     108        for (WeaponSlot* weaponSlot : this->weaponSlots_)
    109109        {
    110110            ++i;
    111111            if (i > index)
    112                 return (*it);
    113         }
    114         return 0;
     112                return weaponSlot;
     113        }
     114        return nullptr;
    115115    }
    116116
     
    153153    {
    154154        unsigned int i = 0;
    155         for (std::map<unsigned int, WeaponSet*>::const_iterator it = this->weaponSets_.begin(); it != this->weaponSets_.end(); ++it)
     155        for (const auto& mapEntry : this->weaponSets_)
    156156        {
    157157            ++i;
    158158            if (i > index)
    159                 return it->second;
    160         }
    161         return 0;
     159                return mapEntry.second;
     160        }
     161        return nullptr;
    162162    }
    163163
     
    168168
    169169        unsigned int freeSlots = 0;
    170         for (std::vector<WeaponSlot*>::iterator it = this->weaponSlots_.begin(); it != this->weaponSlots_.end(); ++it)
    171         {
    172             if (!(*it)->isOccupied())
     170        for (WeaponSlot* weaponSlot : this->weaponSlots_)
     171        {
     172            if (!weaponSlot->isOccupied())
    173173                ++freeSlots;
    174174        }
     
    184184        // Attach all weapons to the first free slots (and to the Pawn)
    185185        unsigned int i = 0;
    186         for (std::vector<WeaponSlot*>::iterator it = this->weaponSlots_.begin(); it != this->weaponSlots_.end(); ++it)
    187         {
    188             if (!(*it)->isOccupied() && i < wPack->getNumWeapons())
     186        for (WeaponSlot* weaponSlot : this->weaponSlots_)
     187        {
     188            if (!weaponSlot->isOccupied() && i < wPack->getNumWeapons())
    189189            {
    190190                Weapon* weapon = wPack->getWeapon(i);
    191                 (*it)->attachWeapon(weapon);
     191                weaponSlot->attachWeapon(weapon);
    192192                this->getPawn()->attach(weapon);
    193193                ++i;
     
    196196
    197197        // Assign the desired weaponmode to the firemodes
    198         for (std::map<unsigned int, WeaponSet *>::iterator it = this->weaponSets_.begin(); it != this->weaponSets_.end(); ++it)
    199         {
    200             unsigned int weaponmode = wPack->getDesiredWeaponmode(it->first);
     198        for (const auto& mapEntry : this->weaponSets_)
     199        {
     200            unsigned int weaponmode = wPack->getDesiredWeaponmode(mapEntry.first);
    201201            if (weaponmode != WeaponSystem::WEAPON_MODE_UNASSIGNED)
    202                 it->second->setWeaponmodeLink(wPack, weaponmode);
     202                mapEntry.second->setWeaponmodeLink(wPack, weaponmode);
    203203        }
    204204
     
    213213        // Remove all weapons from their WeaponSlot
    214214        unsigned int i = 0;
    215         Weapon* weapon = 0;
     215        Weapon* weapon = nullptr;
    216216        while ((weapon = wPack->getWeapon(i++)))
    217217            if (weapon->getWeaponSlot())
     
    219219
    220220        // Remove all added links from the WeaponSets
    221         for (std::map<unsigned int, WeaponSet *>::iterator it = this->weaponSets_.begin(); it != this->weaponSets_.end(); ++it)
    222             it->second->removeWeaponmodeLink(wPack);
     221        for (const auto& mapEntry : this->weaponSets_)
     222            mapEntry.second->removeWeaponmodeLink(wPack);
    223223
    224224        // Remove the WeaponPack from the WeaponSystem
     
    231231    {
    232232        unsigned int i = 0;
    233         for (std::vector<WeaponPack*>::const_iterator it = this->weaponPacks_.begin(); it != this->weaponPacks_.end(); ++it)
     233        for (WeaponPack* weaponPack : this->weaponPacks_)
    234234        {
    235235            ++i;
    236236            if (i > index)
    237                 return (*it);
    238         }
    239         return 0;
     237                return weaponPack;
     238        }
     239        return nullptr;
    240240    }
    241241
     
    273273        // Check if the WeaponSet belongs to this WeaponSystem
    274274        bool foundWeaponSet = false;
    275         for (std::map<unsigned int, WeaponSet *>::iterator it2 = this->weaponSets_.begin(); it2 != this->weaponSets_.end(); ++it2)
    276         {
    277             if (it2->second == wSet)
     275        for (const auto& mapEntry : this->weaponSets_)
     276        {
     277            if (mapEntry.second == wSet)
    278278            {
    279279                foundWeaponSet = true;
     
    301301    void WeaponSystem::reload()
    302302    {
    303         for (std::map<unsigned int, WeaponSet *>::iterator it = this->weaponSets_.begin(); it != this->weaponSets_.end(); ++it)
    304             it->second->reload();
     303        for (const auto& mapEntry : this->weaponSets_)
     304            mapEntry.second->reload();
    305305    }
    306306
     
    308308    {
    309309        if (!identifier || !identifier->getIdentifier())
    310             return 0;
     310            return nullptr;
    311311
    312312        std::map<Identifier *, Munition *>::iterator it = this->munitions_.find(identifier->getIdentifier());
     
    337337        else
    338338        {
    339             orxout(internal_warning) << "Adding munition failed. identifier == NULL " << endl;
     339            orxout(internal_warning) << "Adding munition failed. identifier == nullptr " << endl;
    340340        }
    341341    }
  • 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.