Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

merged branch cpp11_v2 into cpp11_v3

Location:
code/branches/cpp11_v3
Files:
27 edited

Legend:

Unmodified
Added
Removed
  • code/branches/cpp11_v3

  • code/branches/cpp11_v3/src/modules/objects/Attacher.cc

    r9667 r11054  
    4040        RegisterObject(Attacher);
    4141
    42         this->target_ = 0;
     42        this->target_ = nullptr;
    4343    }
    4444
     
    6161        SUPER(Attacher, changedActivity);
    6262
    63         for (std::list<WorldEntity*>::iterator it = this->objects_.begin(); it != this->objects_.end(); ++it)
    64             (*it)->setActive(this->isActive());
     63        for (WorldEntity* object : this->objects_)
     64            object->setActive(this->isActive());
    6565    }
    6666
     
    6969        SUPER(Attacher, changedVisibility);
    7070
    71         for (std::list<WorldEntity*>::iterator it = this->objects_.begin(); it != this->objects_.end(); ++it)
    72             (*it)->setVisible(this->isVisible());
     71        for (WorldEntity* object : this->objects_)
     72            object->setVisible(this->isVisible());
    7373    }
    7474
     
    8383    {
    8484        unsigned int i = 0;
    85         for (std::list<WorldEntity*>::const_iterator it = this->objects_.begin(); it != this->objects_.end(); ++it)
     85        for (WorldEntity* object : this->objects_)
    8686        {
    8787            if (i == index)
    88                 return (*it);
     88                return object;
    8989
    9090            ++i;
    9191        }
    92         return 0;
     92        return nullptr;
    9393    }
    9494
     
    9696    {
    9797        this->targetname_ = target;
    98         this->target_ = 0;
     98        this->target_ = nullptr;
    9999
    100100        if (this->targetname_.empty())
    101101            return;
    102102
    103         for (ObjectList<WorldEntity>::iterator it = ObjectList<WorldEntity>::begin(); it != ObjectList<WorldEntity>::end(); ++it)
     103        for (WorldEntity* worldEntity : ObjectList<WorldEntity>())
    104104        {
    105             if (it->getName() == this->targetname_)
     105            if (worldEntity->getName() == this->targetname_)
    106106            {
    107                 this->target_ = *it;
    108                 this->attachToParent(*it);
     107                this->target_ = worldEntity;
     108                this->attachToParent(worldEntity);
    109109            }
    110110        }
  • code/branches/cpp11_v3/src/modules/objects/Attacher.h

    r9667 r11054  
    5151            virtual ~Attacher() {}
    5252
    53             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
     53            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
    5454
    55             virtual void processEvent(Event& event);
    56             virtual void changedActivity();
    57             virtual void changedVisibility();
     55            virtual void processEvent(Event& event) override;
     56            virtual void changedActivity() override;
     57            virtual void changedVisibility() override;
    5858
    5959            void addObject(WorldEntity* object);
     
    6464                { return this->targetname_; }
    6565
    66             void loadedNewXMLName(BaseObject* object);
     66            virtual void loadedNewXMLName(BaseObject* object) override;
    6767
    6868        private:
  • code/branches/cpp11_v3/src/modules/objects/ForceField.cc

    r9945 r11054  
    118118        {
    119119            // Iterate over all objects that could possibly be affected by the ForceField.
    120             for (ObjectList<MobileEntity>::iterator it = ObjectList<MobileEntity>::begin(); it != ObjectList<MobileEntity>::end(); ++it)
     120            for (MobileEntity* mobileEntity : ObjectList<MobileEntity>())
    121121            {
    122122                // The direction of the orientation of the force field.
     
    125125
    126126                // Vector from the center of the force field to the object its acting on.
    127                 Vector3 distanceVector = it->getWorldPosition() - (this->getWorldPosition() + (this->halfLength_ * direction));
     127                Vector3 distanceVector = mobileEntity->getWorldPosition() - (this->getWorldPosition() + (this->halfLength_ * direction));
    128128
    129129                // The object is outside a ball around the center with radius length/2 of the ForceField.
     
    132132
    133133                // The distance of the object form the orientation vector. (Or rather the smallest distance from the orientation vector)
    134                 float distanceFromDirectionVector = ((it->getWorldPosition() - this->getWorldPosition()).crossProduct(direction)).length();
     134                float distanceFromDirectionVector = ((mobileEntity->getWorldPosition() - this->getWorldPosition()).crossProduct(direction)).length();
    135135
    136136                // If the object in a tube of radius 'radius' around the direction of orientation.
     
    140140                // Apply a force to the object in the direction of the orientation.
    141141                // The force is highest when the object is directly on the direction vector, with a linear decrease, finally reaching zero, when distanceFromDirectionVector = radius.
    142                 it->applyCentralForce((this->radius_ - distanceFromDirectionVector)/this->radius_ * this->velocity_ * direction);
     142                mobileEntity->applyCentralForce((this->radius_ - distanceFromDirectionVector)/this->radius_ * this->velocity_ * direction);
    143143            }
    144144        }
     
    146146        {
    147147            // Iterate over all objects that could possibly be affected by the ForceField.
    148             for (ObjectList<MobileEntity>::iterator it = ObjectList<MobileEntity>::begin(); it != ObjectList<MobileEntity>::end(); ++it)
    149             {
    150                 Vector3 distanceVector = it->getWorldPosition() - this->getWorldPosition();
     148            for (MobileEntity* mobileEntity : ObjectList<MobileEntity>())
     149            {
     150                Vector3 distanceVector = mobileEntity->getWorldPosition() - this->getWorldPosition();
    151151                float distance = distanceVector.length();
    152152                // If the object is within 'radius' distance.
     
    155155                    distanceVector.normalise();
    156156                    // Apply a force proportional to the velocity, with highest force at the origin of the sphere, linear decreasing until reaching a distance of 'radius' from the origin, where the force reaches zero.
    157                     it->applyCentralForce((this->radius_ - distance)/this->radius_ * this->velocity_ * distanceVector);
     157                    mobileEntity->applyCentralForce((this->radius_ - distance)/this->radius_ * this->velocity_ * distanceVector);
    158158                }
    159159            }
     
    162162        {
    163163            // Iterate over all objects that could possibly be affected by the ForceField.
    164             for (ObjectList<MobileEntity>::iterator it = ObjectList<MobileEntity>::begin(); it != ObjectList<MobileEntity>::end(); ++it)
    165             {
    166                 Vector3 distanceVector = this->getWorldPosition() - it->getWorldPosition();
     164            for (MobileEntity* mobileEntity : ObjectList<MobileEntity>())
     165            {
     166                Vector3 distanceVector = this->getWorldPosition() - mobileEntity->getWorldPosition();
    167167                float distance = distanceVector.length();
    168168                // If the object is within 'radius' distance and no more than 'length' away from the boundary of the sphere.
     
    172172                    distanceVector.normalise();
    173173                    // Apply a force proportional to the velocity, with highest force at the boundary of the sphere, linear decreasing until reaching a distance of 'radius-length' from the origin, where the force reaches zero.
    174                     it->applyCentralForce((distance-range)/range * this->velocity_ * distanceVector);
     174                    mobileEntity->applyCentralForce((distance-range)/range * this->velocity_ * distanceVector);
    175175                }
    176176            }
     
    179179        {
    180180            // Iterate over all objects that could possibly be affected by the ForceField.
    181             for (ObjectList<MobileEntity>::iterator it = ObjectList<MobileEntity>::begin(); it != ObjectList<MobileEntity>::end(); ++it)
    182             {
    183                 Vector3 distanceVector = it->getWorldPosition() - this->getWorldPosition();
     181            for (MobileEntity* mobileEntity : ObjectList<MobileEntity>())
     182            {
     183                Vector3 distanceVector = mobileEntity->getWorldPosition() - this->getWorldPosition();
    184184                float distance = distanceVector.length();
    185185                // If the object is within 'radius' distance and especially further away than massRadius_
     
    197197                   
    198198                    // Note: this so called force is actually an acceleration!
    199                     it->applyCentralForce((-1) * (ForceField::attenFactor_ * ForceField::gravConstant_ * this->getMass()) / (distance * distance) * distanceVector);
     199                    mobileEntity->applyCentralForce((-1) * (ForceField::attenFactor_ * ForceField::gravConstant_ * this->getMass()) / (distance * distance) * distanceVector);
    200200                }
    201201            }
     
    204204        {
    205205            // Iterate over all objects that could possibly be affected by the ForceField.
    206             for (ObjectList<MobileEntity>::iterator it = ObjectList<MobileEntity>::begin(); it != ObjectList<MobileEntity>::end(); ++it)
    207             {
    208                 Vector3 distanceVector = it->getWorldPosition() - this->getWorldPosition();
     206            for (MobileEntity* mobileEntity : ObjectList<MobileEntity>())
     207            {
     208                Vector3 distanceVector = mobileEntity->getWorldPosition() - this->getWorldPosition();
    209209                float distance = distanceVector.length();
    210210                if (distance < this->radius_ && distance > this->massRadius_)
     
    212212                    // Add a Acceleration in forceDirection_.
    213213                    // Vector3(0,0,0) is the direction, where the force should work.
    214                     it->addAcceleration(forceDirection_ , Vector3(0,0,0));
     214                    mobileEntity->addAcceleration(forceDirection_ , Vector3(0,0,0));
    215215                }
    216216            }
  • code/branches/cpp11_v3/src/modules/objects/ForceField.h

    r10622 r11054  
    9292            virtual ~ForceField();
    9393
    94             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Creates a ForceField object through XML.
     94            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; //!< Creates a ForceField object through XML.
    9595            void registerVariables(); //!< Registers the variables that should get synchronised over the network
    96             virtual void tick(float dt); //!< A method that is called every tick.
     96            virtual void tick(float dt) override; //!< A method that is called every tick.
    9797           
    9898
  • code/branches/cpp11_v3/src/modules/objects/Planet.h

    r10624 r11054  
    5252            virtual ~Planet();
    5353
    54             virtual void tick(float dt);
     54            virtual void tick(float dt) override;
    5555
    56             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
     56            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
    5757
    58             virtual void changedVisibility();
     58            virtual void changedVisibility() override;
    5959
    6060            inline void setMeshSource(const std::string& meshname)
  • code/branches/cpp11_v3/src/modules/objects/Script.cc

    r10624 r11054  
    140140
    141141        PlayerTrigger* pTrigger = orxonox_cast<PlayerTrigger*>(trigger);
    142         PlayerInfo* player = NULL;
     142        PlayerInfo* player = nullptr;
    143143
    144144        // If the trigger is a PlayerTrigger.
    145         if(pTrigger != NULL)
     145        if(pTrigger != nullptr)
    146146        {
    147147            if(!pTrigger->isForPlayer())  // The PlayerTrigger is not exclusively for Pawns which means we cannot extract one.
     
    153153            return false;
    154154
    155         if(player == NULL)  //TODO: Will this ever happen? If not, change in NotificationDispatcher as well.
     155        if(player == nullptr)  //TODO: Will this ever happen? If not, change in NotificationDispatcher as well.
    156156        {
    157157            orxout(internal_warning) << "The Script was triggered by an entity other than a Pawn. (" << trigger->getIdentifier()->getName() << ")" << endl;
     
    196196            {
    197197                const std::map<unsigned int, PlayerInfo*> clients = PlayerManager::getInstance().getClients();
    198                 for(std::map<unsigned int, PlayerInfo*>::const_iterator it = clients.begin(); it != clients.end(); it++)
     198                for(const auto& mapEntry : clients)
    199199                {
    200                     callStaticNetworkFunction(&Script::executeHelper, it->first, this->getCode(), this->getMode(), this->getNeedsGraphics());
     200                    callStaticNetworkFunction(&Script::executeHelper, mapEntry.first, this->getCode(), this->getMode(), this->getNeedsGraphics());
    201201                    if(this->times_ != Script::INF) // Decrement the number of remaining executions.
    202202                    {
  • code/branches/cpp11_v3/src/modules/objects/Script.h

    r9667 r11054  
    9898            virtual ~Script();
    9999
    100             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a Script object through XML.
    101             virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode); //!< Creates a port that can be used to channel events and react to them.
     100            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; //!< Method for creating a Script object through XML.
     101            virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode) override; //!< Creates a port that can be used to channel events and react to them.
    102102
    103103            bool trigger(bool triggered, BaseObject* trigger); //!< Is called when an event comes in trough the event port.
     
    168168                { return this->forAll_; }
    169169
    170             virtual void clientConnected(unsigned int clientId); //!< Callback that is called when a new client has connected.
    171             virtual void clientDisconnected(unsigned int clientid) {}
     170            virtual void clientConnected(unsigned int clientId) override; //!< Callback that is called when a new client has connected.
     171            virtual void clientDisconnected(unsigned int clientid) override {}
    172172
    173173        private:
  • code/branches/cpp11_v3/src/modules/objects/SpaceBoundaries.cc

    r10624 r11054  
    5959            this->pawnsIn_.clear();
    6060
    61             for( std::vector<BillboardAdministration>::iterator current = this->billboards_.begin(); current != this->billboards_.end(); current++)
     61            for(BillboardAdministration& billboard : this->billboards_)
    6262            {
    63                 if( current->billy != NULL)
    64                 {
    65                     delete current->billy;
     63                if( billboard.billy != nullptr)
     64                {
     65                    delete billboard.billy;
    6666                }
    6767            }
     
    7373    {
    7474        pawnsIn_.clear();
    75         for(ObjectList<Pawn>::iterator current = ObjectList<Pawn>::begin(); current != ObjectList<Pawn>::end(); ++current)
    76         {
    77             Pawn* currentPawn = *current;
     75        for(Pawn* currentPawn : ObjectList<Pawn>())
     76        {
    7877            if( this->reaction_ == 0 )
    7978            {
     
    127126    void SpaceBoundaries::setBillboardOptions(Billboard *billy)
    128127    {
    129         if(billy != NULL)
     128        if(billy != nullptr)
    130129        {
    131130            billy->setMaterial("Grid");
     
    138137    void SpaceBoundaries::removeAllBillboards()
    139138    {
    140         for( std::vector<BillboardAdministration>::iterator current = this->billboards_.begin(); current != this->billboards_.end(); current++ )
    141         {
    142             current->usedYet = false;
    143             current->billy->setVisible(false);
     139        for(BillboardAdministration& billboard : this->billboards_)
     140        {
     141            billboard.usedYet = false;
     142            billboard.billy->setVisible(false);
    144143        }
    145144    }
     
    208207        float distance;
    209208        bool humanItem;
    210         for( std::list<WeakPtr<Pawn> >::iterator current = pawnsIn_.begin(); current != pawnsIn_.end(); current++ )
    211         {
    212             Pawn* currentPawn = *current;
     209        for(Pawn* currentPawn : pawnsIn_)
     210        {
    213211            if( currentPawn && currentPawn->getNode() )
    214212            {
     
    250248    float SpaceBoundaries::computeDistance(WorldEntity *item)
    251249    {
    252         if(item != NULL)
     250        if(item != nullptr)
    253251        {
    254252            Vector3 itemPosition = item->getWorldPosition();
     
    310308    bool SpaceBoundaries::isHumanPlayer(Pawn *item)
    311309    {
    312         if(item != NULL)
     310        if(item != nullptr)
    313311        {
    314312            if(item->getPlayer())
  • code/branches/cpp11_v3/src/modules/objects/SpaceBoundaries.h

    r9667 r11054  
    9393            int getReaction();
    9494
    95             void XMLPort(Element& xmlelement, XMLPort::Mode mode);
     95            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
    9696
    97             void tick(float dt);
     97            virtual void tick(float dt) override;
    9898
    9999        private:
     
    101101
    102102            // Variabeln::
    103             std::list<WeakPtr<Pawn> > pawnsIn_; //!< List of the pawns that this instance of SpaceBoundaries has to handle.
     103            std::list<WeakPtr<Pawn>> pawnsIn_; //!< List of the pawns that this instance of SpaceBoundaries has to handle.
    104104
    105105            std::vector<BillboardAdministration> billboards_;
  • code/branches/cpp11_v3/src/modules/objects/Turret.h

    r11052 r11054  
    6161            virtual ~Turret();
    6262
    63             virtual void rotatePitch(const Vector2& value);
    64             virtual void rotateYaw(const Vector2& value);
    65             virtual void rotateRoll(const Vector2& value);
     63            virtual void rotatePitch(const Vector2& value) override;
     64            virtual void rotateYaw(const Vector2& value) override;
     65            virtual void rotateRoll(const Vector2& value) override;
    6666            virtual float isInRange(const WorldEntity* target);
    6767            virtual void aimAtPosition(const Vector3 &position);
    6868
    69             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    70             virtual void tick(float dt);
     69            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
     70            virtual void tick(float dt) override;
    7171
    7272            /** @brief Sets the maximum distance the turret is allowed to shoot. @param radius The distance*/
  • code/branches/cpp11_v3/src/modules/objects/controllers/TeamTargetProxy.cc

    r10262 r11054  
    2828
    2929#include "TeamTargetProxy.h"
     30#include "core/CoreIncludes.h"
    3031#include "worldentities/ControllableEntity.h"
    3132#include "worldentities/pawns/Pawn.h"
  • code/branches/cpp11_v3/src/modules/objects/controllers/TurretController.cc

    r10622 r11054  
    3030#include "worldentities/pawns/Pawn.h"
    3131#include "objects/Turret.h"
     32#include "core/object/ObjectList.h"
     33#include "core/CoreIncludes.h"
    3234
    3335 namespace orxonox
     
    8183        {
    8284            this->forgetTarget();
    83             turret->setTarget(0);
     85            turret->setTarget(nullptr);
    8486        }
    8587
     
    99101        float minScore = FLT_MAX;
    100102        float tempScore;
    101         Pawn* minScorePawn = 0;
    102 
    103         for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it != ObjectList<Pawn>::end(); ++it)
    104         {
    105             Pawn* entity = orxonox_cast<Pawn*>(*it);
    106             if (!entity || FormationController::sameTeam(turret, entity, this->getGametype()))
     103        Pawn* minScorePawn = nullptr;
     104
     105        for (Pawn* pawn : ObjectList<Pawn>())
     106        {
     107            if (!pawn || FormationController::sameTeam(turret, pawn, this->getGametype()))
    107108                continue;
    108             tempScore = turret->isInRange(entity);
     109            tempScore = turret->isInRange(pawn);
    109110            if(tempScore != -1.f)
    110111            {
     
    112113                {
    113114                    minScore = tempScore;
    114                     minScorePawn = entity;
     115                    minScorePawn = pawn;
    115116                }
    116117            }
  • code/branches/cpp11_v3/src/modules/objects/eventsystem/EventDispatcher.cc

    r9667 r11054  
    4545    {
    4646        if (this->isInitialized())
    47             for (std::list<BaseObject*>::iterator it = this->targets_.begin(); it != this->targets_.end(); ++it)
    48                 (*it)->destroy();
     47            for (BaseObject* target : this->targets_)
     48                target->destroy();
    4949    }
    5050
     
    6161    void EventDispatcher::processEvent(Event& event)
    6262    {
    63         for (std::list<BaseObject*>::iterator it = this->targets_.begin(); it != this->targets_.end(); ++it)
    64             (*it)->processEvent(event);
     63        for (BaseObject* target : this->targets_)
     64            target->processEvent(event);
    6565    }
    6666
     
    7373    {
    7474        unsigned int i = 0;
    75         for (std::list<BaseObject*>::const_iterator it = this->targets_.begin(); it != this->targets_.end(); ++it)
     75        for (BaseObject* target : this->targets_)
    7676        {
    7777            if (i == index)
    78                 return (*it);
     78                return target;
    7979            ++i;
    8080        }
    81         return 0;
     81        return nullptr;
    8282    }
    8383}
  • code/branches/cpp11_v3/src/modules/objects/eventsystem/EventFilter.cc

    r9667 r11054  
    7070        {
    7171            bool success = false;
    72             for (std::list<EventName*>::const_iterator it = this->names_.begin(); it != this->names_.end(); ++it)
     72            for (EventName* name : this->names_)
    7373            {
    74                 if ((*it)->getName() == event.name_)
     74                if (name->getName() == event.name_)
    7575                {
    7676                    success = true;
     
    9696    {
    9797        unsigned int i = 0;
    98         for (std::list<BaseObject*>::const_iterator it = this->sources_.begin(); it != this->sources_.end(); ++it)
     98        for (BaseObject* source : this->sources_)
    9999        {
    100100            if (i == index)
    101                 return (*it);
     101                return source;
    102102            ++i;
    103103        }
    104         return 0;
     104        return nullptr;
    105105    }
    106106
     
    113113    {
    114114        unsigned int i = 0;
    115         for (std::list<EventName*>::const_iterator it = this->names_.begin(); it != this->names_.end(); ++it)
     115        for (EventName* name : this->names_)
    116116        {
    117117            if (i == index)
    118                 return (*it);
     118                return name;
    119119            ++i;
    120120        }
    121         return 0;
     121        return nullptr;
    122122    }
    123123}
  • code/branches/cpp11_v3/src/modules/objects/eventsystem/EventListener.cc

    r9667 r11054  
    7878            return;
    7979
    80         for (ObjectList<BaseObject>::iterator it = ObjectList<BaseObject>::begin(); it != ObjectList<BaseObject>::end(); ++it)
    81             if (it->getName() == this->eventName_)
    82                 this->addEventSource(*it, "");
     80        for (BaseObject* object : ObjectList<BaseObject>())
     81            if (object->getName() == this->eventName_)
     82                this->addEventSource(object, "");
    8383    }
    8484
  • code/branches/cpp11_v3/src/modules/objects/eventsystem/EventTarget.cc

    r9667 r11054  
    7373        this->target_ = name;
    7474
    75         for (ObjectList<BaseObject>::iterator it = ObjectList<BaseObject>::begin(); it != ObjectList<BaseObject>::end(); ++it)
    76             if (it->getName() == this->target_)
    77                 this->addEventTarget(*it);
     75        for (BaseObject* object : ObjectList<BaseObject>())
     76            if (object->getName() == this->target_)
     77                this->addEventTarget(object);
    7878    }
    7979
  • code/branches/cpp11_v3/src/modules/objects/triggers/DistanceMultiTrigger.cc

    r10624 r11054  
    9797    {
    9898
    99         std::queue<MultiTriggerState*>* queue = NULL;
     99        std::queue<MultiTriggerState*>* queue = nullptr;
    100100
    101101        // Check for objects that were in range but no longer are. Iterate through all objects, that are in range.
    102         for(std::set<WeakPtr<WorldEntity> >::iterator it = this->range_.begin(); it != this->range_.end(); )
     102        for(std::set<WeakPtr<WorldEntity>>::iterator it = this->range_.begin(); it != this->range_.end(); )
    103103        {
    104104            WorldEntity* entity = *it;
    105105
    106106            // If the entity no longer exists.
    107             if(entity == NULL)
     107            if(entity == nullptr)
    108108            {
    109109                this->range_.erase(it++);
     
    118118
    119119                // If no queue has been created, yet.
    120                 if(queue == NULL)
     120                if(queue == nullptr)
    121121                    queue = new std::queue<MultiTriggerState*>();
    122122
     
    158158            {
    159159               
    160                 const std::set<WorldEntity*> attached = entity->getAttachedObjects();
     160                const std::set<WorldEntity*> attachedObjects = entity->getAttachedObjects();
    161161                bool found = false;
    162                 for(std::set<WorldEntity*>::const_iterator it = attached.begin(); it != attached.end(); it++)
     162                for(WorldEntity* attachedObject : attachedObjects)
    163163                {
    164                     if((*it)->isA(ClassIdentifier<DistanceTriggerBeacon>::getIdentifier()) && static_cast<DistanceTriggerBeacon*>(*it)->getName() == this->targetName_)
     164                    if(attachedObject->isA(ClassIdentifier<DistanceTriggerBeacon>::getIdentifier()) && static_cast<DistanceTriggerBeacon*>(attachedObject)->getName() == this->targetName_)
    165165                    {
    166166                        found = true;
     
    186186
    187187                // If no queue has been created, yet.
    188                 if(queue == NULL)
     188                if(queue == nullptr)
    189189                    queue = new std::queue<MultiTriggerState*>();
    190190
     
    261261    bool DistanceMultiTrigger::addToRange(WorldEntity* entity)
    262262    {
    263         std::pair<std::set<WeakPtr<WorldEntity> >::iterator, bool> pair = this->range_.insert(entity);
     263        std::pair<std::set<WeakPtr<WorldEntity>>::iterator, bool> pair = this->range_.insert(entity);
    264264        return pair.second;
    265265    }
  • code/branches/cpp11_v3/src/modules/objects/triggers/DistanceMultiTrigger.h

    r10624 r11054  
    153153            ClassTreeMask beaconMask_; //!< A mask, that only accepts DistanceTriggerBeacons.
    154154
    155             std::set<WeakPtr<WorldEntity> > range_; //!< The set of entities that currently are in range of the DistanceMultiTrigger.
     155            std::set<WeakPtr<WorldEntity>> range_; //!< The set of entities that currently are in range of the DistanceMultiTrigger.
    156156
    157157    };
  • code/branches/cpp11_v3/src/modules/objects/triggers/DistanceTrigger.cc

    r10624 r11054  
    106106            this->setForPlayer(true);
    107107
    108         if (targetId == NULL)
     108        if (targetId == nullptr)
    109109        {
    110110            orxout(internal_error, context::triggers) << "\"" << targetStr << "\" is not a valid class name to include in ClassTreeMask (in " << this->getName() << ", class " << this->getIdentifier()->getName() << ')' << endl;
     
    147147    {
    148148        // Check whether there is a cached object, it still exists and whether it is still in range, if so nothing further needs to be done.
    149         if(this->cache_ != NULL)
     149        if(this->cache_ != nullptr)
    150150        {
    151151            if((this->cache_->getWorldPosition() - this->getWorldPosition()).length() < this->distance_)
     
    180180            {
    181181
    182                 const std::set<WorldEntity*> attached = entity->getAttachedObjects();
     182                const std::set<WorldEntity*> attachedObjects = entity->getAttachedObjects();
    183183                bool found = false;
    184                 for(std::set<WorldEntity*>::const_iterator it = attached.begin(); it != attached.end(); it++)
     184                for(WorldEntity* attachedObject : attachedObjects)
    185185                {
    186                     if((*it)->isA(ClassIdentifier<DistanceTriggerBeacon>::getIdentifier()) && static_cast<DistanceTriggerBeacon*>(*it)->getName() == this->targetName_)
     186                    if(attachedObject->isA(ClassIdentifier<DistanceTriggerBeacon>::getIdentifier()) && static_cast<DistanceTriggerBeacon*>(attachedObject)->getName() == this->targetName_)
    187187                    {
    188188                        found = true;
     
    206206
    207207                    Pawn* pawn = orxonox_cast<Pawn*>(entity);
    208                     if(pawn != NULL)
     208                    if(pawn != nullptr)
    209209                        this->setTriggeringPawn(pawn);
    210210                    else
    211                         orxout(internal_warning, context::triggers) << "Pawn was NULL." << endl;
     211                        orxout(internal_warning, context::triggers) << "Pawn was nullptr." << endl;
    212212                }
    213213               
  • code/branches/cpp11_v3/src/modules/objects/triggers/EventMultiTrigger.cc

    r9667 r11054  
    9696    {
    9797        // If the originator is a MultiTriggerContainer, the event originates from a MultiTrigger and thus the event only triggers the EventMultiTrigger for the originator that caused the MultiTrigger to trigger.
    98         if(originator != NULL && originator->isA(ClassIdentifier<MultiTriggerContainer>::getIdentifier()))
     98        if(originator != nullptr && originator->isA(ClassIdentifier<MultiTriggerContainer>::getIdentifier()))
    9999        {
    100100            MultiTriggerContainer* container = static_cast<MultiTriggerContainer*>(originator);
  • code/branches/cpp11_v3/src/modules/objects/triggers/MultiTrigger.cc

    r11020 r11054  
    124124        // Let the MultiTrigger return the states that trigger and process the new states if there are any.
    125125        std::queue<MultiTriggerState*>* queue  = this->letTrigger();
    126         if(queue != NULL)
     126        if(queue != nullptr)
    127127        {
    128128            while(queue->size() > 0)
    129129            {
    130130                MultiTriggerState* state = queue->front();
    131                 // If the state is NULL. (This really shouldn't happen)
    132                 if(state == NULL)
     131                // If the state is nullptr. (This really shouldn't happen)
     132                if(state == nullptr)
    133133                {
    134                     orxout(internal_error, context::triggers) << "In MultiTrigger '" << this->getName() << "' (&" << this << "), Error: State of new states queue was NULL. State ignored." << endl;
     134                    orxout(internal_error, context::triggers) << "In MultiTrigger '" << this->getName() << "' (&" << this << "), Error: State of new states queue was nullptr. State ignored." << endl;
    135135                    queue->pop();
    136136                    continue;
     
    227227                            {
    228228                                // If the MultiTrigger is set to broadcast and has no originator a boradcast is fired.
    229                                 if(this->getBroadcast() && state->originator == NULL)
     229                                if(this->getBroadcast() && state->originator == nullptr)
    230230                                    this->broadcast(bActive);
    231231                                // Else a normal event is fired.
     
    240240                        {
    241241                            // Print some debug output if the state has changed.
    242                             if(state->originator != NULL)
     242                            if(state->originator != nullptr)
    243243                                orxout(verbose, context::triggers) << "MultiTrigger '" << this->getName() << "' (&" << this << ") changed state. originator: " << state->originator->getIdentifier()->getName() << " (&" << state->originator << "), active: " << bActive << ", triggered: " << state->bTriggered << "." << endl;
    244244                            else
    245                                 orxout(verbose, context::triggers) << "MultiTrigger '" << this->getName() << "' (&" << this << ") changed state. originator: NULL, active: " << bActive << ", triggered: " << state->bTriggered << "." << endl;
     245                                orxout(verbose, context::triggers) << "MultiTrigger '" << this->getName() << "' (&" << this << ") changed state. originator: nullptr, active: " << bActive << ", triggered: " << state->bTriggered << "." << endl;
    246246
    247247                            // If the MultiTrigger has a parent trigger, that is itself a MultiTrigger, it needs to call a method to notify him, that its activity has changed.
    248                             if(this->parent_ != NULL && this->parent_->isMultiTrigger())
     248                            if(this->parent_ != nullptr && this->parent_->isMultiTrigger())
    249249                                static_cast<MultiTrigger*>(this->parent_)->childActivityChanged(state->originator);
    250250                        }
     
    265265                else
    266266                {
    267                     this->stateQueue_.push_back(std::pair<float, MultiTriggerState*>(timeRemaining-dt, state));
     267                    this->stateQueue_.emplace_back(timeRemaining-dt, state);
    268268                    this->stateQueue_.pop_front();
    269269                }
     
    299299
    300300        // If the target is not a valid class name display an error.
    301         if (target == NULL)
     301        if (target == nullptr)
    302302        {
    303303            orxout(internal_error, context::triggers) << "'" << targetStr << "' is not a valid class name to include in ClassTreeMask (in " << this->getName() << ", class " << this->getIdentifier()->getName() << ")" << endl;
     
    327327
    328328        // If the target is not a valid class name display an error.
    329         if (target == NULL)
     329        if (target == nullptr)
    330330        {
    331331            orxout(internal_error, context::triggers) << "'" << targetStr << "' is not a valid class name to include in ClassTreeMask (in " << this->getName() << ", class " << this->getIdentifier()->getName() << ")" << endl;
     
    346346    std::queue<MultiTriggerState*>* MultiTrigger::letTrigger(void)
    347347    {
    348         return NULL;
     348        return nullptr;
    349349    }
    350350
     
    443443    void MultiTrigger::fire(bool status, BaseObject* originator)
    444444    {
    445         // If the originator is NULL, a normal event without MultiTriggerContainer is sent.
    446         if(originator == NULL)
     445        // If the originator is nullptr, a normal event without MultiTriggerContainer is sent.
     446        if(originator == nullptr)
    447447        {
    448448            this->fireEvent(status);
     
    479479    bool MultiTrigger::addState(MultiTriggerState* state)
    480480    {
    481         assert(state); // The state really shouldn't be NULL.
     481        assert(state); // The state really shouldn't be nullptr.
    482482
    483483        // If the originator is no target of this MultiTrigger.
     
    489489
    490490        // Add it ot the state queue with the delay specified for the MultiTrigger.
    491         this->stateQueue_.push_back(std::pair<float, MultiTriggerState*>(this->getDelay(), state));
     491        this->stateQueue_.emplace_back(this->getDelay(), state);
    492492
    493493        return true;
     
    504504    bool MultiTrigger::checkAnd(BaseObject* triggerer)
    505505    {
    506         for(std::set<TriggerBase*>::iterator it = this->children_.begin(); it != this->children_.end(); ++it)
    507         {
    508             TriggerBase* trigger = *it;
     506        for(TriggerBase* trigger : this->children_)
     507        {
    509508            if(trigger->isMultiTrigger())
    510509            {
     
    531530    bool MultiTrigger::checkOr(BaseObject* triggerer)
    532531    {
    533         for(std::set<TriggerBase*>::iterator it = this->children_.begin(); it != this->children_.end(); ++it)
    534         {
    535             TriggerBase* trigger = *it;
     532        for(TriggerBase* trigger : this->children_)
     533        {
    536534            if(trigger->isMultiTrigger())
    537535            {
     
    559557    {
    560558        bool triggered = false;
    561         for(std::set<TriggerBase*>::iterator it = this->children_.begin(); it != this->children_.end(); ++it)
    562         {
    563             TriggerBase* trigger = *it;
     559        for(TriggerBase* trigger : this->children_)
     560        {
    564561            if(triggered)
    565562            {
  • code/branches/cpp11_v3/src/modules/objects/triggers/MultiTrigger.h

    r9667 r11054  
    7676        - @b simultaneousTriggerers The number of simultaneous triggerers limits the number of objects that are allowed to trigger the MultiTrigger at the same time. Or more precisely, the number of distinct objects the MultiTrigger has <em>triggered</em> states for, at each point in time. The default is <code>-1</code>, which denotes infinity.
    7777        - @b mode The mode describes how the MultiTrigger acts in relation to all the triggers, that are appended to it. There are 3 modes: <em>and</em>, meaning that the MultiTrigger can only be triggered if all the appended triggers are active. <em>or</em>, meaning that the MultiTrigger can only triggered if at least one of the appended triggers is active. And <em>xor</em>, meaning that the MultiTrigger can only be triggered if one and only one appended trigger is active. Note, that I wrote <em>can only be active</em>, that implies, that there is an additional condition to the <em>activity</em> of the MultiTrigger and that is the fulfillment of the triggering condition (the MultiTrigger itself doesn't have one, but all derived classes should). Also bear in mind, that the <em>activity</em> of a MultiTrigger is still coupled to the object that triggered it. The default is <em>and</em>.
    78         - @b broadcast Broadcast is a boolean, if true the MutliTrigger is in <em>broadcast-mode</em>, meaning, that all trigger events that are caused by no originator (originator is NULL) are broadcast as having come from every possible originator, or more precisely as having come from all objects that are specified targets of this MultiTrigger. The default is false.
     78        - @b broadcast Broadcast is a boolean, if true the MutliTrigger is in <em>broadcast-mode</em>, meaning, that all trigger events that are caused by no originator (originator is nullptr) are broadcast as having come from every possible originator, or more precisely as having come from all objects that are specified targets of this MultiTrigger. The default is false.
    7979        - @b target The target describes the kind of objects that are allowed to trigger this MultiTrigger. The default is @ref orxonox::Pawn "Pawn".
    8080        - Also there is the possibility of appending triggers (as long as they inherit from TriggerBase) to the MultiTrigger just by adding them as children in the XML description of your MultiTrigger.
     
    110110            */
    111111            inline bool isActive(void) const
    112                 { return this->isActive(NULL); }
    113             bool isActive(BaseObject* triggerer = NULL) const; //!< Check whether the MultiTrigger is active for a given object.
     112                { return this->isActive(nullptr); }
     113            bool isActive(BaseObject* triggerer = nullptr) const; //!< Check whether the MultiTrigger is active for a given object.
    114114
    115115            /**
     
    145145            */
    146146            inline bool isTarget(BaseObject* target)
    147                 { if(target == NULL) return true; else return targetMask_.isIncluded(target->getIdentifier()); }
     147                { if(target == nullptr) return true; else return targetMask_.isIncluded(target->getIdentifier()); }
    148148               
    149149            void addTarget(const std::string& targets); //!< Add some target to the MultiTrigger.
     
    152152            virtual std::queue<MultiTriggerState*>* letTrigger(void); //!< This method is called by the MultiTrigger to get information about new trigger events that need to be looked at.
    153153
    154             void changeTriggered(BaseObject* originator = NULL); //!< This method can be called by any class inheriting from MultiTrigger to change it's triggered status for a specified originator.
    155 
    156             bool isModeTriggered(BaseObject* triggerer = NULL); //!< Checks whether the MultiTrigger is triggered concerning it's children.
    157             bool isTriggered(BaseObject* triggerer = NULL); //!< Get whether the MultiTrigger is triggered for a given object.
    158 
    159             virtual void fire(bool status, BaseObject* originator = NULL);  //!< Helper method. Creates an Event for the given status and originator and fires it.
     154            void changeTriggered(BaseObject* originator = nullptr); //!< This method can be called by any class inheriting from MultiTrigger to change it's triggered status for a specified originator.
     155
     156            bool isModeTriggered(BaseObject* triggerer = nullptr); //!< Checks whether the MultiTrigger is triggered concerning it's children.
     157            bool isTriggered(BaseObject* triggerer = nullptr); //!< Get whether the MultiTrigger is triggered for a given object.
     158
     159            virtual void fire(bool status, BaseObject* originator = nullptr);  //!< Helper method. Creates an Event for the given status and originator and fires it.
    160160            void broadcast(bool status); //!< Helper method. Broadcasts an Event for every object that is a target.
    161161
     
    192192            std::set<BaseObject*> triggered_; //!< The set of all objects the MultiTrigger is triggered for.
    193193
    194             std::deque< std::pair<float, MultiTriggerState*> > stateQueue_; //!< The queue of states waiting to become active.
     194            std::deque<std::pair<float, MultiTriggerState*>> stateQueue_; //!< The queue of states waiting to become active.
    195195
    196196            ClassTreeMask targetMask_; //!< The target mask, masking all objects that can trigger this MultiTrigger.
  • code/branches/cpp11_v3/src/modules/objects/triggers/MultiTriggerContainer.cc

    r9667 r11054  
    5050        The creator.
    5151    */
    52     MultiTriggerContainer::MultiTriggerContainer(Context* context) : BaseObject(context), originator_(NULL), data_(NULL)
     52    MultiTriggerContainer::MultiTriggerContainer(Context* context) : BaseObject(context), originator_(nullptr), data_(nullptr)
    5353    {
    5454        RegisterObject(MultiTriggerContainer);
     
    7070
    7171        Pawn* pawn = orxonox_cast<Pawn*>(data);
    72         if(pawn != NULL)
     72        if(pawn != nullptr)
    7373        {
    7474            this->setForPlayer(true);
  • code/branches/cpp11_v3/src/modules/objects/triggers/Trigger.cc

    r10624 r11054  
    234234    {
    235235        // Iterate over all sub-triggers.
    236         for (std::set<TriggerBase*>::iterator it = this->children_.begin(); it != this->children_.end(); ++it)
    237         {
    238             if (!(*it)->isActive())
     236        for (TriggerBase* child : this->children_)
     237        {
     238            if (!child->isActive())
    239239                return false;
    240240        }
     
    252252    {
    253253        // Iterate over all sub-triggers.
    254         for (std::set<TriggerBase*>::iterator it = this->children_.begin(); it != this->children_.end(); ++it)
    255         {
    256             if ((*it)->isActive())
     254        for (TriggerBase* child : this->children_)
     255        {
     256            if (child->isActive())
    257257                return true;
    258258        }
     
    270270    {
    271271        bool test = false;
    272         for (std::set<TriggerBase*>::iterator it = this->children_.begin(); it != this->children_.end(); ++it)
    273         {
    274             if (test && (*it)->isActive())
     272        for (TriggerBase* child : this->children_)
     273        {
     274            if (test && child->isActive())
    275275                return false;
    276             if ((*it)->isActive())
     276            if (child->isActive())
    277277                test = true;
    278278        }
     
    346346    {
    347347        // Iterate over all Triggers.
    348         for (ObjectList<Trigger>::iterator it = ObjectList<Trigger>::begin(); it != ObjectList<Trigger>::end(); ++it)
    349             it->setVisible(bVisible);
     348        for (Trigger* trigger : ObjectList<Trigger>())
     349            trigger->setVisible(bVisible);
    350350    }
    351351
  • code/branches/cpp11_v3/src/modules/objects/triggers/Trigger.h

    r9667 r11054  
    127127            BillboardSet debugBillboard_; //!< A set of debug billboards to visualize the state of the trigger.
    128128
    129             std::queue<std::pair<float, char> > stateChanges_; //!< A queue of state changes (in the same format as latestState_) paired with the time they will take effect since the last state change took effect.
     129            std::queue<std::pair<float, char>> stateChanges_; //!< A queue of state changes (in the same format as latestState_) paired with the time they will take effect since the last state change took effect.
    130130    };
    131131
  • code/branches/cpp11_v3/src/modules/objects/triggers/TriggerBase.cc

    r9667 r11054  
    6767        this->mode_ = TriggerMode::EventTriggerAND;
    6868
    69         this->parent_ = NULL;
     69        this->parent_ = nullptr;
    7070
    7171        this->bMultiTrigger_ = false;
     
    170170        The index.
    171171    @return
    172         Returns a pointer ot the trigger. NULL if no such trigger exists.
     172        Returns a pointer ot the trigger. nullptr if no such trigger exists.
    173173    */
    174174    const TriggerBase* TriggerBase::getTrigger(unsigned int index) const
     
    176176        // If the index is greater than the number of children.
    177177        if (this->children_.size() <= index)
    178             return NULL;
     178            return nullptr;
    179179
    180180        std::set<TriggerBase*>::const_iterator it;
Note: See TracChangeset for help on using the changeset viewer.