Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

merged branch cpp11_v3 back to trunk

Location:
code/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • 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;
Note: See TracChangeset for help on using the changeset viewer.