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:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/cpp11_v3

  • code/branches/cpp11_v3/src/orxonox/gametypes/Dynamicmatch.cc

    r11052 r11054  
    413413    void Dynamicmatch::rewardPig()
    414414    {
    415         for (std::map< PlayerInfo*, int >::iterator it = this->playerParty_.begin(); it != this->playerParty_.end(); ++it) //durch alle Spieler iterieren und alle piggys finden
    416         {
    417             if (it->second==piggy)//Spieler mit der Pig-party frags++
    418             {
    419                  this->playerScored(it->first);
     415        for (const auto& mapEntry : this->playerParty_) //durch alle Spieler iterieren und alle piggys finden
     416        {
     417            if (mapEntry.second==piggy)//Spieler mit der Pig-party frags++
     418            {
     419                 this->playerScored(mapEntry.first);
    420420            }
    421421        }
     
    430430
    431431                std::set<WorldEntity*> pawnAttachments = pawn->getAttachedObjects();
    432                 for (std::set<WorldEntity*>::iterator it = pawnAttachments.begin(); it != pawnAttachments.end(); ++it)
    433                 {
    434                     if ((*it)->isA(Class(TeamColourable)))
     432                for (WorldEntity* pawnAttachment : pawnAttachments)
     433                {
     434                    if (pawnAttachment->isA(Class(TeamColourable)))
    435435                    {
    436                         TeamColourable* tc = orxonox_cast<TeamColourable*>(*it);
     436                        TeamColourable* tc = orxonox_cast<TeamColourable*>(pawnAttachment);
    437437                        tc->setTeamColour(this->partyColours_[it_player->second]);
    438438                    }
     
    449449            if (tutorial) // Announce selectionphase
    450450            {
    451              for (std::map<PlayerInfo*, int>::iterator it = this->playerParty_.begin(); it != this->playerParty_.end(); ++it)
    452                 {
    453                     if (!it->first)//in order to catch nullpointer
     451             for (const auto& mapEntry : this->playerParty_)
     452                {
     453                    if (!mapEntry.first)//in order to catch nullpointer
    454454                        continue;
    455                     if (it->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
     455                    if (mapEntry.first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
    456456                        continue;
    457                     this->gtinfo_->sendStaticMessage("Selection phase: Shoot at everything that moves.",it->first->getClientID(),ColourValue(1.0f, 1.0f, 0.5f));
     457                    this->gtinfo_->sendStaticMessage("Selection phase: Shoot at everything that moves.",mapEntry.first->getClientID(),ColourValue(1.0f, 1.0f, 0.5f));
    458458                }
    459459            }
     
    464464             if(tutorial&&(!notEnoughKillers)&&(!notEnoughChasers)) //Selection phase over
    465465             {
    466                   for (std::map<PlayerInfo*, int>::iterator it = this->playerParty_.begin(); it != this->playerParty_.end(); ++it)
     466                  for (const auto& mapEntry : this->playerParty_)
    467467                  {
    468                        if (!it->first)//in order to catch nullpointer
     468                       if (!mapEntry.first)//in order to catch nullpointer
    469469                           continue;
    470                        if (it->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
     470                       if (mapEntry.first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
    471471                           continue;
    472                        else if (it->second==chaser)
     472                       else if (mapEntry.second==chaser)
    473473                       {
    474474                           if (numberOf[killer]>0)
    475                                this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible. Defend yourself against the killers.",it->first->getClientID(),partyColours_[piggy]);
     475                               this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible. Defend yourself against the killers.",mapEntry.first->getClientID(),partyColours_[piggy]);
    476476                           else
    477                                this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible.",it->first->getClientID(),partyColours_[piggy]);
     477                               this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible.",mapEntry.first->getClientID(),partyColours_[piggy]);
    478478                           //this->gtinfo_->sendFadingMessage("You're now a chaser.",it->first->getClientID());
    479479                       }
    480                        else if (it->second==piggy)
    481                        {
    482                            this->gtinfo_->sendStaticMessage("Either hide or shoot a chaser.",it->first->getClientID(),partyColours_[chaser]);
     480                       else if (mapEntry.second==piggy)
     481                       {
     482                           this->gtinfo_->sendStaticMessage("Either hide or shoot a chaser.",mapEntry.first->getClientID(),partyColours_[chaser]);
    483483                           //this->gtinfo_->sendFadingMessage("You're now a victim.",it->first->getClientID());
    484484                       }
    485                        else if (it->second==killer)
    486                        {
    487                            this->gtinfo_->sendStaticMessage("Take the chasers down.",it->first->getClientID(),partyColours_[chaser]);
     485                       else if (mapEntry.second==killer)
     486                       {
     487                           this->gtinfo_->sendStaticMessage("Take the chasers down.",mapEntry.first->getClientID(),partyColours_[chaser]);
    488488                           //this->gtinfo_->sendFadingMessage("You're now a killer.",it->first->getClientID());
    489489                       }
     
    498498            if (tutorial) // Announce selectionphase
    499499            {
    500              for (std::map<PlayerInfo*, int>::iterator it = this->playerParty_.begin(); it != this->playerParty_.end(); ++it)
    501                 {
    502                     if (!it->first)//in order to catch nullpointer
     500             for (const auto& mapEntry : this->playerParty_)
     501                {
     502                    if (!mapEntry.first)//in order to catch nullpointer
    503503                        continue;
    504                     if (it->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
     504                    if (mapEntry.first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
    505505                        continue;
    506                     this->gtinfo_->sendStaticMessage("Selection phase: Shoot at everything that moves.",it->first->getClientID(),ColourValue(1.0f, 1.0f, 0.5f));
     506                    this->gtinfo_->sendStaticMessage("Selection phase: Shoot at everything that moves.",mapEntry.first->getClientID(),ColourValue(1.0f, 1.0f, 0.5f));
    507507                }
    508508            }
     
    513513            if(tutorial&&(!notEnoughPigs)&&(!notEnoughChasers)) //Selection phase over
    514514             {
    515                   for (std::map<PlayerInfo*, int>::iterator it = this->playerParty_.begin(); it != this->playerParty_.end(); ++it)
     515                  for (const auto& mapEntry : this->playerParty_)
    516516                  {
    517                        if (!it->first)
     517                       if (!mapEntry.first)
    518518                           continue;
    519                        if (it->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
     519                       if (mapEntry.first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
    520520                           continue;
    521                        else if (it->second==chaser)
     521                       else if (mapEntry.second==chaser)
    522522                       {
    523523                           if (numberOf[killer]>0)
    524                                this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible. Defend yourself against the killers.",it->first->getClientID(),partyColours_[piggy]);
     524                               this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible. Defend yourself against the killers.",mapEntry.first->getClientID(),partyColours_[piggy]);
    525525                           else
    526                                this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible.",it->first->getClientID(),partyColours_[piggy]);
     526                               this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible.",mapEntry.first->getClientID(),partyColours_[piggy]);
    527527                           //this->gtinfo_->sendFadingMessage("You're now a chaser.",it->first->getClientID());
    528528                       }
    529                        else if (it->second==piggy)
    530                        {
    531                            this->gtinfo_->sendStaticMessage("Either hide or shoot a chaser.",it->first->getClientID(),partyColours_[piggy]);
     529                       else if (mapEntry.second==piggy)
     530                       {
     531                           this->gtinfo_->sendStaticMessage("Either hide or shoot a chaser.",mapEntry.first->getClientID(),partyColours_[piggy]);
    532532                           //this->gtinfo_->sendFadingMessage("You're now a victim.",it->first->getClientID());
    533533                       }
    534                        else if (it->second==killer)
    535                        {
    536                            this->gtinfo_->sendStaticMessage("Take the chasers down.",it->first->getClientID(),partyColours_[piggy]);
     534                       else if (mapEntry.second==killer)
     535                       {
     536                           this->gtinfo_->sendStaticMessage("Take the chasers down.",mapEntry.first->getClientID(),partyColours_[piggy]);
    537537                           //this->gtinfo_->sendFadingMessage("You're now a killer.",it->first->getClientID());
    538538                       }
     
    548548            if (tutorial) // Announce selectionphase
    549549            {
    550              for (std::map<PlayerInfo*, int>::iterator it = this->playerParty_.begin(); it != this->playerParty_.end(); ++it)
    551                 {
    552                     if (!it->first)//in order to catch nullpointer
     550             for (const auto& mapEntry : this->playerParty_)
     551                {
     552                    if (!mapEntry.first)//in order to catch nullpointer
    553553                        continue;
    554                     if (it->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
     554                    if (mapEntry.first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
    555555                        continue;
    556                     this->gtinfo_->sendStaticMessage("Selection phase: Shoot at everything that moves.",it->first->getClientID(),ColourValue(1.0f, 1.0f, 0.5f));
     556                    this->gtinfo_->sendStaticMessage("Selection phase: Shoot at everything that moves.",mapEntry.first->getClientID(),ColourValue(1.0f, 1.0f, 0.5f));
    557557                }
    558558            }
     
    563563             if(tutorial&&(!notEnoughPigs)&&(!notEnoughKillers)) //Selection phase over
    564564             {
    565                   for (std::map<PlayerInfo*, int>::iterator it = this->playerParty_.begin(); it != this->playerParty_.end(); ++it)
     565                  for (const auto& mapEntry : this->playerParty_)
    566566                  {
    567                        if (!it->first)
     567                       if (!mapEntry.first)
    568568                           continue;
    569                        if (it->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
     569                       if (mapEntry.first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
    570570                           continue;
    571                        else if (it->second==chaser)
     571                       else if (mapEntry.second==chaser)
    572572                       {
    573573                           if (numberOf[killer]>0)
    574                                this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible. Defend yourself against the killers.",it->first->getClientID(),partyColours_[piggy]);
     574                               this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible. Defend yourself against the killers.",mapEntry.first->getClientID(),partyColours_[piggy]);
    575575                           else
    576                                this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible.",it->first->getClientID(),partyColours_[piggy]);
     576                               this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible.",mapEntry.first->getClientID(),partyColours_[piggy]);
    577577                           //this->gtinfo_->sendFadingMessage("You're now a chaser.",it->first->getClientID());
    578578                       }
    579                        else if (it->second==piggy)
    580                        {
    581                            this->gtinfo_->sendStaticMessage("Either hide or shoot a chaser.",it->first->getClientID(),partyColours_[chaser]);
     579                       else if (mapEntry.second==piggy)
     580                       {
     581                           this->gtinfo_->sendStaticMessage("Either hide or shoot a chaser.",mapEntry.first->getClientID(),partyColours_[chaser]);
    582582                           //this->gtinfo_->sendFadingMessage("You're now a victim.",it->first->getClientID());
    583583                       }
    584                        else if (it->second==killer)
    585                        {
    586                            this->gtinfo_->sendStaticMessage("Take the chasers down.",it->first->getClientID(),partyColours_[chaser]);
     584                       else if (mapEntry.second==killer)
     585                       {
     586                           this->gtinfo_->sendStaticMessage("Take the chasers down.",mapEntry.first->getClientID(),partyColours_[chaser]);
    587587                           //this->gtinfo_->sendFadingMessage("You're now a killer.",it->first->getClientID());
    588588                       }
     
    631631        else if(tutorial) // Announce selectionphase
    632632        {
    633             for (std::map<PlayerInfo*, int>::iterator it = this->playerParty_.begin(); it != this->playerParty_.end(); ++it)
    634             {
    635                 if (it->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
     633            for (const auto& mapEntry : this->playerParty_)
     634            {
     635                if (mapEntry.first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
    636636                    continue;
    637                 this->gtinfo_->sendStaticMessage("Selection phase: Shoot at everything that moves.",it->first->getClientID(),ColourValue(1.0f, 1.0f, 0.5f));
     637                this->gtinfo_->sendStaticMessage("Selection phase: Shoot at everything that moves.",mapEntry.first->getClientID(),ColourValue(1.0f, 1.0f, 0.5f));
    638638            }
    639639        }
     
    687687            unsigned int randomspawn = static_cast<unsigned int>(rnd(static_cast<float>(teamSpawnPoints.size())));
    688688            unsigned int index = 0;
    689             for (std::set<SpawnPoint*>::const_iterator it = teamSpawnPoints.begin(); it != teamSpawnPoints.end(); ++it)
     689            for (SpawnPoint* teamSpawnPoint : teamSpawnPoints)
    690690            {
    691691                if (index == randomspawn)
    692                     return (*it);
     692                    return teamSpawnPoint;
    693693
    694694                ++index;
     
    696696        }
    697697
    698         return 0;
     698        return nullptr;
    699699    }
    700700
Note: See TracChangeset for help on using the changeset viewer.