Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

merged branch cpp11_v2 into cpp11_v3

Location:
code/branches/cpp11_v3
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • code/branches/cpp11_v3

  • code/branches/cpp11_v3/src/orxonox/items/Engine.cc

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

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

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

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

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

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

    r10624 r11054  
    4747            virtual ~ShipPart();
    4848
    49             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
     49            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
    5050
    5151            virtual void handleHit(float damage, float healthdamage, float shielddamage, Pawn* originator);
Note: See TracChangeset for help on using the changeset viewer.