Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 17, 2016, 10:29:21 PM (8 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/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
Note: See TracChangeset for help on using the changeset viewer.