Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 21, 2015, 7:05:53 PM (8 years ago)
Author:
muemart
Message:

Run clang-modernize -loop-convert

  • Again, not all possible loops were converted
  • It can do pretty cool transformations, but I had to fix a few compile errors, so there might be some runtime errors lurking around too
File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/cpp11_v2/src/orxonox/gametypes/UnderAttack.cc

    r10768 r10821  
    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 (auto & elem : this->teamnumbers_)
     77        {
     78            if (elem.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 (elem.second == attacker_)
     82                this->gtinfo_->sendAnnounceMessage("You have won the match!", elem.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!", elem.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 (auto & elem : this->teamnumbers_)
     158                {
     159                    if (elem.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 (elem.second == 1)
     163                        this->gtinfo_->sendAnnounceMessage("You have won the match!", elem.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!", elem.first->getClientID());
    166166                }
    167167            }
Note: See TracChangeset for help on using the changeset viewer.