Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

merged branch cpp11_v3 back to trunk

Location:
code/trunk
Files:
209 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/orxonox/CameraManager.cc

    r10624 r11071  
    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/trunk/src/orxonox/CameraManager.h

    r9667 r11071  
    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/trunk/src/orxonox/Level.cc

    r10624 r11071  
    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/trunk/src/orxonox/Level.h

    r10624 r11071  
    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/trunk/src/orxonox/LevelInfo.cc

    r9667 r11071  
    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/trunk/src/orxonox/LevelInfo.h

    r9667 r11071  
    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/trunk/src/orxonox/LevelManager.cc

    r11020 r11071  
    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/trunk/src/orxonox/LevelManager.h

    r10258 r11071  
    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/trunk/src/orxonox/Main.h

    r5693 r11071  
    3333#include "OrxonoxPrereqs.h"
    3434
     35#include <string>
     36
    3537namespace orxonox
    3638{
  • code/trunk/src/orxonox/MoodManager.cc

    r10624 r11071  
    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/trunk/src/orxonox/PlayerManager.cc

    r10624 r11071  
    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/trunk/src/orxonox/PlayerManager.h

    r5966 r11071  
    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/trunk/src/orxonox/Radar.cc

    r10624 r11071  
    4949
    5050    Radar::Radar()
    51         : itFocus_(0)
    52         , focus_(0)
     51        : itFocus_(nullptr)
     52        , focus_(nullptr)
    5353        , objectTypeCounter_(0)
    5454    {
    5555        // TODO: make this mapping configurable. Maybe there's a possibility with self configured
    5656        //       configValues..
    57         this->objectTypes_["Asteroid"] = RadarViewable::Dot;
    58         this->objectTypes_["SpaceShip"] = RadarViewable::Square;
    59         this->objectTypes_["AsdfQwerty"] = RadarViewable::Triangle;
     57        this->objectTypes_["Asteroid"] = RadarViewable::Shape::Dot;
     58        this->objectTypes_["SpaceShip"] = RadarViewable::Shape::Square;
     59        this->objectTypes_["AsdfQwerty"] = RadarViewable::Shape::Triangle;
    6060
    6161        /*WorldEntity* object;
     
    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
     
    113113        std::map<std::string, RadarViewable::Shape>::iterator it = this->objectTypes_.find(name);
    114114        if (it == this->objectTypes_.end())
    115             return this->objectTypes_[name] = RadarViewable::Square; // default, configure!!
     115            return this->objectTypes_[name] = RadarViewable::Shape::Square; // default, configure!!
    116116        else
    117117            return this->objectTypes_[name];
     
    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/trunk/src/orxonox/Radar.h

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

    r10727 r11071  
    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/trunk/src/orxonox/Scene.h

    r10624 r11071  
    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/trunk/src/orxonox/Test.cc

    r10624 r11071  
    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/trunk/src/orxonox/chat/ChatHistory.cc

    r10624 r11071  
    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/trunk/src/orxonox/chat/ChatHistory.h

    r10624 r11071  
    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/trunk/src/orxonox/chat/ChatInputHandler.cc

    r10624 r11071  
    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/trunk/src/orxonox/chat/ChatInputHandler.h

    r9675 r11071  
    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/trunk/src/orxonox/chat/ChatManager.cc

    r10624 r11071  
    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/trunk/src/orxonox/chat/ChatManager.h

    r8858 r11071  
    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/trunk/src/orxonox/collisionshapes/CollisionShape.cc

    r10624 r11071  
    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/trunk/src/orxonox/collisionshapes/CollisionShape.h

    r9667 r11071  
    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/trunk/src/orxonox/collisionshapes/CompoundCollisionShape.cc

    r10624 r11071  
    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/trunk/src/orxonox/collisionshapes/CompoundCollisionShape.h

    r9667 r11071  
    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/trunk/src/orxonox/collisionshapes/WorldEntityCollisionShape.cc

    r10624 r11071  
    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/trunk/src/orxonox/collisionshapes/WorldEntityCollisionShape.h

    r10624 r11071  
    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/trunk/src/orxonox/controllers/AIController.cc

    r9667 r11071  
    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/trunk/src/orxonox/controllers/AIController.h

    r9667 r11071  
    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/trunk/src/orxonox/controllers/ActionpointController.cc

    r11052 r11071  
    339339            inLoop = this->bInLoop_;
    340340
    341             Action::Value value;
     341            Action value;
    342342           
    343343            if ( actionName == "FIGHT" )
     
    371371            return this->actionpoints_[index];
    372372        else
    373             return 0;
     373            return nullptr;
    374374    }
    375375    //XML method
    376     Action::Value ActionpointController::getAction ()
     376    Action ActionpointController::getAction ()
    377377    {
    378378        return this->action_;
     
    401401    }
    402402    //XML method
    403     void ActionpointController::setAction (Action::Value action)
     403    void ActionpointController::setAction (Action action)
    404404    {
    405405        this->action_ = action;
    406406    }
    407407    //set action and target/protect
    408     void ActionpointController::setAction (Action::Value action, ControllableEntity* target)
     408    void ActionpointController::setAction (Action action, ControllableEntity* target)
    409409    {
    410410        if (!this || !this->getControllableEntity())
     
    423423    }
    424424    //set action and target position
    425     void ActionpointController::setAction (Action::Value action, const Vector3& target)
     425    void ActionpointController::setAction (Action action, const Vector3& target)
    426426    {
    427427        if (!this || !this->getControllableEntity())
     
    434434    }
    435435    //set action and target position and orientation
    436     void ActionpointController::setAction (Action::Value action, const Vector3& target,  const Quaternion& orient )
     436    void ActionpointController::setAction (Action action, const Vector3& target,  const Quaternion& orient )
    437437    {
    438438        if (!this || !this->getControllableEntity())
     
    476476                return;
    477477
    478             this->setTarget(0);
     478            this->setTarget(nullptr);
    479479            this->setTargetPosition(this->getControllableEntity()->getWorldPosition());
    480480            this->action_ = Action::NONE;
     
    506506                if (targetName == "")
    507507                    break;
    508                 for (ObjectList<Pawn>::iterator itP = ObjectList<Pawn>::begin(); itP; ++itP)
    509                 {
    510                     if (!this || !this->getControllableEntity())
    511                         return;
    512                     if (CommonController::getName(*itP) == targetName)
     508                for (Pawn* pawn : ObjectList<Pawn>())
     509                {
     510                    if (!this || !this->getControllableEntity())
     511                        return;
     512                    if (CommonController::getName(pawn) == targetName)
    513513                    {
    514                         this->setTarget (static_cast<ControllableEntity*>(*itP));
     514                        this->setTarget (static_cast<ControllableEntity*>(pawn));
    515515                    }
    516516                }
     
    541541                if (protectName == "reservedKeyword:human")
    542542                {
    543                     for (ObjectList<Pawn>::iterator itP = ObjectList<Pawn>::begin(); itP; ++itP)
     543                    for (Pawn* pawn : ObjectList<Pawn>())
    544544                    {
    545                         if (orxonox_cast<ControllableEntity*>(*itP) && ((*itP)->getController()) && ((*itP)->getController()->getIdentifier()->getName() == "NewHumanController"))
     545                        if (orxonox_cast<ControllableEntity*>(pawn) && (pawn->getController()) && (pawn->getController()->getIdentifier()->getName() == "NewHumanController"))
    546546                        {
    547                             this->setProtect (static_cast<ControllableEntity*>(*itP));
     547                            this->setProtect (static_cast<ControllableEntity*>(pawn));
    548548                        }
    549549                    }
     
    551551                else
    552552                {
    553                     for (ObjectList<Pawn>::iterator itP = ObjectList<Pawn>::begin(); itP; ++itP)
     553                    for (Pawn* pawn : ObjectList<Pawn>())
    554554                    {
    555                         if (CommonController::getName(*itP) == protectName)
     555                        if (CommonController::getName(pawn) == protectName)
    556556                        {
    557                             this->setProtect (static_cast<ControllableEntity*>(*itP));
     557                            this->setProtect (static_cast<ControllableEntity*>(pawn));
    558558                        }
    559559                    }                           
     
    578578                std::string targetName = p.name;
    579579
    580                 for (ObjectList<Pawn>::iterator itP = ObjectList<Pawn>::begin(); itP; ++itP)
    581                 {
    582                     if (CommonController::getName(*itP) == targetName)
     580                for (Pawn* pawn : ObjectList<Pawn>())
     581                {
     582                    if (CommonController::getName(pawn) == targetName)
    583583                    {
    584584                        if (!this || !this->getControllableEntity())
    585585                            return;
    586                         this->setTarget (static_cast<ControllableEntity*>(*itP));
     586                        this->setTarget (static_cast<ControllableEntity*>(pawn));
    587587                    }
    588588                }
     
    702702    {
    703703        if (!this || !this->getControllableEntity())
    704             return 0;
    705 
    706         Pawn* closestTarget = 0;
     704            return nullptr;
     705
     706        Pawn* closestTarget = nullptr;
    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 (Pawn* pawn : ObjectList<Pawn>())
    710710        {
    711711            if (!this || !this->getControllableEntity())
    712                 return 0;
    713             if ( CommonController::sameTeam (this->getControllableEntity(), static_cast<ControllableEntity*>(*itP), gt) )
     712                return nullptr;
     713            if ( CommonController::sameTeam (this->getControllableEntity(), static_cast<ControllableEntity*>(pawn), gt) )
    714714                continue;
    715715
    716             float distance = CommonController::distance (*itP, this->getControllableEntity());
     716            float distance = CommonController::distance (pawn, this->getControllableEntity());
    717717            if (distance < minDistance)
    718718            {
    719                 closestTarget = *itP;
     719                closestTarget = pawn;
    720720                minDistance = distance;
    721721            }
     
    725725           return closestTarget;
    726726        }
    727         return 0; 
     727        return nullptr;
    728728    }
    729729    //push action FIGHT to the stack and set target to the closest enemy
  • code/trunk/src/orxonox/controllers/ActionpointController.h

    r11052 r11071  
    6565        All the demos are in a file called AITest.oxw. In the menu look for New AI Testing Level.
    6666    */
    67     namespace Action
     67    enum class Action
    6868    { 
    69         enum Value
    70         {
    71             NONE, FLY, FIGHT, PROTECT, FIGHTALL, ATTACK
    72         };
    73        
    74     }
     69        NONE, FLY, FIGHT, PROTECT, FIGHTALL, ATTACK
     70    };
    7571   
    7672    struct Point {
    77         Action::Value action;
     73        Action action;
    7874        std::string name;
    7975        Vector3 position;
    8076        bool inLoop;
    81     } ;
    82     namespace PickupType
    83     {
    84         enum Value
    85         { 
    86             NONE, DAMAGE, HEALTH, SPEED, PORTAL
    87         };
    88     }
     77    };
    8978
    9079    class _OrxonoxExport ActionpointController : public FightingController, public Tickable
     
    9483            ActionpointController(Context* context);
    9584            virtual ~ActionpointController();
    96             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);         
     85            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
    9786               
    9887            /**
     
    10190                In tick ship flies and fires.
    10291            */
    103             virtual void tick(float dt);   
     92            virtual void tick(float dt) override;
    10493            /**
    10594            @brief
     
    186175            virtual void takeActionpoints (const std::vector<Point>& vector, const std::vector<Point>& loop, bool b);
    187176
    188             virtual Action::Value getAction ();
     177            virtual Action getAction ();
    189178            virtual std::string getActionName();
    190179
    191             void setAction (Action::Value action);
    192             void setAction (Action::Value action, ControllableEntity* target);
    193             void setAction (Action::Value action, const Vector3& target);
    194             void setAction (Action::Value action, const Vector3& target,  const Quaternion& orient );
     180            void setAction (Action action);
     181            void setAction (Action action, ControllableEntity* target);
     182            void setAction (Action action, const Vector3& target);
     183            void setAction (Action action, const Vector3& target,  const Quaternion& orient );
    195184
    196185            virtual bool setWingman(ActionpointController* wingman)
     
    210199                WeakPtr<ActionpointController> myDivisionLeader_;
    211200            //----[Actionpoint information]----
    212                 Action::Value action_;
     201                Action action_;
    213202                std::string protectName_;
    214203                std::string targetName_;
    215                 std::vector<WeakPtr<WorldEntity> > actionpoints_;
     204                std::vector<WeakPtr<WorldEntity>> actionpoints_;
    216205                float squaredaccuracy_;
    217                 std::vector<Point > parsedActionpoints_;//<! actionpoints as they are stored here after being parsed from XML
    218                 std::vector<Point > loopActionpoints_;  //<! actionpoints that are to be looped
     206                std::vector<Point> parsedActionpoints_; //<! actionpoints as they are stored here after being parsed from XML
     207                std::vector<Point> loopActionpoints_;   //<! actionpoints that are to be looped
    219208                bool bInLoop_;                          //<! variable for addActionpoint method
    220209                bool bLoop_;                            //<! is state machine looping?
  • code/trunk/src/orxonox/controllers/ArtificialController.cc

    r11052 r11071  
    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/trunk/src/orxonox/controllers/ArtificialController.h

    r9667 r11071  
    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/trunk/src/orxonox/controllers/CommonController.cc

    r11052 r11071  
    8383        int team2 = entity2->getTeam();
    8484
    85         Controller* controller = 0;
     85        Controller* controller = nullptr;
    8686        if (entity1->getController())
    8787            controller = entity1->getController();
     
    120120        }
    121121
    122         TeamBaseMatchBase* base = 0;
     122        TeamBaseMatchBase* base = nullptr;
    123123        base = orxonox_cast<TeamBaseMatchBase*>(entity1);
    124124        if (base)
     
    154154        }
    155155
    156         DroneController* droneController = 0;
     156        DroneController* droneController = nullptr;
    157157        droneController = orxonox_cast<DroneController*>(entity1->getController());
    158158        if (droneController && static_cast<ControllableEntity*>(droneController->getOwner()) == entity2)
  • code/trunk/src/orxonox/controllers/Controller.cc

    r9797 r11071  
    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/trunk/src/orxonox/controllers/Controller.h

    r9797 r11071  
    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/trunk/src/orxonox/controllers/ControllerDirector.cc

    r10622 r11071  
    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/trunk/src/orxonox/controllers/ControllerDirector.h

    r10622 r11071  
    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/trunk/src/orxonox/controllers/DivisionController.cc

    r11052 r11071  
    4040        RegisterObject(DivisionController);
    4141        this->setFormationMode(FormationMode::DIAMOND);
    42         this->target_ = 0;
    43         this->myFollower_ = 0;
    44         this->myWingman_ = 0;
     42        this->target_ = nullptr;
     43        this->myFollower_ = nullptr;
     44        this->myWingman_ = nullptr;
    4545    }
    4646
    4747    DivisionController::~DivisionController()
    4848    {
    49         for (size_t i = 0; i < this->actionpoints_.size(); ++i)
     49        for (WorldEntity* actionpoint : this->actionpoints_)
    5050        {
    51             if(this->actionpoints_[i])
    52                 this->actionpoints_[i]->destroy();
     51            if (actionpoint)
     52                actionpoint->destroy();
    5353        }
    5454        this->parsedActionpoints_.clear();
    5555        this->actionpoints_.clear();
    5656    }
    57 
    58     void DivisionController::XMLPort(Element& xmlelement, XMLPort::Mode mode)
    59     {
    60         SUPER(DivisionController, XMLPort, xmlelement, mode);
    61        
    62     }
    63     void DivisionController::tick(float dt)
    64     {   
    65         if (!this->isActive())
    66             return;   
    67        
    68         SUPER(DivisionController, tick, dt);
    69        
    70     }
    7157    void DivisionController::action()
    7258    {   
  • code/trunk/src/orxonox/controllers/DivisionController.h

    r11052 r11071  
    5050            //----[/language demanded functions]----           
    5151
    52             //----[orxonox demanded functions]----
    53                 virtual void tick(float dt);
    54 
    55                 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);         
    56             //----[orxonox demanded functions]----
    57 
    5852            //----[own functions]----
    59                 virtual bool setFollower(ActionpointController* newFollower);
    60                 virtual bool setWingman(ActionpointController* newWingman);
    61                 virtual bool hasWingman();
    62                 virtual bool hasFollower();
     53                virtual bool setFollower(ActionpointController* newFollower) override;
     54                virtual bool setWingman(ActionpointController* newWingman) override;
     55                virtual bool hasWingman() override;
     56                virtual bool hasFollower() override;
    6357               
    6458            //----[/own functions]----
    65             virtual void stayNearProtect();
     59            virtual void stayNearProtect() override;
    6660
    6761        protected:
    6862            //----action must only be managed by this----
    69             virtual void action(); //<! action() is called in regular intervals managing the bot's behaviour.
     63            virtual void action() override; //<! action() is called in regular intervals managing the bot's behaviour.
    7064
    7165        private:
  • code/trunk/src/orxonox/controllers/DroneController.cc

    r9667 r11071  
    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/trunk/src/orxonox/controllers/DroneController.h

    r9667 r11071  
    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/trunk/src/orxonox/controllers/FightingController.cc

    r11052 r11071  
    2727 */
    2828#include "controllers/FightingController.h"
    29 #include "core/XMLPort.h"
    3029#include "util/Math.h"
    3130
     
    5655    {
    5756       
    58     }
    59     void FightingController::XMLPort( Element& xmlelement, XMLPort::Mode mode )
    60     {
    61         SUPER( FightingController, XMLPort, xmlelement, mode );
    6257    }
    6358    void FightingController::lookAtTarget(float dt)
     
    243238    {
    244239        if (!this || !this->getControllableEntity())
    245             return 0;
    246 
    247         Pawn* closestTarget = 0;
     240            return nullptr;
     241
     242        Pawn* closestTarget = nullptr;
    248243        float minDistance =  std::numeric_limits<float>::infinity();
    249244        Gametype* gt = this->getGametype();
    250         for (ObjectList<Pawn>::iterator itP = ObjectList<Pawn>::begin(); itP; ++itP)
    251         {
    252             if ( CommonController::sameTeam (this->getControllableEntity(), static_cast<ControllableEntity*>(*itP), gt) )
     245        for (Pawn* pawn : ObjectList<Pawn>())
     246        {
     247            if ( CommonController::sameTeam (this->getControllableEntity(), static_cast<ControllableEntity*>(pawn), gt) )
    253248                continue;
    254249
    255             float distance = CommonController::distance (*itP, this->getControllableEntity());
     250            float distance = CommonController::distance (pawn, this->getControllableEntity());
    256251            if (distance < minDistance)
    257252            {
    258                 closestTarget = *itP;
     253                closestTarget = pawn;
    259254                minDistance = distance;
    260255            }
     
    264259           return closestTarget;
    265260        }
    266         return 0; 
     261        return nullptr;
    267262    }
    268263    //I checked it out, rockets DO NOT cause any problems! this->getControllableEntity() is always a SpaceShip
     
    340335            {
    341336                this->weaponModes_.clear(); // reset previous weapon information
    342                 WeaponSlot* wSlot = 0;
     337                WeaponSlot* wSlot = nullptr;
    343338                for(int l=0; (wSlot = pawn->getWeaponSlot(l)) ; l++)
    344339                {
    345                     WeaponMode* wMode = 0;
     340                    WeaponMode* wMode = nullptr;
    346341                    for(int i=0; (wMode = wSlot->getWeapon()->getWeaponmode(i)) ; i++)
    347342                    {
     
    361356    }
    362357
    363     int FightingController::getFiremode(std::string name)
    364     {
    365         for (std::map< std::string, int >::iterator it = this->weaponModes_.begin(); it != this->weaponModes_.end(); ++it)
    366         {
    367             if (it->first == name)
    368                 return it->second;
     358    int FightingController::getFiremode(const std::string& name)
     359    {
     360        for (const auto& mapEntry : this->weaponModes_)
     361        {
     362            if (mapEntry.first == name)
     363                return mapEntry.second;
    369364        }
    370365        return -1;
  • code/trunk/src/orxonox/controllers/FightingController.h

    r11052 r11071  
    5050            virtual ~FightingController();
    5151           
    52             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    53        
    5452            float squaredDistanceToTarget() const;
    5553            bool isLookingAtTarget(float angle) const;
     
    7472                                                                        //<! this and target_ plus or minus some amount in difference vector direction,
    7573                                                                        //<! depending on whether it is better to close up or survive.
    76             void dodgeTowards (Vector3& position);  //fly towards position and awoid being hit
    7774            void doFire();  //<! choose weapon, set aim at target_ and fire
    7875            WeakPtr<ControllableEntity> target_;
     
    9996            void setupWeapons(); //<! Defines which weapons are available for a bot. Is recalled whenever a bot was killed.
    10097            bool bSetupWorked; //<! If false, setupWeapons() is called.
    101             int getFiremode(std::string name);
     98            int getFiremode(const std::string& name);
    10299         
    103100    };
  • code/trunk/src/orxonox/controllers/FlyingController.cc

    r11052 r11071  
    6161    }
    6262   
    63     void FlyingController::setFormationModeXML(std::string val)
     63    void FlyingController::setFormationModeXML(const std::string& val)
    6464    {
    6565        const std::string valUpper = getUppercase(val);
    66         FormationMode::Value value;
     66        FormationMode value;
    6767       
    6868        if (valUpper == "WALL")
     
    233233            return;
    234234        SpaceShip* ship = orxonox_cast<SpaceShip*>(this->getControllableEntity());
    235         if(ship == NULL) return;
     235        if(ship == nullptr) return;
    236236        if(ship->getBoostPower()*1.5f > ship->getInitialBoostPower()) //upper limit ->boost
    237237        {
  • code/trunk/src/orxonox/controllers/FlyingController.h

    r11052 r11071  
    4141
    4242    //Formation mode for the divisions
    43     namespace FormationMode
     43    enum class FormationMode
    4444    {
    45         enum Value
    46         {
    47             FINGER4, DIAMOND, WALL
    48         };
    49     }
     45        FINGER4, DIAMOND, WALL
     46    };
    5047
    5148    class _OrxonoxExport FlyingController : public CommonController
     
    5855            FlyingController(Context* context);
    5956            virtual ~FlyingController();
    60             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
     57            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
    6158
    6259            void setSpread (int spread)                         //<! spread is a multiplier for formation flight, should be bigger than 100
     
    6562                { return this->spread_; }
    6663
    67             void setFormationModeXML(std::string val);
     64            void setFormationModeXML(const std::string& val);
    6865            std::string getFormationModeXML() const;
    6966
    70             void setFormationMode(FormationMode::Value val)
     67            void setFormationMode(FormationMode val)
    7168                { this->formationMode_ = val; }
    72             FormationMode::Value getFormationMode() const
     69            FormationMode getFormationMode() const
    7370                { return this->formationMode_; }
    7471            bool bCopyOrientation_;                             //<! set to true by default, MasterController sets it in its tick(),
     
    9188                                                                    //<! this stays in a certain position relative to leader     
    9289           
    93             FormationMode::Value formationMode_;
     90            FormationMode formationMode_;
    9491         
    9592            float rotationProgress_;    //<! for slerping
  • code/trunk/src/orxonox/controllers/FormationController.cc

    r11052 r11071  
    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/trunk/src/orxonox/controllers/FormationController.h

    r10631 r11071  
    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/trunk/src/orxonox/controllers/HumanController.cc

    r11052 r11071  
    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/trunk/src/orxonox/controllers/HumanController.h

    r10624 r11071  
    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/trunk/src/orxonox/controllers/MasterController.cc

    r11052 r11071  
    5858        {
    5959            //fill the vector in the first tick
    60             for (ObjectList<ActionpointController>::iterator it = ObjectList<ActionpointController>::begin(); it; ++it)
     60            for (ActionpointController* controller : ObjectList<ActionpointController>())
    6161            {
    6262                //----0ptr?----
    63                 if (!it)
     63                if (!controller)
    6464                    continue;
    65                 this->controllers_.push_back(*it);
     65                this->controllers_.push_back(controller);
    6666            }
    6767        }
  • code/trunk/src/orxonox/controllers/MasterController.h

    r11052 r11071  
    6161
    6262            //----[orxonox demanded functions]----
    63                 virtual void tick(float dt);
     63                virtual void tick(float dt) override;
    6464
    6565            //----[orxonox demanded functions]----
     
    6868         
    6969        private:
    70             std::vector<WeakPtr<ActionpointController> > controllers_;  //<! vector of controllers, which action(), canFire() and maneuver() methods are to be called
     70            std::vector<WeakPtr<ActionpointController>> controllers_;//<! vector of controllers, which action(), canFire() and maneuver() methods are to be called
    7171            size_t indexOfCurrentController_;                        //<! index of current controller
    7272            unsigned int numberOfTicksPassedSinceLastActionCall_;
  • code/trunk/src/orxonox/controllers/NewHumanController.cc

    r10631 r11071  
    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/trunk/src/orxonox/controllers/NewHumanController.h

    r9667 r11071  
    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/trunk/src/orxonox/controllers/ScriptController.cc

    r10622 r11071  
    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/trunk/src/orxonox/controllers/ScriptController.h

    r10622 r11071  
    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/trunk/src/orxonox/controllers/SectionController.cc

    r11052 r11071  
    4040        this->setFormationMode(FormationMode::FINGER4);
    4141
    42         this->myWingman_ = 0;
    43         this->myDivisionLeader_ = 0;
     42        this->myWingman_ = nullptr;
     43        this->myDivisionLeader_ = nullptr;
    4444        this->bFirstAction_ = true;
    4545
     
    4848    SectionController::~SectionController()
    4949    {
    50        for (size_t i = 0; i < this->actionpoints_.size(); ++i)
    51         {
    52             if(this->actionpoints_[i])
    53                 this->actionpoints_[i]->destroy();
     50        for (WorldEntity* actionpoint : this->actionpoints_)
     51        {
     52            if (actionpoint)
     53                actionpoint->destroy();
    5454        }
    5555        this->parsedActionpoints_.clear();
    5656        this->actionpoints_.clear();
    57     }
    58     void SectionController::XMLPort(Element& xmlelement, XMLPort::Mode mode)
    59     {
    60         SUPER(SectionController, XMLPort, xmlelement, mode);
    61     }
    62 
    63     //----in tick, move (or look) and shoot----
    64     void SectionController::tick(float dt)
    65     {
    66         if (!this->isActive())
    67             return;
    68    
    69         SUPER(SectionController, tick, dt);
    70        
    7157    }
    7258
     
    131117    {
    132118        //----If division leader fights, cover him by fighting emenies close to his target----
    133         Action::Value action = this->myDivisionLeader_->getAction();
     119        Action action = this->myDivisionLeader_->getAction();
    134120
    135121        if (action == Action::FIGHT || action == Action::FIGHTALL || action == Action::ATTACK)
     
    147133                    Vector3 divisionTargetPosition = this->myDivisionLeader_->getTarget()->getWorldPosition();
    148134                    Gametype* gt = this->getGametype();
    149                     for (ObjectList<Pawn>::iterator itP = ObjectList<Pawn>::begin(); itP; ++itP)
     135                    for (Pawn* pawn : ObjectList<Pawn>())
    150136                    {
    151137                        //----is enemy?----
    152                         if ( CommonController::sameTeam (this->getControllableEntity(), static_cast<ControllableEntity*>(*itP), gt) )
     138                        if ( CommonController::sameTeam (this->getControllableEntity(), static_cast<ControllableEntity*>(pawn), gt) )
    153139                            continue;           
    154140                        //----in range?----
    155                         if (((*itP)->getWorldPosition() - divisionTargetPosition).length() < 3000 &&
    156                             (*itP) != this->myDivisionLeader_->getTarget())
     141                        if ((pawn->getWorldPosition() - divisionTargetPosition).length() < 3000 &&
     142                            pawn != this->myDivisionLeader_->getTarget())
    157143                        {
    158144                            foundTarget = true;
    159                             target =  (*itP);
     145                            target = pawn;
    160146                            break;
    161147                        }
     
    188174        this->setFormationMode( this->myDivisionLeader_->getFormationMode() );
    189175        this->spread_ = this->myDivisionLeader_->getSpread();
    190         Vector3* targetRelativePosition;
    191176        switch (this->formationMode_){
    192177            case FormationMode::WALL:
    193             {
    194                 targetRelativePosition = new Vector3 (-2.0f*this->spread_, 0, 0);   
    195                 break;
    196             }
     178                return Vector3 (-2.0f*this->spread_, 0, 0);
     179
    197180            case FormationMode::FINGER4:
    198             {
    199                 targetRelativePosition = new Vector3 (-2.0f*this->spread_, 0, 1.0f*this->spread_);   
    200                 break;
    201             }
     181                return Vector3 (-2.0f*this->spread_, 0, 1.0f*this->spread_);
    202182           
    203183            case FormationMode::DIAMOND:
    204             {
    205                 targetRelativePosition = new Vector3 (-2.0f*this->spread_, 0, 1.0f*this->spread_);
    206                 break;
    207             }
    208         }
    209         Vector3 result = *targetRelativePosition;
    210         delete targetRelativePosition;
    211         return result;
     184                return Vector3 (-2.0f*this->spread_, 0, 1.0f*this->spread_);
     185
     186            default:
     187                return Vector3::ZERO;
     188        }
    212189    }
    213190
     
    226203
    227204        if (!this->getControllableEntity())
    228             return 0;
    229 
    230         ActionpointController* closestLeader = 0;
     205            return nullptr;
     206
     207        ActionpointController* closestLeader = nullptr;
    231208        float minDistance =  std::numeric_limits<float>::infinity();
    232209        //go through all pawns
    233         for (ObjectList<ActionpointController>::iterator it = ObjectList<ActionpointController>::begin(); it; ++it)
     210        for (ActionpointController* controller : ObjectList<ActionpointController>())
    234211        {
    235212            //0ptr or not DivisionController?
    236             if (!(it) || !((it)->getIdentifier()->getName() == "DivisionController") || !(it->getControllableEntity()))
     213            if (!controller || !(controller->getIdentifier()->getName() == "DivisionController") || !(controller->getControllableEntity()))
    237214                continue;
    238215            //same team?
    239             if ((this->getControllableEntity()->getTeam() != (it)->getControllableEntity()->getTeam()))
     216            if ((this->getControllableEntity()->getTeam() != controller->getControllableEntity()->getTeam()))
    240217                continue;
    241218
    242219            //is equal to this?
    243             if (orxonox_cast<ControllableEntity*>(*it) == this->getControllableEntity())
     220            if (orxonox_cast<ControllableEntity*>(controller) == this->getControllableEntity())
    244221                continue;
    245222
    246             float distance = CommonController::distance (it->getControllableEntity(), this->getControllableEntity());
     223            float distance = CommonController::distance (controller->getControllableEntity(), this->getControllableEntity());
    247224           
    248             if (distance < minDistance && !(it->hasFollower()))
    249             {
    250                 closestLeader = *it;
     225            if (distance < minDistance && !(controller->hasFollower()))
     226            {
     227                closestLeader = controller;
    251228                minDistance = distance;
    252229            }
     
    258235                return closestLeader;
    259236        }
    260         return 0;
     237        return nullptr;
    261238    }
    262239
  • code/trunk/src/orxonox/controllers/SectionController.h

    r11052 r11071  
    4949            //----[/language demanded functions]----
    5050           
    51             //----[orxonox demanded functions]----
    52                 virtual void tick(float dt);
    53                
    54                 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    55             //----[/orxonox demanded functions]----
    56            
    5751            //----[own functions]----
    5852                ActionpointController* findNewDivisionLeader();
    5953
    60                 virtual bool setWingman(ActionpointController* newWingman);
    61                 virtual bool hasWingman();
    62                 virtual bool hasFollower()
     54                virtual bool setWingman(ActionpointController* newWingman) override;
     55                virtual bool hasWingman() override;
     56                virtual bool hasFollower() override
    6357                    { return false; }
    6458                void chooseTarget();
     
    6761        protected:       
    6862            //----action must only be managed by this----     
    69                 virtual void action(); //<! action() is called in regular intervals by MasterController managing the bot's behaviour.
     63                virtual void action() override; //<! action() is called in regular intervals by MasterController managing the bot's behaviour.
    7064                Vector3 getFormationPosition ();
    7165                void keepFormation();
  • code/trunk/src/orxonox/controllers/WaypointController.cc

    r9667 r11071  
    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/trunk/src/orxonox/controllers/WaypointController.h

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

    r9716 r11071  
    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/trunk/src/orxonox/controllers/WaypointPatrolController.h

    r9716 r11071  
    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/trunk/src/orxonox/controllers/WingmanController.cc

    r11052 r11071  
    3939    {
    4040        RegisterObject(WingmanController);
    41         this->myLeader_ = 0;
     41        this->myLeader_ = nullptr;
    4242        this->bFirstAction_ = true;
    4343
     
    4646    WingmanController::~WingmanController()
    4747    {
    48         for (size_t i = 0; i < this->actionpoints_.size(); ++i)
     48        for (WorldEntity* actionpoint : this->actionpoints_)
    4949        {
    50             if(this->actionpoints_[i])
    51                 this->actionpoints_[i]->destroy();
     50            if (actionpoint)
     51                actionpoint->destroy();
    5252        }
    5353        this->parsedActionpoints_.clear();
    5454        this->actionpoints_.clear();
    55     }
    56  
    57     void WingmanController::XMLPort(Element& xmlelement, XMLPort::Mode mode)
    58     {
    59         SUPER(WingmanController, XMLPort, xmlelement, mode);
    60     }
    61    
    62     //----in tick, move (or look) and shoot----
    63     void WingmanController::tick(float dt)
    64     {   
    65         if (!this->isActive())
    66             return;
    67        
    68         SUPER(WingmanController, tick, dt);
    69 
    7055    }
    7156   
     
    122107    Vector3 WingmanController::getFormationPosition ()
    123108    {
    124 
    125 
    126109        this->setFormationMode( this->myLeader_->getFormationMode() );
    127         Vector3* targetRelativePosition;
    128110        this->spread_ = this->myLeader_->getSpread();
    129111        if (this->myLeader_->getIdentifier()->getName() == "DivisionController")
     
    131113            switch (this->formationMode_){
    132114                case FormationMode::WALL:
    133                 {
    134                     targetRelativePosition = new Vector3 (2.0f*this->spread_, 0, 0 - 1.0f*this->tolerance_);
    135                     break;
    136                 }
     115                    return Vector3 (2.0f*this->spread_, 0, 0 - 1.0f*this->tolerance_);
    137116                case FormationMode::FINGER4:
    138                 {
    139                     targetRelativePosition = new Vector3 (2.0f*this->spread_, 0, this->spread_ - 1.0f*this->tolerance_);
    140                     break;
    141                 }
     117                    return Vector3 (2.0f*this->spread_, 0, this->spread_ - 1.0f*this->tolerance_);
    142118                case FormationMode::DIAMOND:
    143                 {
    144                     targetRelativePosition = new Vector3 (2.0f*this->spread_, 0, this->spread_ - 1.0f*this->tolerance_);
    145                     break;
    146                 }
     119                    return Vector3 (2.0f*this->spread_, 0, this->spread_ - 1.0f*this->tolerance_);
     120                default:
     121                    return Vector3::ZERO;
    147122            }
    148123        }
     
    151126            switch (this->formationMode_){
    152127                case FormationMode::WALL:
    153                 {
    154                     targetRelativePosition = new Vector3 (-2.0f*this->spread_, 0, 0 - 1.0f*this->tolerance_);
    155                     break;
    156                 }
     128                    return Vector3 (-2.0f*this->spread_, 0, 0 - 1.0f*this->tolerance_);
    157129                case FormationMode::FINGER4:
    158                 {
    159                     targetRelativePosition = new Vector3 (-2.0f*this->spread_, 0, this->spread_ - 1.0f*this->tolerance_);
    160                     break;
    161                 }
     130                    return Vector3 (-2.0f*this->spread_, 0, this->spread_ - 1.0f*this->tolerance_);
    162131                case FormationMode::DIAMOND:
    163                 {
    164                     targetRelativePosition = new Vector3 (2.0f*this->spread_, -1.0f*this->spread_, 0 - 1.0f*this->tolerance_);
    165                     break;
    166                 }
     132                    return Vector3 (2.0f*this->spread_, -1.0f*this->spread_, 0 - 1.0f*this->tolerance_);
     133                default:
     134                    return Vector3::ZERO;
    167135            }
    168136        }
    169         Vector3 result = *targetRelativePosition;
    170         delete targetRelativePosition;
    171         return result;
    172137    }
    173138    void WingmanController::keepFormation()
     
    185150
    186151        if (!this->getControllableEntity())
    187             return 0;
     152            return nullptr;
    188153
    189154        //----vars for finding the closest leader----
    190         ActionpointController* closestLeader = 0;
     155        ActionpointController* closestLeader = nullptr;
    191156        float minDistance =  std::numeric_limits<float>::infinity();
    192157        Gametype* gt = this->getGametype();
    193158
    194         for (ObjectList<ActionpointController>::iterator it = ObjectList<ActionpointController>::begin(); it; ++it)
     159        for (ActionpointController* controller : ObjectList<ActionpointController>())
    195160        {
    196161            //----0ptr or not a leader or dead?----
    197             if (!it ||
    198                 (it->getIdentifier()->getName() != "SectionController" && it->getIdentifier()->getName() != "DivisionController") ||
    199                 !(it->getControllableEntity()))
     162            if (!controller ||
     163                (controller->getIdentifier()->getName() != "SectionController" && controller->getIdentifier()->getName() != "DivisionController") ||
     164                !(controller->getControllableEntity()))
    200165                continue;
    201166           
    202167            //----same team?----
    203             if ( !CommonController::sameTeam (this->getControllableEntity(), (it)->getControllableEntity(), gt) )
     168            if ( !CommonController::sameTeam (this->getControllableEntity(), controller->getControllableEntity(), gt) )
    204169                continue;
    205170           
    206171            //----check distance----
    207             float distance = CommonController::distance (it->getControllableEntity(), this->getControllableEntity());
    208             if (distance < minDistance && !(it->hasWingman()))
     172            float distance = CommonController::distance (controller->getControllableEntity(), this->getControllableEntity());
     173            if (distance < minDistance && !(controller->hasWingman()))
    209174            {
    210                 closestLeader = *it;
     175                closestLeader = controller;
    211176                minDistance = distance;
    212177            }
     
    222187            }
    223188        }
    224         return 0;
     189        return nullptr;
    225190    }
    226191
  • code/trunk/src/orxonox/controllers/WingmanController.h

    r11052 r11071  
    5151           
    5252            //----[orxonox demanded functions]----
    53                 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    54 
    55                 virtual void tick(float dt);
    56                 virtual bool hasWingman()
     53                virtual bool hasWingman() override
    5754                    { return false; }
    58                 virtual bool hasFollower()
     55                virtual bool hasFollower() override
    5956                    { return false; }
    6057            //----[/orxonox demanded functions]----
     
    6663        protected:
    6764            //----action must only be managed by this----
    68                 virtual void action(); //<! action() is called in regular intervals managing the bot's behaviour.
     65                virtual void action() override; //<! action() is called in regular intervals managing the bot's behaviour.
    6966                Vector3 getFormationPosition ();
    7067                void keepFormation();
  • code/trunk/src/orxonox/gamestates/GSClient.h

    r7163 r11071  
    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/trunk/src/orxonox/gamestates/GSGraphics.h

    r6417 r11071  
    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/trunk/src/orxonox/gamestates/GSLevel.cc

    r10624 r11071  
    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/trunk/src/orxonox/gamestates/GSLevel.h

    r10624 r11071  
    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/trunk/src/orxonox/gamestates/GSLevelMemento.h

    r10281 r11071  
    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/trunk/src/orxonox/gamestates/GSMainMenu.cc

    r10624 r11071  
    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/trunk/src/orxonox/gamestates/GSMainMenu.h

    r9667 r11071  
    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/trunk/src/orxonox/gamestates/GSMasterServer.h

    r7801 r11071  
    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/trunk/src/orxonox/gamestates/GSRoot.cc

    r10624 r11071  
    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/trunk/src/orxonox/gamestates/GSRoot.h

    r8706 r11071  
    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/trunk/src/orxonox/gamestates/GSServer.cc

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

    r5929 r11071  
    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/trunk/src/orxonox/gamestates/GSStandalone.h

    r5929 r11071  
    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/trunk/src/orxonox/gametypes/Asteroids.h

    r9667 r11071  
    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/trunk/src/orxonox/gametypes/Deathmatch.h

    r9667 r11071  
    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/trunk/src/orxonox/gametypes/Dynamicmatch.cc

    r11052 r11071  
    8888    Dynamicmatch::~Dynamicmatch()
    8989    {
    90         for (std::set<Timer*>::iterator it = this->piggyTimers_.begin(); it != this->piggyTimers_.end(); ++it)
    91             delete (*it);
     90        for (Timer* timer : this->piggyTimers_)
     91            delete timer;
    9292    }
    9393
     
    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/trunk/src/orxonox/gametypes/Dynamicmatch.h

    r11052 r11071  
    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/trunk/src/orxonox/gametypes/Gametype.cc

    r10624 r11071  
    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/trunk/src/orxonox/gametypes/Gametype.h

    r10624 r11071  
    4545namespace orxonox
    4646{
    47     namespace PlayerState
    48     {
    49         enum Value
    50         {
    51             Uninitialized,
    52             Joined,
    53             Alive,
    54             Dead
    55         };
    56     }
     47    enum class PlayerState
     48    {
     49        Uninitialized,
     50        Joined,
     51        Alive,
     52        Dead
     53    };
    5754
    5855    struct Player
    5956    {
    6057        PlayerInfo* info_;
    61         PlayerState::Value state_;
     58        PlayerState state_;
    6259        int frags_;
    6360        int killed_;
     
    7673            void setConfigValues();
    7774
    78             virtual void tick(float dt);
     75            virtual void tick(float dt) override;
    7976
    8077            inline const GametypeInfo* getGametypeInfo() const
     
    9693            virtual void playerScored(PlayerInfo* player, int score = 1);
    9794
    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);
     95            virtual bool allowPawnHit(Pawn* victim, Pawn* originator = nullptr);
     96            virtual bool allowPawnDamage(Pawn* victim, Pawn* originator = nullptr);
     97            virtual bool allowPawnDeath(Pawn* victim, Pawn* originator = nullptr);
     98
     99            virtual void pawnKilled(Pawn* victim, Pawn* killer = nullptr);
    103100            virtual void pawnPreSpawn(Pawn* pawn);
    104101            virtual void pawnPostSpawn(Pawn* pawn);
     
    175172            virtual void spawnDeadPlayersIfRequested();
    176173
    177             virtual GSLevelMementoState* exportMementoState();
    178             virtual void importMementoState(const std::vector<GSLevelMementoState*>& states);
     174            virtual GSLevelMementoState* exportMementoState() override;
     175            virtual void importMementoState(const std::vector<GSLevelMementoState*>& states) override;
    179176
    180177            WeakPtr<GametypeInfo> gtinfo_;
  • code/trunk/src/orxonox/gametypes/LastManStanding.cc

    r9667 r11071  
    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/trunk/src/orxonox/gametypes/LastManStanding.h

    r9667 r11071  
    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/trunk/src/orxonox/gametypes/LastTeamStanding.cc

    r9941 r11071  
    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/trunk/src/orxonox/gametypes/LastTeamStanding.h

    r9667 r11071  
    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/trunk/src/orxonox/gametypes/Mission.cc

    r10624 r11071  
    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/trunk/src/orxonox/gametypes/Mission.h

    r9729 r11071  
    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/trunk/src/orxonox/gametypes/TeamBaseMatch.cc

    r9667 r11071  
    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/trunk/src/orxonox/gametypes/TeamBaseMatch.h

    r9667 r11071  
    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/trunk/src/orxonox/gametypes/TeamDeathmatch.cc

    r9941 r11071  
    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/trunk/src/orxonox/gametypes/TeamDeathmatch.h

    r9941 r11071  
    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/trunk/src/orxonox/gametypes/TeamGametype.cc

    r9941 r11071  
    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/trunk/src/orxonox/gametypes/TeamGametype.h

    r9941 r11071  
    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/trunk/src/orxonox/gametypes/UnderAttack.cc

    r9941 r11071  
    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/trunk/src/orxonox/gametypes/UnderAttack.h

    r9941 r11071  
    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/trunk/src/orxonox/graphics/AnimatedModel.h

    r9667 r11071  
    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/trunk/src/orxonox/graphics/Backlight.cc

    r9667 r11071  
    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/trunk/src/orxonox/graphics/Backlight.h

    r9667 r11071  
    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/trunk/src/orxonox/graphics/Billboard.cc

    r9667 r11071  
    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/trunk/src/orxonox/graphics/Billboard.h

    r9667 r11071  
    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/trunk/src/orxonox/graphics/BlinkingBillboard.h

    r9667 r11071  
    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/trunk/src/orxonox/graphics/Camera.h

    r9667 r11071  
    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/trunk/src/orxonox/graphics/FadingBillboard.h

    r9667 r11071  
    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/trunk/src/orxonox/graphics/GlobalShader.h

    r9667 r11071  
    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/trunk/src/orxonox/graphics/Light.cc

    r9667 r11071  
    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::Type::Point,       "check enum");
     47    static_assert((int)Ogre::Light::LT_DIRECTIONAL == (int)Light::Type::Directional, "check enum");
     48    static_assert((int)Ogre::Light::LT_SPOTLIGHT   == (int)Light::Type::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;
    58         this->type_ = Light::Point;
     57        this->type_ = Type::Point;
    5958        this->attenuation_ = Vector4(100000, 1, 0, 0);
    6059        this->spotlightRange_ = Vector3(40.0f, 30.0f, 1.0f);
     
    106105    void Light::registerVariables()
    107106    {
    108         registerVariable((int&)this->type_,     VariableDirection::ToClient, new NetworkCallback<Light>(this, &Light::updateType));
     107        registerVariable(this->type_,           VariableDirection::ToClient, new NetworkCallback<Light>(this, &Light::updateType));
    109108        registerVariable(this->diffuse_,        VariableDirection::ToClient, new NetworkCallback<Light>(this, &Light::updateDiffuseColour));
    110109        registerVariable(this->specular_,       VariableDirection::ToClient, new NetworkCallback<Light>(this, &Light::updateSpecularColour));
     
    127126    void Light::updateAttenuation()
    128127    {
    129         if (this->light_ && this->type_ != Light::Directional)
     128        if (this->light_ && this->type_ != Type::Directional)
    130129            this->light_->setAttenuation(this->attenuation_.x, this->attenuation_.y, this->attenuation_.z, this->attenuation_.w);
    131130    }
     
    133132    void Light::updateSpotlightRange()
    134133    {
    135         if (this->light_ && this->type_ == Light::Spotlight)
     134        if (this->light_ && this->type_ == Type::Spotlight)
    136135            this->light_->setSpotlightRange(Degree(this->spotlightRange_.x), Degree(this->spotlightRange_.y), this->spotlightRange_.z);
    137136    }
     
    140139    {
    141140        if (type == "point")
    142             this->setType(Light::Point);
     141            this->setType(Type::Point);
    143142        else if (type == "directional")
    144             this->setType(Light::Directional);
     143            this->setType(Type::Directional);
    145144        else if (type == "spotlight")
    146             this->setType(Light::Spotlight);
     145            this->setType(Type::Spotlight);
    147146        else
    148             this->setType(Light::Point);
     147            this->setType(Type::Point);
    149148    }
    150149
     
    153152        switch (this->type_)
    154153        {
    155             case Light::Directional:
     154            case Type::Directional:
    156155                return "directional";
    157             case Light::Spotlight:
     156            case Type::Spotlight:
    158157                return "spotlight";
    159             case Light::Point:
     158            case Type::Point:
    160159            default:
    161160                return "point";
     
    169168            this->light_->setType(static_cast<Ogre::Light::LightTypes>(this->type_));
    170169
    171             if (this->type_ != Light::Directional)
     170            if (this->type_ != Type::Directional)
    172171                this->updateAttenuation();
    173             if (this->type_ == Light::Spotlight)
     172            if (this->type_ == Type::Spotlight)
    174173                this->updateSpotlightRange();
    175174        }
  • code/trunk/src/orxonox/graphics/Light.h

    r9667 r11071  
    4242    {
    4343        public:
    44             enum LightTypes // Copy from the Ogre enum
     44            enum class Type // Copy from the Ogre enum
    4545            {
    4646                /// Point light sources give off light equally in all directions, so require only position not direction
     
    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()
    6363                { return this->light_; }
    6464
    65             inline void setType(Light::LightTypes type)
     65            inline void setType(Light::Type type)
    6666                { this->type_ = type; this->updateType(); }
    67             inline Light::LightTypes getType() const
     67            inline Light::Type getType() const
    6868                { return this->type_; }
    6969
     
    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
     
    144144
    145145            Ogre::Light* light_;
    146             LightTypes type_;
     146            Light::Type type_;
    147147            ColourValue diffuse_;
    148148            ColourValue specular_;
  • code/trunk/src/orxonox/graphics/MeshLodInformation.h

    r9667 r11071  
    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/trunk/src/orxonox/graphics/Model.cc

    r10728 r11071  
    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/trunk/src/orxonox/graphics/Model.h

    r9667 r11071  
    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/trunk/src/orxonox/graphics/ParticleEmitter.cc

    r9950 r11071  
    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/trunk/src/orxonox/graphics/ParticleEmitter.h

    r9950 r11071  
    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/trunk/src/orxonox/graphics/ParticleSpawner.h

    r9667 r11071  
    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/trunk/src/orxonox/infos/Bot.h

    r9667 r11071  
    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/trunk/src/orxonox/infos/GametypeInfo.cc

    r10624 r11071  
    291291        if(GameMode::isMaster())
    292292        {
    293             NotificationListener::sendNotification("Press [Fire] to respawn", GametypeInfo::NOTIFICATION_SENDER, notificationMessageType::info, notificationSendMode::network, player->getClientID());
     293            NotificationListener::sendNotification("Press [Fire] to respawn", GametypeInfo::NOTIFICATION_SENDER, NotificationMessageType::info, NotificationSendMode::network, player->getClientID());
    294294            // Remove the player from the list of players that have spawned, since it currently is not.
    295295            this->spawnedPlayers_.erase(player);
     
    346346                // Display "Press [Fire] to start the match" if the game has not yet ended.
    347347                if(!this->hasEnded())
    348                     NotificationListener::sendNotification("Press [Fire] to start the match", GametypeInfo::NOTIFICATION_SENDER, notificationMessageType::info, notificationSendMode::network, player->getClientID());
     348                    NotificationListener::sendNotification("Press [Fire] to start the match", GametypeInfo::NOTIFICATION_SENDER, NotificationMessageType::info, NotificationSendMode::network, player->getClientID());
    349349                // Else display "Game has ended".
    350350                else
    351                     NotificationListener::sendNotification("Game has ended", GametypeInfo::NOTIFICATION_SENDER, notificationMessageType::info, notificationSendMode::network, player->getClientID());
     351                    NotificationListener::sendNotification("Game has ended", GametypeInfo::NOTIFICATION_SENDER, NotificationMessageType::info, NotificationSendMode::network, player->getClientID());
    352352            }
    353353        }
     
    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/trunk/src/orxonox/infos/HumanPlayer.cc

    r10624 r11071  
    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/trunk/src/orxonox/infos/HumanPlayer.h

    r10624 r11071  
    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/trunk/src/orxonox/infos/PlayerInfo.cc

    r11052 r11071  
    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/trunk/src/orxonox/infos/PlayerInfo.h

    r10624 r11071  
    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/trunk/src/orxonox/interfaces/NotificationListener.cc

    r10624 r11071  
    7474        The type of the notification, can be either 'info' or 'important'.
    7575    */
    76     /*static*/ void NotificationListener::sendNetworkHelper(const std::string& message, const std::string& sender, notificationSendMode::Value sendMode, unsigned int clientId, bool isCommand, notificationMessageType::Value messageType)
     76    /*static*/ void NotificationListener::sendNetworkHelper(const std::string& message, const std::string& sender, NotificationSendMode sendMode, unsigned int clientId, bool isCommand, NotificationMessageType messageType)
    7777    {
    7878        // If we're in standalone mode or we're already no the right client we create and send the notification/command.
    79         if(GameMode::isStandalone() || sendMode == notificationSendMode::local || (sendMode ==  notificationSendMode::network && Host::getPlayerID() == clientId))
     79        if(GameMode::isStandalone() || sendMode == NotificationSendMode::local || (sendMode ==  NotificationSendMode::network && Host::getPlayerID() == clientId))
    8080        {
    8181            sendHelper(message, sender, isCommand, messageType);
    8282        }
    8383        // If we're on the server (and the server is not the intended recipient of the notification/command) we send it over the network.
    84         else if(GameMode::isServer() && sendMode == notificationSendMode::network && Host::getPlayerID() != clientId)
     84        else if(GameMode::isServer() && sendMode == NotificationSendMode::network && Host::getPlayerID() != clientId)
    8585        {
    86             callStaticNetworkFunction(&NotificationListener::sendHelper, clientId, message, sender, isCommand, (unsigned int)messageType);
     86            callStaticNetworkFunction(&NotificationListener::sendHelper, clientId, message, sender, isCommand, messageType);
    8787        }
    88         else if(GameMode::isServer() && sendMode == notificationSendMode::broadcast)
     88        else if(GameMode::isServer() && sendMode == NotificationSendMode::broadcast)
    8989        {
    9090            // TODO: Works as intended?
    91             callStaticNetworkFunction(&NotificationListener::sendHelper, NETWORK_PEER_ID_BROADCAST, message, sender, isCommand, (unsigned int)messageType);
     91            callStaticNetworkFunction(&NotificationListener::sendHelper, NETWORK_PEER_ID_BROADCAST, message, sender, isCommand, messageType);
    9292        }
    9393    }
     
    105105        The type of the notification.
    106106    */
    107     /*static*/ void NotificationListener::sendHelper(const std::string& message, const std::string& sender, bool isCommand, unsigned int messageType)
     107    /*static*/ void NotificationListener::sendHelper(const std::string& message, const std::string& sender, bool isCommand, NotificationMessageType type)
    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, type);
    115115
    116116            // If the notification is a command.
    117117            if(isCommand)
    118118            {
    119                 notificationCommand::Value command = str2Command(message);
    120                 if(command != notificationCommand::none)
    121                     it->executeCommand(command, sender);
     119                NotificationCommand command = str2Command(message);
     120                if(command != NotificationCommand::none)
     121                    listener->executeCommand(command, sender);
    122122            }
    123123        }
     
    130130        The string to be converted.
    131131    @return
    132         Returns the corresponding enum, notificationCommand::none if the command doesn't exist.
     132        Returns the corresponding enum, NotificationCommand::none if the command doesn't exist.
    133133    */
    134     /*static*/ notificationCommand::Value NotificationListener::str2Command(const std::string& string)
     134    /*static*/ NotificationCommand NotificationListener::str2Command(const std::string& string)
    135135    {
    136         notificationCommand::Value command = notificationCommand::none;
     136        NotificationCommand command = NotificationCommand::none;
    137137
    138138        if(string == NotificationListener::COMMAND_CLEAR)
    139             command = notificationCommand::clear;
     139            command = NotificationCommand::clear;
    140140
    141141        return command;
     
    150150        Returns the corresponding string.
    151151    */
    152     /*static*/ const std::string& NotificationListener::command2Str(notificationCommand::Value command)
     152    /*static*/ const std::string& NotificationListener::command2Str(NotificationCommand command)
    153153    {
    154154        switch(command)
    155155        {
    156             case notificationCommand::clear:
     156            case NotificationCommand::clear:
    157157                return NotificationListener::COMMAND_CLEAR;
    158158            default:
  • code/trunk/src/orxonox/interfaces/NotificationListener.h

    r9667 r11071  
    4949{
    5050    // TODO: Document.
    51     namespace notificationMessageType
    52     {
    53         enum Value {
    54             info,
    55             important
    56         };
    57     }
     51    enum class NotificationMessageType {
     52        info,
     53        important
     54    };
    5855   
    59     namespace notificationSendMode
    60     {
    61         enum Value {
    62             local,
    63             network,
    64             broadcast
    65         };
    66     }
     56    enum class NotificationSendMode {
     57        local,
     58        network,
     59        broadcast
     60    };
    6761   
    68     namespace notificationCommand
    69     {
    70         enum Value {
    71             none,
    72             clear
    73         };
    74     }
     62    enum class NotificationCommand {
     63        none,
     64        clear
     65    };
    7566
    7667    // TODO: Update doc.
     
    10192            @param sender The sender that sent the notification. Default is 'none'.
    10293            @param messageType The type of the message, can be either 'info' or 'important'. Default is 'info'.
    103             @param sendMode The mode in which the notification is sent, can be 'local' to send the notification to the client where this function is executed, 'network' if the notification is to be sent to the client with the specified clientID, or 'broadcast' if the notification should be sent to all hosts. Default is notificationSendMode::local.
     94            @param sendMode The mode in which the notification is sent, can be 'local' to send the notification to the client where this function is executed, 'network' if the notification is to be sent to the client with the specified clientID, or 'broadcast' if the notification should be sent to all hosts. Default is NotificationSendMode::local.
    10495            @param clientId The id of the client the notification should be sent to. Default is 0.
    10596            */
    106             static void sendNotification(const std::string& message, const std::string& sender = NotificationListener::NONE, notificationMessageType::Value messageType = notificationMessageType::info, notificationSendMode::Value sendMode = notificationSendMode::local, unsigned int clientId = 0)
     97            static void sendNotification(const std::string& message, const std::string& sender = NotificationListener::NONE, NotificationMessageType messageType = NotificationMessageType::info, NotificationSendMode sendMode = NotificationSendMode::local, unsigned int clientId = 0)
    10798                { NotificationListener::sendNetworkHelper(message, sender, sendMode, clientId, false, messageType); }
    10899            /**
     
    110101            @param command The command that should be sent (and later executed).
    111102            @param sender The sender that sent the notification. Default is 'none'.
    112             @param sendMode The mode in which the command is sent, can be 'local' to send the command to the client where this function is executed, 'network' if the command is to be sent to the client with the specified clientID, or 'broadcast' if the command should be sent to all hosts. Default is notificationSendMode::local.
     103            @param sendMode The mode in which the command is sent, can be 'local' to send the command to the client where this function is executed, 'network' if the command is to be sent to the client with the specified clientID, or 'broadcast' if the command should be sent to all hosts. Default is NotificationSendMode::local.
    113104            @param clientId The id of the client the command should be sent to. Default is 0.
    114105            */
    115             static void sendCommand(const std::string& command, const std::string& sender = NotificationListener::NONE, notificationSendMode::Value sendMode = notificationSendMode::local, unsigned int clientId = 0)
     106            static void sendCommand(const std::string& command, const std::string& sender = NotificationListener::NONE, NotificationSendMode sendMode = NotificationSendMode::local, unsigned int clientId = 0)
    116107                { NotificationListener::sendNetworkHelper(command, sender, sendMode, clientId, true); }
    117108
    118             static void sendHelper(const std::string& message, const std::string& sender, bool isCommand = false, unsigned int messageMode = 0); // Helper method to register a notification/execute a command with all NotificationListeners after it has been sent over the network.
     109            static void sendHelper(const std::string& message, const std::string& sender, bool isCommand, NotificationMessageType type); // Helper method to register a notification/execute a command with all NotificationListeners after it has been sent over the network.
    119110
    120111            //TODO: Make protected?
     
    128119            @return Returns true if the notification was successfully registered, false if not.
    129120            */
    130             virtual bool registerNotification(const std::string& message, const std::string& sender, notificationMessageType::Value type)
     121            virtual bool registerNotification(const std::string& message, const std::string& sender, NotificationMessageType type)
    131122                { return false; }
    132123            /**
     
    137128            @return Returns true if the command was successfully executed, false if not.
    138129            */
    139             virtual bool executeCommand(notificationCommand::Value command, const std::string& sender) { return false; }
     130            virtual bool executeCommand(NotificationCommand command, const std::string& sender) { return false; }
    140131
    141132        public:
     
    149140           
    150141        protected:
    151             static void sendNetworkHelper(const std::string& message, const std::string& sender, notificationSendMode::Value sendMode, unsigned int clientId, bool isCommand = false, notificationMessageType::Value messageType = notificationMessageType::info); // Helper method to send both notifications and commands over the network.
     142            static void sendNetworkHelper(const std::string& message, const std::string& sender, NotificationSendMode sendMode, unsigned int clientId, bool isCommand = false, NotificationMessageType messageType = NotificationMessageType::info); // Helper method to send both notifications and commands over the network.
    152143
    153             static notificationCommand::Value str2Command(const std::string& string); // Helper method. Converts a string into the enum for a command.
    154             static const std::string& command2Str(notificationCommand::Value command); // Helper method. Converts a command enum into its corresponding string.
     144            static NotificationCommand str2Command(const std::string& string); // Helper method. Converts a string into the enum for a command.
     145            static const std::string& command2Str(NotificationCommand command); // Helper method. Converts a command enum into its corresponding string.
    155146    };
    156147}
  • code/trunk/src/orxonox/interfaces/PickupCarrier.cc

    r10624 r11071  
    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/trunk/src/orxonox/interfaces/PickupCarrier.h

    r9667 r11071  
    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/trunk/src/orxonox/interfaces/PickupListener.cc

    r10624 r11071  
    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/trunk/src/orxonox/interfaces/Pickupable.cc

    r10624 r11071  
    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/trunk/src/orxonox/interfaces/Pickupable.h

    r10624 r11071  
    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/trunk/src/orxonox/interfaces/RadarViewable.cc

    r10624 r11071  
    4949        , wePtr_(wePtr)
    5050        , radarObjectCamouflage_(0.0f)
    51         , radarObjectShape_(Dot)
     51        , radarObjectShape_(Shape::Dot)
    5252        , radarObjectDescription_("staticObject")
    5353        , scale_(1.0f)
  • code/trunk/src/orxonox/interfaces/RadarViewable.h

    r10624 r11071  
    4949    {
    5050    public:
    51         enum Shape
     51        enum class Shape
    5252        {
    5353            Square,
     
    6666                if (name == "HIDDEN")
    6767                {
    68                     this->bVisibility_ = 0;
     68                    this->bVisibility_ = false;
    6969                    this->settingsChanged();
    7070                }
  • code/trunk/src/orxonox/items/Engine.cc

    r9667 r11071  
    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/trunk/src/orxonox/items/Engine.h

    r9667 r11071  
    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/trunk/src/orxonox/items/MultiStateEngine.cc

    r9939 r11071  
    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 (WorldEntity* effect : container->getEffects())
     89                        effect->destroy();
    9090                if (this->defEngineSndNormal_)
    9191                    this->defEngineSndNormal_->destroy();
     
    124124                this->state_ = 0;
    125125                if (this->getShip()->isBoosting() && forward)
    126                     this->state_ = Boost;
     126                    this->state_ = EngineState::Boost;
    127127                else if (forward && !this->state_) // this->state_ == Boost
    128                     this->state_ = Normal;
     128                    this->state_ = EngineState::Normal;
    129129                else if (direction.z > 0.0 && velocity.z < 0.0)
    130                     this->state_ = Brake;
     130                    this->state_ = EngineState::Brake;
    131131                else
    132                     this->state_ = Idle;
    133 
    134                 if (this->state_ == Idle && this->getSpeedAdd() > 0)
    135                     this->state_ = Normal;
     132                    this->state_ = EngineState::Idle;
     133
     134                if (this->state_ == EngineState::Idle && this->getSpeedAdd() > 0)
     135                    this->state_ = EngineState::Normal;
    136136            }
    137137
     
    141141
    142142                float pitch = velocity.length();
    143                 if (this->state_ & Normal)
     143                if (this->state_ & EngineState::Normal)
    144144                    defEngineSndNormal_->setPitch(clamp(pitch/MAX_VELOCITY_NORMAL + 1, 0.5f, 2.0f));
    145                 if (this->state_ & Boost)
     145                if (this->state_ & EngineState::Boost)
    146146                    defEngineSndBoost_->setPitch(clamp(pitch/MAX_VELOCITY_BOOST + 1, 0.5f, 2.0f));
    147147
    148                 if (changes & Idle)
    149                 {
    150                     lua_pushboolean(this->lua_->getInternalLuaState(), this->state_ & Idle);
     148                if (changes & EngineState::Idle)
     149                {
     150                    lua_pushboolean(this->lua_->getInternalLuaState(), this->state_ & EngineState::Idle);
    151151                    lua_setglobal(this->lua_->getInternalLuaState(), "idle");
    152152                }
    153                 if (changes & Normal)
    154                 {
    155                     lua_pushboolean(this->lua_->getInternalLuaState(), this->state_ & Normal);
     153                if (changes & EngineState::Normal)
     154                {
     155                    lua_pushboolean(this->lua_->getInternalLuaState(), this->state_ & EngineState::Normal);
    156156                    lua_setglobal(this->lua_->getInternalLuaState(), "normal");
    157                     if (this->state_ & Normal)
     157                    if (this->state_ & EngineState::Normal)
    158158                        defEngineSndNormal_->play();
    159159                    else
    160160                        defEngineSndNormal_->stop();
    161161                }
    162                 if (changes & Brake)
    163                 {
    164                     lua_pushboolean(this->lua_->getInternalLuaState(), this->state_ & Brake);
     162                if (changes & EngineState::Brake)
     163                {
     164                    lua_pushboolean(this->lua_->getInternalLuaState(), this->state_ & EngineState::Brake);
    165165                    lua_setglobal(this->lua_->getInternalLuaState(), "brake");
    166166                }
    167                 if (changes & Boost)
    168                 {
    169                     lua_pushboolean(this->lua_->getInternalLuaState(), this->state_ & Boost);
     167                if (changes & EngineState::Boost)
     168                {
     169                    lua_pushboolean(this->lua_->getInternalLuaState(), this->state_ & EngineState::Boost);
    170170                    lua_setglobal(this->lua_->getInternalLuaState(), "boost");
    171                     if (this->state_ & Boost)
     171                    if (this->state_ & EngineState::Boost)
    172172                        defEngineSndBoost_->play();
    173173                    else
     
    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);
    203     }
    204 
    205     void MultiStateEngine::addEffectContainer(EffectContainer* effect)
    206     {
    207         if (effect == NULL)
     200        for (EffectContainer* container : this->effectContainers_)
     201            for (WorldEntity* effect : container->getEffects())
     202                this->getShip()->attach(effect);
     203    }
     204
     205    void MultiStateEngine::addEffectContainer(EffectContainer* container)
     206    {
     207        if (container == nullptr)
    208208            return;
    209         effect->setLuaState(this->lua_, 'f' + multi_cast<std::string>(this->effectContainers_.size()));
    210         this->effectContainers_.push_back(effect);
     209        container->setLuaState(this->lua_, 'f' + multi_cast<std::string>(this->effectContainers_.size()));
     210        this->effectContainers_.push_back(container);
    211211        if (this->getShip())
    212212        {
    213             for (std::vector<WorldEntity*>::const_iterator it = effect->getEffectsBegin(); it != effect->getEffectsBegin(); ++it)
    214                 this->getShip()->attach(*it);
     213            for (WorldEntity* effect : container->getEffects())
     214                this->getShip()->attach(effect);
    215215        }
    216216    }
     
    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/trunk/src/orxonox/items/MultiStateEngine.h

    r9667 r11071  
    4141    {
    4242        public:
    43             enum EngineState
     43            struct EngineState
    4444            {
    45                 Idle    = 1,
    46                 Normal  = 2,
    47                 Brake   = 4,
    48                 Boost   = 8
     45                static constexpr int Idle    = 1;
     46                static constexpr int Normal  = 2;
     47                static constexpr int Brake   = 4;
     48                static constexpr int Boost   = 8;
    4949            };
    5050
     
    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/trunk/src/orxonox/items/PartDestructionEvent.cc

    r10262 r11071  
    9898        {
    9999            switch (this->targetParam_) {
    100             case shieldhealth:
     100            case TargetParam::shieldhealth:
    101101                this->parent_->getParent()->setShieldHealth(operate(this->parent_->getParent()->getShieldHealth()));
    102102                break;
    103             case boostpower:
     103            case TargetParam::boostpower:
    104104                this->parent_->getParent()->setInitialBoostPower(operate(this->parent_->getParent()->getInitialBoostPower()));
    105105                break;
    106             case boostpowerrate:
     106            case TargetParam::boostpowerrate:
    107107                this->parent_->getParent()->setBoostPowerRate(operate(this->parent_->getParent()->getBoostPowerRate()));
    108108                break;
    109             case rotationthrust:
     109            case TargetParam::rotationthrust:
    110110                this->parent_->getParent()->setRotationThrust(operate(this->parent_->getParent()->getRotationThrust()));
    111111                break;
     
    120120        {
    121121            switch (this->targetParam_) {
    122             case null:
     122            case TargetParam::null:
    123123                this->parent_->getParent()->getEngineByName(targetName_)->destroy();
    124124                break;
    125             case boostfactor:
     125            case TargetParam::boostfactor:
    126126                this->parent_->getParent()->getEngineByName(targetName_)->setBoostFactor(operate(this->parent_->getParent()->getEngineByName(targetName_)->getBoostFactor()));
    127127                break;
    128             case speedfront:
     128            case TargetParam::speedfront:
    129129                this->parent_->getParent()->getEngineByName(targetName_)->setMaxSpeedFront(operate(this->parent_->getParent()->getEngineByName(targetName_)->getMaxSpeedFront()));
    130130                break;
    131             case accelerationfront:
     131            case TargetParam::accelerationfront:
    132132                this->parent_->getParent()->getEngineByName(targetName_)->setAccelerationFront(operate(this->parent_->getParent()->getEngineByName(targetName_)->getAccelerationFront()));
    133133                break;
     
    142142        {
    143143            switch (this->targetParam_) {
    144             case null:
     144            case TargetParam::null:
    145145                if (!this->parent_->getParent()->getShipPartByName(targetName_))
    146146                    return;
     
    214214            if (param == "NULL")
    215215            {
    216                 this->targetParam_ = null;
     216                this->targetParam_ = TargetParam::null;
    217217                return;
    218218            }
    219219            if (param == "boostfactor")
    220220            {
    221                 this->targetParam_ = boostfactor;
     221                this->targetParam_ = TargetParam::boostfactor;
    222222                return;
    223223            }
    224224            if (param == "speedfront")
    225225            {
    226                 this->targetParam_ = speedfront;
     226                this->targetParam_ = TargetParam::speedfront;
    227227                return;
    228228            }
    229229            if (param == "accelerationfront")
    230230            {
    231                 this->targetParam_ = accelerationfront;
     231                this->targetParam_ = TargetParam::accelerationfront;
    232232                return;
    233233            }
     
    244244            if (param == "shieldhealth")
    245245            {
    246                 this->targetParam_ = shieldhealth;
     246                this->targetParam_ = TargetParam::shieldhealth;
    247247                return;
    248248            }
    249249            if (param == "boostpower")
    250250            {
    251                 this->targetParam_ = boostpower;
     251                this->targetParam_ = TargetParam::boostpower;
    252252                return;
    253253            }
    254254            if (param == "boostpowerrate")
    255255            {
    256                 this->targetParam_ = boostpowerrate;
     256                this->targetParam_ = TargetParam::boostpowerrate;
    257257                return;
    258258            }
    259259            if (param == "rotationthrust")
    260260            {
    261                 this->targetParam_ = rotationthrust;
     261                this->targetParam_ = TargetParam::rotationthrust;
    262262                return;
    263263            }
     
    271271            if (param == "NULL")
    272272            {
    273                 this->targetParam_ = null;
     273                this->targetParam_ = TargetParam::null;
    274274                return;
    275275            }
  • code/trunk/src/orxonox/items/PartDestructionEvent.h

    r10262 r11071  
    8282                    List of all allowed parameters.
    8383                */
    84             enum TargetParam
     84            enum class TargetParam
    8585            {
    8686                shieldhealth,
     
    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/trunk/src/orxonox/items/ShipPart.cc

    r11052 r11071  
    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];
    182182    }
    183183
    184     void ShipPart::setDamageAbsorption(float value)
    185     {
    186         this->damageAbsorption_ = value;
    187     }
    188 
    189184    void ShipPart::setParent(ModularSpaceShip* ship)
    190185    {
    191186        this->parent_ = ship;
    192     }
    193 
    194     /**
    195     @brief
    196         Sets the health of the ShipPart.
    197     */
    198     void ShipPart::setHealth(float health)
    199     {
    200         this->health_ = health;
    201187    }
    202188
  • code/trunk/src/orxonox/items/ShipPart.h

    r10624 r11071  
    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);
     
    6464            PartDestructionEvent* getDestructionEvent(unsigned int index);
    6565
    66             virtual void setDamageAbsorption(float value);
    67             inline float getDamageAbsorption()
     66            inline void setDamageAbsorption(float value)
     67                { this->damageAbsorption_ = value; }
     68            inline float getDamageAbsorption() const
    6869                { return this->damageAbsorption_; }
    6970
    7071            void setParent(ModularSpaceShip* ship);
    71             inline ModularSpaceShip* getParent()
     72            inline ModularSpaceShip* getParent() const
    7273                { return this->parent_; }
    7374
    7475            inline void setEventExecution(bool var)
    7576                { this->eventExecution_ = var; }
    76             inline bool isEventExecution()
     77            inline bool isEventExecution() const
    7778                { return this->eventExecution_; }
    7879
    79             virtual void setHealth(float health);
     80            inline void setHealth(float health)
     81                { this->health_ = health; }
    8082            inline void addHealth(float health)
    8183                { this->setHealth(this->health_ + health); }
  • code/trunk/src/orxonox/overlays/GUISheet.h

    r9667 r11071  
    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/trunk/src/orxonox/overlays/InGameConsole.cc

    r10624 r11071  
    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        }
     
    292292
    293293        for (int i = LINES - 1; i > max; --i)
    294             this->print("", Shell::DebugOutput, i, true);
     294            this->print("", Shell::LineType::DebugOutput, i, true);
    295295
    296296        for (int i = max; i >= 1; --i)
     
    318318    {
    319319        if (LINES > 0)
    320             this->print(this->shell_->getInput(), Shell::Input, 0);
     320            this->print(this->shell_->getInput(), Shell::LineType::Input, 0);
    321321
    322322        if (this->shell_->getInput().empty())
     
    342342    void InGameConsole::executed()
    343343    {
    344         this->shell_->addOutput(this->shell_->getInput(), Shell::Command);
     344        this->shell_->addOutput(this->shell_->getInput(), Shell::LineType::Command);
    345345    }
    346346
     
    562562        switch (type)
    563563        {
    564             case Shell::Message:
    565             case Shell::DebugOutput:     colourTop = ColourValue(0.9f, 0.9f, 0.9f); break;
    566 
    567             case Shell::UserError:       colourTop = ColourValue(0.9f, 0.0f, 0.0f); break;
    568             case Shell::UserWarning:     colourTop = ColourValue(0.9f, 0.5f, 0.0f); break;
    569             case Shell::UserStatus:      colourTop = ColourValue(0.0f, 0.9f, 0.0f); break;
    570             case Shell::UserInfo:        colourTop = ColourValue(0.0f, 0.8f, 0.8f); break;
    571 
    572             case Shell::InternalError:   colourTop = ColourValue(0.5f, 0.0f, 0.0f); break;
    573             case Shell::InternalWarning: colourTop = ColourValue(0.5f, 0.2f, 0.0f); break;
    574             case Shell::InternalStatus:  colourTop = ColourValue(0.0f, 0.5f, 0.0f); break;
    575             case Shell::InternalInfo:    colourTop = ColourValue(0.0f, 0.4f, 0.4f); break;
    576 
    577             case Shell::Verbose:         colourTop = ColourValue(0.3f, 0.3f, 0.9f); break;
    578             case Shell::VerboseMore:     colourTop = ColourValue(0.2f, 0.2f, 0.7f); break;
    579             case Shell::VerboseUltra:    colourTop = ColourValue(0.1f, 0.1f, 0.5f); break;
    580 
    581             case Shell::Command:         colourTop = ColourValue(0.8f, 0.2f, 0.8f); break;
    582             case Shell::Hint:            colourTop = ColourValue(0.4f, 0.0f, 0.4f); break;
    583             case Shell::Input:           colourTop = ColourValue(0.9f, 0.9f, 0.9f); break;
    584 
    585             default:                     colourTop = ColourValue(0.5f, 0.5f, 0.5f); break;
     564            case Shell::LineType::Message:
     565            case Shell::LineType::DebugOutput:     colourTop = ColourValue(0.9f, 0.9f, 0.9f); break;
     566
     567            case Shell::LineType::UserError:       colourTop = ColourValue(0.9f, 0.0f, 0.0f); break;
     568            case Shell::LineType::UserWarning:     colourTop = ColourValue(0.9f, 0.5f, 0.0f); break;
     569            case Shell::LineType::UserStatus:      colourTop = ColourValue(0.0f, 0.9f, 0.0f); break;
     570            case Shell::LineType::UserInfo:        colourTop = ColourValue(0.0f, 0.8f, 0.8f); break;
     571
     572            case Shell::LineType::InternalError:   colourTop = ColourValue(0.5f, 0.0f, 0.0f); break;
     573            case Shell::LineType::InternalWarning: colourTop = ColourValue(0.5f, 0.2f, 0.0f); break;
     574            case Shell::LineType::InternalStatus:  colourTop = ColourValue(0.0f, 0.5f, 0.0f); break;
     575            case Shell::LineType::InternalInfo:    colourTop = ColourValue(0.0f, 0.4f, 0.4f); break;
     576
     577            case Shell::LineType::Verbose:         colourTop = ColourValue(0.3f, 0.3f, 0.9f); break;
     578            case Shell::LineType::VerboseMore:     colourTop = ColourValue(0.2f, 0.2f, 0.7f); break;
     579            case Shell::LineType::VerboseUltra:    colourTop = ColourValue(0.1f, 0.1f, 0.5f); break;
     580
     581            case Shell::LineType::Command:         colourTop = ColourValue(0.8f, 0.2f, 0.8f); break;
     582            case Shell::LineType::Hint:            colourTop = ColourValue(0.4f, 0.0f, 0.4f); break;
     583            case Shell::LineType::Input:           colourTop = ColourValue(0.9f, 0.9f, 0.9f); break;
     584
     585            default:                               colourTop = ColourValue(0.5f, 0.5f, 0.5f); break;
    586586        }
    587587
  • code/trunk/src/orxonox/overlays/InGameConsole.h

    r10624 r11071  
    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/trunk/src/orxonox/overlays/OrxonoxOverlay.cc

    r11052 r11071  
    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())
     
    9494        this->angle_ = Degree(0.0);
    9595        this->bCorrectAspect_ = false;
    96         this->rotState_ = Horizontal;
     96        this->rotState_ = RotationState::Horizontal;
    9797        this->angleChanged(); // updates all other values as well
    9898
     
    259259            {
    260260                tempAspect = 1.0f / this->windowAspectRatio_;
    261                 rotState_ = Vertical;
     261                rotState_ = RotationState::Vertical;
    262262            }
    263263            else if (angle > 179 || angle < 1)
    264264            {
    265265                tempAspect = this->windowAspectRatio_;
    266                 rotState_ = Horizontal;
     266                rotState_ = RotationState::Horizontal;
    267267            }
    268268            else
    269269            {
    270270                tempAspect = 1.0f;
    271                 rotState_ = Inbetween;
     271                rotState_ = RotationState::Inbetween;
    272272            }
    273273
  • code/trunk/src/orxonox/overlays/OrxonoxOverlay.h

    r11052 r11071  
    7979            and in between is everything else.
    8080        */
    81         enum RotationState
     81        enum class RotationState
    8282        {
    8383            Horizontal,
     
    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)
     
    186186        virtual void changedOverlayGroup()
    187187            { this->changedVisibility(); }
    188         virtual void setZOrder(unsigned short order);
     188        void setZOrder(unsigned short order);
    189189
    190190    protected:
     
    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/trunk/src/orxonox/overlays/OverlayGroup.cc

    r11052 r11071  
    5151        {
    5252            ArgumentCompletionList names;
    53             for (ObjectList<OverlayGroup>::iterator it = ObjectList<OverlayGroup>::begin(); it; ++it)
    54                 names.push_back(ArgumentCompletionListElement(it->getName(), getLowercase(it->getName())));
     53            for (OverlayGroup* overlayGroup : ObjectList<OverlayGroup>())
     54                names.push_back(ArgumentCompletionListElement(overlayGroup->getName(), getLowercase(overlayGroup->getName())));
    5555            return names;
    5656        }
     
    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/trunk/src/orxonox/overlays/OverlayGroup.h

    r10624 r11071  
    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/trunk/src/orxonox/sound/AmbientSound.cc

    r10624 r11071  
    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/trunk/src/orxonox/sound/AmbientSound.h

    r9939 r11071  
    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/trunk/src/orxonox/sound/BaseSound.cc

    r10624 r11071  
    4949        , volume_(0.7)
    5050        , bLooping_(false)
    51         , state_(Stopped)
     51        , state_(State::Stopped)
    5252        , pitch_ (1.0)
    5353    {
     
    6363    BaseSound::~BaseSound()
    6464    {
    65         if (this->state_ != Stopped)
     65        if (this->state_ != State::Stopped)
    6666            this->stop();
    6767        // Release buffer
    68         if (this->soundBuffer_ != NULL)
     68        if (this->soundBuffer_ != nullptr)
    6969        {
    7070            assert(GameMode::playsSound());
     
    8383    void BaseSound::doPlay()
    8484    {
    85         this->state_ = Playing;
    86         if (GameMode::playsSound() && this->getSourceState() != AL_PLAYING && this->soundBuffer_ != NULL)
     85        this->state_ = State::Playing;
     86        if (GameMode::playsSound() && this->getSourceState() != AL_PLAYING && this->soundBuffer_ != nullptr)
    8787        {
    8888            if (!alIsSource(this->audioSource_))
     
    102102    bool BaseSound::doStop()
    103103    {
    104         this->state_ = Stopped;
     104        this->state_ = State::Stopped;
    105105        if (alIsSource(this->audioSource_))
    106106        {
     
    123123        if (this->isStopped())
    124124            return;
    125         this->state_ = Paused;
     125        this->state_ = State::Paused;
    126126        if (alIsSource(this->audioSource_))
    127127            alSourcePause(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
     
    256256        else // No source acquired so far, but might be set to playing or paused
    257257        {
    258             State state = static_cast<State>(this->state_); // save
     258            State state = this->state_; // save
    259259            if (this->isPlaying() || this->isPaused())
    260260                doPlay();
    261             if (state == Paused)
    262             {
    263                 this->state_ = Paused;
     261            if (state == State::Paused)
     262            {
     263                this->state_ = State::Paused;
    264264                doPause();
    265265            }
     
    271271        switch (this->state_)
    272272        {
    273             case Playing:
     273            case State::Playing:
    274274                this->play();
    275275                break;
    276             case Paused:
     276            case State::Paused:
    277277                this->pause();
    278278                break;
    279             case Stopped:
     279            case State::Stopped:
    280280            default:
    281281                this->stop();
  • code/trunk/src/orxonox/sound/BaseSound.h

    r9667 r11071  
    3333
    3434#include <string>
    35 #include <boost/shared_ptr.hpp>
     35#include <memory>
    3636#include <OgreDataStream.h>
    3737#include "core/object/Listable.h"
     
    5454        virtual void pause() { this->doPause(); }
    5555
    56         bool isPlaying() const { return this->state_ == Playing; }
    57         bool isPaused()  const { return this->state_ == Paused; }
    58         bool isStopped() const { return this->state_ == Stopped; }
     56        bool isPlaying() const { return this->state_ == State::Playing; }
     57        bool isPaused()  const { return this->state_ == State::Paused; }
     58        bool isStopped() const { return this->state_ == State::Stopped; }
    5959
    6060        virtual void setSource(const std::string& source);
     
    7676
    7777    protected:
    78         enum State
     78        enum class State
    7979        {
    8080            Stopped,
     
    107107        ALuint          audioSource_;
    108108        bool            bPooling_;
    109         shared_ptr<SoundBuffer> soundBuffer_;
     109        std::shared_ptr<SoundBuffer> soundBuffer_;
    110110        std::string     source_;
    111111        float           volume_;
    112112        bool            bLooping_;
    113         uint8_t         state_;       // This Variable is actually of type State
     113        State           state_;       // This Variable is actually of type State
    114114        float           pitch_;
    115115
  • code/trunk/src/orxonox/sound/SoundBuffer.cc

    r8858 r11071  
    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/trunk/src/orxonox/sound/SoundBuffer.h

    r10624 r11071  
    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/trunk/src/orxonox/sound/SoundManager.cc

    r10624 r11071  
    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/trunk/src/orxonox/sound/SoundManager.h

    r10624 r11071  
    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/trunk/src/orxonox/sound/SoundStreamer.cc

    r8858 r11071  
    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/trunk/src/orxonox/sound/WorldAmbientSound.cc

    r10624 r11071  
    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/trunk/src/orxonox/sound/WorldAmbientSound.h

    r9939 r11071  
    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/trunk/src/orxonox/sound/WorldSound.cc

    r9939 r11071  
    5858        registerVariable(bLooping_, ObjectDirection::ToClient, new NetworkCallback<WorldSound>(this, &WorldSound::loopingChanged));
    5959        registerVariable(pitch_,    ObjectDirection::ToClient, new NetworkCallback<WorldSound>(this, &WorldSound::pitchChanged));
    60         registerVariable((uint8_t&)(BaseSound::state_), ObjectDirection::ToClient, new NetworkCallback<WorldSound>(this, &WorldSound::stateChanged));
     60        registerVariable(BaseSound::state_, ObjectDirection::ToClient, new NetworkCallback<WorldSound>(this, &WorldSound::stateChanged));
    6161    }
    6262
  • code/trunk/src/orxonox/sound/WorldSound.h

    r9667 r11071  
    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/trunk/src/orxonox/weaponsystem/DefaultWeaponmodeLink.h

    r9667 r11071  
    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/trunk/src/orxonox/weaponsystem/Munition.cc

    r11052 r11071  
    5252        this->reloadTime_ = 0.5f;
    5353
    54         this->lastFilledWeaponMode_ = NULL;
     54        this->lastFilledWeaponMode_ = nullptr;
    5555    }
    5656
    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
     
    200200                    magazine->munition_ = 0;
    201201
    202                     if (this->reload(NULL))
     202                    if (this->reload(nullptr))
    203203                        // Successfully reloaded, continue recursively
    204204                        return this->takeMunition(amount, 0);
     
    262262        if (deployment_ != MunitionDeployment::Separate)
    263263        {
    264             user = NULL;
     264            user = nullptr;
    265265        }
    266266
     
    271271            if (it->first == lastFilledWeaponMode_)
    272272            {
    273                 lastFilledWeaponMode_ = NULL;
     273                lastFilledWeaponMode_ = nullptr;
    274274            }           
    275275            delete it->second;
     
    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        }
     
    315315        {
    316316            // Stacking munition means, if a magazine gets full, the munition adds to a new magazine
    317             Magazine* magazine = this->getMagazine(NULL);
     317            Magazine* magazine = this->getMagazine(nullptr);
    318318            if (magazine)
    319319            {
     
    345345            std::map<WeaponMode*, Magazine*>::iterator it;
    346346
    347             // If the pointer to the weapon mode whose magazine got munition added to is NULL, then set the iterator to the beginning of the map
     347            // If the pointer to the weapon mode whose magazine got munition added to is nullptr, then set the iterator to the beginning of the map
    348348            // Otherwise set it to the next weapon mode
    349             if (lastFilledWeaponMode_ == NULL)
     349            if (lastFilledWeaponMode_ == nullptr)
    350350            {
    351351                it = this->assignedMagazines_.begin();
     
    441441        for (unsigned int i = 0; i < addedMagazines; ++i)
    442442        {
    443             for (std::map<WeaponMode*, Magazine*>::iterator it = this->assignedMagazines_.begin(); it != this->assignedMagazines_.end(); ++it)
    444             {
    445                 if (needReload(it->first))
    446                 {
    447                     reload(it->first);
     443            for (const auto& mapEntry : this->assignedMagazines_)
     444            {
     445                if (needReload(mapEntry.first))
     446                {
     447                    reload(mapEntry.first);
    448448                    break;
    449449                }
     
    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
     
    523523            if (it->first == lastFilledWeaponMode_)
    524524            {
    525                 lastFilledWeaponMode_ = NULL;
     525                lastFilledWeaponMode_ = nullptr;
    526526            }
    527527            delete it->second;
  • code/trunk/src/orxonox/weaponsystem/Munition.h

    r11052 r11071  
    3939namespace orxonox
    4040{
    41     namespace MunitionDeployment
     41    enum class MunitionDeployment
    4242    {
    43         enum Value
    44         {
    45             Separate, // Every comsuming weapon mode has its own magazine. It is possible that one weapon mode is out of ammo while another still has some.
    46             Share, // All comsuming weapon modes take their munition from the same magazine. If this magazine is empty a new one is loaded.
    47             Stack // There is only one magazine where all the munition is stored. Use this deployment mode for heavy weapons loke rockets, bombs, ...
    48         };
    49     }
     43        Separate, // Every comsuming weapon mode has its own magazine. It is possible that one weapon mode is out of ammo while another still has some.
     44        Share, // All comsuming weapon modes take their munition from the same magazine. If this magazine is empty a new one is loaded.
     45        Stack // There is only one magazine where all the munition is stored. Use this deployment mode for heavy weapons loke rockets, bombs, ...
     46    };
    5047
    5148    class _OrxonoxExport Munition : public BaseObject
     
    6966            virtual ~Munition();
    7067
    71             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
     68            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
    7269
    7370            unsigned int getNumMunition(WeaponMode* user) const;
     
    8077            inline unsigned int getMaxMunitionPerMagazine() const
    8178                { return this->maxMunitionPerMagazine_; }
    82             inline MunitionDeployment::Value getMunitionDeployment() const
     79            inline MunitionDeployment getMunitionDeployment() const
    8380                { return deployment_; }
    8481
     
    115112            std::map<WeaponMode*, Magazine*> assignedMagazines_; // Maps weapon modes to magazines that are currently used.
    116113
    117             MunitionDeployment::Value deployment_; // Defines the behaviour how munition and magazines are distributed to the consuming weapon modes.
     114            MunitionDeployment deployment_; // Defines the behaviour how munition and magazines are distributed to the consuming weapon modes.
    118115
    119116            bool bAllowMunitionRefilling_;
  • code/trunk/src/orxonox/weaponsystem/ReplenishingMunition.h

    r11052 r11071  
    5252        public:
    5353            ReplenishingMunition(Context* context);
    54             virtual ~ReplenishingMunition() {}
     54            virtual ~ReplenishingMunition() = default;
    5555
    56             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
     56            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
    5757           
    58             virtual float getProgress();
     58            float getProgress();
    5959            inline unsigned int getReplenishAmount() const
    6060                { return replenishAmount_; }
  • code/trunk/src/orxonox/weaponsystem/Weapon.cc

    r11052 r11071  
    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
    158158    void Weapon::updateMunition()
    159159    {
    160         for (std::multimap<unsigned int, WeaponMode*>::iterator it = this->weaponmodes_.begin(); it != this->weaponmodes_.end(); ++it)
    161             it->second->updateMunition();
     160        for (const auto& mapEnty : this->weaponmodes_)
     161            mapEnty.second->updateMunition();
    162162    }
    163163}
  • code/trunk/src/orxonox/weaponsystem/Weapon.h

    r11052 r11071  
    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);
     
    5757            void addWeaponmode(WeaponMode* weaponmode);
    5858            WeaponMode* getWeaponmode(unsigned int index) const;
    59             inline std::multimap<unsigned int, WeaponMode*>* getAllWeaponmodes()
    60                 { return &weaponmodes_; }
     59            inline const std::multimap<unsigned int, WeaponMode*>& getAllWeaponmodes() const
     60                { return weaponmodes_; }
    6161            inline int getNumWeaponModes() const
    6262                { return weaponmodes_.size(); }
  • code/trunk/src/orxonox/weaponsystem/WeaponMode.cc

    r11052 r11071  
    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/trunk/src/orxonox/weaponsystem/WeaponMode.h

    r11052 r11071  
    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/trunk/src/orxonox/weaponsystem/WeaponPack.cc

    r11052 r11071  
    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    }
    125 
    126     std::vector<Weapon*>* WeaponPack::getAllWeapons()
    127     {
    128         return &weapons_;       
    129     }   
    130125
    131126    void WeaponPack::addDefaultWeaponmodeLink(DefaultWeaponmodeLink* link)
     
    137132    {
    138133        unsigned int i = 0;
    139         for (std::set<DefaultWeaponmodeLink*>::const_iterator it = this->links_.begin(); it != this->links_.end(); ++it)
     134        for (DefaultWeaponmodeLink* link : this->links_)
    140135        {
    141136            if (i == index)
    142                 return (*it);
     137                return link;
    143138
    144139            ++i;
    145140        }
    146         return 0;
     141        return nullptr;
    147142    }
    148143
    149144    unsigned int WeaponPack::getDesiredWeaponmode(unsigned int firemode) const
    150145    {
    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();
     146        for (DefaultWeaponmodeLink* link : this->links_)
     147            if (link->getFiremode() == firemode)
     148                return link->getWeaponmode();
    154149
    155150        return WeaponSystem::WEAPON_MODE_UNASSIGNED;
     
    158153    void WeaponPack::notifyWeapons()
    159154    {
    160         for (std::vector<Weapon *>::const_iterator it = this->weapons_.begin(); it != this->weapons_.end(); ++it)
    161             (*it)->setWeaponPack(this);
     155        for (Weapon* weapon : this->weapons_)
     156            weapon->setWeaponPack(this);
    162157    }
    163158
    164159    void WeaponPack::updateMunition()
    165160    {
    166         for (std::vector<Weapon *>::const_iterator it = this->weapons_.begin(); it != this->weapons_.end(); ++it)
    167             (*it)->updateMunition();
     161        for (Weapon* weapon : this->weapons_)
     162            weapon->updateMunition();
    168163    }
    169164}
  • code/trunk/src/orxonox/weaponsystem/WeaponPack.h

    r11052 r11071  
    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);
     
    5252            void removeWeapon(Weapon * weapon);
    5353            Weapon * getWeapon(unsigned int index) const;
    54             std::vector<Weapon*>* getAllWeapons();
     54            inline const std::vector<Weapon*>& getAllWeapons() const
     55                { return weapons_; }
    5556
    5657            inline size_t getNumWeapons() const
  • code/trunk/src/orxonox/weaponsystem/WeaponSet.cc

    r10650 r11071  
    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/trunk/src/orxonox/weaponsystem/WeaponSet.h

    r9667 r11071  
    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/trunk/src/orxonox/weaponsystem/WeaponSlot.cc

    r10648 r11071  
    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/trunk/src/orxonox/weaponsystem/WeaponSlot.h

    r10650 r11071  
    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/trunk/src/orxonox/weaponsystem/WeaponSystem.cc

    r11052 r11071  
    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;
    240     }
    241 
    242     std::vector<WeaponPack *> * WeaponSystem::getAllWeaponPacks()
    243     {
    244         return &weaponPacks_;
    245     }   
     237                return weaponPack;
     238        }
     239        return nullptr;
     240    }
    246241
    247242    bool WeaponSystem::swapWeaponSlots(WeaponSlot * wSlot1, WeaponSlot * wSlot2)
     
    273268        // Check if the WeaponSet belongs to this WeaponSystem
    274269        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)
     270        for (const auto& mapEntry : this->weaponSets_)
     271        {
     272            if (mapEntry.second == wSet)
    278273            {
    279274                foundWeaponSet = true;
     
    301296    void WeaponSystem::reload()
    302297    {
    303         for (std::map<unsigned int, WeaponSet *>::iterator it = this->weaponSets_.begin(); it != this->weaponSets_.end(); ++it)
    304             it->second->reload();
     298        for (const auto& mapEntry : this->weaponSets_)
     299            mapEntry.second->reload();
    305300    }
    306301
     
    308303    {
    309304        if (!identifier || !identifier->getIdentifier())
    310             return 0;
     305            return nullptr;
    311306
    312307        std::map<Identifier *, Munition *>::iterator it = this->munitions_.find(identifier->getIdentifier());
     
    317312        else
    318313        {
    319             return NULL;
     314            return nullptr;
    320315        }
    321316    }
     
    323318    void WeaponSystem::addMunition(Munition* munition)
    324319    {
    325         if (munition == NULL)
     320        if (munition == nullptr)
    326321        {
    327322            return;
     
    337332        else
    338333        {
    339             orxout(internal_warning) << "Adding munition failed. identifier == NULL " << endl;
     334            orxout(internal_warning) << "Adding munition failed. identifier == nullptr " << endl;
    340335        }
    341336    }
     
    343338    void WeaponSystem::updateMunition()
    344339    {
    345         for (std::vector<WeaponPack*>::iterator it = this->weaponPacks_.begin(); it != this->weaponPacks_.end(); ++it)
    346         {
    347             (*it)->updateMunition();
     340        for (WeaponPack* weaponPack : this->weaponPacks_)
     341        {
     342            weaponPack->updateMunition();
    348343        }
    349344    }
  • code/trunk/src/orxonox/weaponsystem/WeaponSystem.h

    r11052 r11071  
    6767            void removeWeaponPack(WeaponPack * wPack);
    6868            WeaponPack * getWeaponPack(unsigned int index) const;
    69             std::vector<WeaponPack *> * getAllWeaponPacks();
     69            inline const std::vector<WeaponPack *>& getAllWeaponPacks() const
     70                { return weaponPacks_; }
    7071
    7172            // configure slots and firemodes
  • code/trunk/src/orxonox/worldentities/Actionpoint.h

    r11052 r11071  
    9292        public:
    9393            Actionpoint(Context* context);
    94             virtual ~Actionpoint() {}
     94            virtual ~Actionpoint() = default;
    9595
    96             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
     96            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
    9797
    9898            /** @brief Decides what AI will do. @param val action to execute */
  • code/trunk/src/orxonox/worldentities/CameraPosition.h

    r9667 r11071  
    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/trunk/src/orxonox/worldentities/ControllableEntity.cc

    r10624 r11071  
    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/trunk/src/orxonox/worldentities/ControllableEntity.h

    r10624 r11071  
    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/trunk/src/orxonox/worldentities/Drone.cc

    r9667 r11071  
    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);
    4849        this->localAngularAcceleration_.setValue(0, 0, 0);
    4950        this->setRadarVisibility(false);
    50         this->setCollisionType(WorldEntity::Dynamic);
     51        this->setCollisionType(WorldEntity::CollisionType::Dynamic);
    5152
    5253        myController_ = new DroneController(this->getContext()); //!< Creates a new controller and passes our this pointer to it as creator.
  • code/trunk/src/orxonox/worldentities/Drone.h

    r9667 r11071  
    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/trunk/src/orxonox/worldentities/EffectContainer.cc

    r9667 r11071  
    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/trunk/src/orxonox/worldentities/EffectContainer.h

    r9667 r11071  
    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);
     
    5454            WorldEntity* getEffect(unsigned int index) const;
    5555
    56             inline std::vector<WorldEntity*>::const_iterator getEffectsBegin()
    57                 { return this->effects_.begin(); }
    58             inline std::vector<WorldEntity*>::const_iterator getEffectsEnd()
    59                 { return this->effects_.end(); }
     56            inline const std::vector<WorldEntity*>& getEffects() const
     57                { return this->effects_; }
    6058
    6159            void updateCondition();
  • code/trunk/src/orxonox/worldentities/ExplosionChunk.cc

    r9667 r11071  
    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/trunk/src/orxonox/worldentities/ExplosionChunk.h

    r9667 r11071  
    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/trunk/src/orxonox/worldentities/ExplosionPart.cc

    r11052 r11071  
    4747        this->effect2_ = "";
    4848        this->model_= new Model(this->getContext());
    49         this->effect1Particle_= NULL;
    50         this->effect2Particle_= NULL;
     49        this->effect1Particle_= nullptr;
     50        this->effect2Particle_= nullptr;
    5151        this->explosionEntity_ = new MovableEntity(this->getContext());
    5252        this->posOffset_ = Vector3::ZERO;
  • code/trunk/src/orxonox/worldentities/ExplosionPart.h

    r11052 r11071  
    5151            ExplosionPart(Context* context);
    5252            ~ExplosionPart();
    53             void XMLPort(Element& xmlelement, XMLPort::Mode mode);
     53            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
     54
    5455            void Explode();
    5556            void stop();
  • code/trunk/src/orxonox/worldentities/MobileEntity.cc

    r9667 r11071  
    189189    bool MobileEntity::isCollisionTypeLegal(WorldEntity::CollisionType type) const
    190190    {
    191         if (type == WorldEntity::Static)
     191        if (type == WorldEntity::CollisionType::Static)
    192192        {
    193193            orxout(internal_warning) << "Cannot tell a MobileEntity to have static collision type! Ignoring." << endl;
  • code/trunk/src/orxonox/worldentities/MobileEntity.h

    r11052 r11071  
    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/trunk/src/orxonox/worldentities/MovableEntity.cc

    r11018 r11071  
    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/trunk/src/orxonox/worldentities/MovableEntity.h

    r10216 r11071  
    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/trunk/src/orxonox/worldentities/SpawnPoint.cc

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

    r11052 r11071  
    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/trunk/src/orxonox/worldentities/StaticEntity.cc

    r9667 r11071  
    9595    bool StaticEntity::isCollisionTypeLegal(WorldEntity::CollisionType type) const
    9696    {
    97         if (type == WorldEntity::Kinematic || type == WorldEntity::Dynamic)
     97        if (type == WorldEntity::CollisionType::Kinematic || type == WorldEntity::CollisionType::Dynamic)
    9898        {
    9999            orxout(internal_warning) << "Cannot tell a StaticEntity to have kinematic or dynamic collision type! Ignoring." << endl;
  • code/trunk/src/orxonox/worldentities/StaticEntity.h

    r11052 r11071  
    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/trunk/src/orxonox/worldentities/TeamSpawnPoint.h

    r11052 r11071  
    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)
     
    4949            unsigned int getTeamNumber() const
    5050                { return this->teamNumber_; }
    51             virtual Pawn* spawn();
     51            virtual Pawn* spawn() override;
    5252
    5353        private:
  • code/trunk/src/orxonox/worldentities/WorldEntity.cc

    r10624 r11071  
    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::TransformSpace::Local,  "check enum");
     59    static_assert((int)Ogre::Node::TS_PARENT == (int)WorldEntity::TransformSpace::Parent, "check enum");
     60    static_assert((int)Ogre::Node::TS_WORLD  == (int)WorldEntity::TransformSpace::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;
     
    9695        this->collisionShape_ = new WorldEntityCollisionShape(this->getContext());
    9796        this->collisionShape_->setWorldEntityOwner(this);
    98         this->collisionType_             = None;
    99         this->collisionTypeSynchronised_ = None;
     97        this->collisionType_             = CollisionType::None;
     98        this->collisionTypeSynchronised_ = CollisionType::None;
    10099        this->mass_                 = 1.0f;
    101100        this->childrenMass_         = 0;
     
    208207        registerVariable(this->bCollisionResponseActive_,
    209208                                                VariableDirection::ToClient, new NetworkCallback<WorldEntity>(this, &WorldEntity::collisionResponseActivityChanged));
    210         registerVariable((int&)this->collisionTypeSynchronised_,
     209        registerVariable(this->collisionTypeSynchronised_,
    211210                                                VariableDirection::ToClient, new NetworkCallback<WorldEntity>(this, &WorldEntity::collisionTypeChanged));
    212211        registerVariable(this->bPhysicsActiveSynchronised_,
     
    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            }
     
    323322    void WorldEntity::collisionTypeChanged()
    324323    {
    325         if (this->collisionTypeSynchronised_ != Dynamic &&
    326             this->collisionTypeSynchronised_ != Kinematic &&
    327             this->collisionTypeSynchronised_ != Static &&
    328             this->collisionTypeSynchronised_ != None)
     324        if (this->collisionTypeSynchronised_ != CollisionType::Dynamic &&
     325            this->collisionTypeSynchronised_ != CollisionType::Kinematic &&
     326            this->collisionTypeSynchronised_ != CollisionType::Static &&
     327            this->collisionTypeSynchronised_ != CollisionType::None)
    329328        {
    330329            orxout(internal_error) << "Error when collsion Type was received over network. Unknown enum value:" << this->collisionTypeSynchronised_ << endl;
     
    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);
     
    682681        switch (relativeTo)
    683682        {
    684         case WorldEntity::Local:
     683        case TransformSpace::Local:
    685684            // position is relative to parent so transform downwards
    686685            this->setPosition(this->getPosition() + this->getOrientation() * distance);
    687686            break;
    688         case WorldEntity::Parent:
     687        case TransformSpace::Parent:
    689688            this->setPosition(this->getPosition() + distance);
    690689            break;
    691         case WorldEntity::World:
     690        case TransformSpace::World:
    692691            // position is relative to parent so transform upwards
    693692            if (this->node_->getParent())
     
    712711        switch(relativeTo)
    713712        {
    714         case WorldEntity::Local:
     713        case TransformSpace::Local:
    715714            this->setOrientation(this->getOrientation() * rotation);
    716715            break;
    717         case WorldEntity::Parent:
     716        case TransformSpace::Parent:
    718717            // Rotations are normally relative to local axes, transform up
    719718            this->setOrientation(rotation * this->getOrientation());
    720719            break;
    721         case WorldEntity::World:
     720        case TransformSpace::World:
    722721            // Rotations are normally relative to local axes, transform up
    723722            this->setOrientation(this->getOrientation() * this->getWorldOrientation().Inverse()
     
    742741        switch (relativeTo)
    743742        {
    744         case WorldEntity::Local:
     743        case TransformSpace::Local:
    745744            origin = Vector3::ZERO;
    746745            break;
    747         case WorldEntity::Parent:
     746        case TransformSpace::Parent:
    748747            origin = this->getPosition();
    749748            break;
    750         case WorldEntity::World:
     749        case TransformSpace::World:
    751750            origin = this->getWorldPosition();
    752751            break;
     
    832831
    833832        // Check whether we have to create or destroy.
    834         if (type != None && this->collisionType_ == None)
     833        if (type != CollisionType::None && this->collisionType_ == CollisionType::None)
    835834        {
    836835/*
     
    850849            this->physicalBody_->setActivationState(DISABLE_DEACTIVATION);
    851850        }
    852         else if (type == None && this->collisionType_ != None)
     851        else if (type == CollisionType::None && this->collisionType_ != CollisionType::None)
    853852        {
    854853            // Destroy rigid body
     
    856855            deactivatePhysics();
    857856            delete this->physicalBody_;
    858             this->physicalBody_ = 0;
    859             this->collisionType_ = None;
    860             this->collisionTypeSynchronised_ = None;
     857            this->physicalBody_ = nullptr;
     858            this->collisionType_ = CollisionType::None;
     859            this->collisionTypeSynchronised_ = CollisionType::None;
    861860            return;
    862861        }
     
    865864        switch (type)
    866865        {
    867         case Dynamic:
     866        case CollisionType::Dynamic:
    868867            this->physicalBody_->setCollisionFlags(this->physicalBody_->getCollisionFlags() & !btCollisionObject::CF_STATIC_OBJECT & !btCollisionObject::CF_KINEMATIC_OBJECT);
    869868            break;
    870         case Kinematic:
     869        case CollisionType::Kinematic:
    871870            this->physicalBody_->setCollisionFlags((this->physicalBody_->getCollisionFlags() & !btCollisionObject::CF_STATIC_OBJECT) | btCollisionObject::CF_KINEMATIC_OBJECT);
    872871            break;
    873         case Static:
     872        case CollisionType::Static:
    874873            this->physicalBody_->setCollisionFlags((this->physicalBody_->getCollisionFlags() & !btCollisionObject::CF_KINEMATIC_OBJECT) | btCollisionObject::CF_STATIC_OBJECT);
    875874            break;
    876         case None:
     875        case CollisionType::None:
    877876            assert(false); // Doesn't happen
    878877            return;
     
    896895        CollisionType type;
    897896        if (typeStrLower == "dynamic")
    898             type = Dynamic;
     897            type = CollisionType::Dynamic;
    899898        else if (typeStrLower == "static")
    900             type = Static;
     899            type = CollisionType::Static;
    901900        else if (typeStrLower == "kinematic")
    902             type = Kinematic;
     901            type = CollisionType::Kinematic;
    903902        else if (typeStrLower == "none")
    904             type = None;
     903            type = CollisionType::None;
    905904        else
    906905            ThrowException(ParseError, std::string("Attempting to set an unknown collision type: '") + typeStr + "'.");
     
    913912        switch (this->getCollisionType())
    914913        {
    915             case Dynamic:
     914            case CollisionType::Dynamic:
    916915                return "dynamic";
    917             case Kinematic:
     916            case CollisionType::Kinematic:
    918917                return "kinematic";
    919             case Static:
     918            case CollisionType::Static:
    920919                return "static";
    921             case None:
     920            case CollisionType::None:
    922921                return "none";
    923922            default:
     
    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/trunk/src/orxonox/worldentities/WorldEntity.h

    r10726 r11071  
    8282                Enumeration denoting the spaces which a transform can be relative to.
    8383            */
    84             enum TransformSpace
     84            enum class TransformSpace
    8585            {
    8686                //! Transform is relative to the local space
     
    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;
     
    117117            const Vector3& getWorldPosition() const;
    118118
    119             void translate(const Vector3& distance, TransformSpace relativeTo = WorldEntity::Parent);
    120             inline void translate(float x, float y, float z, TransformSpace relativeTo = WorldEntity::Parent)
     119            void translate(const Vector3& distance, TransformSpace relativeTo = TransformSpace::Parent);
     120            inline void translate(float x, float y, float z, TransformSpace relativeTo = TransformSpace::Parent)
    121121                { this->translate(Vector3(x, y, z), relativeTo); }
    122122
     
    134134            const Quaternion& getWorldOrientation() const;
    135135
    136             void rotate(const Quaternion& rotation, TransformSpace relativeTo = WorldEntity::Local);
    137             inline void rotate(const Vector3& axis, const Degree& angle, TransformSpace relativeTo = WorldEntity::Local)
     136            void rotate(const Quaternion& rotation, TransformSpace relativeTo = TransformSpace::Local);
     137            inline void rotate(const Vector3& axis, const Degree& angle, TransformSpace relativeTo = TransformSpace::Local)
    138138                { this->rotate(Quaternion(angle, axis), relativeTo); }
    139139
    140             inline void yaw(const Degree& angle, TransformSpace relativeTo = WorldEntity::Local)
     140            inline void yaw(const Degree& angle, TransformSpace relativeTo = TransformSpace::Local)
    141141                { this->rotate(Quaternion(angle, Vector3::UNIT_Y), relativeTo); }
    142             inline void pitch(const Degree& angle, TransformSpace relativeTo = WorldEntity::Local)
     142            inline void pitch(const Degree& angle, TransformSpace relativeTo = TransformSpace::Local)
    143143                { this->rotate(Quaternion(angle, Vector3::UNIT_X), relativeTo); }
    144             inline void roll(const Degree& angle, TransformSpace relativeTo = WorldEntity::Local)
     144            inline void roll(const Degree& angle, TransformSpace relativeTo = TransformSpace::Local)
    145145                { this->rotate(Quaternion(angle, Vector3::UNIT_Z), relativeTo); }
    146146
    147             void lookAt(const Vector3& target, TransformSpace relativeTo = WorldEntity::Parent, const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z);
    148             void setDirection(const Vector3& direction, TransformSpace relativeTo = WorldEntity::Local, const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z);
    149             inline void setDirection(float x, float y, float z, TransformSpace relativeTo = WorldEntity::Local, const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z)
     147            void lookAt(const Vector3& target, TransformSpace relativeTo = TransformSpace::Parent, const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z);
     148            void setDirection(const Vector3& direction, TransformSpace relativeTo = TransformSpace::Local, const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z);
     149            inline void setDirection(float x, float y, float z, TransformSpace relativeTo = TransformSpace::Local, const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z)
    150150                { this->setDirection(Vector3(x, y, z), relativeTo, localDirectionVector); }
    151151
     
    257257                None:      The object has no physics at all.
    258258            */
    259             enum CollisionType
     259            enum class CollisionType
    260260            {
    261261                Dynamic,
     
    266266
    267267            //! Tells whether the object has any connection to the Bullet physics engine. If hasPhysics() is false, the object may still have a velocity.
    268             bool hasPhysics()       const { return getCollisionType() != None     ; }
     268            bool hasPhysics()       const { return getCollisionType() != CollisionType::None     ; }
    269269            //! @see CollisionType
    270             bool isStatic()         const { return getCollisionType() == Static   ; }
     270            bool isStatic()         const { return getCollisionType() == CollisionType::Static   ; }
    271271            //! @see CollisionType
    272             bool isKinematic()      const { return getCollisionType() == Kinematic; }
     272            bool isKinematic()      const { return getCollisionType() == CollisionType::Kinematic; }
    273273            //! @see CollisionType
    274             bool isDynamic()        const { return getCollisionType() == Dynamic  ; }
     274            bool isDynamic()        const { return getCollisionType() == CollisionType::Dynamic  ; }
    275275            //! Tells whether physics has been activated (you can temporarily deactivate it)
    276276            bool isPhysicsActive()  const { return this->bPhysicsActive_; }
  • code/trunk/src/orxonox/worldentities/pawns/FpsPlayer.cc

    r9667 r11071  
    7979        // FpsPlayer is always a physical object per default
    8080        // Be aware of this call: The collision type legality check will not reach derived classes!
    81         this->setCollisionType(WorldEntity::Dynamic);
     81        this->setCollisionType(WorldEntity::CollisionType::Dynamic);
    8282        // Get notification about collisions
    8383        this->enableCollisionCallback();
     
    130130    bool FpsPlayer::isCollisionTypeLegal(WorldEntity::CollisionType type) const
    131131    {
    132         if (type != WorldEntity::Dynamic)
     132        if (type != WorldEntity::CollisionType::Dynamic)
    133133        {
    134134            orxout(internal_warning) << "Cannot tell a FpsPlayer not to be dynamic! Ignoring." << endl;
     
    168168            if (!this->isInMouseLook())
    169169            {
    170                 this->yaw(Radian(this->yaw_ * this->getMouseLookSpeed()), WorldEntity::Parent);
     170                this->yaw(Radian(this->yaw_ * this->getMouseLookSpeed()), WorldEntity::TransformSpace::Parent);
    171171
    172172                Radian pitch = this->cameraPositionRootNode_->getOrientation().getPitch();
     
    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/trunk/src/orxonox/worldentities/pawns/FpsPlayer.h

    r9667 r11071  
    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/trunk/src/orxonox/worldentities/pawns/ModularSpaceShip.cc

    r10624 r11071  
    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/trunk/src/orxonox/worldentities/pawns/ModularSpaceShip.h

    r10262 r11071  
    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/trunk/src/orxonox/worldentities/pawns/Pawn.cc

    r11052 r11071  
    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
     
    8686        this->aimPosition_ = Vector3::ZERO;
    8787
    88         //this->explosionPartList_ = NULL;
     88        //this->explosionPartList_ = nullptr;
    8989
    9090        if (GameMode::isMaster())
     
    9494        }
    9595        else
    96             this->weaponSystem_ = 0;
     96            this->weaponSystem_ = nullptr;
    9797
    9898        this->setRadarObjectColour(ColourValue::Red);
    99         this->setRadarObjectShape(RadarViewable::Dot);
     99        this->setRadarObjectShape(RadarViewable::Shape::Dot);
    100100
    101101        this->registerVariables();
     
    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;
    513     }
    514 
    515     std::vector<WeaponPack *> * Pawn::getAllWeaponPacks()
    516     {
    517         if (this->weaponSystem_)
    518             return this->weaponSystem_->getAllWeaponPacks();
    519         else
    520             return 0;       
     512            return nullptr;
    521513    }
    522514
     
    531523    Munition* Pawn::getMunitionXML() const
    532524    {
    533         return NULL;
     525        return nullptr;
    534526    }
    535527
     
    541533        }
    542534
    543         return NULL;
     535        return nullptr;
    544536    }
    545537
     
    564556    bool Pawn::hasSlaves()
    565557    {
    566         for (ObjectList<FormationController>::iterator it =
    567              ObjectList<FormationController>::begin();
    568              it != ObjectList<FormationController>::end(); ++it )
     558        for (FormationController* controller : ObjectList<FormationController>())
    569559        {
    570560            // checks if the pawn's controller has a slave
    571             if (this->hasHumanController() && it->getMaster() == this->getPlayer()->getController())
     561            if (this->hasHumanController() && controller->getMaster() == this->getPlayer()->getController())
    572562                return true;
    573563        }
     
    577567    // A function that returns a slave of the pawn's controller
    578568    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;
     569        for (FormationController* controller : ObjectList<FormationController>())
     570        {
     571            if (this->hasHumanController() && controller->getMaster() == this->getPlayer()->getController())
     572                return controller->getController();
     573        }
     574        return nullptr;
    587575    }
    588576
  • code/trunk/src/orxonox/worldentities/pawns/Pawn.h

    r11052 r11071  
    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
     
    7171
    7272
    73             virtual void setHealth(float health);
     73            void setHealth(float health);
    7474            inline void addHealth(float health)
    7575                { this->setHealth(this->health_ + health); }
     
    8989                { return this->initialHealth_; }
    9090
    91             virtual void setShieldHealth(float shieldHealth);
     91            void setShieldHealth(float shieldHealth);
    9292
    9393            inline float getShieldHealth()
     
    100100                { return (this->getShieldHealth() > 0); }
    101101
    102             virtual void setMaxShieldHealth(float maxshieldhealth);
     102            void setMaxShieldHealth(float maxshieldhealth);
    103103            inline float getMaxShieldHealth() const
    104104                { return this->maxShieldHealth_; }
     
    119119                { return this->shieldAbsorption_; }
    120120
    121             virtual void setShieldRechargeRate(float shieldRechargeRate);
     121            void setShieldRechargeRate(float shieldRechargeRate);
    122122            inline float getShieldRechargeRate() const
    123123                { return this->shieldRechargeRate_; }
    124124
    125             virtual void setShieldRechargeWaitTime(float shieldRechargeWaitTime);
     125            void setShieldRechargeWaitTime(float shieldRechargeWaitTime);
    126126            inline float getShieldRechargeWaitTime() const
    127127                { return this->shieldRechargeWaitTime_; }
     
    133133                { this->shieldRechargeWaitCountdown_ = this->getShieldRechargeWaitTime(); } // TODO: Implement in Projectile.cc
    134134
    135             virtual void decreaseShieldRechargeCountdownTime(float dt);
     135            void decreaseShieldRechargeCountdownTime(float dt);
    136136
    137137            /** @brief Sets the state of the pawns vulnerability. @param bVulnerable */
     
    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
     
    170170            void addWeaponPackXML(WeaponPack * wPack);
    171171            WeaponPack * getWeaponPack(unsigned int index) const;
    172             std::vector<WeaponPack *> * getAllWeaponPacks();
    173172
    174173            void addMunitionXML(Munition* munition);
     
    201200
    202201
    203             virtual void startLocalHumanControl();
     202            virtual void startLocalHumanControl() override;
    204203
    205204            void setAimPosition( Vector3 position )
     
    208207                { return this->aimPosition_; }
    209208
    210             virtual const Vector3& getCarrierPosition(void) const
     209            virtual const Vector3& getCarrierPosition(void) const override
    211210                { return this->getWorldPosition(); };
    212211
    213             virtual void changedVisibility();
     212            virtual void changedVisibility() override;
    214213
    215214            void setExplosionSound(const std::string& engineSound);
    216215            const std::string& getExplosionSound();
    217216
    218             virtual const WeaponSystem* getWeaponSystem() const
     217            inline const WeaponSystem* getWeaponSystem() const
    219218                { return this->weaponSystem_; }
    220219
    221220        protected:
    222             virtual void preDestroy();
    223 
    224             virtual void setPlayer(PlayerInfo* player);
    225             virtual void removePlayer();
     221            virtual void preDestroy() override;
     222
     223            virtual void setPlayer(PlayerInfo* player) override;
     224            virtual void removePlayer() override;
    226225
    227226            virtual void death();
     
    231230            virtual void spawneffect();
    232231
    233             virtual void damage(float damage, float healthdamage = 0.0f, float shielddamage = 0.0f, Pawn* originator = NULL, const btCollisionShape* cs = NULL);
     232            virtual void damage(float damage, float healthdamage = 0.0f, float shielddamage = 0.0f, Pawn* originator = nullptr, const btCollisionShape* cs = nullptr);
    234233
    235234            bool bAlive_;
    236235            bool bVulnerable_; ///< If false the pawn may not ged damaged
    237236
    238             virtual std::vector<PickupCarrier*>* getCarrierChildren(void) const
     237            virtual std::vector<PickupCarrier*>* getCarrierChildren(void) const override
    239238                { return new std::vector<PickupCarrier*>(); }
    240             virtual PickupCarrier* getCarrierParent(void) const
    241                 { return NULL; }
     239            virtual PickupCarrier* getCarrierParent(void) const override
     240                { return nullptr; }
    242241
    243242
  • code/trunk/src/orxonox/worldentities/pawns/SpaceShip.cc

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

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

    r10624 r11071  
    5151        }
    5252
    53         this->setRadarObjectShape(RadarViewable::Triangle);
     53        this->setRadarObjectShape(RadarViewable::Shape::Triangle);
    5454    }
    5555
     
    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}
  • code/trunk/src/orxonox/worldentities/pawns/TeamBaseMatchBase.h

    r9667 r11071  
    3636namespace orxonox
    3737{
    38     namespace BaseState
     38    enum class BaseState
    3939    {
    40         enum Value
    41         {
    42             Uncontrolled,
    43             ControlTeam1,
    44             ControlTeam2,
    45         };
    46     }
     40        Uncontrolled,
     41        ControlTeam1,
     42        ControlTeam2,
     43    };
    4744
    4845
     
    5855
    5956            // Set the state of a base to whatever the argument of the function is
    60             void setState(BaseState::Value state)
     57            void setState(BaseState state)
    6158            {
    6259                this->state_ = state;
     
    6663
    6764            // Get the state of a base as a return value
    68             BaseState::Value getState() const
     65            BaseState getState() const
    6966            {
    7067                return this->state_;
     
    7572            void changeTeamColour();
    7673
    77             BaseState::Value state_;
     74            BaseState state_;
    7875    };
    7976}
Note: See TracChangeset for help on using the changeset viewer.