Changeset 10821 for code/branches/cpp11_v2/src/modules
- Timestamp:
- Nov 21, 2015, 7:05:53 PM (9 years ago)
- Location:
- code/branches/cpp11_v2/src/modules
- Files:
-
- 38 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/cpp11_v2/src/modules/docking/Dock.cc
r10765 r10821 327 327 const DockingEffect* Dock::getEffect(unsigned int i) const 328 328 { 329 for ( std::list<DockingEffect*>::const_iterator effect = this->effects_.begin(); effect != this->effects_.end(); ++effect)329 for (const auto & elem : this->effects_) 330 330 { 331 331 if(i == 0) 332 return *effect;332 return elem; 333 333 i--; 334 334 } … … 346 346 const DockingAnimation* Dock::getAnimation(unsigned int i) const 347 347 { 348 for ( std::list<DockingAnimation*>::const_iterator animation = this->animations_.begin(); animation != this->animations_.end(); ++animation)348 for (const auto & elem : this->animations_) 349 349 { 350 350 if(i == 0) 351 return *animation;351 return elem; 352 352 i--; 353 353 } -
code/branches/cpp11_v2/src/modules/docking/DockingAnimation.cc
r10765 r10821 57 57 bool check = true; 58 58 59 for ( std::list<DockingAnimation*>::iterator animation = animations.begin(); animation != animations.end(); animation++)59 for (auto & animations_animation : animations) 60 60 { 61 61 if(dock) 62 check &= ( *animation)->docking(player);62 check &= (animations_animation)->docking(player); 63 63 else 64 check &= ( *animation)->release(player);64 check &= (animations_animation)->release(player); 65 65 } 66 66 -
code/branches/cpp11_v2/src/modules/docking/DockingEffect.cc
r10765 r10821 53 53 bool check = true; 54 54 55 for ( std::list<DockingEffect*>::iterator effect = effects.begin(); effect != effects.end(); effect++)55 for (auto & effects_effect : effects) 56 56 { 57 57 if (dock) 58 check &= ( *effect)->docking(player);58 check &= (effects_effect)->docking(player); 59 59 else 60 check &= ( *effect)->release(player);60 check &= (effects_effect)->release(player); 61 61 } 62 62 -
code/branches/cpp11_v2/src/modules/gametypes/RaceCheckPoint.cc
r10765 r10821 146 146 { 147 147 Vector3 checkpoints(-1,-1,-1); int count=0; 148 for ( std::set<int>::iterator it= nextCheckpoints_.begin();it!=nextCheckpoints_.end(); it++)148 for (const auto & elem : nextCheckpoints_) 149 149 { 150 150 switch (count) 151 151 { 152 case 0: checkpoints.x = static_cast<Ogre::Real>( *it); break;153 case 1: checkpoints.y = static_cast<Ogre::Real>( *it); break;154 case 2: checkpoints.z = static_cast<Ogre::Real>( *it); break;152 case 0: checkpoints.x = static_cast<Ogre::Real>(elem); break; 153 case 1: checkpoints.y = static_cast<Ogre::Real>(elem); break; 154 case 2: checkpoints.z = static_cast<Ogre::Real>(elem); break; 155 155 } 156 156 ++count; -
code/branches/cpp11_v2/src/modules/gametypes/SpaceRaceController.cc
r10768 r10821 154 154 { 155 155 std::map<RaceCheckPoint*, int> zaehler; // counts how many times the checkpoint was reached (for simulation) 156 for ( unsigned int i = 0; i < allCheckpoints.size(); i++)157 { 158 zaehler.insert(std::pair<RaceCheckPoint*, int>(allCheckpoint s[i],0));156 for (auto & allCheckpoint : allCheckpoints) 157 { 158 zaehler.insert(std::pair<RaceCheckPoint*, int>(allCheckpoint,0)); 159 159 } 160 160 int maxWays = rekSimulationCheckpointsReached(currentCheckpoint, zaehler); 161 161 162 162 std::vector<RaceCheckPoint*> returnVec; 163 for ( std::map<RaceCheckPoint*, int>::iterator iter = zaehler.begin(); iter != zaehler.end(); iter++)164 { 165 if ( iter->second == maxWays)166 { 167 returnVec.push_back( iter->first);163 for (auto & elem : zaehler) 164 { 165 if (elem.second == maxWays) 166 { 167 returnVec.push_back(elem.first); 168 168 } 169 169 } … … 226 226 227 227 // find the next checkpoint with the minimal distance 228 for ( std::set<int>::iterator it = raceCheckpoint->getNextCheckpoints().begin(); it != raceCheckpoint->getNextCheckpoints().end(); ++it)229 { 230 RaceCheckPoint* nextRaceCheckPoint = findCheckpoint( *it);228 for (auto elem : raceCheckpoint->getNextCheckpoints()) 229 { 230 RaceCheckPoint* nextRaceCheckPoint = findCheckpoint(elem); 231 231 float distance = recCalculateDistance(nextRaceCheckPoint, this->getControllableEntity()->getPosition()); 232 232 … … 289 289 RaceCheckPoint* SpaceRaceController::findCheckpoint(int index) const 290 290 { 291 for ( size_t i = 0; i < this->checkpoints_.size(); ++i)292 if ( this->checkpoints_[i]->getCheckpointIndex() == index)293 return this->checkpoints_[i];291 for (auto & elem : this->checkpoints_) 292 if (elem->getCheckpointIndex() == index) 293 return elem; 294 294 return nullptr; 295 295 } … … 414 414 btScalar radiusObject; 415 415 416 for ( std::vector<StaticEntity*>::const_iterator it = allObjects.begin(); it != allObjects.end(); ++it)417 { 418 for (int everyShape=0; ( *it)->getAttachedCollisionShape(everyShape) != nullptr; everyShape++)419 { 420 btCollisionShape* currentShape = ( *it)->getAttachedCollisionShape(everyShape)->getCollisionShape();416 for (const auto & allObject : allObjects) 417 { 418 for (int everyShape=0; (allObject)->getAttachedCollisionShape(everyShape) != nullptr; everyShape++) 419 { 420 btCollisionShape* currentShape = (allObject)->getAttachedCollisionShape(everyShape)->getCollisionShape(); 421 421 if(currentShape == nullptr) 422 422 continue; -
code/branches/cpp11_v2/src/modules/gametypes/SpaceRaceManager.cc
r10768 r10821 54 54 SpaceRaceManager::~SpaceRaceManager() 55 55 { 56 for ( size_t i = 0; i < this->checkpoints_.size(); ++i)57 this->checkpoints_[i]->destroy();56 for (auto & elem : this->checkpoints_) 57 elem->destroy(); 58 58 } 59 59 … … 77 77 } 78 78 79 for ( std::map< PlayerInfo*, Player>::iterator it = players_.begin(); it != players_.end(); ++it)79 for (auto & elem : players_) 80 80 { 81 81 82 for ( size_t i = 0; i < this->checkpoints_.size(); ++i)82 for (auto & _i : this->checkpoints_) 83 83 { 84 if ( this->checkpoints_[i]->playerWasHere(it->first)){85 this->checkpointReached( this->checkpoints_[i], it->first /*this->checkpoints_[i]->getPlayer()*/);84 if (_i->playerWasHere(elem.first)){ 85 this->checkpointReached(_i, elem.first /*this->checkpoints_[i]->getPlayer()*/); 86 86 } 87 87 } … … 113 113 RaceCheckPoint* SpaceRaceManager::findCheckpoint(int index) const 114 114 { 115 for ( size_t i = 0; i < this->checkpoints_.size(); ++i)116 if ( this->checkpoints_[i]->getCheckpointIndex() == index)117 return this->checkpoints_[i];115 for (auto & elem : this->checkpoints_) 116 if (elem->getCheckpointIndex() == index) 117 return elem; 118 118 return nullptr; 119 119 } … … 125 125 // the player already visited an old checkpoint; see which checkpoints are possible now 126 126 const std::set<int>& possibleCheckpoints = oldCheckpoint->getNextCheckpoints(); 127 for ( std::set<int>::const_iterator it = possibleCheckpoints.begin(); it != possibleCheckpoints.end(); ++it)128 if (this->findCheckpoint( *it) == newCheckpoint)127 for (const auto & possibleCheckpoint : possibleCheckpoints) 128 if (this->findCheckpoint(possibleCheckpoint) == newCheckpoint) 129 129 return true; 130 130 return false; … … 179 179 { 180 180 const std::set<int>& oldVisible = oldCheckpoint->getNextCheckpoints(); 181 for ( std::set<int>::const_iterator it = oldVisible.begin(); it != oldVisible.end(); ++it)182 this->findCheckpoint( *it)->setRadarVisibility(false);181 for (const auto & elem : oldVisible) 182 this->findCheckpoint(elem)->setRadarVisibility(false); 183 183 } 184 184 … … 188 188 189 189 const std::set<int>& newVisible = newCheckpoint->getNextCheckpoints(); 190 for ( std::set<int>::const_iterator it = newVisible.begin(); it != newVisible.end(); ++it)191 this->findCheckpoint( *it)->setRadarVisibility(true);190 for (const auto & elem : newVisible) 191 this->findCheckpoint(elem)->setRadarVisibility(true); 192 192 } 193 193 } -
code/branches/cpp11_v2/src/modules/jump/Jump.cc
r10817 r10821 633 633 634 634 635 for ( int i = 0; i < numI; ++i)635 for (auto & elem : matrix) 636 636 { 637 637 for (int j = 0; j < numJ; ++j) 638 638 { 639 matrix[i][j].type = PLATFORM_EMPTY;640 matrix[i][j].done = false;639 elem[j].type = PLATFORM_EMPTY; 640 elem[j].done = false; 641 641 } 642 642 } … … 795 795 796 796 // Fill matrix with selected platform types 797 for ( int i = 0; i < numI; ++ i)797 for (auto & elem : matrix) 798 798 { 799 799 for (int j = 0; j < numJ; ++ j) … … 801 801 if (rand()%3 == 0) 802 802 { 803 matrix[i][j].type = platformtype1;803 elem[j].type = platformtype1; 804 804 } 805 805 else 806 806 { 807 matrix[i][j].type = platformtype2;807 elem[j].type = platformtype2; 808 808 } 809 matrix[i][j].done = false;809 elem[j].done = false; 810 810 } 811 811 } -
code/branches/cpp11_v2/src/modules/mini4dgame/Mini4Dgame.cc
r10768 r10821 155 155 { 156 156 // first spawn human players to assign always the left bat to the player in singleplayer 157 for ( std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)158 if ( it->first->isHumanPlayer() && (it->first->isReadyToSpawn() || this->bForceSpawn_))159 this->spawnPlayer( it->first);157 for (auto & elem : this->players_) 158 if (elem.first->isHumanPlayer() && (elem.first->isReadyToSpawn() || this->bForceSpawn_)) 159 this->spawnPlayer(elem.first); 160 160 // now spawn bots 161 for ( std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)162 if (! it->first->isHumanPlayer() && (it->first->isReadyToSpawn() || this->bForceSpawn_))163 this->spawnPlayer( it->first);161 for (auto & elem : this->players_) 162 if (!elem.first->isHumanPlayer() && (elem.first->isReadyToSpawn() || this->bForceSpawn_)) 163 this->spawnPlayer(elem.first); 164 164 } 165 165 -
code/branches/cpp11_v2/src/modules/notifications/NotificationManager.cc
r10765 r10821 69 69 { 70 70 // Destroys all Notifications. 71 for( std::multimap<std::time_t, Notification*>::iterator it = this->allNotificationsList_.begin(); it!= this->allNotificationsList_.end(); it++)72 it->second->destroy();71 for(auto & elem : this->allNotificationsList_) 72 elem.second->destroy(); 73 73 this->allNotificationsList_.clear(); 74 74 … … 152 152 bool executed = false; 153 153 // Clear all NotificationQueues that have the input sender as target. 154 for( std::map<const std::string, NotificationQueue*>::iterator it = this->queues_.begin(); it != this->queues_.end(); it++) // Iterate through all NotificationQueues.155 { 156 const std::set<std::string>& set = it->second->getTargetsSet();154 for(auto & elem : this->queues_) // Iterate through all NotificationQueues. 155 { 156 const std::set<std::string>& set = elem.second->getTargetsSet(); 157 157 // If either the sender is 'all', the NotificationQueue has as target all or the NotificationQueue has the input sender as a target. 158 158 if(all || set.find(NotificationListener::ALL) != set.end() || set.find(sender) != set.end()) 159 executed = it->second->tidy() || executed;159 executed = elem.second->tidy() || executed; 160 160 } 161 161 … … 187 187 188 188 // Insert the Notification in all NotificationQueues that have its sender as target. 189 for( std::map<const std::string, NotificationQueue*>::iterator it = this->queues_.begin(); it != this->queues_.end(); it++) // Iterate through all NotificationQueues.190 { 191 const std::set<std::string>& set = it->second->getTargetsSet();189 for(auto & elem : this->queues_) // Iterate through all NotificationQueues. 190 { 191 const std::set<std::string>& set = elem.second->getTargetsSet(); 192 192 bool bAll = set.find(NotificationListener::ALL) != set.end(); 193 193 // If either the Notification has as sender 'all', the NotificationQueue displays all Notifications or the NotificationQueue has the sender of the Notification as target. … … 195 195 { 196 196 if(!bAll) 197 this->notificationLists_[ it->second->getName()]->insert(std::pair<std::time_t, Notification*>(time, notification)); // Insert the Notification in the notifications list of the current NotificationQueue.198 it->second->update(notification, time); // Update the NotificationQueue.197 this->notificationLists_[elem.second->getName()]->insert(std::pair<std::time_t, Notification*>(time, notification)); // Insert the Notification in the notifications list of the current NotificationQueue. 198 elem.second->update(notification, time); // Update the NotificationQueue. 199 199 } 200 200 } … … 345 345 346 346 // Iterate through all Notifications to determine whether any of them should belong to the newly registered NotificationQueue. 347 for( std::multimap<std::time_t, Notification*>::iterator it = this->allNotificationsList_.begin(); it != this->allNotificationsList_.end(); it++)348 { 349 if(!bAll && set.find( it->second->getSender()) != set.end()) // Checks whether the listener has the sender of the current Notification as target.350 map->insert(std::pair<std::time_t, Notification*>( it->first, it->second));347 for(auto & elem : this->allNotificationsList_) 348 { 349 if(!bAll && set.find(elem.second->getSender()) != set.end()) // Checks whether the listener has the sender of the current Notification as target. 350 map->insert(std::pair<std::time_t, Notification*>(elem.first, elem.second)); 351 351 } 352 352 -
code/branches/cpp11_v2/src/modules/notifications/NotificationQueue.cc
r9667 r10821 206 206 { 207 207 // Add all Notifications that have been created after this NotificationQueue was created. 208 for( std::multimap<std::time_t, Notification*>::iterator it = notifications->begin(); it != notifications->end(); it++)208 for(auto & notification : *notifications) 209 209 { 210 if( it->first >= this->creationTime_)211 this->push( it->second, it->first);210 if(notification.first >= this->creationTime_) 211 this->push(notification.second, notification.first); 212 212 } 213 213 } … … 336 336 this->ordering_.clear(); 337 337 // Delete all NotificationContainers in the list. 338 for( std::vector<NotificationContainer*>::iterator it = this->notifications_.begin(); it != this->notifications_.end(); it++)339 delete *it;338 for(auto & elem : this->notifications_) 339 delete elem; 340 340 341 341 this->notifications_.clear(); … … 426 426 bool first = true; 427 427 // Iterate through the set of targets. 428 for( std::set<std::string>::const_iterator it = this->targets_.begin(); it != this->targets_.end(); it++)428 for(const auto & elem : this->targets_) 429 429 { 430 430 if(!first) … … 432 432 else 433 433 first = false; 434 stream << *it;434 stream << elem; 435 435 } 436 436 -
code/branches/cpp11_v2/src/modules/objects/Attacher.cc
r10768 r10821 61 61 SUPER(Attacher, changedActivity); 62 62 63 for ( std::list<WorldEntity*>::iterator it = this->objects_.begin(); it != this->objects_.end(); ++it)64 ( *it)->setActive(this->isActive());63 for (auto & elem : this->objects_) 64 (elem)->setActive(this->isActive()); 65 65 } 66 66 … … 69 69 SUPER(Attacher, changedVisibility); 70 70 71 for ( std::list<WorldEntity*>::iterator it = this->objects_.begin(); it != this->objects_.end(); ++it)72 ( *it)->setVisible(this->isVisible());71 for (auto & elem : this->objects_) 72 (elem)->setVisible(this->isVisible()); 73 73 } 74 74 … … 83 83 { 84 84 unsigned int i = 0; 85 for ( std::list<WorldEntity*>::const_iterator it = this->objects_.begin(); it != this->objects_.end(); ++it)85 for (const auto & elem : this->objects_) 86 86 { 87 87 if (i == index) 88 return ( *it);88 return (elem); 89 89 90 90 ++i; -
code/branches/cpp11_v2/src/modules/objects/Script.cc
r10765 r10821 196 196 { 197 197 const std::map<unsigned int, PlayerInfo*> clients = PlayerManager::getInstance().getClients(); 198 for( std::map<unsigned int, PlayerInfo*>::const_iterator it = clients.begin(); it != clients.end(); it++)198 for(const auto & client : clients) 199 199 { 200 callStaticNetworkFunction(&Script::executeHelper, it->first, this->getCode(), this->getMode(), this->getNeedsGraphics());200 callStaticNetworkFunction(&Script::executeHelper, client.first, this->getCode(), this->getMode(), this->getNeedsGraphics()); 201 201 if(this->times_ != Script::INF) // Decrement the number of remaining executions. 202 202 { -
code/branches/cpp11_v2/src/modules/objects/SpaceBoundaries.cc
r10769 r10821 59 59 this->pawnsIn_.clear(); 60 60 61 for( std::vector<BillboardAdministration>::iterator current = this->billboards_.begin(); current != this->billboards_.end(); current++)61 for(auto & elem : this->billboards_) 62 62 { 63 if( current->billy != nullptr)64 { 65 delete current->billy;63 if( elem.billy != nullptr) 64 { 65 delete elem.billy; 66 66 } 67 67 } … … 138 138 void SpaceBoundaries::removeAllBillboards() 139 139 { 140 for( std::vector<BillboardAdministration>::iterator current = this->billboards_.begin(); current != this->billboards_.end(); current++)141 { 142 current->usedYet = false;143 current->billy->setVisible(false);140 for(auto & elem : this->billboards_) 141 { 142 elem.usedYet = false; 143 elem.billy->setVisible(false); 144 144 } 145 145 } … … 208 208 float distance; 209 209 bool humanItem; 210 for( std::list<WeakPtr<Pawn>>::iterator current = pawnsIn_.begin(); current != pawnsIn_.end(); current++)211 { 212 Pawn* currentPawn = *current;210 for(auto currentPawn : pawnsIn_) 211 { 212 213 213 if( currentPawn && currentPawn->getNode() ) 214 214 { -
code/branches/cpp11_v2/src/modules/objects/eventsystem/EventDispatcher.cc
r10768 r10821 45 45 { 46 46 if (this->isInitialized()) 47 for ( std::list<BaseObject*>::iterator it = this->targets_.begin(); it != this->targets_.end(); ++it)48 ( *it)->destroy();47 for (auto & elem : this->targets_) 48 (elem)->destroy(); 49 49 } 50 50 … … 61 61 void EventDispatcher::processEvent(Event& event) 62 62 { 63 for ( std::list<BaseObject*>::iterator it = this->targets_.begin(); it != this->targets_.end(); ++it)64 ( *it)->processEvent(event);63 for (auto & elem : this->targets_) 64 (elem)->processEvent(event); 65 65 } 66 66 … … 73 73 { 74 74 unsigned int i = 0; 75 for ( std::list<BaseObject*>::const_iterator it = this->targets_.begin(); it != this->targets_.end(); ++it)75 for (const auto & elem : this->targets_) 76 76 { 77 77 if (i == index) 78 return ( *it);78 return (elem); 79 79 ++i; 80 80 } -
code/branches/cpp11_v2/src/modules/objects/eventsystem/EventFilter.cc
r10768 r10821 96 96 { 97 97 unsigned int i = 0; 98 for ( std::list<BaseObject*>::const_iterator it = this->sources_.begin(); it != this->sources_.end(); ++it)98 for (const auto & elem : this->sources_) 99 99 { 100 100 if (i == index) 101 return ( *it);101 return (elem); 102 102 ++i; 103 103 } … … 113 113 { 114 114 unsigned int i = 0; 115 for ( std::list<EventName*>::const_iterator it = this->names_.begin(); it != this->names_.end(); ++it)115 for (const auto & elem : this->names_) 116 116 { 117 117 if (i == index) 118 return ( *it);118 return (elem); 119 119 ++i; 120 120 } -
code/branches/cpp11_v2/src/modules/objects/triggers/DistanceMultiTrigger.cc
r10769 r10821 160 160 const std::set<WorldEntity*> attached = entity->getAttachedObjects(); 161 161 bool found = false; 162 for( std::set<WorldEntity*>::const_iterator it = attached.begin(); it != attached.end(); it++)162 for(const auto & elem : attached) 163 163 { 164 if(( *it)->isA(ClassIdentifier<DistanceTriggerBeacon>::getIdentifier()) && static_cast<DistanceTriggerBeacon*>(*it)->getName() == this->targetName_)164 if((elem)->isA(ClassIdentifier<DistanceTriggerBeacon>::getIdentifier()) && static_cast<DistanceTriggerBeacon*>(elem)->getName() == this->targetName_) 165 165 { 166 166 found = true; -
code/branches/cpp11_v2/src/modules/objects/triggers/DistanceTrigger.cc
r10765 r10821 182 182 const std::set<WorldEntity*> attached = entity->getAttachedObjects(); 183 183 bool found = false; 184 for( std::set<WorldEntity*>::const_iterator it = attached.begin(); it != attached.end(); it++)184 for(const auto & elem : attached) 185 185 { 186 if(( *it)->isA(ClassIdentifier<DistanceTriggerBeacon>::getIdentifier()) && static_cast<DistanceTriggerBeacon*>(*it)->getName() == this->targetName_)186 if((elem)->isA(ClassIdentifier<DistanceTriggerBeacon>::getIdentifier()) && static_cast<DistanceTriggerBeacon*>(elem)->getName() == this->targetName_) 187 187 { 188 188 found = true; -
code/branches/cpp11_v2/src/modules/objects/triggers/MultiTrigger.cc
r10765 r10821 504 504 bool MultiTrigger::checkAnd(BaseObject* triggerer) 505 505 { 506 for( std::set<TriggerBase*>::iterator it = this->children_.begin(); it != this->children_.end(); ++it)507 { 508 TriggerBase* trigger = *it;506 for(auto trigger : this->children_) 507 { 508 509 509 if(trigger->isMultiTrigger()) 510 510 { … … 531 531 bool MultiTrigger::checkOr(BaseObject* triggerer) 532 532 { 533 for( std::set<TriggerBase*>::iterator it = this->children_.begin(); it != this->children_.end(); ++it)534 { 535 TriggerBase* trigger = *it;533 for(auto trigger : this->children_) 534 { 535 536 536 if(trigger->isMultiTrigger()) 537 537 { … … 559 559 { 560 560 bool triggered = false; 561 for( std::set<TriggerBase*>::iterator it = this->children_.begin(); it != this->children_.end(); ++it)562 { 563 TriggerBase* trigger = *it;561 for(auto trigger : this->children_) 562 { 563 564 564 if(triggered) 565 565 { -
code/branches/cpp11_v2/src/modules/objects/triggers/Trigger.cc
r10624 r10821 234 234 { 235 235 // Iterate over all sub-triggers. 236 for ( std::set<TriggerBase*>::iterator it = this->children_.begin(); it != this->children_.end(); ++it)237 { 238 if (!( *it)->isActive())236 for (const auto & elem : this->children_) 237 { 238 if (!(elem)->isActive()) 239 239 return false; 240 240 } … … 252 252 { 253 253 // Iterate over all sub-triggers. 254 for ( std::set<TriggerBase*>::iterator it = this->children_.begin(); it != this->children_.end(); ++it)255 { 256 if (( *it)->isActive())254 for (const auto & elem : this->children_) 255 { 256 if ((elem)->isActive()) 257 257 return true; 258 258 } … … 270 270 { 271 271 bool test = false; 272 for ( std::set<TriggerBase*>::iterator it = this->children_.begin(); it != this->children_.end(); ++it)273 { 274 if (test && ( *it)->isActive())272 for (const auto & elem : this->children_) 273 { 274 if (test && (elem)->isActive()) 275 275 return false; 276 if (( *it)->isActive())276 if ((elem)->isActive()) 277 277 test = true; 278 278 } -
code/branches/cpp11_v2/src/modules/overlays/hud/ChatOverlay.cc
r9667 r10821 58 58 ChatOverlay::~ChatOverlay() 59 59 { 60 for ( std::set<Timer*>::iterator it = this->timers_.begin(); it != this->timers_.end(); ++it)61 delete ( *it);60 for (const auto & elem : this->timers_) 61 delete (elem); 62 62 } 63 63 … … 92 92 this->text_->setCaption(""); 93 93 94 for ( std::list<Ogre::DisplayString>::iterator it = this->messages_.begin(); it != this->messages_.end(); ++it)94 for (auto & elem : this->messages_) 95 95 { 96 this->text_->setCaption(this->text_->getCaption() + "\n" + ( *it));96 this->text_->setCaption(this->text_->getCaption() + "\n" + (elem)); 97 97 } 98 98 } -
code/branches/cpp11_v2/src/modules/overlays/hud/HUDNavigation.cc
r10774 r10821 131 131 } 132 132 this->fontName_ = font; 133 for ( std::map<RadarViewable*, ObjectInfo>::iterator it = this->activeObjectList_.begin(); it != this->activeObjectList_.end(); ++it)134 { 135 if ( it->second.text_ != nullptr)136 it->second.text_->setFontName(this->fontName_);133 for (auto & elem : this->activeObjectList_) 134 { 135 if (elem.second.text_ != nullptr) 136 elem.second.text_->setFontName(this->fontName_); 137 137 } 138 138 } … … 151 151 } 152 152 this->textSize_ = size; 153 for ( std::map<RadarViewable*, ObjectInfo>::iterator it = this->activeObjectList_.begin(); it!=this->activeObjectList_.end(); ++it)154 { 155 if ( it->second.text_)156 it->second.text_->setCharHeight(size);153 for (auto & elem : this->activeObjectList_) 154 { 155 if (elem.second.text_) 156 elem.second.text_->setCharHeight(size); 157 157 } 158 158 } … … 186 186 const Matrix4& camTransform = cam->getOgreCamera()->getProjectionMatrix() * cam->getOgreCamera()->getViewMatrix(); 187 187 188 for ( std::list<std::pair<RadarViewable*, unsigned int>>::iterator listIt = this->sortedObjectList_.begin(); listIt != this->sortedObjectList_.end(); ++listIt)189 listIt->second = (int)((listIt->first->getRVWorldPosition() - HumanController::getLocalControllerSingleton()->getControllableEntity()->getWorldPosition()).length() + 0.5f);188 for (auto & elem : this->sortedObjectList_) 189 elem.second = (int)((elem.first->getRVWorldPosition() - HumanController::getLocalControllerSingleton()->getControllableEntity()->getWorldPosition()).length() + 0.5f); 190 190 191 191 this->sortedObjectList_.sort(compareDistance); … … 531 531 float yScale = this->getActualSize().y; 532 532 533 for ( std::map<RadarViewable*, ObjectInfo>::iterator it = this->activeObjectList_.begin(); it != this->activeObjectList_.end(); ++it)534 { 535 if ( it->second.health_ != nullptr)536 it->second.health_->setDimensions(this->healthMarkerSize_ * xScale, this->healthMarkerSize_ * yScale);537 if ( it->second.healthLevel_ != nullptr)538 it->second.healthLevel_->setDimensions(this->healthLevelMarkerSize_ * xScale, this->healthLevelMarkerSize_ * yScale);539 if ( it->second.panel_ != nullptr)540 it->second.panel_->setDimensions(this->navMarkerSize_ * xScale, this->navMarkerSize_ * yScale);541 if ( it->second.text_ != nullptr)542 it->second.text_->setCharHeight(this->textSize_ * yScale);543 if ( it->second.target_ != nullptr)544 it->second.target_->setDimensions(this->aimMarkerSize_ * xScale, this->aimMarkerSize_ * yScale);533 for (auto & elem : this->activeObjectList_) 534 { 535 if (elem.second.health_ != nullptr) 536 elem.second.health_->setDimensions(this->healthMarkerSize_ * xScale, this->healthMarkerSize_ * yScale); 537 if (elem.second.healthLevel_ != nullptr) 538 elem.second.healthLevel_->setDimensions(this->healthLevelMarkerSize_ * xScale, this->healthLevelMarkerSize_ * yScale); 539 if (elem.second.panel_ != nullptr) 540 elem.second.panel_->setDimensions(this->navMarkerSize_ * xScale, this->navMarkerSize_ * yScale); 541 if (elem.second.text_ != nullptr) 542 elem.second.text_->setCharHeight(this->textSize_ * yScale); 543 if (elem.second.target_ != nullptr) 544 elem.second.target_->setDimensions(this->aimMarkerSize_ * xScale, this->aimMarkerSize_ * yScale); 545 545 } 546 546 } … … 670 670 { 671 671 const std::set<RadarViewable*>& respawnObjects = this->getOwner()->getScene()->getRadar()->getRadarObjects(); 672 for ( std::set<RadarViewable*>::const_iterator it = respawnObjects.begin(); it != respawnObjects.end(); ++it)673 { 674 if (!( *it)->isHumanShip_)675 this->addObject( *it);672 for (const auto & respawnObject : respawnObjects) 673 { 674 if (!(respawnObject)->isHumanShip_) 675 this->addObject(respawnObject); 676 676 } 677 677 } -
code/branches/cpp11_v2/src/modules/overlays/hud/HUDRadar.cc
r10768 r10821 92 92 Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->map3DBack_); 93 93 94 for (std::map<RadarViewable*,Ogre::PanelOverlayElement*>::iterator it = this->radarObjects_.begin(); 95 it != this->radarObjects_.end(); ++it) 96 { 97 Ogre::OverlayManager::getSingleton().destroyOverlayElement(it->second); 94 for (auto & elem : this->radarObjects_) 95 { 96 Ogre::OverlayManager::getSingleton().destroyOverlayElement(elem.second); 98 97 } 99 98 } -
code/branches/cpp11_v2/src/modules/overlays/stats/Scoreboard.cc
r9667 r10821 60 60 SUPER(Scoreboard, changedVisibility); 61 61 62 for ( unsigned int i = 0; i < this->lines_.size(); ++i)63 this->lines_[i]->changedVisibility();62 for (auto & elem : this->lines_) 63 elem->changedVisibility(); 64 64 } 65 65 … … 94 94 95 95 unsigned int index = 0; 96 for ( std::map<PlayerInfo*, Player>::const_iterator it = playerList.begin(); it != playerList.end(); ++it)96 for (const auto & elem : playerList) 97 97 { 98 this->lines_[index]->setPlayerName(multi_cast<std::string>( it->first->getName()));99 this->lines_[index]->setScore(multi_cast<std::string>( it->second.frags_));100 this->lines_[index]->setDeaths(multi_cast<std::string>( it->second.killed_));98 this->lines_[index]->setPlayerName(multi_cast<std::string>(elem.first->getName())); 99 this->lines_[index]->setScore(multi_cast<std::string>(elem.second.frags_)); 100 this->lines_[index]->setDeaths(multi_cast<std::string>(elem.second.killed_)); 101 101 index++; 102 102 } -
code/branches/cpp11_v2/src/modules/pickup/PickupCollection.cc
r10765 r10821 68 68 { 69 69 // Destroy all Pickupables constructing this PickupCollection. 70 for( std::list<CollectiblePickup*>::iterator it = this->pickups_.begin(); it != this->pickups_.end(); ++it)71 { 72 ( *it)->wasRemovedFromCollection();73 ( *it)->destroy();70 for(auto & elem : this->pickups_) 71 { 72 (elem)->wasRemovedFromCollection(); 73 (elem)->destroy(); 74 74 } 75 75 this->pickups_.clear(); … … 99 99 this->processingUsed_ = true; 100 100 // Change used for all Pickupables this PickupCollection consists of. 101 for( std::list<CollectiblePickup*>::iterator it = this->pickups_.begin(); it != this->pickups_.end(); ++it)102 ( *it)->setUsed(this->isUsed());101 for(auto & elem : this->pickups_) 102 (elem)->setUsed(this->isUsed()); 103 103 104 104 this->processingUsed_ = false; … … 119 119 size_t numPickupsEnabled = 0; 120 120 size_t numPickupsInUse = 0; 121 for( std::list<CollectiblePickup*>::iterator it = this->pickups_.begin(); it != this->pickups_.end(); ++it)122 { 123 if (( *it)->isEnabled())121 for(auto & elem : this->pickups_) 122 { 123 if ((elem)->isEnabled()) 124 124 ++numPickupsEnabled; 125 if (( *it)->isUsed())125 if ((elem)->isUsed()) 126 126 ++numPickupsInUse; 127 127 } … … 146 146 147 147 // Change the PickupCarrier for all Pickupables this PickupCollection consists of. 148 for( std::list<CollectiblePickup*>::iterator it = this->pickups_.begin(); it != this->pickups_.end(); ++it)148 for(auto & elem : this->pickups_) 149 149 { 150 150 if(this->getCarrier() == nullptr) 151 ( *it)->setCarrier(nullptr);151 (elem)->setCarrier(nullptr); 152 152 else 153 ( *it)->setCarrier(this->getCarrier()->getTarget(*it));153 (elem)->setCarrier(this->getCarrier()->getTarget(elem)); 154 154 } 155 155 } … … 186 186 // If at least all the enabled pickups of this PickupCollection are no longer picked up. 187 187 bool isOnePickupEnabledAndPickedUp = false; 188 for( std::list<CollectiblePickup*>::iterator it = this->pickups_.begin(); it != this->pickups_.end(); ++it)189 { 190 if (( *it)->isEnabled() && (*it)->isPickedUp())188 for(auto & elem : this->pickups_) 189 { 190 if ((elem)->isEnabled() && (elem)->isPickedUp()) 191 191 { 192 192 isOnePickupEnabledAndPickedUp = true; … … 208 208 bool PickupCollection::isTarget(const PickupCarrier* carrier) const 209 209 { 210 for( std::list<CollectiblePickup*>::const_iterator it = this->pickups_.begin(); it != this->pickups_.end(); ++it)211 { 212 if(!carrier->isTarget( *it))210 for(const auto & elem : this->pickups_) 211 { 212 if(!carrier->isTarget(elem)) 213 213 return false; 214 214 } -
code/branches/cpp11_v2/src/modules/pickup/PickupManager.cc
r10765 r10821 91 91 92 92 // Destroying all the PickupInventoryContainers that are still there. 93 for( std::map<uint32_t, PickupInventoryContainer*>::iterator it = this->pickupInventoryContainers_.begin(); it != this->pickupInventoryContainers_.end(); it++)94 delete it->second;93 for(auto & elem : this->pickupInventoryContainers_) 94 delete elem.second; 95 95 this->pickupInventoryContainers_.clear(); 96 96 -
code/branches/cpp11_v2/src/modules/pickup/items/MetaPickup.cc
r10765 r10821 118 118 std::set<Pickupable*> pickups = carrier->getPickups(); 119 119 // Iterate over all Pickupables of the PickupCarrier. 120 for( std::set<Pickupable*>::iterator it = pickups.begin(); it != pickups.end(); it++)120 for(auto pickup : pickups) 121 121 { 122 Pickupable* pickup = (*it);122 123 123 if(pickup == nullptr || pickup == this) 124 124 continue; -
code/branches/cpp11_v2/src/modules/pong/Pong.cc
r10768 r10821 145 145 146 146 // If one of the bats is missing, create it. Apply the template for the bats as specified in the centerpoint. 147 for ( size_t i = 0; i < 2; ++i)147 for (auto & elem : this->bat_) 148 148 { 149 if ( this->bat_[i]== nullptr)149 if (elem == nullptr) 150 150 { 151 this->bat_[i]= new PongBat(this->center_->getContext());152 this->bat_[i]->addTemplate(this->center_->getBattemplate());151 elem = new PongBat(this->center_->getContext()); 152 elem->addTemplate(this->center_->getBattemplate()); 153 153 } 154 154 } … … 211 211 { 212 212 // first spawn human players to assign always the left bat to the player in singleplayer 213 for ( std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)214 if ( it->first->isHumanPlayer() && (it->first->isReadyToSpawn() || this->bForceSpawn_))215 this->spawnPlayer( it->first);213 for (auto & elem : this->players_) 214 if (elem.first->isHumanPlayer() && (elem.first->isReadyToSpawn() || this->bForceSpawn_)) 215 this->spawnPlayer(elem.first); 216 216 // now spawn bots 217 for ( std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)218 if (! it->first->isHumanPlayer() && (it->first->isReadyToSpawn() || this->bForceSpawn_))219 this->spawnPlayer( it->first);217 for (auto & elem : this->players_) 218 if (!elem.first->isHumanPlayer() && (elem.first->isReadyToSpawn() || this->bForceSpawn_)) 219 this->spawnPlayer(elem.first); 220 220 } 221 221 -
code/branches/cpp11_v2/src/modules/pong/PongAI.cc
r10769 r10821 77 77 PongAI::~PongAI() 78 78 { 79 for ( std::list<std::pair<Timer*, char>>::iterator it = this->reactionTimers_.begin(); it != this->reactionTimers_.end(); ++it)80 it->first->destroy();79 for (auto & elem : this->reactionTimers_) 80 elem.first->destroy(); 81 81 } 82 82 -
code/branches/cpp11_v2/src/modules/questsystem/GlobalQuest.cc
r10765 r10821 94 94 95 95 // Iterate through all players possessing this Quest. 96 for( std::set<PlayerInfo*>::const_iterator it = players_.begin(); it != players_.end(); it++)97 QuestEffect::invokeEffects( *it, this->getFailEffectList());96 for(const auto & elem : players_) 97 QuestEffect::invokeEffects(elem, this->getFailEffectList()); 98 98 99 99 return true; … … 119 119 120 120 // Iterate through all players possessing the Quest. 121 for( std::set<PlayerInfo*>::const_iterator it = players_.begin(); it != players_.end(); it++)122 QuestEffect::invokeEffects( *it, this->getCompleteEffectList());121 for(const auto & elem : players_) 122 QuestEffect::invokeEffects(elem, this->getCompleteEffectList()); 123 123 124 124 Quest::complete(player); … … 242 242 { 243 243 int i = index; 244 for ( std::list<QuestEffect*>::const_iterator effect = this->rewards_.begin(); effect != this->rewards_.end(); ++effect)244 for (const auto & elem : this->rewards_) 245 245 { 246 246 if(i == 0) 247 return *effect;247 return elem; 248 248 249 249 i--; -
code/branches/cpp11_v2/src/modules/questsystem/Quest.cc
r10765 r10821 190 190 191 191 // Iterate through all subquests. 192 for ( std::list<Quest*>::const_iterator subQuest = this->subQuests_.begin(); subQuest != this->subQuests_.end(); ++subQuest)192 for (const auto & elem : this->subQuests_) 193 193 { 194 194 if(i == 0) // We're counting down... 195 return *subQuest;195 return elem; 196 196 197 197 i--; … … 214 214 215 215 // Iterate through all QuestHints. 216 for ( std::list<QuestHint*>::const_iterator hint = this->hints_.begin(); hint != this->hints_.end(); ++hint)216 for (const auto & elem : this->hints_) 217 217 { 218 218 if(i == 0) // We're counting down... 219 return *hint;219 return elem; 220 220 221 221 i--; … … 237 237 238 238 // Iterate through all fail QuestEffects. 239 for ( std::list<QuestEffect*>::const_iterator effect = this->failEffects_.begin(); effect != this->failEffects_.end(); ++effect)239 for (const auto & elem : this->failEffects_) 240 240 { 241 241 if(i == 0) // We're counting down... 242 return *effect;242 return elem; 243 243 244 244 i--; … … 260 260 261 261 // Iterate through all complete QuestEffects. 262 for ( std::list<QuestEffect*>::const_iterator effect = this->completeEffects_.begin(); effect != this->completeEffects_.end(); ++effect)262 for (const auto & elem : this->completeEffects_) 263 263 { 264 264 if(i == 0) // We're counting down... 265 return *effect;265 return elem; 266 266 267 267 i--; -
code/branches/cpp11_v2/src/modules/questsystem/QuestEffect.cc
r10624 r10821 74 74 orxout(verbose, context::quests) << "Invoking QuestEffects on player: " << player << " ." << endl; 75 75 76 for ( std::list<QuestEffect*>::iterator effect = effects.begin(); effect != effects.end(); effect++)77 temp = temp && ( *effect)->invoke(player);76 for (auto & effects_effect : effects) 77 temp = temp && (effects_effect)->invoke(player); 78 78 79 79 return temp; -
code/branches/cpp11_v2/src/modules/questsystem/QuestEffectBeacon.cc
r10765 r10821 236 236 { 237 237 int i = index; 238 for ( std::list<QuestEffect*>::const_iterator effect = this->effects_.begin(); effect != this->effects_.end(); ++effect)238 for (const auto & elem : this->effects_) 239 239 { 240 240 if(i == 0) 241 return *effect;241 return elem; 242 242 243 243 i--; -
code/branches/cpp11_v2/src/modules/questsystem/QuestListener.cc
r10765 r10821 97 97 /* static */ void QuestListener::advertiseStatusChange(std::list<QuestListener*> & listeners, const std::string & status) 98 98 { 99 for ( std::list<QuestListener*>::iterator it = listeners.begin(); it != listeners.end(); ++it) // Iterate through all QuestListeners100 { 101 QuestListener* listener = *it;99 for (auto listener : listeners) // Iterate through all QuestListeners 100 { 101 102 102 if(listener->getMode() == status || listener->getMode() == QuestListener::ALL) // Check whether the status change affects the give QuestListener. 103 103 listener->execute(); -
code/branches/cpp11_v2/src/modules/questsystem/QuestManager.cc
r10765 r10821 235 235 { 236 236 int numQuests = 0; 237 for( std::map<std::string, Quest*>::iterator it = this->questMap_.begin(); it != this->questMap_.end(); it++)238 { 239 if( it->second->getParentQuest() == nullptr && !it->second->isInactive(player))237 for(auto & elem : this->questMap_) 238 { 239 if(elem.second->getParentQuest() == nullptr && !elem.second->isInactive(player)) 240 240 numQuests++; 241 241 } … … 255 255 Quest* QuestManager::getRootQuest(PlayerInfo* player, int index) 256 256 { 257 for( std::map<std::string, Quest*>::iterator it = this->questMap_.begin(); it != this->questMap_.end(); it++)258 { 259 if( it->second->getParentQuest() == nullptr && !it->second->isInactive(player) && index-- == 0)260 return it->second;257 for(auto & elem : this->questMap_) 258 { 259 if(elem.second->getParentQuest() == nullptr && !elem.second->isInactive(player) && index-- == 0) 260 return elem.second; 261 261 } 262 262 return nullptr; … … 280 280 std::list<Quest*> quests = quest->getSubQuestList(); 281 281 int numQuests = 0; 282 for( std::list<Quest*>::iterator it = quests.begin(); it != quests.end(); it++)283 { 284 if(!( *it)->isInactive(player))282 for(auto & quest : quests) 283 { 284 if(!(quest)->isInactive(player)) 285 285 numQuests++; 286 286 } … … 304 304 305 305 std::list<Quest*> quests = quest->getSubQuestList(); 306 for( std::list<Quest*>::iterator it = quests.begin(); it != quests.end(); it++)307 { 308 if(!( *it)->isInactive(player) && index-- == 0)309 return *it;306 for(auto & quest : quests) 307 { 308 if(!(quest)->isInactive(player) && index-- == 0) 309 return quest; 310 310 } 311 311 return nullptr; … … 326 326 std::list<QuestHint*> hints = quest->getHintsList(); 327 327 int numHints = 0; 328 for( std::list<QuestHint*>::iterator it = hints.begin(); it != hints.end(); it++)329 { 330 if(( *it)->isActive(player))328 for(auto & hint : hints) 329 { 330 if((hint)->isActive(player)) 331 331 numHints++; 332 332 } … … 349 349 { 350 350 std::list<QuestHint*> hints = quest->getHintsList(); 351 for( std::list<QuestHint*>::iterator it = hints.begin(); it != hints.end(); it++)352 { 353 if(( *it)->isActive(player) && index-- == 0)354 return *it;351 for(auto & hint : hints) 352 { 353 if((hint)->isActive(player) && index-- == 0) 354 return hint; 355 355 } 356 356 return nullptr; -
code/branches/cpp11_v2/src/modules/questsystem/effects/AddReward.cc
r10765 r10821 84 84 { 85 85 int i = index; 86 for ( std::list<Rewardable*>::const_iterator reward = this->rewards_.begin(); reward != this->rewards_.end(); ++reward)86 for (const auto & elem : this->rewards_) 87 87 { 88 88 if(i == 0) 89 return *reward;89 return elem; 90 90 i--; 91 91 } … … 106 106 107 107 bool temp = true; 108 for ( std::list<Rewardable*>::iterator reward = this->rewards_.begin(); reward != this->rewards_.end(); ++reward)109 temp = temp && ( *reward)->reward(player);108 for (auto & elem : this->rewards_) 109 temp = temp && (elem)->reward(player); 110 110 111 111 orxout(verbose, context::quests) << "Rewardable successfully added to player." << player << " ." << endl; -
code/branches/cpp11_v2/src/modules/tetris/Tetris.cc
r10769 r10821 104 104 } 105 105 106 for ( std::list<StrongPtr<TetrisStone>>::iterator it = this->stones_.begin(); it != this->stones_.end(); ++it)107 ( *it)->destroy();106 for (auto & elem : this->stones_) 107 (elem)->destroy(); 108 108 this->stones_.clear(); 109 109 } … … 341 341 { 342 342 // Spawn a human player. 343 for ( std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)344 if ( it->first->isHumanPlayer() && (it->first->isReadyToSpawn() || this->bForceSpawn_))345 this->spawnPlayer( it->first);343 for (auto & elem : this->players_) 344 if (elem.first->isHumanPlayer() && (elem.first->isReadyToSpawn() || this->bForceSpawn_)) 345 this->spawnPlayer(elem.first); 346 346 } 347 347 … … 502 502 } 503 503 // adjust height of stones above the deleted row //TODO: check if this could be a source of a bug. 504 for( std::list<StrongPtr<TetrisStone>>::iterator it = this->stones_.begin(); it != this->stones_.end(); ++it)505 { 506 if(static_cast<unsigned int>((( *it)->getPosition().y - 5)/this->center_->getStoneSize()) > row)507 ( *it)->setPosition((*it)->getPosition()-Vector3(0,10,0));504 for(auto & elem : this->stones_) 505 { 506 if(static_cast<unsigned int>(((elem)->getPosition().y - 5)/this->center_->getStoneSize()) > row) 507 (elem)->setPosition((elem)->getPosition()-Vector3(0,10,0)); 508 508 } 509 509 -
code/branches/cpp11_v2/src/modules/tetris/TetrisBrick.cc
r10765 r10821 239 239 { 240 240 assert(this->tetris_); 241 for( unsigned int i = 0; i < this->brickStones_.size(); i++)242 { 243 this->brickStones_[i]->detachFromParent();244 this->brickStones_[i]->attachToParent(center);245 this->brickStones_[i]->setPosition(this->getPosition()+this->tetris_->rotateVector(this->brickStones_[i]->getPosition(),this->rotationCount_ ));241 for(auto & elem : this->brickStones_) 242 { 243 elem->detachFromParent(); 244 elem->attachToParent(center); 245 elem->setPosition(this->getPosition()+this->tetris_->rotateVector(elem->getPosition(),this->rotationCount_ )); 246 246 } 247 247 this->brickStones_.clear(); -
code/branches/cpp11_v2/src/modules/towerdefense/TowerDefense.cc
r10769 r10821 183 183 en1->lookAt(waypoints_.at(1)->getPosition() + offset_); 184 184 185 for ( unsigned int i = 0; i < waypoints_.size(); ++ i)185 for (auto & elem : waypoints_) 186 186 { 187 187 orxonox::WeakPtr<MovableEntity> waypoint = new MovableEntity(this->center_->getContext()); 188 waypoint->setPosition( waypoints_.at(i)->getPosition() + offset_);188 waypoint->setPosition(elem->getPosition() + offset_); 189 189 controller->addWaypoint(waypoint); 190 190 }
Note: See TracChangeset
for help on using the changeset viewer.