Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 2, 2015, 11:32:08 PM (9 years ago)
Author:
landauf
Message:

made mapEntry const& wherever possible

Location:
code/branches/cpp11_v2/src/orxonox
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • code/branches/cpp11_v2/src/orxonox/collisionshapes/CompoundCollisionShape.cc

    r10916 r10917  
    6565        {
    6666            // Delete all children
    67             for (auto& mapEntry : this->attachedShapes_)
     67            for (const auto& mapEntry : this->attachedShapes_)
    6868            {
    6969                // make sure that the child doesn't want to detach itself --> speedup because of the missing update
     
    266266        std::vector<CollisionShape*> shapes;
    267267        // Iterate through all attached CollisionShapes and add them to the list of shapes.
    268         for(auto& mapEntry : this->attachedShapes_)
     268        for(const auto& mapEntry : this->attachedShapes_)
    269269            shapes.push_back(mapEntry.first);
    270270
  • code/branches/cpp11_v2/src/orxonox/controllers/ArtificialController.cc

    r10916 r10917  
    231231    int ArtificialController::getFiremode(std::string name)
    232232    {
    233         for (auto& mapEntry : this->weaponModes_)
     233        for (const auto& mapEntry : this->weaponModes_)
    234234        {
    235235            if (mapEntry.first == name)
  • code/branches/cpp11_v2/src/orxonox/gametypes/Dynamicmatch.cc

    r10916 r10917  
    405405    void Dynamicmatch::rewardPig()
    406406    {
    407         for (auto& mapEntry : this->playerParty_) //durch alle Spieler iterieren und alle piggys finden
     407        for (const auto& mapEntry : this->playerParty_) //durch alle Spieler iterieren und alle piggys finden
    408408        {
    409409            if (mapEntry.second==piggy)//Spieler mit der Pig-party frags++
     
    441441            if (tutorial) // Announce selectionphase
    442442            {
    443              for (auto& mapEntry : this->playerParty_)
     443             for (const auto& mapEntry : this->playerParty_)
    444444                {
    445445                    if (!mapEntry.first)//in order to catch nullpointer
     
    456456             if(tutorial&&(!notEnoughKillers)&&(!notEnoughChasers)) //Selection phase over
    457457             {
    458                   for (auto& mapEntry : this->playerParty_)
     458                  for (const auto& mapEntry : this->playerParty_)
    459459                  {
    460460                       if (!mapEntry.first)//in order to catch nullpointer
     
    490490            if (tutorial) // Announce selectionphase
    491491            {
    492              for (auto& mapEntry : this->playerParty_)
     492             for (const auto& mapEntry : this->playerParty_)
    493493                {
    494494                    if (!mapEntry.first)//in order to catch nullpointer
     
    505505            if(tutorial&&(!notEnoughPigs)&&(!notEnoughChasers)) //Selection phase over
    506506             {
    507                   for (auto& mapEntry : this->playerParty_)
     507                  for (const auto& mapEntry : this->playerParty_)
    508508                  {
    509509                       if (!mapEntry.first)
     
    540540            if (tutorial) // Announce selectionphase
    541541            {
    542              for (auto& mapEntry : this->playerParty_)
     542             for (const auto& mapEntry : this->playerParty_)
    543543                {
    544544                    if (!mapEntry.first)//in order to catch nullpointer
     
    555555             if(tutorial&&(!notEnoughPigs)&&(!notEnoughKillers)) //Selection phase over
    556556             {
    557                   for (auto& mapEntry : this->playerParty_)
     557                  for (const auto& mapEntry : this->playerParty_)
    558558                  {
    559559                       if (!mapEntry.first)
     
    620620        else if(tutorial) // Announce selectionphase
    621621        {
    622             for (auto& mapEntry : this->playerParty_)
     622            for (const auto& mapEntry : this->playerParty_)
    623623            {
    624624                if (mapEntry.first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
  • code/branches/cpp11_v2/src/orxonox/gametypes/Gametype.cc

    r10916 r10917  
    139139        if (!this->gtinfo_->hasStarted())
    140140        {
    141             for (auto& mapEntry : this->players_)
     141            for (const auto& mapEntry : this->players_)
    142142            {
    143143                // Inform the GametypeInfo that the player is ready to spawn.
     
    169169        }
    170170
    171         for (auto& mapEntry : this->players_)
     171        for (const auto& mapEntry : this->players_)
    172172        {
    173173            if (mapEntry.first->getControllableEntity())
     
    404404                    bool allplayersready = true;
    405405                    bool hashumanplayers = false;
    406                     for (auto& mapEntry : this->players_)
     406                    for (const auto& mapEntry : this->players_)
    407407                    {
    408408                        if (!mapEntry.first->isReadyToSpawn())
     
    430430    void Gametype::spawnPlayersIfRequested()
    431431    {
    432         for (auto& mapEntry : this->players_)
     432        for (const auto& mapEntry : this->players_)
    433433        {
    434434            if (mapEntry.first->isReadyToSpawn() || this->bForceSpawn_)
     
    439439    void Gametype::spawnDeadPlayersIfRequested()
    440440    {
    441         for (auto& mapEntry : this->players_)
     441        for (const auto& mapEntry : this->players_)
    442442            if (mapEntry.second.state_ == PlayerState::Dead)
    443443                if (mapEntry.first->isReadyToSpawn() || this->bForceSpawn_)
     
    538538    GSLevelMementoState* Gametype::exportMementoState()
    539539    {
    540         for (auto& mapEntry : this->players_)
     540        for (const auto& mapEntry : this->players_)
    541541        {
    542542            if (mapEntry.first->isHumanPlayer() && mapEntry.first->getControllableEntity() && mapEntry.first->getControllableEntity()->getCamera())
     
    587587
    588588        // find correct player and assign default entity with original position & orientation
    589         for (auto& mapEntry : this->players_)
     589        for (const auto& mapEntry : this->players_)
    590590        {
    591591            if (mapEntry.first->isHumanPlayer())
  • code/branches/cpp11_v2/src/orxonox/gametypes/LastManStanding.cc

    r10916 r10917  
    5656    void LastManStanding::spawnDeadPlayersIfRequested()
    5757    {
    58         for (auto& mapEntry : this->players_)
     58        for (const auto& mapEntry : this->players_)
    5959            if (mapEntry.second.state_ == PlayerState::Dead)
    6060            {
     
    114114    {
    115115        int min=lives;
    116         for (auto& mapEntry : this->playerLives_)
     116        for (const auto& mapEntry : this->playerLives_)
    117117        {
    118118            if (mapEntry.second<=0)
     
    128128        Gametype::end();
    129129
    130         for (auto& mapEntry : this->playerLives_)
     130        for (const auto& mapEntry : this->playerLives_)
    131131        {
    132132            if (mapEntry.first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
  • code/branches/cpp11_v2/src/orxonox/gametypes/LastTeamStanding.cc

    r10916 r10917  
    145145    void LastTeamStanding::spawnDeadPlayersIfRequested()
    146146    {
    147         for (auto& mapEntry : this->players_)
     147        for (const auto& mapEntry : this->players_)
    148148            if (mapEntry.second.state_ == PlayerState::Dead)
    149149            {
     
    229229        int party = -1;
    230230        //find a player who survived
    231         for (auto& mapEntry : this->playerLives_)
     231        for (const auto& mapEntry : this->playerLives_)
    232232        {
    233233          if (mapEntry.first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
     
    255255    {
    256256        int min = lives;
    257         for (auto& mapEntry : this->playerLives_)
     257        for (const auto& mapEntry : this->playerLives_)
    258258        {
    259259            if (mapEntry.second <= 0)
  • code/branches/cpp11_v2/src/orxonox/gametypes/TeamBaseMatch.cc

    r10916 r10917  
    187187            }
    188188
    189             for (auto& mapEntry : this->teamnumbers_)
     189            for (const auto& mapEntry : this->teamnumbers_)
    190190            {
    191191                if (mapEntry.first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
  • code/branches/cpp11_v2/src/orxonox/gametypes/TeamDeathmatch.cc

    r10916 r10917  
    6969        int winnerTeam = 0;
    7070        int highestScore = 0;
    71         for (auto& mapEntry : this->players_)
     71        for (const auto& mapEntry : this->players_)
    7272        {
    7373            if ( this->getTeamScore(mapEntry.first) > highestScore )
  • code/branches/cpp11_v2/src/orxonox/gametypes/TeamGametype.cc

    r10916 r10917  
    9999        std::vector<unsigned int> playersperteam(this->teams_, 0);
    100100
    101         for (auto& mapEntry : this->teamnumbers_)
     101        for (const auto& mapEntry : this->teamnumbers_)
    102102            if (mapEntry.second < static_cast<int>(this->teams_) && mapEntry.second >= 0)
    103103                playersperteam[mapEntry.second]++;
     
    141141    void TeamGametype::spawnDeadPlayersIfRequested()
    142142    {
    143         for (auto& mapEntry : this->players_)\
     143        for (const auto& mapEntry : this->players_)\
    144144        {
    145145            if(allowedInGame_[mapEntry.first] == false)//check if dead player is allowed to enter
     
    178178        if(!player || this->getTeam(player) == -1)
    179179            return 0;
    180         for (auto& mapEntry : this->players_)
     180        for (const auto& mapEntry : this->players_)
    181181        {
    182182            if ( this->getTeam(mapEntry.first) ==  this->getTeam(player) )
     
    191191    {
    192192        int teamSize = 0;
    193         for (auto& mapEntry : this->teamnumbers_)
     193        for (const auto& mapEntry : this->teamnumbers_)
    194194        {
    195195            if (mapEntry.second == team)
     
    202202    {
    203203        int teamSize = 0;
    204         for (auto& mapEntry : this->teamnumbers_)
     204        for (const auto& mapEntry : this->teamnumbers_)
    205205        {
    206206            if (mapEntry.second == team  && mapEntry.first->isHumanPlayer())
     
    376376    void TeamGametype::announceTeamWin(int winnerTeam)
    377377    {
    378         for (auto& mapEntry : this->teamnumbers_)
     378        for (const auto& mapEntry : this->teamnumbers_)
    379379        {
    380380            if (mapEntry.first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
  • code/branches/cpp11_v2/src/orxonox/gametypes/UnderAttack.cc

    r10916 r10917  
    7474        this->gameEnded_ = true;
    7575
    76         for (auto& mapEntry : this->teamnumbers_)
     76        for (const auto& mapEntry : this->teamnumbers_)
    7777        {
    7878            if (mapEntry.first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
     
    155155                ChatManager::message(message);
    156156
    157                 for (auto& mapEntry : this->teamnumbers_)
     157                for (const auto& mapEntry : this->teamnumbers_)
    158158                {
    159159                    if (mapEntry.first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
  • code/branches/cpp11_v2/src/orxonox/weaponsystem/Munition.cc

    r10916 r10917  
    5555    Munition::~Munition()
    5656    {
    57         for (auto& mapEntry : this->currentMagazines_)
     57        for (const auto& mapEntry : this->currentMagazines_)
    5858            delete mapEntry.second;
    5959    }
     
    316316            {
    317317                bool change = false;
    318                 for (auto& mapEntry : this->currentMagazines_)
     318                for (const auto& mapEntry : this->currentMagazines_)
    319319                {
    320320                    // Add munition if the magazine isn't full (but only to loaded magazines)
  • code/branches/cpp11_v2/src/orxonox/weaponsystem/Weapon.cc

    r10916 r10917  
    6161                this->weaponPack_->removeWeapon(this);
    6262
    63             for (auto& mapEntry : this->weaponmodes_)
     63            for (const auto& mapEntry : this->weaponmodes_)
    6464                mapEntry.second->destroy();
    6565        }
     
    136136    void Weapon::reload()
    137137    {
    138         for (auto& mapEntry : this->weaponmodes_)
     138        for (const auto& mapEntry : this->weaponmodes_)
    139139            mapEntry.second->reload();
    140140    }
     
    148148    void Weapon::notifyWeaponModes()
    149149    {
    150         for (auto& mapEntry : this->weaponmodes_)
     150        for (const auto& mapEntry : this->weaponmodes_)
    151151            mapEntry.second->setWeapon(this);
    152152    }
  • code/branches/cpp11_v2/src/orxonox/weaponsystem/WeaponSet.cc

    r10916 r10917  
    6363    {
    6464        // Fire all WeaponPacks with their defined weaponmode
    65         for (auto& mapEntry : this->weaponpacks_)
     65        for (const auto& mapEntry : this->weaponpacks_)
    6666            if (mapEntry.second != WeaponSystem::WEAPON_MODE_UNASSIGNED)
    6767                mapEntry.first->fire(mapEntry.second);
     
    7171    {
    7272        // Reload all WeaponPacks with their defined weaponmode
    73         for (auto& mapEntry : this->weaponpacks_)
     73        for (const auto& mapEntry : this->weaponpacks_)
    7474            mapEntry.first->reload();
    7575    }
  • code/branches/cpp11_v2/src/orxonox/weaponsystem/WeaponSystem.cc

    r10916 r10917  
    196196
    197197        // Assign the desired weaponmode to the firemodes
    198         for (auto& mapEntry : this->weaponSets_)
     198        for (const auto& mapEntry : this->weaponSets_)
    199199        {
    200200            unsigned int weaponmode = wPack->getDesiredWeaponmode(mapEntry.first);
     
    219219
    220220        // Remove all added links from the WeaponSets
    221         for (auto& mapEntry : this->weaponSets_)
     221        for (const auto& mapEntry : this->weaponSets_)
    222222            mapEntry.second->removeWeaponmodeLink(wPack);
    223223
     
    268268        // Check if the WeaponSet belongs to this WeaponSystem
    269269        bool foundWeaponSet = false;
    270         for (auto& mapEntry : this->weaponSets_)
     270        for (const auto& mapEntry : this->weaponSets_)
    271271        {
    272272            if (mapEntry.second == wSet)
     
    296296    void WeaponSystem::reload()
    297297    {
    298         for (auto& mapEntry : this->weaponSets_)
     298        for (const auto& mapEntry : this->weaponSets_)
    299299            mapEntry.second->reload();
    300300    }
Note: See TracChangeset for help on using the changeset viewer.