Changeset 11054 for code/branches/cpp11_v3/src/orxonox/LevelManager.cc
- Timestamp:
- Jan 10, 2016, 1:54:11 PM (9 years ago)
- Location:
- code/branches/cpp11_v3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/cpp11_v3
- Property svn:mergeinfo changed
-
code/branches/cpp11_v3/src/orxonox/LevelManager.cc
r11020 r11054 78 78 { 79 79 // Delete all the LevelInfoItem objects because the LevelManager created them 80 std::set<LevelInfoItem*, LevelInfoCompare>::iterator it = availableLevels_.begin(); 81 for (; it != availableLevels_.end(); ++it) 82 (*it)->destroy(); 80 for (LevelInfoItem* info : availableLevels_) 81 info->destroy(); 83 82 } 84 83 … … 154 153 Get the currently active Level. 155 154 @return 156 Returns a pointer to the currently active level or NULLif there currently are no active Levels.155 Returns a pointer to the currently active level or nullptr if there currently are no active Levels. 157 156 */ 158 157 Level* LevelManager::getActiveLevel() … … 161 160 return this->levels_.front(); 162 161 else 163 return 0;162 return nullptr; 164 163 } 165 164 … … 175 174 this->levels_.front()->setActive(true); 176 175 // Make every player enter the newly activated level. 177 for ( std::map<unsigned int, PlayerInfo*>::const_iterator it = PlayerManager::getInstance().getClients().begin(); it != PlayerManager::getInstance().getClients().end(); ++it)178 this->levels_.front()->playerEntered( it->second);176 for (const auto& mapEntry : PlayerManager::getInstance().getClients()) 177 this->levels_.front()->playerEntered(mapEntry.second); 179 178 } 180 179 } … … 218 217 { 219 218 if(index >= this->availableLevels_.size()) 220 return NULL;219 return nullptr; 221 220 222 221 // If this index directly follows the last we can optimize a lot. … … 272 271 if (it->find("old/") != 0) 273 272 { 274 LevelInfoItem* info = NULL;273 LevelInfoItem* info = nullptr; 275 274 276 275 // Load the LevelInfo object from the level file. … … 279 278 280 279 // Find the LevelInfo object we've just loaded (if there was one) 281 for( ObjectList<LevelInfo>::iterator item = ObjectList<LevelInfo>::begin(); item != ObjectList<LevelInfo>::end(); ++item)282 if( item->getXMLFilename() == *it)283 info = item->copy();280 for(LevelInfo* levelInfo : ObjectList<LevelInfo>()) 281 if(levelInfo->getXMLFilename() == *it) 282 info = levelInfo->copy(); 284 283 285 284 // We don't need the loaded stuff anymore 286 285 Loader::getInstance().unload(&file); 287 286 288 if(info == NULL)287 if(info == nullptr) 289 288 { 290 289 // Create a default LevelInfoItem object that merely contains the name
Note: See TracChangeset
for help on using the changeset viewer.