Changeset 10916
- Timestamp:
- Dec 2, 2015, 11:22:03 PM (9 years ago)
- Location:
- code/branches/cpp11_v2/src
- Files:
-
- 130 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/cpp11_v2/src/libraries/core/BaseObject.cc
r10821 r10916 234 234 { 235 235 unsigned int i = 0; 236 for ( const auto & elem: this->templates_)236 for (Template* temp : this->templates_) 237 237 { 238 238 if (i == index) 239 return (elem);239 return temp; 240 240 i++; 241 241 } … … 269 269 { 270 270 unsigned int i = 0; 271 for (const auto & elem: this->eventSources_)272 { 273 if ( elem.second != state)271 for (const auto& mapEntry : this->eventSources_) 272 { 273 if (mapEntry.second != state) 274 274 continue; 275 275 276 276 if (i == index) 277 return elem.first;277 return mapEntry.first; 278 278 ++i; 279 279 } … … 296 296 { 297 297 unsigned int i = 0; 298 for ( const auto & elem: this->eventListenersXML_)298 for (BaseObject* listener : this->eventListenersXML_) 299 299 { 300 300 if (i == index) 301 return elem;301 return listener; 302 302 ++i; 303 303 } … … 358 358 Event event(activate, originator, name); 359 359 360 for ( const auto & elem: this->eventListeners_)361 { 362 event.statename_ = (elem)->eventSources_[this];363 (elem)->processEvent(event);360 for (BaseObject* listener : this->eventListeners_) 361 { 362 event.statename_ = listener->eventSources_[this]; 363 listener->processEvent(event); 364 364 } 365 365 } … … 370 370 void BaseObject::fireEvent(Event& event) 371 371 { 372 for ( const auto & elem: this->eventListeners_)373 (elem)->processEvent(event);372 for (BaseObject* listener : this->eventListeners_) 373 listener->processEvent(event); 374 374 } 375 375 … … 474 474 475 475 // iterate through all states and get the event sources 476 for (auto & statename : eventnames) 477 { 478 479 476 for (const std::string& statename : eventnames) 477 { 480 478 // if the event state is already known, continue with the next state 481 479 orxonox::EventState* eventstate = object->getEventState(statename); -
code/branches/cpp11_v2/src/libraries/core/ClassTreeMask.cc
r10821 r10916 293 293 { 294 294 // No it's not: Search for classes inheriting from the given class and add the rules for them 295 for (const auto & elem: subclass->getDirectChildren())296 if ( (elem)->isA(this->root_->getClass()))297 if (overwrite || (!this->nodeExists( elem))) // If we don't want to overwrite, only add nodes that don't already exist298 this->add(this->root_, elem, bInclude, overwrite);295 for (const Identifier* directChild : subclass->getDirectChildren()) 296 if (directChild->isA(this->root_->getClass())) 297 if (overwrite || (!this->nodeExists(directChild))) // If we don't want to overwrite, only add nodes that don't already exist 298 this->add(this->root_, directChild, bInclude, overwrite); 299 299 } 300 300 … … 325 325 { 326 326 // Search for an already existing node, containing the subclass we want to add 327 for ( auto & elem: node->subnodes_)327 for (ClassTreeMaskNode* subnode : node->subnodes_) 328 328 { 329 if (subclass->isA( (elem)->getClass()))329 if (subclass->isA(subnode->getClass())) 330 330 { 331 331 // We've found an existing node -> delegate the work with a recursive function-call and return 332 this->add( elem, subclass, bInclude, overwrite);332 this->add(subnode, subclass, bInclude, overwrite); 333 333 return; 334 334 } … … 392 392 if (!subclass) 393 393 return; 394 for (const auto & elem: subclass->getDirectChildren())395 this->add( elem, this->isIncluded(elem), false, false);394 for (const Identifier* directChild : subclass->getDirectChildren()) 395 this->add(directChild, this->isIncluded(directChild), false, false); 396 396 397 397 this->add(subclass, bInclude, false, clean); … … 435 435 436 436 // Go through the list of subnodes and look for a node containing the searched subclass and delegate the request by a recursive function-call. 437 for ( auto & elem: node->subnodes_)438 if (subclass->isA( (elem)->getClass()))439 return isIncluded( elem, subclass);437 for (ClassTreeMaskNode* subnode : node->subnodes_) 438 if (subclass->isA(subnode->getClass())) 439 return isIncluded(subnode, subclass); 440 440 441 441 // There is no subnode containing our class -> the rule of the current node takes in effect … … 957 957 // The bool is "false", meaning they have no subnodes and therefore need no further checks 958 958 if (node->isIncluded()) 959 for (const auto & elem: directChildren)960 this->subclasses_.insert(this->subclasses_.end(), std::pair<const Identifier*, bool>( elem, false));959 for (const Identifier* directChild : directChildren) 960 this->subclasses_.insert(this->subclasses_.end(), std::pair<const Identifier*, bool>(directChild, false)); 961 961 } 962 962 } -
code/branches/cpp11_v2/src/libraries/core/Core.cc
r10821 r10916 279 279 280 280 const std::vector<std::string>& modulePaths = ApplicationPaths::getInstance().getModulePaths(); 281 for (const auto& modulePath : modulePaths)281 for (const std::string& modulePath : modulePaths) 282 282 { 283 283 ModuleInstance* module = new ModuleInstance(modulePath); … … 309 309 void Core::unloadModules() 310 310 { 311 for (auto module : this->modules_) 312 { 313 311 for (ModuleInstance* module : this->modules_) 312 { 314 313 this->unloadModule(module); 315 314 delete module; -
code/branches/cpp11_v2/src/libraries/core/CoreStaticInitializationHandler.cc
r10821 r10916 99 99 std::set<Identifier*> identifiers; 100 100 const std::set<StaticallyInitializedInstance*>& instances = module->getInstances(StaticInitialization::IDENTIFIER); 101 for ( const auto &instance : instances)101 for (StaticallyInitializedInstance* instance : instances) 102 102 identifiers.insert(&static_cast<StaticallyInitializedIdentifier*>(instance)->getIdentifier()); 103 103 … … 106 106 // that objects within one module may reference each other by strong pointers. but it is not allowed that objects from another 107 107 // module (which is not unloaded) uses strong pointers to point at objects inside the unloaded module. this will lead to a crash. 108 for ( const auto &identifier : identifiers)109 (identifier)->destroyObjects();108 for (Identifier* identifier : identifiers) 109 identifier->destroyObjects(); 110 110 111 111 // check if all objects were really destroyed. this is not the case if an object is referenced by a strong pointer from another 112 112 // module (or if two objects inside this module reference each other). this will lead to a crash and must be fixed (e.g. by 113 113 // changing object dependencies; or by changing the logic that allows modules to be unloaded). 114 for ( const auto &identifier : identifiers)114 for (Identifier* identifier : identifiers) 115 115 { 116 116 ObjectListBase* objectList = Context::getRootContext()->getObjectList(identifier); 117 117 if (objectList->size() > 0) 118 118 { 119 orxout(internal_error) << "There are still " << objectList->size() << " objects of type " << (identifier)->getName()119 orxout(internal_error) << "There are still " << objectList->size() << " objects of type " << identifier->getName() 120 120 << " after unloading the Identifier. This may lead to a crash" << endl; 121 121 } … … 123 123 124 124 // destroy object-lists in all contexts 125 for ( const auto &identifier : identifiers)125 for (Identifier* identifier : identifiers) 126 126 { 127 127 // only do this if the Identifier is not a Context itself; otherwise we delete the list we're iterating over 128 if (! (identifier)->isExactlyA(Class(Context)))128 if (!identifier->isExactlyA(Class(Context))) 129 129 { 130 130 // iterate over all contexts 131 131 for (ObjectList<Context>::iterator it_context = ObjectList<Context>::begin(); it_context != ObjectList<Context>::end(); ++it_context) 132 it_context->destroyObjectList( (identifier));132 it_context->destroyObjectList(identifier); 133 133 } 134 134 } -
code/branches/cpp11_v2/src/libraries/core/Game.cc
r10821 r10916 612 612 // Check if graphics is still required 613 613 bool graphicsRequired = false; 614 for ( auto & elem: loadedStates_)615 graphicsRequired |= elem->getInfo().bGraphicsMode;614 for (const std::shared_ptr<GameState>& state : loadedStates_) 615 graphicsRequired |= state->getInfo().bGraphicsMode; 616 616 if (!graphicsRequired) 617 617 this->unloadGraphics(!this->bAbort_); // if abort is false, that means the game is still running while unloading graphics. in this case we load a graphics manager without renderer (to keep all necessary ogre instances alive) -
code/branches/cpp11_v2/src/libraries/core/Language.cc
r10821 r10916 107 107 Language::~Language() 108 108 { 109 for (auto & elem: this->languageEntries_)110 delete ( elem.second);109 for (auto& mapEntry : this->languageEntries_) 110 delete (mapEntry.second); 111 111 } 112 112 … … 319 319 320 320 // Iterate through the list an write the lines into the file 321 for (const auto & elem: this->languageEntries_)322 { 323 file << elem.second->getLabel() << '=' << elem.second->getDefault() << endl;321 for (const auto& mapEntry : this->languageEntries_) 322 { 323 file << mapEntry.second->getLabel() << '=' << mapEntry.second->getDefault() << endl; 324 324 } 325 325 -
code/branches/cpp11_v2/src/libraries/core/Loader.cc
r10821 r10916 165 165 std::ostringstream message; 166 166 message << "Possible sources of error:" << endl; 167 for ( auto & linesource: linesources)167 for (const std::pair<std::string, size_t>& pair : linesources) 168 168 { 169 message << linesource.first << ", Line " << linesource.second << endl;169 message << pair.first << ", Line " << pair.second << endl; 170 170 } 171 171 orxout(user_error, context::loader) << message.str() << endl; … … 261 261 { 262 262 bool expectedValue = true; 263 for (auto & luaTag: luaTags)264 { 265 if ( luaTag.second == expectedValue)263 for (auto& mapEntry : luaTags) 264 { 265 if (mapEntry.second == expectedValue) 266 266 expectedValue = !expectedValue; 267 267 else -
code/branches/cpp11_v2/src/libraries/core/LuaState.cc
r10852 r10916 326 326 /*static*/ bool LuaState::addToluaInterface(int (*function)(lua_State*), const std::string& name) 327 327 { 328 for (const auto & interface: getToluaInterfaces())329 { 330 if ( interface.first == name || interface.second == function)328 for (const auto& mapEntry : getToluaInterfaces()) 329 { 330 if (mapEntry.first == name || mapEntry.second == function) 331 331 { 332 332 orxout(internal_warning, context::lua) << "Trying to add a Tolua interface with the same name or function." << endl; … … 337 337 338 338 // Open interface in all LuaStates 339 for ( const auto &state : getInstances())339 for (LuaState* state : getInstances()) 340 340 (*function)(state->luaState_); 341 341 … … 354 354 355 355 // Close interface in all LuaStates 356 for ( const auto &state : getInstances())356 for (LuaState* state : getInstances()) 357 357 { 358 358 lua_pushnil(state->luaState_); … … 369 369 /*static*/ void LuaState::openToluaInterfaces(lua_State* state) 370 370 { 371 for (const auto & interface: getToluaInterfaces())372 ( interface.second)(state);371 for (const auto& mapEntry : getToluaInterfaces()) 372 (mapEntry.second)(state); 373 373 } 374 374 375 375 /*static*/ void LuaState::closeToluaInterfaces(lua_State* state) 376 376 { 377 for (const auto & interface: getToluaInterfaces())377 for (const auto& mapEntry : getToluaInterfaces()) 378 378 { 379 379 lua_pushnil(state); 380 lua_setglobal(state, interface.first.c_str());380 lua_setglobal(state, mapEntry.first.c_str()); 381 381 } 382 382 } -
code/branches/cpp11_v2/src/libraries/core/Namespace.cc
r10821 r10916 53 53 { 54 54 if (this->bRoot_) 55 for ( auto & elem: this->representingNamespaces_)56 delete elem;55 for (NamespaceNode* node : this->representingNamespaces_) 56 delete node; 57 57 } 58 58 … … 80 80 for (unsigned int i = 0; i < tokens.size(); i++) 81 81 { 82 for ( auto & elem: this->getNamespace()->representingNamespaces_)82 for (NamespaceNode* node : this->getNamespace()->representingNamespaces_) 83 83 { 84 std::set<NamespaceNode*> temp = elem->getNodeRelative(tokens[i]);84 std::set<NamespaceNode*> temp = node->getNodeRelative(tokens[i]); 85 85 this->representingNamespaces_.insert(temp.begin(), temp.end()); 86 86 } … … 93 93 if (this->bAutogeneratedFileRootNamespace_) 94 94 { 95 for ( auto & elem: this->representingNamespaces_)95 for (NamespaceNode* node : this->representingNamespaces_) 96 96 { 97 elem->setRoot(true);98 elem->setHidden(true);97 node->setRoot(true); 98 node->setHidden(true); 99 99 } 100 100 } … … 114 114 bool Namespace::includes(const Namespace* ns) const 115 115 { 116 for ( const auto & elem1 : this->representingNamespaces_)116 for (NamespaceNode* node1 : this->representingNamespaces_) 117 117 { 118 for ( const auto & elem2 : ns->representingNamespaces_)118 for (NamespaceNode* node2 : ns->representingNamespaces_) 119 119 { 120 if ( elem1->includes(elem2))120 if (node1->includes(node2)) 121 121 { 122 122 if (this->operator_ == "or") … … 149 149 150 150 int i = 0; 151 for ( const auto & elem: this->representingNamespaces_)151 for (NamespaceNode* node : this->representingNamespaces_) 152 152 { 153 153 if (i > 0) 154 154 output += " / "; 155 155 156 output += elem->toString();156 output += node->toString(); 157 157 i++; 158 158 } … … 166 166 167 167 int i = 0; 168 for ( const auto & elem: this->representingNamespaces_)168 for (NamespaceNode* node : this->representingNamespaces_) 169 169 { 170 170 if (i > 0) 171 171 output += '\n'; 172 172 173 output += elem->toString(indentation);173 output += node->toString(indentation); 174 174 i++; 175 175 } -
code/branches/cpp11_v2/src/libraries/core/NamespaceNode.cc
r10821 r10916 103 103 bool bFoundMatchingNamespace = false; 104 104 105 for (auto & elem: this->subnodes_)105 for (auto& mapEntry : this->subnodes_) 106 106 { 107 if ( elem.first.find(firstPart) == (elem.first.size() - firstPart.size()))107 if (mapEntry.first.find(firstPart) == (mapEntry.first.size() - firstPart.size())) 108 108 { 109 std::set<NamespaceNode*> temp2 = elem.second->getNodeRelative(secondPart);109 std::set<NamespaceNode*> temp2 = mapEntry.second->getNodeRelative(secondPart); 110 110 nodes.insert(temp2.begin(), temp2.end()); 111 111 bFoundMatchingNamespace = true; … … 132 132 else 133 133 { 134 for (const auto & elem: this->subnodes_)135 if ( elem.second->includes(ns))134 for (const auto& mapEntry : this->subnodes_) 135 if (mapEntry.second->includes(ns)) 136 136 return true; 137 137 } … … 167 167 std::string output = (indentation + this->name_ + '\n'); 168 168 169 for (const auto & elem: this->subnodes_)170 output += elem.second->toString(indentation + " ");169 for (const auto& mapEntry : this->subnodes_) 170 output += mapEntry.second->toString(indentation + " "); 171 171 172 172 return output; -
code/branches/cpp11_v2/src/libraries/core/Resource.cc
r10821 r10916 58 58 DataStreamListPtr resources(new Ogre::DataStreamList()); 59 59 const Ogre::StringVector& groups = Ogre::ResourceGroupManager::getSingleton().getResourceGroups(); 60 for (const auto& group : groups)60 for (const std::string& group : groups) 61 61 { 62 62 DataStreamListPtr temp = Ogre::ResourceGroupManager::getSingleton().openResources(pattern, group); … … 121 121 StringVectorPtr resourceNames(new Ogre::StringVector()); 122 122 const Ogre::StringVector& groups = Ogre::ResourceGroupManager::getSingleton().getResourceGroups(); 123 for (const auto& group : groups)123 for (const std::string& group : groups) 124 124 { 125 125 StringVectorPtr temp = Ogre::ResourceGroupManager::getSingleton().findResourceNames(group, pattern); -
code/branches/cpp11_v2/src/libraries/core/class/Identifier.cc
r10821 r10916 87 87 for (std::list<const Identifier*>::const_iterator it = this->directParents_.begin(); it != this->directParents_.end(); ++it) 88 88 const_cast<Identifier*>(*it)->directChildren_.erase(this); 89 for (const auto & elem: this->children_)90 const_cast<Identifier*>( elem)->parents_.remove(this);91 for (const auto & elem: this->directChildren_)92 const_cast<Identifier*>( elem)->directParents_.remove(this);93 94 for (auto & elem: this->configValues_)95 delete ( elem.second);96 for (auto & elem: this->xmlportParamContainers_)97 delete ( elem.second);98 for (auto & elem: this->xmlportObjectContainers_)99 delete ( elem.second);89 for (const Identifier* child : this->children_) 90 const_cast<Identifier*>(child)->parents_.remove(this); 91 for (const Identifier* directChild : this->directChildren_) 92 const_cast<Identifier*>(directChild)->directParents_.remove(this); 93 94 for (auto& mapEntry : this->configValues_) 95 delete (mapEntry.second); 96 for (auto& mapEntry : this->xmlportParamContainers_) 97 delete (mapEntry.second); 98 for (auto& mapEntry : this->xmlportObjectContainers_) 99 delete (mapEntry.second); 100 100 } 101 101 … … 157 157 if (this->directParents_.empty()) 158 158 { 159 for (const auto & elem: initializationTrace)160 if ( elem!= this)161 this->parents_.push_back( elem);159 for (const Identifier* identifier : initializationTrace) 160 if (identifier != this) 161 this->parents_.push_back(identifier); 162 162 } 163 163 else … … 261 261 262 262 // if any parent class is virtual, it will be instantiated first, so we need to add them first. 263 for (const auto & elem: this->parents_)264 { 265 if ( (elem)->isVirtualBase())263 for (const Identifier* parent : this->parents_) 264 { 265 if (parent->isVirtualBase()) 266 266 { 267 for (std::list<const Identifier*>::const_iterator it_parent_parent = const_cast<Identifier*>( elem)->parents_.begin(); it_parent_parent != const_cast<Identifier*>(elem)->parents_.end(); ++it_parent_parent)267 for (std::list<const Identifier*>::const_iterator it_parent_parent = const_cast<Identifier*>(parent)->parents_.begin(); it_parent_parent != const_cast<Identifier*>(parent)->parents_.end(); ++it_parent_parent) 268 268 this->addIfNotExists(expectedIdentifierTrace, *it_parent_parent); 269 this->addIfNotExists(expectedIdentifierTrace, elem);269 this->addIfNotExists(expectedIdentifierTrace, parent); 270 270 } 271 271 } 272 272 273 273 // now all direct parents get created recursively. already added identifiers (e.g. virtual base classes) are not added again. 274 for (const auto & elem: this->directParents_)275 { 276 for (std::list<const Identifier*>::const_iterator it_parent_parent = const_cast<Identifier*>( elem)->parents_.begin(); it_parent_parent != const_cast<Identifier*>(elem)->parents_.end(); ++it_parent_parent)274 for (const Identifier* directParent : this->directParents_) 275 { 276 for (std::list<const Identifier*>::const_iterator it_parent_parent = const_cast<Identifier*>(directParent)->parents_.begin(); it_parent_parent != const_cast<Identifier*>(directParent)->parents_.end(); ++it_parent_parent) 277 277 this->addIfNotExists(expectedIdentifierTrace, *it_parent_parent); 278 this->addIfNotExists(expectedIdentifierTrace, elem);278 this->addIfNotExists(expectedIdentifierTrace, directParent); 279 279 } 280 280 … … 285 285 286 286 orxout(internal_warning) << " Actual trace (after creating a sample instance):" << endl << " "; 287 for (const auto & elem: this->parents_)288 orxout(internal_warning) << " " << (elem)->getName();287 for (const Identifier* parent : this->parents_) 288 orxout(internal_warning) << " " << parent->getName(); 289 289 orxout(internal_warning) << endl; 290 290 … … 295 295 296 296 orxout(internal_warning) << " Direct parents (according to class hierarchy definitions):" << endl << " "; 297 for (const auto & elem: this->directParents_)298 orxout(internal_warning) << " " << (elem)->getName();297 for (const Identifier* directParent : this->directParents_) 298 orxout(internal_warning) << " " << directParent->getName(); 299 299 orxout(internal_warning) << endl; 300 300 } -
code/branches/cpp11_v2/src/libraries/core/class/Identifier.h
r10821 r10916 462 462 463 463 if (updateChildren) 464 for (const auto & elem: this->getChildren())465 (elem)->updateConfigValues(false);464 for (const Identifier* child : this->getChildren()) 465 child->updateConfigValues(false); 466 466 } 467 467 -
code/branches/cpp11_v2/src/libraries/core/class/IdentifierManager.cc
r10821 r10916 93 93 { 94 94 Context temporaryContext(nullptr); 95 for ( autoidentifier : this->identifiers_)95 for (Identifier* identifier : this->identifiers_) 96 96 { 97 98 97 if (identifier->isInitialized()) 99 98 continue; … … 127 126 128 127 // finish the initialization of all identifiers 129 for ( const auto &initializedIdentifier : initializedIdentifiers)130 (initializedIdentifier)->finishInitialization();128 for (Identifier* initializedIdentifier : initializedIdentifiers) 129 initializedIdentifier->finishInitialization(); 131 130 132 131 // only check class hierarchy in dev mode because it's an expensive operation and it requires a developer to fix detected problems anyway. … … 144 143 { 145 144 // check if there are any uninitialized identifiers remaining 146 for ( const auto & elem: this->identifiers_)147 if (! (elem)->isInitialized())148 orxout(internal_error) << "Identifier was registered late and is not initialized: " << (elem)->getName() << " / " << (elem)->getTypeInfo().name() << endl;145 for (Identifier* identifier : this->identifiers_) 146 if (!identifier->isInitialized()) 147 orxout(internal_error) << "Identifier was registered late and is not initialized: " << identifier->getName() << " / " << identifier->getTypeInfo().name() << endl; 149 148 150 149 // for all initialized identifiers, check if a sample instance behaves as expected according to the class hierarchy 151 150 Context temporaryContext(nullptr); 152 for ( const auto &initializedIdentifier : initializedIdentifiers)151 for (Identifier* initializedIdentifier : initializedIdentifiers) 153 152 { 154 if (! (initializedIdentifier)->hasFactory())153 if (!initializedIdentifier->hasFactory()) 155 154 continue; 156 155 157 Identifiable* temp = (initializedIdentifier)->fabricate(&temporaryContext);158 159 for ( const auto & elem: this->identifiers_)156 Identifiable* temp = initializedIdentifier->fabricate(&temporaryContext); 157 158 for (Identifier* identifier : this->identifiers_) 160 159 { 161 bool isA_AccordingToRtti = (elem)->canDynamicCastObjectToIdentifierClass(temp);162 bool isA_AccordingToClassHierarchy = temp->isA( (elem));160 bool isA_AccordingToRtti = identifier->canDynamicCastObjectToIdentifierClass(temp); 161 bool isA_AccordingToClassHierarchy = temp->isA(identifier); 163 162 164 163 if (isA_AccordingToRtti != isA_AccordingToClassHierarchy) 165 164 { 166 orxout(internal_error) << "Class hierarchy does not match RTTI: Class hierarchy claims that " << (initializedIdentifier)->getName() <<167 (isA_AccordingToClassHierarchy ? " is a " : " is not a ") << (elem)->getName() << " but RTTI says the opposite." << endl;165 orxout(internal_error) << "Class hierarchy does not match RTTI: Class hierarchy claims that " << initializedIdentifier->getName() << 166 (isA_AccordingToClassHierarchy ? " is a " : " is not a ") << identifier->getName() << " but RTTI says the opposite." << endl; 168 167 } 169 168 } … … 184 183 { 185 184 orxout(internal_status) << "Destroy class-hierarchy" << endl; 186 for ( const auto & elem: this->identifiers_)187 (elem)->reset();185 for (Identifier* identifier : this->identifiers_) 186 identifier->reset(); 188 187 } 189 188 … … 260 259 { 261 260 // TODO: use std::type_index and a map to find identifiers by type_info (only with c++11) 262 for ( const auto & elem: this->identifiers_)263 if ( (elem)->getTypeInfo() == typeInfo)264 return (elem);261 for (Identifier* identifer : this->identifiers_) 262 if (identifer->getTypeInfo() == typeInfo) 263 return identifer; 265 264 return nullptr; 266 265 } -
code/branches/cpp11_v2/src/libraries/core/command/ArgumentCompletionFunctions.cc
r10821 r10916 77 77 bool groupIsVisible(const std::map<std::string, ConsoleCommand*>& group, bool bOnlyShowHidden) 78 78 { 79 for (const auto & elem: group)80 if ( elem.second->isActive() && elem.second->hasAccess() && (!elem.second->isHidden())^bOnlyShowHidden)79 for (const auto& mapEntry : group) 80 if (mapEntry.second->isActive() && mapEntry.second->hasAccess() && (!mapEntry.second->isHidden())^bOnlyShowHidden) 81 81 return true; 82 82 … … 100 100 // get all the groups that are visible (except the shortcut group "") 101 101 const std::map<std::string, std::map<std::string, ConsoleCommand*>>& commands = ConsoleCommandManager::getInstance().getCommands(); 102 for (const auto & command: commands)103 if (groupIsVisible( command.second, bOnlyShowHidden) && command.first != "" && (fragmentLC == "" || getLowercase(command.first).find(fragmentLC) == 0))104 groupList.push_back(ArgumentCompletionListElement( command.first, getLowercase(command.first)));102 for (const auto& mapEntry : commands) 103 if (groupIsVisible(mapEntry.second, bOnlyShowHidden) && mapEntry.first != "" && (fragmentLC == "" || getLowercase(mapEntry.first).find(fragmentLC) == 0)) 104 groupList.push_back(ArgumentCompletionListElement(mapEntry.first, getLowercase(mapEntry.first))); 105 105 106 106 // now add all shortcuts (in group "") … … 113 113 114 114 // add the shortcuts 115 for (const auto & elem: it_group->second)116 if ( elem.second->isActive() && elem.second->hasAccess() && (!elem.second->isHidden())^bOnlyShowHidden && (fragmentLC == "" || getLowercase(elem.first).find(fragmentLC) == 0))117 groupList.push_back(ArgumentCompletionListElement( elem.first, getLowercase(elem.first)));115 for (const auto& mapEntry : it_group->second) 116 if (mapEntry.second->isActive() && mapEntry.second->hasAccess() && (!mapEntry.second->isHidden())^bOnlyShowHidden && (fragmentLC == "" || getLowercase(mapEntry.first).find(fragmentLC) == 0)) 117 groupList.push_back(ArgumentCompletionListElement(mapEntry.first, getLowercase(mapEntry.first))); 118 118 } 119 119 … … 146 146 if (it_group != ConsoleCommandManager::getInstance().getCommands().end()) 147 147 { 148 for (const auto & elem: it_group->second)149 if ( elem.second->isActive() && elem.second->hasAccess() && (!elem.second->isHidden())^bOnlyShowHidden)150 commandList.push_back(ArgumentCompletionListElement( elem.first, getLowercase(elem.first)));148 for (const auto& mapEntry : it_group->second) 149 if (mapEntry.second->isActive() && mapEntry.second->hasAccess() && (!mapEntry.second->isHidden())^bOnlyShowHidden) 150 commandList.push_back(ArgumentCompletionListElement(mapEntry.first, getLowercase(mapEntry.first))); 151 151 } 152 152 … … 281 281 282 282 const std::set<std::string>& names = SettingsConfigFile::getInstance().getSectionNames(); 283 for (const auto& name : names)283 for (const std::string& name : names) 284 284 sectionList.push_back(ArgumentCompletionListElement(name, getLowercase(name))); 285 285 -
code/branches/cpp11_v2/src/libraries/core/command/CommandEvaluation.cc
r10821 r10916 306 306 // the user typed 1-2 arguments, check what he tried to type and print a suitable error 307 307 std::string groupLC = getLowercase(this->getToken(0)); 308 for (const auto & elem: ConsoleCommandManager::getInstance().getCommandsLC())309 if ( elem.first == groupLC)308 for (const auto& mapEntry : ConsoleCommandManager::getInstance().getCommandsLC()) 309 if (mapEntry.first == groupLC) 310 310 return std::string("Error: There is no command in group \"") + this->getToken(0) + "\" starting with \"" + this->getToken(1) + "\"."; 311 311 … … 328 328 329 329 // iterate through all groups and their commands and calculate the distance to the current command. keep the best. 330 for (const auto & elem: ConsoleCommandManager::getInstance().getCommandsLC())331 { 332 if ( elem.first != "")333 { 334 for (std::map<std::string, ConsoleCommand*>::const_iterator it_name = elem.second.begin(); it_name != elem.second.end(); ++it_name)335 { 336 std::string command = elem.first + " " + it_name->first;330 for (const auto& mapEntry : ConsoleCommandManager::getInstance().getCommandsLC()) 331 { 332 if (mapEntry.first != "") 333 { 334 for (std::map<std::string, ConsoleCommand*>::const_iterator it_name = mapEntry.second.begin(); it_name != mapEntry.second.end(); ++it_name) 335 { 336 std::string command = mapEntry.first + " " + it_name->first; 337 337 unsigned int distance = getLevenshteinDistance(command, token0_LC + " " + token1_LC); 338 338 if (distance < nearestDistance) … … 349 349 if (it_group != ConsoleCommandManager::getInstance().getCommandsLC().end()) 350 350 { 351 for (const auto & elem: it_group->second)352 { 353 std::string command = elem.first;351 for (const auto& mapEntry : it_group->second) 352 { 353 std::string command = mapEntry.first; 354 354 unsigned int distance = getLevenshteinDistance(command, token0_LC); 355 355 if (distance < nearestDistance) … … 429 429 { 430 430 size_t count = 0; 431 for (const auto & elem: list)432 if (elem .getComparable() != "")431 for (const ArgumentCompletionListElement& element : list) 432 if (element.getComparable() != "") 433 433 ++count; 434 434 return count; … … 495 495 { 496 496 // only one (non-empty) value in the list - search it and return it 497 for (const auto & elem: list)498 { 499 if (elem .getComparable() != "")497 for (const ArgumentCompletionListElement& element : list) 498 { 499 if (element.getComparable() != "") 500 500 { 501 501 // arguments that have a separate string to be displayed need a little more care - just return them without modification. add a space character to the others. 502 if (elem .hasDisplay())503 return (elem .getString());502 if (element.hasDisplay()) 503 return (element.getString()); 504 504 else 505 return (elem .getString() + ' ');505 return (element.getString() + ' '); 506 506 } 507 507 } … … 517 517 char tempComparable = '\0'; 518 518 char temp = '\0'; 519 for (const auto & elem: list)520 { 521 const std::string& argumentComparable = elem .getComparable();522 const std::string& argument = elem .getString();519 for (const ArgumentCompletionListElement& element : list) 520 { 521 const std::string& argumentComparable = element.getComparable(); 522 const std::string& argument = element.getString(); 523 523 524 524 // ignore empty arguments … … 560 560 { 561 561 std::string output; 562 for (const auto & elem: list)563 { 564 output += elem .getDisplay();562 for (const ArgumentCompletionListElement& element : list) 563 { 564 output += element.getDisplay(); 565 565 566 566 // add a space character between two elements for all non-empty arguments 567 if (elem .getComparable() != "")567 if (element.getComparable() != "") 568 568 output += ' '; 569 569 } -
code/branches/cpp11_v2/src/libraries/core/command/ConsoleCommand.cc
r10825 r10916 75 75 this->baseFunctor_ = executor->getFunctor(); 76 76 77 for ( auto & elem: this->argumentCompleter_)78 elem= nullptr;77 for (ArgumentCompleter*& completer : this->argumentCompleter_) 78 completer = nullptr; 79 79 80 80 this->keybindMode_ = KeybindMode::OnPress; -
code/branches/cpp11_v2/src/libraries/core/command/Shell.cc
r10821 r10916 258 258 vectorize(text, '\n', &lines); 259 259 260 for ( auto& line : lines)260 for (const std::string& line : lines) 261 261 this->addLine(line, type); 262 262 } -
code/branches/cpp11_v2/src/libraries/core/command/TclThreadList.h
r10821 r10916 262 262 boost::shared_lock<boost::shared_mutex> lock(this->mutex_); 263 263 264 for (const auto & elem: this->list_)265 if (elem == value)264 for (const T& element : this->list_) 265 if (element == value) 266 266 return true; 267 267 -
code/branches/cpp11_v2/src/libraries/core/command/TclThreadManager.cc
r10821 r10916 551 551 552 552 std::list<unsigned int> threads; 553 for (const auto & elem: this->interpreterBundles_)554 if ( elem.first > 0 && elem.first <= this->numInterpreterBundles_) // only list autonumbered interpreters (created with create()) - exclude the default interpreter 0 and all manually numbered interpreters)555 threads.push_back( elem.first);553 for (const auto& mapEntry : this->interpreterBundles_) 554 if (mapEntry.first > 0 && mapEntry.first <= this->numInterpreterBundles_) // only list autonumbered interpreters (created with create()) - exclude the default interpreter 0 and all manually numbered interpreters) 555 threads.push_back(mapEntry.first); 556 556 return threads; 557 557 } -
code/branches/cpp11_v2/src/libraries/core/commandline/CommandLineParser.cc
r10821 r10916 124 124 std::string shortcut; 125 125 std::string value; 126 for ( auto& argument : arguments)126 for (const std::string& argument : arguments) 127 127 { 128 128 if (argument.size() != 0) -
code/branches/cpp11_v2/src/libraries/core/config/ConfigFile.cc
r10821 r10916 234 234 } 235 235 236 for ( const auto & elem: this->sections_)237 { 238 file << (elem)->getFileEntry() << endl;239 240 for (std::list<ConfigFileEntry*>::const_iterator it_entries = (elem)->getEntriesBegin(); it_entries != (elem)->getEntriesEnd(); ++it_entries)236 for (ConfigFileSection* section : this->sections_) 237 { 238 file << section->getFileEntry() << endl; 239 240 for (std::list<ConfigFileEntry*>::const_iterator it_entries = section->getEntriesBegin(); it_entries != section->getEntriesEnd(); ++it_entries) 241 241 file << (*it_entries)->getFileEntry() << endl; 242 242 … … 278 278 @brief Returns a pointer to the section with given name (or nullptr if the section doesn't exist). 279 279 */ 280 ConfigFileSection* ConfigFile::getSection(const std::string& section ) const281 { 282 for ( const auto & elem: this->sections_)283 if ( (elem)->getName() == section)284 return (elem);280 ConfigFileSection* ConfigFile::getSection(const std::string& sectionName) const 281 { 282 for (ConfigFileSection* section : this->sections_) 283 if (section->getName() == sectionName) 284 return section; 285 285 return nullptr; 286 286 } … … 289 289 @brief Returns a pointer to the section with given name. If it doesn't exist, the section is created. 290 290 */ 291 ConfigFileSection* ConfigFile::getOrCreateSection(const std::string& section )292 { 293 for ( auto & elem: this->sections_)294 if ( (elem)->getName() == section)295 return (elem);291 ConfigFileSection* ConfigFile::getOrCreateSection(const std::string& sectionName) 292 { 293 for (ConfigFileSection* section : this->sections_) 294 if (section->getName() == sectionName) 295 return section; 296 296 297 297 this->bUpdated_ = true; 298 298 299 return (*this->sections_.insert(this->sections_.end(), new ConfigFileSection(section )));299 return (*this->sections_.insert(this->sections_.end(), new ConfigFileSection(sectionName))); 300 300 } 301 301 … … 307 307 bool sectionsUpdated = false; 308 308 309 for ( auto & elem: this->sections_)310 { 311 if ( (elem)->bUpdated_)309 for (ConfigFileSection* section : this->sections_) 310 { 311 if (section->bUpdated_) 312 312 { 313 313 sectionsUpdated = true; 314 (elem)->bUpdated_ = false;314 section->bUpdated_ = false; 315 315 } 316 316 } -
code/branches/cpp11_v2/src/libraries/core/config/ConfigFileManager.cc
r10821 r10916 53 53 ConfigFileManager::~ConfigFileManager() 54 54 { 55 for ( const auto & elem: this->configFiles_)56 if ( elem)57 delete (elem);55 for (ConfigFile* configFile : this->configFiles_) 56 if (configFile) 57 delete configFile; 58 58 } 59 59 -
code/branches/cpp11_v2/src/libraries/core/config/ConfigFileSection.cc
r10821 r10916 80 80 { 81 81 unsigned int size = 0; 82 for ( const auto & elem: this->entries_)83 if ( (elem)->getName() == name)84 if ( (elem)->getIndex() >= size)85 size = (elem)->getIndex() + 1;82 for (ConfigFileEntry* entry : this->entries_) 83 if (entry->getName() == name) 84 if (entry->getIndex() >= size) 85 size = entry->getIndex() + 1; 86 86 return size; 87 87 } … … 105 105 ConfigFileEntry* ConfigFileSection::getEntry(const std::string& name) const 106 106 { 107 for ( const auto & elem: this->entries_)107 for (ConfigFileEntry* entry : this->entries_) 108 108 { 109 if ( (elem)->getName() == name)110 return e lem;109 if (entry->getName() == name) 110 return entry; 111 111 } 112 112 return nullptr; … … 121 121 ConfigFileEntry* ConfigFileSection::getEntry(const std::string& name, unsigned int index) const 122 122 { 123 for ( const auto & elem: this->entries_)123 for (ConfigFileEntry* entry : this->entries_) 124 124 { 125 if (( (elem)->getName() == name) && ((elem)->getIndex() == index))126 return e lem;125 if ((entry->getName() == name) && (entry->getIndex() == index)) 126 return entry; 127 127 } 128 128 return nullptr; -
code/branches/cpp11_v2/src/libraries/core/config/ConfigValueContainer.h
r10845 r10916 130 130 131 131 this->value_ = V(); 132 for ( auto & elem: defvalue)133 this->valueVector_.push_back(MultiType( elem));132 for (const D& defvalueElement : defvalue) 133 this->valueVector_.push_back(MultiType(defvalueElement)); 134 134 135 135 this->initVector(); … … 183 183 std::vector<T> temp = *value; 184 184 value->clear(); 185 for ( auto & elem: this->valueVector_)186 value->push_back( elem);185 for (const MultiType& vectorEntry : this->valueVector_) 186 value->push_back(vectorEntry); 187 187 188 188 if (value->size() != temp.size()) … … 211 211 { 212 212 value->clear(); 213 for ( auto & elem: this->valueVector_)214 value->push_back( elem);213 for (const MultiType& vectorEntry : this->valueVector_) 214 value->push_back(vectorEntry); 215 215 } 216 216 return *this; -
code/branches/cpp11_v2/src/libraries/core/input/Button.cc
r10821 r10916 196 196 197 197 // add command to the buffer if not yet existing 198 for ( auto & elem: *paramCommandBuffer_)199 { 200 if ( elem->evaluation_.getConsoleCommand()198 for (BufferedParamCommand* command : *paramCommandBuffer_) 199 { 200 if (command->evaluation_.getConsoleCommand() 201 201 == eval.getConsoleCommand()) 202 202 { 203 203 // already in list 204 cmd->paramCommand_ = elem;204 cmd->paramCommand_ = command; 205 205 break; 206 206 } -
code/branches/cpp11_v2/src/libraries/core/input/InputBuffer.cc
r10821 r10916 110 110 void InputBuffer::insert(const std::string& input, bool update) 111 111 { 112 for ( auto & elem: input)113 { 114 this->insert( elem, false);112 for (const char& inputChar : input) 113 { 114 this->insert(inputChar, false); 115 115 116 116 if (update) 117 this->updated( elem, false);117 this->updated(inputChar, false); 118 118 } 119 119 … … 170 170 void InputBuffer::updated() 171 171 { 172 for ( auto & elem: this->listeners_)173 { 174 if ( (elem)->bListenToAllChanges_)175 (elem)->callFunction();172 for (BaseInputBufferListenerTuple* listener : this->listeners_) 173 { 174 if (listener->bListenToAllChanges_) 175 listener->callFunction(); 176 176 } 177 177 } … … 179 179 void InputBuffer::updated(const char& update, bool bSingleInput) 180 180 { 181 for ( auto & elem: this->listeners_)182 { 183 if ((! (elem)->trueKeyFalseChar_) && ((elem)->bListenToAllChanges_ || ((elem)->char_ == update)) && (!(elem)->bOnlySingleInput_ || bSingleInput))184 (elem)->callFunction();181 for (BaseInputBufferListenerTuple* listener : this->listeners_) 182 { 183 if ((!listener->trueKeyFalseChar_) && (listener->bListenToAllChanges_ || (listener->char_ == update)) && (!listener->bOnlySingleInput_ || bSingleInput)) 184 listener->callFunction(); 185 185 } 186 186 } … … 201 201 return; 202 202 203 for ( auto & elem: this->listeners_)204 { 205 if ( (elem)->trueKeyFalseChar_ && ((elem)->key_ == evt.getKeyCode()))206 (elem)->callFunction();203 for (BaseInputBufferListenerTuple* listener : this->listeners_) 204 { 205 if (listener->trueKeyFalseChar_ && (listener->key_ == evt.getKeyCode())) 206 listener->callFunction(); 207 207 } 208 208 -
code/branches/cpp11_v2/src/libraries/core/input/InputDevice.h
r10845 r10916 158 158 159 159 // Call all the states with the held button event 160 for ( auto& button : pressedButtons_)161 for ( auto &state : inputStates_)160 for (ButtonType& button : pressedButtons_) 161 for (InputState* state : inputStates_) 162 162 state->template buttonEvent<ButtonEvent::THold, typename Traits::ButtonTypeParam>( 163 163 this->getDeviceID(), static_cast<DeviceClass*>(this)->getButtonEventArg(button)); 164 164 165 165 // Call states with device update events 166 for ( auto & elem: inputStates_)167 elem->update(time.getDeltaTime(), this->getDeviceID());166 for (InputState* state : inputStates_) 167 state->update(time.getDeltaTime(), this->getDeviceID()); 168 168 169 169 static_cast<DeviceClass*>(this)->updateImpl(time); … … 196 196 197 197 // Call states 198 for ( auto & elem: inputStates_)199 elem->template buttonEvent<ButtonEvent::TPress, typename Traits::ButtonTypeParam>(this->getDeviceID(), static_cast<DeviceClass*>(this)->getButtonEventArg(button));198 for (InputState* state : inputStates_) 199 state->template buttonEvent<ButtonEvent::TPress, typename Traits::ButtonTypeParam>(this->getDeviceID(), static_cast<DeviceClass*>(this)->getButtonEventArg(button)); 200 200 } 201 201 … … 218 218 219 219 // Call states 220 for ( auto & elem: inputStates_)221 elem->template buttonEvent<ButtonEvent::TRelease, typename Traits::ButtonTypeParam>(this->getDeviceID(), static_cast<DeviceClass*>(this)->getButtonEventArg(button));220 for (InputState* state : inputStates_) 221 state->template buttonEvent<ButtonEvent::TRelease, typename Traits::ButtonTypeParam>(this->getDeviceID(), static_cast<DeviceClass*>(this)->getButtonEventArg(button)); 222 222 } 223 223 -
code/branches/cpp11_v2/src/libraries/core/input/InputManager.cc
r10821 r10916 373 373 // check whether a state has changed its EMPTY situation 374 374 bool bUpdateRequired = false; 375 for (auto & elem: activeStates_)376 { 377 if ( elem.second->hasExpired())378 { 379 elem.second->resetExpiration();375 for (auto& mapEntry : activeStates_) 376 { 377 if (mapEntry.second->hasExpired()) 378 { 379 mapEntry.second->resetExpiration(); 380 380 bUpdateRequired = true; 381 381 } … … 391 391 392 392 // Collect function calls for the update 393 for ( auto & elem: activeStatesTicked_)394 elem->update(time.getDeltaTime());393 for (InputState* state : activeStatesTicked_) 394 state->update(time.getDeltaTime()); 395 395 396 396 // Execute all cached function calls in order … … 401 401 // If we delay the calls, then OIS and and the InputStates are not anymore 402 402 // in the call stack and can therefore be edited. 403 for (auto & elem: this->callBuffer_)404 elem();403 for (auto& function : this->callBuffer_) 404 function(); 405 405 406 406 this->callBuffer_.clear(); … … 437 437 // Using an std::set to avoid duplicates 438 438 std::set<InputState*> tempSet; 439 for ( auto & elem: devices_)440 if ( elem!= nullptr)441 for (unsigned int iState = 0; iState < elem->getStateListRef().size(); ++iState)442 tempSet.insert( elem->getStateListRef()[iState]);439 for (InputDevice* device : devices_) 440 if (device != nullptr) 441 for (unsigned int iState = 0; iState < device->getStateListRef().size(); ++iState) 442 tempSet.insert(device->getStateListRef()[iState]); 443 443 444 444 // Copy the content of the std::set back to the actual vector 445 445 activeStatesTicked_.clear(); 446 for ( const auto & elem: tempSet)447 activeStatesTicked_.push_back( elem);446 for (InputState* state : tempSet) 447 activeStatesTicked_.push_back(state); 448 448 449 449 // Check whether we have to change the mouse mode -
code/branches/cpp11_v2/src/libraries/core/input/JoyStick.cc
r10821 r10916 186 186 void JoyStick::clearBuffersImpl() 187 187 { 188 for ( auto & elem: povStates_)189 elem= 0;188 for (int& state : povStates_) 189 state = 0; 190 190 } 191 191 -
code/branches/cpp11_v2/src/libraries/core/input/KeyBinder.cc
r10821 r10916 153 153 void KeyBinder::buttonThresholdChanged() 154 154 { 155 for ( auto & elem: allHalfAxes_)156 if (! elem->bButtonThresholdUser_)157 elem->buttonThreshold_ = this->buttonThreshold_;155 for (HalfAxis* halfAxis : allHalfAxes_) 156 if (!halfAxis->bButtonThresholdUser_) 157 halfAxis->buttonThreshold_ = this->buttonThreshold_; 158 158 } 159 159 … … 383 383 it->second->clear(); 384 384 385 for ( auto & elem: paramCommandBuffer_)386 delete elem;385 for (BufferedParamCommand* command : paramCommandBuffer_) 386 delete command; 387 387 paramCommandBuffer_.clear(); 388 388 } … … 394 394 { 395 395 // iterate over all buttons 396 for (const auto & elem: this->allButtons_)397 { 398 Button* button = elem.second;396 for (const auto& mapEntry : this->allButtons_) 397 { 398 Button* button = mapEntry.second; 399 399 400 400 // iterate over all modes … … 465 465 this->mousePosition_[1] = 0.0f; 466 466 467 for ( auto & elem: mouseAxes_)468 elem.reset();467 for (HalfAxis& axis : mouseAxes_) 468 axis.reset(); 469 469 } 470 470 … … 505 505 } 506 506 507 for ( auto & elem: mouseAxes_)507 for (HalfAxis& axis : mouseAxes_) 508 508 { 509 509 // Why dividing relative value by dt? The reason lies in the simple fact, that when you … … 515 515 { 516 516 // just ignore if dt == 0.0 because we have multiplied by 0.0 anyway.. 517 elem.relVal_ /= dt;518 } 519 520 tickHalfAxis( elem);517 axis.relVal_ /= dt; 518 } 519 520 tickHalfAxis(axis); 521 521 } 522 522 } -
code/branches/cpp11_v2/src/libraries/core/input/KeyBinder.h
r10845 r10916 226 226 { 227 227 // execute all buffered bindings (additional parameter) 228 for ( auto & elem: paramCommandBuffer_)228 for (BufferedParamCommand* command : paramCommandBuffer_) 229 229 { 230 elem->rel_ *= dt;231 elem->execute();230 command->rel_ *= dt; 231 command->execute(); 232 232 } 233 233 234 234 // always reset the relative movement of the mouse 235 for ( auto & elem: mouseAxes_)236 elem.relVal_ = 0.0f;235 for (HalfAxis& axis : mouseAxes_) 236 axis.relVal_ = 0.0f; 237 237 } 238 238 }// tolua_export -
code/branches/cpp11_v2/src/libraries/core/input/Mouse.cc
r10821 r10916 82 82 IntVector2 rel(e.state.X.rel, e.state.Y.rel); 83 83 IntVector2 clippingSize(e.state.width, e.state.height); 84 for ( auto & elem: inputStates_)85 elem->mouseMoved(abs, rel, clippingSize);84 for (InputState* state : inputStates_) 85 state->mouseMoved(abs, rel, clippingSize); 86 86 } 87 87 … … 89 89 if (e.state.Z.rel != 0) 90 90 { 91 for ( auto & elem: inputStates_)92 elem->mouseScrolled(e.state.Z.abs, e.state.Z.rel);91 for (InputState* state : inputStates_) 92 state->mouseScrolled(e.state.Z.abs, e.state.Z.rel); 93 93 } 94 94 -
code/branches/cpp11_v2/src/libraries/core/module/DynLibManager.cc
r10821 r10916 75 75 { 76 76 // Unload & delete resources in turn 77 for (auto & elem: mLibList)77 for (auto& mapEntry : mLibList) 78 78 { 79 elem.second->unload();80 delete elem.second;79 mapEntry.second->unload(); 80 delete mapEntry.second; 81 81 } 82 82 -
code/branches/cpp11_v2/src/libraries/core/module/ModuleInstance.cc
r10821 r10916 59 59 { 60 60 const std::set<StaticallyInitializedInstance*>& instances = this->staticallyInitializedInstancesByType_[type]; 61 for ( const auto &instance : instances)62 (instance)->load();61 for (StaticallyInitializedInstance* instance : instances) 62 instance->load(); 63 63 } 64 64 … … 75 75 std::map<StaticInitialization::Type, std::set<StaticallyInitializedInstance*>> copy(this->staticallyInitializedInstancesByType_); 76 76 this->staticallyInitializedInstancesByType_.clear(); 77 for (auto & elem: copy)78 for (std::set<StaticallyInitializedInstance*>::iterator it2 = elem.second.begin(); it2 != elem.second.end(); ++it2)77 for (auto& mapEntry : copy) 78 for (std::set<StaticallyInitializedInstance*>::iterator it2 = mapEntry.second.begin(); it2 != mapEntry.second.end(); ++it2) 79 79 delete (*it2); 80 80 } -
code/branches/cpp11_v2/src/libraries/core/module/PluginManager.cc
r10821 r10916 59 59 ModifyConsoleCommand("PluginManager", __CC_PluginManager_unload_name).setObject(nullptr); 60 60 61 for (auto & elem: this->references_)62 delete elem.second;63 for (auto & elem: this->plugins_)64 delete elem.second;61 for (auto& mapEntry : this->references_) 62 delete mapEntry.second; 63 for (auto& mapEntry : this->plugins_) 64 delete mapEntry.second; 65 65 } 66 66 … … 68 68 { 69 69 const std::vector<std::string>& pluginPaths = ApplicationPaths::getInstance().getPluginPaths(); 70 for ( autolibraryName : pluginPaths)70 for (const std::string& libraryName : pluginPaths) 71 71 { 72 72 std::string name; 73 74 73 std::string filename = libraryName + + specialConfig::pluginExtension; 75 74 std::ifstream infile(filename.c_str()); -
code/branches/cpp11_v2/src/libraries/core/module/StaticInitializationManager.cc
r10821 r10916 50 50 { 51 51 // attention: loading a module may add new handlers to the list 52 for ( auto & elem: this->handlers_)53 (elem)->loadModule(module);52 for (StaticInitializationHandler* handler : this->handlers_) 53 handler->loadModule(module); 54 54 } 55 55 -
code/branches/cpp11_v2/src/libraries/core/object/Context.cc
r10821 r10916 70 70 // unregister context from object lists before object lists are destroyed 71 71 this->unregisterObject(); 72 for ( auto & elem: this->objectLists_)73 delete elem;72 for (ObjectListBase* objectList : this->objectLists_) 73 delete objectList; 74 74 } 75 75 -
code/branches/cpp11_v2/src/libraries/core/object/Listable.cc
r10821 r10916 76 76 void Listable::unregisterObject() 77 77 { 78 for ( auto & elem: this->elements_)79 Listable::deleteObjectListElement(elem );78 for (ObjectListBaseElement* element : this->elements_) 79 Listable::deleteObjectListElement(element); 80 80 this->elements_.clear(); 81 81 } … … 91 91 this->elements_.clear(); 92 92 93 for ( auto & elem: copy)93 for (ObjectListBaseElement* element : copy) 94 94 { 95 elem ->changeContext(this->context_, context);96 Listable::deleteObjectListElement(elem );95 element->changeContext(this->context_, context); 96 Listable::deleteObjectListElement(element); 97 97 } 98 98 -
code/branches/cpp11_v2/src/libraries/core/object/ObjectListBase.cc
r10821 r10916 92 92 void ObjectListBase::notifyRemovalListeners(ObjectListBaseElement* element) const 93 93 { 94 for ( const auto & elem: this->listeners_)95 (elem)->removedElement(element);94 for (ObjectListElementRemovalListener* listener : this->listeners_) 95 listener->removedElement(element); 96 96 } 97 97 -
code/branches/cpp11_v2/src/libraries/core/singleton/ScopeManager.cc
r10821 r10916 73 73 void ScopeManager::activateListenersForScope(ScopeID::Value scope) 74 74 { 75 for ( const auto & elem: this->listeners_[scope])76 this->activateListener( elem);75 for (ScopeListener* listener : this->listeners_[scope]) 76 this->activateListener(listener); 77 77 } 78 78 79 79 void ScopeManager::deactivateListenersForScope(ScopeID::Value scope) 80 80 { 81 for ( const auto & elem: this->listeners_[scope])82 this->deactivateListener( elem);81 for (ScopeListener* listener : this->listeners_[scope]) 82 this->deactivateListener(listener); 83 83 } 84 84 -
code/branches/cpp11_v2/src/libraries/network/FunctionCall.cc
r10821 r10916 131 131 *(uint32_t*)(mem+2*sizeof(uint32_t)) = this->objectID_; 132 132 mem += 3*sizeof(uint32_t); 133 for( auto & elem: this->arguments_)133 for(const MultiType& argument : this->arguments_) 134 134 { 135 elem.exportData( mem );135 argument.exportData( mem ); 136 136 } 137 137 } -
code/branches/cpp11_v2/src/libraries/network/Host.cc
r10821 r10916 80 80 void Host::addPacket(ENetPacket *packet, int clientID, uint8_t channelID) 81 81 { 82 for( auto & instances_: instances_s)82 for(Host* host : instances_s) 83 83 { 84 if( (instances_)->isActive() )84 if( host->isActive() ) 85 85 { 86 (instances_)->queuePacket(packet, clientID, channelID);86 host->queuePacket(packet, clientID, channelID); 87 87 } 88 88 } … … 97 97 void Host::sendChat(const std::string& message, unsigned int sourceID, unsigned int targetID) 98 98 { 99 for( auto & instances_: instances_s)100 if( (instances_)->isActive() )101 (instances_)->doSendChat(message, sourceID, targetID);99 for(Host* host : instances_s) 100 if( host->isActive() ) 101 host->doSendChat(message, sourceID, targetID); 102 102 } 103 103 … … 114 114 bool Host::isServer() 115 115 { 116 for ( auto & instances_: instances_s)116 for (Host* host : instances_s) 117 117 { 118 if( (instances_)->isActive() )118 if( host->isActive() ) 119 119 { 120 if( (instances_)->isServer_() )120 if( host->isServer_() ) 121 121 return true; 122 122 } -
code/branches/cpp11_v2/src/libraries/network/synchronisable/Synchronisable.cc
r10821 r10916 88 88 } 89 89 // delete all Synchronisable Variables from syncList_ ( which are also in stringList_ ) 90 for( auto & elem: syncList_)91 delete (elem);90 for(SynchronisableVariableBase* variable : syncList_) 91 delete variable; 92 92 syncList_.clear(); 93 93 stringList_.clear(); -
code/branches/cpp11_v2/src/libraries/tools/DebugDrawer.cc
r10821 r10916 392 392 manualObject->estimateVertexCount(lineVertices.size()); 393 393 manualObject->estimateIndexCount(lineIndices.size()); 394 for ( auto & elem: lineVertices)394 for (const VertexPair& pair : lineVertices) 395 395 { 396 manualObject->position( elem.first);397 manualObject->colour( elem.second);396 manualObject->position(pair.first); 397 manualObject->colour(pair.second); 398 398 } 399 for ( auto & elem: lineIndices)400 manualObject->index( elem);399 for (int lineIndex : lineIndices) 400 manualObject->index(lineIndex); 401 401 } 402 402 else … … 409 409 manualObject->estimateVertexCount(triangleVertices.size()); 410 410 manualObject->estimateIndexCount(triangleIndices.size()); 411 for ( auto & elem: triangleVertices)411 for (const VertexPair& pair : triangleVertices) 412 412 { 413 manualObject->position( elem.first);414 manualObject->colour( elem.second.r, elem.second.g, elem.second.b, fillAlpha);413 manualObject->position(pair.first); 414 manualObject->colour(pair.second.r, pair.second.g, pair.second.b, fillAlpha); 415 415 } 416 for ( auto & elem: triangleIndices)417 manualObject->index( elem);416 for (int triangleIndex : triangleIndices) 417 manualObject->index(triangleIndex); 418 418 } 419 419 else -
code/branches/cpp11_v2/src/libraries/tools/IcoSphere.cc
r10821 r10916 116 116 std::list<TriangleIndices> faces2; 117 117 118 for ( autof : faces)118 for (const TriangleIndices& f : faces) 119 119 { 120 121 120 int a = getMiddlePoint(f.v1, f.v2); 122 121 int b = getMiddlePoint(f.v2, f.v3); … … 194 193 void IcoSphere::addToLineIndices(int baseIndex, std::list<int>* target) const 195 194 { 196 for (const auto & elem: lineIndices)195 for (const LineIndices& line : lineIndices) 197 196 { 198 target->push_back(baseIndex + (elem).v1);199 target->push_back(baseIndex + (elem).v2);197 target->push_back(baseIndex + line.v1); 198 target->push_back(baseIndex + line.v2); 200 199 } 201 200 } … … 203 202 void IcoSphere::addToTriangleIndices(int baseIndex, std::list<int>* target) const 204 203 { 205 for (const auto & elem: faces)204 for (const TriangleIndices& triangle : faces) 206 205 { 207 target->push_back(baseIndex + (elem).v1);208 target->push_back(baseIndex + (elem).v2);209 target->push_back(baseIndex + (elem).v3);206 target->push_back(baseIndex + triangle.v1); 207 target->push_back(baseIndex + triangle.v2); 208 target->push_back(baseIndex + triangle.v3); 210 209 } 211 210 } … … 217 216 transform.setScale(Ogre::Vector3(scale, scale, scale)); 218 217 219 for ( auto & elem: vertices)220 target->push_back(VertexPair(transform * elem, colour));218 for (const Ogre::Vector3& vertex : vertices) 219 target->push_back(VertexPair(transform * vertex, colour)); 221 220 222 221 return vertices.size(); -
code/branches/cpp11_v2/src/libraries/tools/Shader.cc
r10821 r10916 197 197 { 198 198 // iterate through the list of parameters 199 for ( auto & elem: this->parameters_)200 { 201 Ogre::Technique* techniquePtr = materialPtr->getTechnique( elem.technique_);199 for (const ParameterContainer& parameter : this->parameters_) 200 { 201 Ogre::Technique* techniquePtr = materialPtr->getTechnique(parameter.technique_); 202 202 if (techniquePtr) 203 203 { 204 Ogre::Pass* passPtr = techniquePtr->getPass( elem.pass_);204 Ogre::Pass* passPtr = techniquePtr->getPass(parameter.pass_); 205 205 if (passPtr) 206 206 { 207 207 // change the value of the parameter depending on its type 208 if ( elem.value_.isType<int>())209 passPtr->getFragmentProgramParameters()->setNamedConstant( elem.parameter_, elem.value_.get<int>());210 else if ( elem.value_.isType<float>())211 passPtr->getFragmentProgramParameters()->setNamedConstant( elem.parameter_, elem.value_.get<float>());208 if (parameter.value_.isType<int>()) 209 passPtr->getFragmentProgramParameters()->setNamedConstant(parameter.parameter_, parameter.value_.get<int>()); 210 else if (parameter.value_.isType<float>()) 211 passPtr->getFragmentProgramParameters()->setNamedConstant(parameter.parameter_, parameter.value_.get<float>()); 212 212 } 213 213 else 214 orxout(internal_warning) << "No pass " << elem.pass_ << " in technique " << elem.technique_ << " in compositor \"" << this->compositorName_ << "\" or pass has no shader." << endl;214 orxout(internal_warning) << "No pass " << parameter.pass_ << " in technique " << parameter.technique_ << " in compositor \"" << this->compositorName_ << "\" or pass has no shader." << endl; 215 215 } 216 216 else 217 orxout(internal_warning) << "No technique " << elem.technique_ << " in compositor \"" << this->compositorName_ << "\" or technique has no pass with shader." << endl;217 orxout(internal_warning) << "No technique " << parameter.technique_ << " in compositor \"" << this->compositorName_ << "\" or technique has no pass with shader." << endl; 218 218 } 219 219 this->parameters_.clear(); … … 228 228 { 229 229 const Ogre::Root::PluginInstanceList& plugins = Ogre::Root::getSingleton().getInstalledPlugins(); 230 for ( auto &plugin : plugins)230 for (Ogre::Plugin* plugin : plugins) 231 231 if (plugin->getName() == "Cg Program Manager") 232 232 return true; -
code/branches/cpp11_v2/src/libraries/util/DisplayStringConversions.h
r10821 r10916 51 51 { 52 52 Ogre::UTFString::code_point cp; 53 for ( auto & elem: input)53 for (const char& character : input) 54 54 { 55 cp = elem;55 cp = character; 56 56 cp &= 0xFF; 57 57 output->append(1, cp); -
code/branches/cpp11_v2/src/libraries/util/Serialise.h
r10821 r10916 672 672 { 673 673 uint32_t tempsize = sizeof(uint32_t); // for the number of entries 674 for(const auto & elem: *((std::set<T>*)(&variable)))675 tempsize += returnSize( elem );674 for(const T& element : *((std::set<T>*)(&variable))) 675 tempsize += returnSize( element ); 676 676 return tempsize; 677 677 } -
code/branches/cpp11_v2/src/libraries/util/SignalHandler.cc
r10821 r10916 81 81 void SignalHandler::dontCatch() 82 82 { 83 for ( auto & elem: sigRecList)84 { 85 signal( elem.signal, elem.handler );83 for (const SignalRec& sigRec : sigRecList) 84 { 85 signal( sigRec.signal, sigRec.handler ); 86 86 } 87 87 … … 133 133 } 134 134 135 for ( auto & elem: SignalHandler::getInstance().callbackList)136 { 137 (*( elem.cb))( elem.someData );135 for (const SignalCallbackRec& callback : SignalHandler::getInstance().callbackList) 136 { 137 (*(callback.cb))( callback.someData ); 138 138 } 139 139 -
code/branches/cpp11_v2/src/libraries/util/SmallObjectAllocator.cc
r10821 r10916 53 53 SmallObjectAllocator::~SmallObjectAllocator() 54 54 { 55 for ( auto & elem: this->blocks_)56 delete[] elem;55 for (char* block : this->blocks_) 56 delete[] block; 57 57 } 58 58 -
code/branches/cpp11_v2/src/libraries/util/StringUtils.cc
r10821 r10916 262 262 std::string output(str.size() * 2, ' '); 263 263 size_t i = 0; 264 for ( auto & elem: str)265 { 266 switch ( elem)264 for (const char& character : str) 265 { 266 switch (character) 267 267 { 268 268 case '\\': output[i] = '\\'; output[i + 1] = '\\'; break; … … 276 276 case '"': output[i] = '\\'; output[i + 1] = '"'; break; 277 277 case '\0': output[i] = '\\'; output[i + 1] = '0'; break; 278 default : output[i] = elem; ++i; continue;278 default : output[i] = character; ++i; continue; 279 279 } 280 280 i += 2; … … 336 336 void lowercase(std::string* str) 337 337 { 338 for ( auto & elem: *str)339 { 340 elem = static_cast<char>(tolower(elem));338 for (char& character : *str) 339 { 340 character = static_cast<char>(tolower(character)); 341 341 } 342 342 } … … 353 353 void uppercase(std::string* str) 354 354 { 355 for ( auto & elem: *str)356 { 357 elem = static_cast<char>(toupper(elem));355 for (char& character : *str) 356 { 357 character = static_cast<char>(toupper(character)); 358 358 } 359 359 } … … 460 460 { 461 461 size_t j = 0; 462 for ( auto & elem: str)463 { 464 if ( elem== target)462 for (char& character : str) 463 { 464 if (character == target) 465 465 { 466 elem= replacement;466 character = replacement; 467 467 ++j; 468 468 } -
code/branches/cpp11_v2/src/libraries/util/output/BaseWriter.cc
r10821 r10916 116 116 117 117 // iterate over all strings in the config-vector 118 for ( auto& full_name : this->configurableAdditionalContexts_)118 for (const std::string& full_name : this->configurableAdditionalContexts_) 119 119 { 120 121 122 120 // split the name into main-name and sub-name (if given; otherwise sub-name remains empty). both names are separated by :: 123 121 std::string name = full_name; -
code/branches/cpp11_v2/src/libraries/util/output/MemoryWriter.cc
r10821 r10916 65 65 void MemoryWriter::resendOutput(OutputListener* listener) const 66 66 { 67 for ( auto& message : this->messages_)67 for (const Message& message : this->messages_) 68 68 { 69 70 69 listener->unfilteredOutput(message.level, *message.context, message.lines); 71 70 } -
code/branches/cpp11_v2/src/libraries/util/output/OutputListener.cc
r10821 r10916 111 111 this->levelMask_ = mask; 112 112 113 for ( auto & elem: this->listeners_)114 elem->updatedLevelMask(this);113 for (AdditionalContextListener* listener : this->listeners_) 114 listener->updatedLevelMask(this); 115 115 } 116 116 … … 142 142 this->additionalContextsLevelMask_ = mask; 143 143 144 for ( auto & elem: this->listeners_)145 elem->updatedAdditionalContextsLevelMask(this);144 for (AdditionalContextListener* listener : this->listeners_) 145 listener->updatedAdditionalContextsLevelMask(this); 146 146 } 147 147 … … 153 153 this->additionalContextsMask_ = mask; 154 154 155 for ( auto & elem: this->listeners_)156 elem->updatedAdditionalContextsMask(this);155 for (AdditionalContextListener* listener : this->listeners_) 156 listener->updatedAdditionalContextsMask(this); 157 157 } 158 158 -
code/branches/cpp11_v2/src/libraries/util/output/OutputManager.cc
r10829 r10916 131 131 vectorize(message, '\n', &lines); 132 132 133 for ( auto & elem: this->listeners_)134 elem->unfilteredOutput(level, context, lines);133 for (OutputListener* listener : this->listeners_) 134 listener->unfilteredOutput(level, context, lines); 135 135 } 136 136 … … 178 178 { 179 179 int mask = 0; 180 for ( auto & elem: this->listeners_)181 mask |= elem->getLevelMask();180 for (OutputListener* listener : this->listeners_) 181 mask |= listener->getLevelMask(); 182 182 this->combinedLevelMask_ = static_cast<OutputLevel>(mask); 183 183 } … … 189 189 { 190 190 int mask = 0; 191 for ( auto & elem: this->listeners_)192 mask |= elem->getAdditionalContextsLevelMask();191 for (OutputListener* listener : this->listeners_) 192 mask |= listener->getAdditionalContextsLevelMask(); 193 193 this->combinedAdditionalContextsLevelMask_ = static_cast<OutputLevel>(mask); 194 194 } … … 200 200 { 201 201 this->combinedAdditionalContextsMask_ = 0; 202 for ( auto & elem: this->listeners_)203 this->combinedAdditionalContextsMask_ |= elem->getAdditionalContextsMask();202 for (OutputListener* listener : this->listeners_) 203 this->combinedAdditionalContextsMask_ |= listener->getAdditionalContextsMask(); 204 204 } 205 205 -
code/branches/cpp11_v2/src/libraries/util/output/SubcontextOutputListener.cc
r10821 r10916 79 79 80 80 // compose the mask of subcontexts and build the set of sub-context-IDs 81 for (const auto &subcontext : subcontexts)81 for (const OutputContextContainer* subcontext : subcontexts) 82 82 { 83 this->subcontextsCheckMask_ |= (subcontext)->mask;84 this->subcontexts_.insert( (subcontext)->sub_id);83 this->subcontextsCheckMask_ |= subcontext->mask; 84 this->subcontexts_.insert(subcontext->sub_id); 85 85 } 86 86 -
code/branches/cpp11_v2/src/modules/docking/Dock.cc
r10821 r10916 327 327 const DockingEffect* Dock::getEffect(unsigned int i) const 328 328 { 329 for ( const auto & elem: this->effects_)329 for (DockingEffect* effect : this->effects_) 330 330 { 331 331 if(i == 0) 332 return e lem;332 return effect; 333 333 i--; 334 334 } … … 346 346 const DockingAnimation* Dock::getAnimation(unsigned int i) const 347 347 { 348 for ( const auto & elem: this->animations_)348 for (DockingAnimation* animation : this->animations_) 349 349 { 350 350 if(i == 0) 351 return elem;351 return animation; 352 352 i--; 353 353 } -
code/branches/cpp11_v2/src/modules/docking/DockingAnimation.cc
r10821 r10916 57 57 bool check = true; 58 58 59 for ( auto & animations_animation : animations)59 for (DockingAnimation* animation : animations) 60 60 { 61 61 if(dock) 62 check &= (animations_animation)->docking(player);62 check &= animation->docking(player); 63 63 else 64 check &= (animations_animation)->release(player);64 check &= animation->release(player); 65 65 } 66 66 -
code/branches/cpp11_v2/src/modules/docking/DockingEffect.cc
r10821 r10916 53 53 bool check = true; 54 54 55 for ( auto & effects_effect : effects)55 for (DockingEffect* effect : effects) 56 56 { 57 57 if (dock) 58 check &= (effects_effect)->docking(player);58 check &= effect->docking(player); 59 59 else 60 check &= (effects_effect)->release(player);60 check &= effect->release(player); 61 61 } 62 62 -
code/branches/cpp11_v2/src/modules/gametypes/RaceCheckPoint.cc
r10821 r10916 146 146 { 147 147 Vector3 checkpoints(-1,-1,-1); int count=0; 148 for ( const auto & elem: nextCheckpoints_)148 for (int nextCheckpoint : nextCheckpoints_) 149 149 { 150 150 switch (count) 151 151 { 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;152 case 0: checkpoints.x = static_cast<Ogre::Real>(nextCheckpoint); break; 153 case 1: checkpoints.y = static_cast<Ogre::Real>(nextCheckpoint); break; 154 case 2: checkpoints.z = static_cast<Ogre::Real>(nextCheckpoint); break; 155 155 } 156 156 ++count; -
code/branches/cpp11_v2/src/modules/gametypes/SpaceRaceController.cc
r10821 r10916 154 154 { 155 155 std::map<RaceCheckPoint*, int> zaehler; // counts how many times the checkpoint was reached (for simulation) 156 for ( auto & allCheckpoint : allCheckpoints)157 { 158 zaehler.insert(std::pair<RaceCheckPoint*, int>( allCheckpoint,0));156 for (RaceCheckPoint* checkpoint : allCheckpoints) 157 { 158 zaehler.insert(std::pair<RaceCheckPoint*, int>(checkpoint,0)); 159 159 } 160 160 int maxWays = rekSimulationCheckpointsReached(currentCheckpoint, zaehler); 161 161 162 162 std::vector<RaceCheckPoint*> returnVec; 163 for (auto & elem: zaehler)164 { 165 if ( elem.second == maxWays)166 { 167 returnVec.push_back( elem.first);163 for (auto& mapEntry : zaehler) 164 { 165 if (mapEntry.second == maxWays) 166 { 167 returnVec.push_back(mapEntry.first); 168 168 } 169 169 } … … 226 226 227 227 // find the next checkpoint with the minimal distance 228 for ( auto elem: raceCheckpoint->getNextCheckpoints())229 { 230 RaceCheckPoint* nextRaceCheckPoint = findCheckpoint( elem);228 for (int checkpointIndex : raceCheckpoint->getNextCheckpoints()) 229 { 230 RaceCheckPoint* nextRaceCheckPoint = findCheckpoint(checkpointIndex); 231 231 float distance = recCalculateDistance(nextRaceCheckPoint, this->getControllableEntity()->getPosition()); 232 232 … … 289 289 RaceCheckPoint* SpaceRaceController::findCheckpoint(int index) const 290 290 { 291 for ( auto & elem: this->checkpoints_)292 if ( elem->getCheckpointIndex() == index)293 return elem;291 for (RaceCheckPoint* checkpoint : this->checkpoints_) 292 if (checkpoint->getCheckpointIndex() == index) 293 return checkpoint; 294 294 return nullptr; 295 295 } … … 414 414 btScalar radiusObject; 415 415 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();416 for (StaticEntity* object : allObjects) 417 { 418 for (int everyShape=0; object->getAttachedCollisionShape(everyShape) != nullptr; everyShape++) 419 { 420 btCollisionShape* currentShape = object->getAttachedCollisionShape(everyShape)->getCollisionShape(); 421 421 if(currentShape == nullptr) 422 422 continue; -
code/branches/cpp11_v2/src/modules/gametypes/SpaceRaceManager.cc
r10821 r10916 54 54 SpaceRaceManager::~SpaceRaceManager() 55 55 { 56 for ( auto & elem: this->checkpoints_)57 elem->destroy();56 for (RaceCheckPoint* checkpoint : this->checkpoints_) 57 checkpoint->destroy(); 58 58 } 59 59 … … 77 77 } 78 78 79 for (auto & elem: players_)79 for (auto& mapEntry : players_) 80 80 { 81 81 82 for ( auto & _i: this->checkpoints_)82 for (RaceCheckPoint* checkpoint : this->checkpoints_) 83 83 { 84 if ( _i->playerWasHere(elem.first)){85 this->checkpointReached( _i, elem.first /*this->checkpoints_[i]->getPlayer()*/);84 if (checkpoint->playerWasHere(mapEntry.first)){ 85 this->checkpointReached(checkpoint, mapEntry.first /*this->checkpoints_[i]->getPlayer()*/); 86 86 } 87 87 } … … 113 113 RaceCheckPoint* SpaceRaceManager::findCheckpoint(int index) const 114 114 { 115 for ( auto & elem: this->checkpoints_)116 if ( elem->getCheckpointIndex() == index)117 return elem;115 for (RaceCheckPoint* checkpoint : this->checkpoints_) 116 if (checkpoint->getCheckpointIndex() == index) 117 return checkpoint; 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 ( const auto &possibleCheckpoint : possibleCheckpoints)127 for (int possibleCheckpoint : possibleCheckpoints) 128 128 if (this->findCheckpoint(possibleCheckpoint) == newCheckpoint) 129 129 return true; … … 179 179 { 180 180 const std::set<int>& oldVisible = oldCheckpoint->getNextCheckpoints(); 181 for ( const auto & elem: oldVisible)182 this->findCheckpoint( elem)->setRadarVisibility(false);181 for (int checkpointIndex : oldVisible) 182 this->findCheckpoint(checkpointIndex)->setRadarVisibility(false); 183 183 } 184 184 … … 188 188 189 189 const std::set<int>& newVisible = newCheckpoint->getNextCheckpoints(); 190 for ( const auto & elem: newVisible)191 this->findCheckpoint( elem)->setRadarVisibility(true);190 for (int checkpointIndex : newVisible) 191 this->findCheckpoint(checkpointIndex)->setRadarVisibility(true); 192 192 } 193 193 } -
code/branches/cpp11_v2/src/modules/jump/Jump.cc
r10821 r10916 633 633 634 634 635 for ( auto & elem : matrix)635 for (int i = 0; i < numI; ++i) 636 636 { 637 637 for (int j = 0; j < numJ; ++j) 638 638 { 639 elem[j].type = PLATFORM_EMPTY;640 elem[j].done = false;639 matrix[i][j].type = PLATFORM_EMPTY; 640 matrix[i][j].done = false; 641 641 } 642 642 } … … 795 795 796 796 // Fill matrix with selected platform types 797 for ( auto & elem : matrix)797 for (int i = 0; i < numI; ++ i) 798 798 { 799 799 for (int j = 0; j < numJ; ++ j) … … 801 801 if (rand()%3 == 0) 802 802 { 803 elem[j].type = platformtype1;803 matrix[i][j].type = platformtype1; 804 804 } 805 805 else 806 806 { 807 elem[j].type = platformtype2;807 matrix[i][j].type = platformtype2; 808 808 } 809 elem[j].done = false;809 matrix[i][j].done = false; 810 810 } 811 811 } -
code/branches/cpp11_v2/src/modules/mini4dgame/Mini4Dgame.cc
r10821 r10916 155 155 { 156 156 // first spawn human players to assign always the left bat to the player in singleplayer 157 for (auto & elem: this->players_)158 if ( elem.first->isHumanPlayer() && (elem.first->isReadyToSpawn() || this->bForceSpawn_))159 this->spawnPlayer( elem.first);157 for (auto& mapEntry : this->players_) 158 if (mapEntry.first->isHumanPlayer() && (mapEntry.first->isReadyToSpawn() || this->bForceSpawn_)) 159 this->spawnPlayer(mapEntry.first); 160 160 // now spawn bots 161 for (auto & elem: this->players_)162 if (! elem.first->isHumanPlayer() && (elem.first->isReadyToSpawn() || this->bForceSpawn_))163 this->spawnPlayer( elem.first);161 for (auto& mapEntry : this->players_) 162 if (!mapEntry.first->isHumanPlayer() && (mapEntry.first->isReadyToSpawn() || this->bForceSpawn_)) 163 this->spawnPlayer(mapEntry.first); 164 164 } 165 165 -
code/branches/cpp11_v2/src/modules/notifications/NotificationManager.cc
r10821 r10916 69 69 { 70 70 // Destroys all Notifications. 71 for(auto & elem: this->allNotificationsList_)72 elem.second->destroy();71 for(auto& mapEntry : this->allNotificationsList_) 72 mapEntry.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(auto & elem: this->queues_) // Iterate through all NotificationQueues.155 { 156 const std::set<std::string>& set = elem.second->getTargetsSet();154 for(auto& mapEntry : this->queues_) // Iterate through all NotificationQueues. 155 { 156 const std::set<std::string>& set = mapEntry.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 = elem.second->tidy() || executed;159 executed = mapEntry.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(auto & elem: this->queues_) // Iterate through all NotificationQueues.190 { 191 const std::set<std::string>& set = elem.second->getTargetsSet();189 for(auto& mapEntry : this->queues_) // Iterate through all NotificationQueues. 190 { 191 const std::set<std::string>& set = mapEntry.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_[ 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.197 this->notificationLists_[mapEntry.second->getName()]->insert(std::pair<std::time_t, Notification*>(time, notification)); // Insert the Notification in the notifications list of the current NotificationQueue. 198 mapEntry.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(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));347 for(auto& mapEntry : this->allNotificationsList_) 348 { 349 if(!bAll && set.find(mapEntry.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*>(mapEntry.first, mapEntry.second)); 351 351 } 352 352 -
code/branches/cpp11_v2/src/modules/notifications/NotificationQueue.cc
r10821 r10916 206 206 { 207 207 // Add all Notifications that have been created after this NotificationQueue was created. 208 for(auto & notification: *notifications)208 for(auto& mapEntry : *notifications) 209 209 { 210 if( notification.first >= this->creationTime_)211 this->push( notification.second, notification.first);210 if(mapEntry.first >= this->creationTime_) 211 this->push(mapEntry.second, mapEntry.first); 212 212 } 213 213 } … … 336 336 this->ordering_.clear(); 337 337 // Delete all NotificationContainers in the list. 338 for( auto & elem: this->notifications_)339 delete elem;338 for(NotificationContainer* notification : this->notifications_) 339 delete notification; 340 340 341 341 this->notifications_.clear(); … … 426 426 bool first = true; 427 427 // Iterate through the set of targets. 428 for(const auto & elem: this->targets_)428 for(const std::string& target : this->targets_) 429 429 { 430 430 if(!first) … … 432 432 else 433 433 first = false; 434 stream << elem;434 stream << target; 435 435 } 436 436 -
code/branches/cpp11_v2/src/modules/objects/Attacher.cc
r10821 r10916 61 61 SUPER(Attacher, changedActivity); 62 62 63 for ( auto & elem: this->objects_)64 (elem)->setActive(this->isActive());63 for (WorldEntity* object : this->objects_) 64 object->setActive(this->isActive()); 65 65 } 66 66 … … 69 69 SUPER(Attacher, changedVisibility); 70 70 71 for ( auto & elem: this->objects_)72 (elem)->setVisible(this->isVisible());71 for (WorldEntity* object : this->objects_) 72 object->setVisible(this->isVisible()); 73 73 } 74 74 … … 83 83 { 84 84 unsigned int i = 0; 85 for ( const auto & elem: this->objects_)85 for (WorldEntity* object : this->objects_) 86 86 { 87 87 if (i == index) 88 return (elem);88 return object; 89 89 90 90 ++i; -
code/branches/cpp11_v2/src/modules/objects/Script.cc
r10821 r10916 196 196 { 197 197 const std::map<unsigned int, PlayerInfo*> clients = PlayerManager::getInstance().getClients(); 198 for(const auto & client: clients)198 for(const auto& mapEntry : clients) 199 199 { 200 callStaticNetworkFunction(&Script::executeHelper, client.first, this->getCode(), this->getMode(), this->getNeedsGraphics());200 callStaticNetworkFunction(&Script::executeHelper, mapEntry.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
r10821 r10916 59 59 this->pawnsIn_.clear(); 60 60 61 for( auto & elem: this->billboards_)61 for(BillboardAdministration& billboard : this->billboards_) 62 62 { 63 if( elem.billy != nullptr)64 { 65 delete elem.billy;63 if( billboard.billy != nullptr) 64 { 65 delete billboard.billy; 66 66 } 67 67 } … … 138 138 void SpaceBoundaries::removeAllBillboards() 139 139 { 140 for( auto & elem: this->billboards_)141 { 142 elem.usedYet = false;143 elem.billy->setVisible(false);140 for(BillboardAdministration& billboard : this->billboards_) 141 { 142 billboard.usedYet = false; 143 billboard.billy->setVisible(false); 144 144 } 145 145 } … … 208 208 float distance; 209 209 bool humanItem; 210 for(auto currentPawn : pawnsIn_) 211 { 212 210 for(Pawn* currentPawn : pawnsIn_) 211 { 213 212 if( currentPawn && currentPawn->getNode() ) 214 213 { -
code/branches/cpp11_v2/src/modules/objects/eventsystem/EventDispatcher.cc
r10821 r10916 45 45 { 46 46 if (this->isInitialized()) 47 for ( auto & elem: this->targets_)48 (elem)->destroy();47 for (BaseObject* target : this->targets_) 48 target->destroy(); 49 49 } 50 50 … … 61 61 void EventDispatcher::processEvent(Event& event) 62 62 { 63 for ( auto & elem: this->targets_)64 (elem)->processEvent(event);63 for (BaseObject* target : this->targets_) 64 target->processEvent(event); 65 65 } 66 66 … … 73 73 { 74 74 unsigned int i = 0; 75 for ( const auto & elem: this->targets_)75 for (BaseObject* target : this->targets_) 76 76 { 77 77 if (i == index) 78 return (elem);78 return target; 79 79 ++i; 80 80 } -
code/branches/cpp11_v2/src/modules/objects/eventsystem/EventFilter.cc
r10821 r10916 96 96 { 97 97 unsigned int i = 0; 98 for ( const auto & elem: this->sources_)98 for (BaseObject* source : this->sources_) 99 99 { 100 100 if (i == index) 101 return (elem);101 return source; 102 102 ++i; 103 103 } … … 113 113 { 114 114 unsigned int i = 0; 115 for ( const auto & elem: this->names_)115 for (EventName* name : this->names_) 116 116 { 117 117 if (i == index) 118 return (elem);118 return name; 119 119 ++i; 120 120 } -
code/branches/cpp11_v2/src/modules/objects/triggers/DistanceMultiTrigger.cc
r10821 r10916 158 158 { 159 159 160 const std::set<WorldEntity*> attached = entity->getAttachedObjects();160 const std::set<WorldEntity*> attachedObjects = entity->getAttachedObjects(); 161 161 bool found = false; 162 for( const auto & elem : attached)162 for(WorldEntity* attachedObject : attachedObjects) 163 163 { 164 if( (elem)->isA(ClassIdentifier<DistanceTriggerBeacon>::getIdentifier()) && static_cast<DistanceTriggerBeacon*>(elem)->getName() == this->targetName_)164 if(attachedObject->isA(ClassIdentifier<DistanceTriggerBeacon>::getIdentifier()) && static_cast<DistanceTriggerBeacon*>(attachedObject)->getName() == this->targetName_) 165 165 { 166 166 found = true; -
code/branches/cpp11_v2/src/modules/objects/triggers/DistanceTrigger.cc
r10821 r10916 180 180 { 181 181 182 const std::set<WorldEntity*> attached = entity->getAttachedObjects();182 const std::set<WorldEntity*> attachedObjects = entity->getAttachedObjects(); 183 183 bool found = false; 184 for( const auto & elem : attached)184 for(WorldEntity* attachedObject : attachedObjects) 185 185 { 186 if( (elem)->isA(ClassIdentifier<DistanceTriggerBeacon>::getIdentifier()) && static_cast<DistanceTriggerBeacon*>(elem)->getName() == this->targetName_)186 if(attachedObject->isA(ClassIdentifier<DistanceTriggerBeacon>::getIdentifier()) && static_cast<DistanceTriggerBeacon*>(attachedObject)->getName() == this->targetName_) 187 187 { 188 188 found = true; -
code/branches/cpp11_v2/src/modules/objects/triggers/MultiTrigger.cc
r10821 r10916 504 504 bool MultiTrigger::checkAnd(BaseObject* triggerer) 505 505 { 506 for(auto trigger : this->children_) 507 { 508 506 for(TriggerBase* trigger : this->children_) 507 { 509 508 if(trigger->isMultiTrigger()) 510 509 { … … 531 530 bool MultiTrigger::checkOr(BaseObject* triggerer) 532 531 { 533 for(auto trigger : this->children_) 534 { 535 532 for(TriggerBase* trigger : this->children_) 533 { 536 534 if(trigger->isMultiTrigger()) 537 535 { … … 559 557 { 560 558 bool triggered = false; 561 for(auto trigger : this->children_) 562 { 563 559 for(TriggerBase* trigger : this->children_) 560 { 564 561 if(triggered) 565 562 { -
code/branches/cpp11_v2/src/modules/objects/triggers/Trigger.cc
r10821 r10916 234 234 { 235 235 // Iterate over all sub-triggers. 236 for ( const auto & elem: this->children_)237 { 238 if (! (elem)->isActive())236 for (TriggerBase* child : this->children_) 237 { 238 if (!child->isActive()) 239 239 return false; 240 240 } … … 252 252 { 253 253 // Iterate over all sub-triggers. 254 for ( const auto & elem: this->children_)255 { 256 if ( (elem)->isActive())254 for (TriggerBase* child : this->children_) 255 { 256 if (child->isActive()) 257 257 return true; 258 258 } … … 270 270 { 271 271 bool test = false; 272 for ( const auto & elem: this->children_)273 { 274 if (test && (elem)->isActive())272 for (TriggerBase* child : this->children_) 273 { 274 if (test && child->isActive()) 275 275 return false; 276 if ( (elem)->isActive())276 if (child->isActive()) 277 277 test = true; 278 278 } -
code/branches/cpp11_v2/src/modules/overlays/hud/ChatOverlay.cc
r10821 r10916 58 58 ChatOverlay::~ChatOverlay() 59 59 { 60 for ( const auto & elem: this->timers_)61 delete (elem);60 for (Timer* timer : this->timers_) 61 delete timer; 62 62 } 63 63 … … 92 92 this->text_->setCaption(""); 93 93 94 for ( auto & elem: this->messages_)94 for (const Ogre::DisplayString& message : this->messages_) 95 95 { 96 this->text_->setCaption(this->text_->getCaption() + "\n" + (elem));96 this->text_->setCaption(this->text_->getCaption() + "\n" + message); 97 97 } 98 98 } -
code/branches/cpp11_v2/src/modules/overlays/hud/HUDNavigation.cc
r10821 r10916 131 131 } 132 132 this->fontName_ = font; 133 for (auto & elem: this->activeObjectList_)134 { 135 if ( elem.second.text_ != nullptr)136 elem.second.text_->setFontName(this->fontName_);133 for (auto& mapEntry : this->activeObjectList_) 134 { 135 if (mapEntry.second.text_ != nullptr) 136 mapEntry.second.text_->setFontName(this->fontName_); 137 137 } 138 138 } … … 151 151 } 152 152 this->textSize_ = size; 153 for (auto & elem: this->activeObjectList_)154 { 155 if ( elem.second.text_)156 elem.second.text_->setCharHeight(size);153 for (auto& mapEntry : this->activeObjectList_) 154 { 155 if (mapEntry.second.text_) 156 mapEntry.second.text_->setCharHeight(size); 157 157 } 158 158 } … … 186 186 const Matrix4& camTransform = cam->getOgreCamera()->getProjectionMatrix() * cam->getOgreCamera()->getViewMatrix(); 187 187 188 for ( auto & elem: this->sortedObjectList_)189 elem.second = (int)((elem.first->getRVWorldPosition() - HumanController::getLocalControllerSingleton()->getControllableEntity()->getWorldPosition()).length() + 0.5f);188 for (std::pair<RadarViewable*, unsigned int>& pair : this->sortedObjectList_) 189 pair.second = (int)((pair.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 (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);533 for (auto& mapEntry : this->activeObjectList_) 534 { 535 if (mapEntry.second.health_ != nullptr) 536 mapEntry.second.health_->setDimensions(this->healthMarkerSize_ * xScale, this->healthMarkerSize_ * yScale); 537 if (mapEntry.second.healthLevel_ != nullptr) 538 mapEntry.second.healthLevel_->setDimensions(this->healthLevelMarkerSize_ * xScale, this->healthLevelMarkerSize_ * yScale); 539 if (mapEntry.second.panel_ != nullptr) 540 mapEntry.second.panel_->setDimensions(this->navMarkerSize_ * xScale, this->navMarkerSize_ * yScale); 541 if (mapEntry.second.text_ != nullptr) 542 mapEntry.second.text_->setCharHeight(this->textSize_ * yScale); 543 if (mapEntry.second.target_ != nullptr) 544 mapEntry.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 ( const auto &respawnObject : respawnObjects)673 { 674 if (! (respawnObject)->isHumanShip_)672 for (RadarViewable* respawnObject : respawnObjects) 673 { 674 if (!respawnObject->isHumanShip_) 675 675 this->addObject(respawnObject); 676 676 } -
code/branches/cpp11_v2/src/modules/overlays/hud/HUDRadar.cc
r10821 r10916 92 92 Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->map3DBack_); 93 93 94 for (auto & elem: this->radarObjects_)95 { 96 Ogre::OverlayManager::getSingleton().destroyOverlayElement( elem.second);94 for (auto& mapEntry : this->radarObjects_) 95 { 96 Ogre::OverlayManager::getSingleton().destroyOverlayElement(mapEntry.second); 97 97 } 98 98 } -
code/branches/cpp11_v2/src/modules/overlays/stats/Scoreboard.cc
r10821 r10916 60 60 SUPER(Scoreboard, changedVisibility); 61 61 62 for ( auto & elem: this->lines_)63 elem->changedVisibility();62 for (CreateLines* line : this->lines_) 63 line->changedVisibility(); 64 64 } 65 65 … … 94 94 95 95 unsigned int index = 0; 96 for (const auto & elem: playerList)96 for (const auto& mapEntry : playerList) 97 97 { 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_));98 this->lines_[index]->setPlayerName(multi_cast<std::string>(mapEntry.first->getName())); 99 this->lines_[index]->setScore(multi_cast<std::string>(mapEntry.second.frags_)); 100 this->lines_[index]->setDeaths(multi_cast<std::string>(mapEntry.second.killed_)); 101 101 index++; 102 102 } -
code/branches/cpp11_v2/src/modules/pickup/PickupCollection.cc
r10821 r10916 68 68 { 69 69 // Destroy all Pickupables constructing this PickupCollection. 70 for( auto & elem: this->pickups_)71 { 72 (elem)->wasRemovedFromCollection();73 (elem)->destroy();70 for(CollectiblePickup* pickup : this->pickups_) 71 { 72 pickup->wasRemovedFromCollection(); 73 pickup->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( auto & elem: this->pickups_)102 (elem)->setUsed(this->isUsed());101 for(CollectiblePickup* pickup : this->pickups_) 102 pickup->setUsed(this->isUsed()); 103 103 104 104 this->processingUsed_ = false; … … 119 119 size_t numPickupsEnabled = 0; 120 120 size_t numPickupsInUse = 0; 121 for( auto & elem: this->pickups_)122 { 123 if ( (elem)->isEnabled())121 for(CollectiblePickup* pickup : this->pickups_) 122 { 123 if (pickup->isEnabled()) 124 124 ++numPickupsEnabled; 125 if ( (elem)->isUsed())125 if (pickup->isUsed()) 126 126 ++numPickupsInUse; 127 127 } … … 146 146 147 147 // Change the PickupCarrier for all Pickupables this PickupCollection consists of. 148 for( auto & elem: this->pickups_)148 for(CollectiblePickup* pickup : this->pickups_) 149 149 { 150 150 if(this->getCarrier() == nullptr) 151 (elem)->setCarrier(nullptr);151 pickup->setCarrier(nullptr); 152 152 else 153 (elem)->setCarrier(this->getCarrier()->getTarget(elem));153 pickup->setCarrier(this->getCarrier()->getTarget(pickup)); 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( auto & elem: this->pickups_)189 { 190 if ( (elem)->isEnabled() && (elem)->isPickedUp())188 for(CollectiblePickup* pickup : this->pickups_) 189 { 190 if (pickup->isEnabled() && pickup->isPickedUp()) 191 191 { 192 192 isOnePickupEnabledAndPickedUp = true; … … 208 208 bool PickupCollection::isTarget(const PickupCarrier* carrier) const 209 209 { 210 for( const auto & elem: this->pickups_)211 { 212 if(!carrier->isTarget( elem))210 for(CollectiblePickup* pickup : this->pickups_) 211 { 212 if(!carrier->isTarget(pickup)) 213 213 return false; 214 214 } -
code/branches/cpp11_v2/src/modules/pickup/PickupManager.cc
r10821 r10916 91 91 92 92 // Destroying all the PickupInventoryContainers that are still there. 93 for(auto & elem: this->pickupInventoryContainers_)94 delete elem.second;93 for(auto& mapEntry : this->pickupInventoryContainers_) 94 delete mapEntry.second; 95 95 this->pickupInventoryContainers_.clear(); 96 96 -
code/branches/cpp11_v2/src/modules/pickup/items/MetaPickup.cc
r10821 r10916 118 118 std::set<Pickupable*> pickups = carrier->getPickups(); 119 119 // Iterate over all Pickupables of the PickupCarrier. 120 for( autopickup : pickups)120 for(Pickupable* pickup : pickups) 121 121 { 122 123 122 if(pickup == nullptr || pickup == this) 124 123 continue; -
code/branches/cpp11_v2/src/modules/pong/Pong.cc
r10821 r10916 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 ( auto & elem: this->bat_)147 for (WeakPtr<orxonox::PongBat>& bat : this->bat_) 148 148 { 149 if ( elem== nullptr)149 if (bat == nullptr) 150 150 { 151 elem= new PongBat(this->center_->getContext());152 elem->addTemplate(this->center_->getBattemplate());151 bat = new PongBat(this->center_->getContext()); 152 bat->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 (auto & elem: this->players_)214 if ( elem.first->isHumanPlayer() && (elem.first->isReadyToSpawn() || this->bForceSpawn_))215 this->spawnPlayer( elem.first);213 for (auto& mapEntry : this->players_) 214 if (mapEntry.first->isHumanPlayer() && (mapEntry.first->isReadyToSpawn() || this->bForceSpawn_)) 215 this->spawnPlayer(mapEntry.first); 216 216 // now spawn bots 217 for (auto & elem: this->players_)218 if (! elem.first->isHumanPlayer() && (elem.first->isReadyToSpawn() || this->bForceSpawn_))219 this->spawnPlayer( elem.first);217 for (auto& mapEntry : this->players_) 218 if (!mapEntry.first->isHumanPlayer() && (mapEntry.first->isReadyToSpawn() || this->bForceSpawn_)) 219 this->spawnPlayer(mapEntry.first); 220 220 } 221 221 -
code/branches/cpp11_v2/src/modules/pong/PongAI.cc
r10821 r10916 77 77 PongAI::~PongAI() 78 78 { 79 for ( auto & elem: this->reactionTimers_)80 elem.first->destroy();79 for (std::pair<Timer*, char>& pair : this->reactionTimers_) 80 pair.first->destroy(); 81 81 } 82 82 -
code/branches/cpp11_v2/src/modules/questsystem/GlobalQuest.cc
r10821 r10916 94 94 95 95 // Iterate through all players possessing this Quest. 96 for( const auto & elem: players_)97 QuestEffect::invokeEffects( elem, this->getFailEffectList());96 for(PlayerInfo* questPlayer : players_) 97 QuestEffect::invokeEffects(questPlayer, this->getFailEffectList()); 98 98 99 99 return true; … … 119 119 120 120 // Iterate through all players possessing the Quest. 121 for( const auto & elem: players_)122 QuestEffect::invokeEffects( elem, this->getCompleteEffectList());121 for(PlayerInfo* questPlayer : players_) 122 QuestEffect::invokeEffects(questPlayer, this->getCompleteEffectList()); 123 123 124 124 Quest::complete(player); … … 242 242 { 243 243 int i = index; 244 for ( const auto & elem: this->rewards_)244 for (QuestEffect* reward : this->rewards_) 245 245 { 246 246 if(i == 0) 247 return elem;247 return reward; 248 248 249 249 i--; -
code/branches/cpp11_v2/src/modules/questsystem/Quest.cc
r10821 r10916 190 190 191 191 // Iterate through all subquests. 192 for ( const auto & elem: this->subQuests_)192 for (Quest* quest : this->subQuests_) 193 193 { 194 194 if(i == 0) // We're counting down... 195 return elem;195 return quest; 196 196 197 197 i--; … … 214 214 215 215 // Iterate through all QuestHints. 216 for ( const auto & elem: this->hints_)216 for (QuestHint* hint : this->hints_) 217 217 { 218 218 if(i == 0) // We're counting down... 219 return elem;219 return hint; 220 220 221 221 i--; … … 237 237 238 238 // Iterate through all fail QuestEffects. 239 for ( const auto & elem: this->failEffects_)239 for (QuestEffect* effect : this->failEffects_) 240 240 { 241 241 if(i == 0) // We're counting down... 242 return e lem;242 return effect; 243 243 244 244 i--; … … 260 260 261 261 // Iterate through all complete QuestEffects. 262 for ( const auto & elem: this->completeEffects_)262 for (QuestEffect* effect : this->completeEffects_) 263 263 { 264 264 if(i == 0) // We're counting down... 265 return e lem;265 return effect; 266 266 267 267 i--; -
code/branches/cpp11_v2/src/modules/questsystem/QuestEffect.cc
r10821 r10916 74 74 orxout(verbose, context::quests) << "Invoking QuestEffects on player: " << player << " ." << endl; 75 75 76 for ( auto & effects_effect : effects)77 temp = temp && (effects_effect)->invoke(player);76 for (QuestEffect* effect : effects) 77 temp = temp && effect->invoke(player); 78 78 79 79 return temp; -
code/branches/cpp11_v2/src/modules/questsystem/QuestEffectBeacon.cc
r10821 r10916 236 236 { 237 237 int i = index; 238 for ( const auto & elem: this->effects_)238 for (QuestEffect* effect : this->effects_) 239 239 { 240 240 if(i == 0) 241 return e lem;241 return effect; 242 242 243 243 i--; -
code/branches/cpp11_v2/src/modules/questsystem/QuestListener.cc
r10821 r10916 97 97 /* static */ void QuestListener::advertiseStatusChange(std::list<QuestListener*> & listeners, const std::string & status) 98 98 { 99 for (auto listener : listeners) // Iterate through all QuestListeners 100 { 101 99 for (QuestListener* listener : listeners) // Iterate through all QuestListeners 100 { 102 101 if(listener->getMode() == status || listener->getMode() == QuestListener::ALL) // Check whether the status change affects the give QuestListener. 103 102 listener->execute(); -
code/branches/cpp11_v2/src/modules/questsystem/QuestManager.cc
r10821 r10916 235 235 { 236 236 int numQuests = 0; 237 for(auto & elem: this->questMap_)238 { 239 if( elem.second->getParentQuest() == nullptr && !elem.second->isInactive(player))237 for(auto& mapEntry : this->questMap_) 238 { 239 if(mapEntry.second->getParentQuest() == nullptr && !mapEntry.second->isInactive(player)) 240 240 numQuests++; 241 241 } … … 255 255 Quest* QuestManager::getRootQuest(PlayerInfo* player, int index) 256 256 { 257 for(auto & elem: this->questMap_)258 { 259 if( elem.second->getParentQuest() == nullptr && !elem.second->isInactive(player) && index-- == 0)260 return elem.second;257 for(auto& mapEntry : this->questMap_) 258 { 259 if(mapEntry.second->getParentQuest() == nullptr && !mapEntry.second->isInactive(player) && index-- == 0) 260 return mapEntry.second; 261 261 } 262 262 return nullptr; … … 280 280 std::list<Quest*> quests = quest->getSubQuestList(); 281 281 int numQuests = 0; 282 for( auto &quest : quests)283 { 284 if(! (quest)->isInactive(player))282 for(Quest* subquest : quests) 283 { 284 if(!subquest->isInactive(player)) 285 285 numQuests++; 286 286 } … … 304 304 305 305 std::list<Quest*> quests = quest->getSubQuestList(); 306 for( auto &quest : quests)307 { 308 if(! (quest)->isInactive(player) && index-- == 0)306 for(Quest* subquest : quests) 307 { 308 if(!subquest->isInactive(player) && index-- == 0) 309 309 return quest; 310 310 } … … 326 326 std::list<QuestHint*> hints = quest->getHintsList(); 327 327 int numHints = 0; 328 for( auto &hint : hints)329 { 330 if( (hint)->isActive(player))328 for(QuestHint* 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( auto &hint : hints)352 { 353 if( (hint)->isActive(player) && index-- == 0)351 for(QuestHint* hint : hints) 352 { 353 if(hint->isActive(player) && index-- == 0) 354 354 return hint; 355 355 } -
code/branches/cpp11_v2/src/modules/questsystem/effects/AddReward.cc
r10821 r10916 84 84 { 85 85 int i = index; 86 for ( const auto & elem: this->rewards_)86 for (Rewardable* reward : this->rewards_) 87 87 { 88 88 if(i == 0) 89 return elem;89 return reward; 90 90 i--; 91 91 } … … 106 106 107 107 bool temp = true; 108 for ( auto & elem: this->rewards_)109 temp = temp && (elem)->reward(player);108 for (Rewardable* reward : this->rewards_) 109 temp = temp && reward->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
r10821 r10916 104 104 } 105 105 106 for ( auto & elem: this->stones_)107 (elem)->destroy();106 for (TetrisStone* stone : this->stones_) 107 stone->destroy(); 108 108 this->stones_.clear(); 109 109 } … … 341 341 { 342 342 // Spawn a human player. 343 for (auto & elem: this->players_)344 if ( elem.first->isHumanPlayer() && (elem.first->isReadyToSpawn() || this->bForceSpawn_))345 this->spawnPlayer( elem.first);343 for (auto& mapEntry : this->players_) 344 if (mapEntry.first->isHumanPlayer() && (mapEntry.first->isReadyToSpawn() || this->bForceSpawn_)) 345 this->spawnPlayer(mapEntry.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( 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));504 for(TetrisStone* stone : this->stones_) 505 { 506 if(static_cast<unsigned int>((stone->getPosition().y - 5)/this->center_->getStoneSize()) > row) 507 stone->setPosition(stone->getPosition()-Vector3(0,10,0)); 508 508 } 509 509 -
code/branches/cpp11_v2/src/modules/tetris/TetrisBrick.cc
r10821 r10916 239 239 { 240 240 assert(this->tetris_); 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_ ));241 for(TetrisStone* stone : this->brickStones_) 242 { 243 stone->detachFromParent(); 244 stone->attachToParent(center); 245 stone->setPosition(this->getPosition()+this->tetris_->rotateVector(stone->getPosition(),this->rotationCount_ )); 246 246 } 247 247 this->brickStones_.clear(); -
code/branches/cpp11_v2/src/modules/towerdefense/TowerDefense.cc
r10821 r10916 183 183 en1->lookAt(waypoints_.at(1)->getPosition() + offset_); 184 184 185 for ( auto & elem: waypoints_)185 for (TowerDefenseField* field : waypoints_) 186 186 { 187 187 orxonox::WeakPtr<MovableEntity> waypoint = new MovableEntity(this->center_->getContext()); 188 waypoint->setPosition( elem->getPosition() + offset_);188 waypoint->setPosition(field->getPosition() + offset_); 189 189 controller->addWaypoint(waypoint); 190 190 } -
code/branches/cpp11_v2/src/orxonox/Level.cc
r10821 r10916 106 106 void Level::networkCallbackTemplatesChanged() 107 107 { 108 for(const auto & elem: this->networkTemplateNames_)109 { 110 assert(Template::getTemplate( elem));111 Template::getTemplate( elem)->applyOn(this);108 for(const std::string& name : this->networkTemplateNames_) 109 { 110 assert(Template::getTemplate(name)); 111 Template::getTemplate(name)->applyOn(this); 112 112 } 113 113 } … … 135 135 // objects alive when ~Level is called. This is the reason why we cannot directly destroy() the Plugins - instead we need 136 136 // to call destroyLater() to ensure that no instances from this plugin exist anymore. 137 for ( auto & elem: this->plugins_)138 (elem)->destroyLater();137 for (PluginReference* plugin : this->plugins_) 138 plugin->destroyLater(); 139 139 this->plugins_.clear(); 140 140 } … … 173 173 { 174 174 unsigned int i = 0; 175 for ( const auto & elem: this->objects_)175 for (BaseObject* object : this->objects_) 176 176 { 177 177 if (i == index) 178 return (elem);178 return object; 179 179 ++i; 180 180 } -
code/branches/cpp11_v2/src/orxonox/LevelInfo.cc
r10821 r10916 106 106 { 107 107 SubString substr = SubString(tags, ",", " "); // Split the string into tags. 108 const std::vector<std::string>& strings = substr.getAllStrings();109 for (const auto & strings_it : strings)110 this->addTag( strings_it, false);108 const std::vector<std::string>& tokens = substr.getAllStrings(); 109 for (const std::string& token : tokens) 110 this->addTag(token, false); 111 111 112 112 this->tagsUpdated(); … … 121 121 { 122 122 SubString substr = SubString(ships, ",", " "); // Split the string into tags. 123 const std::vector<std::string>& strings = substr.getAllStrings();124 for(const auto & strings_it : strings)125 this->addStartingShip( strings_it, false);123 const std::vector<std::string>& tokens = substr.getAllStrings(); 124 for(const std::string& token : tokens) 125 this->addStartingShip(token, false); 126 126 127 127 this->startingshipsUpdated(); -
code/branches/cpp11_v2/src/orxonox/LevelManager.cc
r10821 r10916 175 175 this->levels_.front()->setActive(true); 176 176 // Make every player enter the newly activated level. 177 for (const auto & elem: PlayerManager::getInstance().getClients())178 this->levels_.front()->playerEntered( elem.second);177 for (const auto& mapEntry : PlayerManager::getInstance().getClients()) 178 this->levels_.front()->playerEntered(mapEntry.second); 179 179 } 180 180 } -
code/branches/cpp11_v2/src/orxonox/Scene.cc
r10821 r10916 220 220 { 221 221 // Remove all WorldEntities and shove them to the queue since they would still like to be in a physical world. 222 for ( const auto & elem: this->physicalObjects_)222 for (WorldEntity* object : this->physicalObjects_) 223 223 { 224 this->physicalWorld_->removeRigidBody( (elem)->physicalBody_);225 this->physicalObjectQueue_.insert( elem);224 this->physicalWorld_->removeRigidBody(object->physicalBody_); 225 this->physicalObjectQueue_.insert(object); 226 226 } 227 227 this->physicalObjects_.clear(); … … 255 255 { 256 256 // Add all scheduled WorldEntities 257 for ( const auto & elem: this->physicalObjectQueue_)257 for (WorldEntity* object : this->physicalObjectQueue_) 258 258 { 259 this->physicalWorld_->addRigidBody( (elem)->physicalBody_);260 this->physicalObjects_.insert( elem);259 this->physicalWorld_->addRigidBody(object->physicalBody_); 260 this->physicalObjects_.insert(object); 261 261 } 262 262 this->physicalObjectQueue_.clear(); … … 319 319 { 320 320 unsigned int i = 0; 321 for ( const auto & elem: this->objects_)321 for (BaseObject* object : this->objects_) 322 322 { 323 323 if (i == index) 324 return (elem);324 return object; 325 325 ++i; 326 326 } -
code/branches/cpp11_v2/src/orxonox/collisionshapes/CompoundCollisionShape.cc
r10821 r10916 65 65 { 66 66 // Delete all children 67 for (auto & elem: this->attachedShapes_)67 for (auto& mapEntry : this->attachedShapes_) 68 68 { 69 69 // make sure that the child doesn't want to detach itself --> speedup because of the missing update 70 elem.first->notifyDetached();71 elem.first->destroy();72 if (this->collisionShape_ == elem.second)70 mapEntry.first->notifyDetached(); 71 mapEntry.first->destroy(); 72 if (this->collisionShape_ == mapEntry.second) 73 73 this->collisionShape_ = nullptr; // don't destroy it twice 74 74 } … … 246 246 { 247 247 unsigned int i = 0; 248 for (const auto & elem: this->attachedShapes_)248 for (const auto& mapEntry : this->attachedShapes_) 249 249 { 250 250 if (i == index) 251 return elem.first;251 return mapEntry.first; 252 252 ++i; 253 253 } … … 266 266 std::vector<CollisionShape*> shapes; 267 267 // Iterate through all attached CollisionShapes and add them to the list of shapes. 268 for(auto & elem: this->attachedShapes_)269 shapes.push_back( elem.first);268 for(auto& mapEntry : this->attachedShapes_) 269 shapes.push_back(mapEntry.first); 270 270 271 271 // Delete the compound shape and create a new one. … … 274 274 275 275 // Re-attach all CollisionShapes. 276 for(auto shape : shapes) 277 { 278 276 for(CollisionShape* shape : shapes) 277 { 279 278 shape->setScale3D(this->getScale3D()); 280 279 // Only actually attach if we didn't pick a CompoundCollisionShape with no content. -
code/branches/cpp11_v2/src/orxonox/controllers/ArtificialController.cc
r10768 r10916 231 231 int ArtificialController::getFiremode(std::string name) 232 232 { 233 for (auto firemode: this->weaponModes_)234 { 235 if ( firemode.first == name)236 return firemode.second;233 for (auto& mapEntry : this->weaponModes_) 234 { 235 if (mapEntry.first == name) 236 return mapEntry.second; 237 237 } 238 238 return -1; -
code/branches/cpp11_v2/src/orxonox/controllers/FormationController.cc
r10821 r10916 440 440 if(newMaster->slaves_.size() > this->maxFormationSize_) continue; 441 441 442 for( auto & elem: this->slaves_)442 for(FormationController* slave : this->slaves_) 443 443 { 444 (elem)->myMaster_ = newMaster;445 newMaster->slaves_.push_back( elem);444 slave->myMaster_ = newMaster; 445 newMaster->slaves_.push_back(slave); 446 446 } 447 447 this->slaves_.clear(); … … 486 486 int i = 1; 487 487 488 for( auto & elem: slaves_)488 for(FormationController* slave : slaves_) 489 489 { 490 490 pos = Vector3::ZERO; … … 497 497 dest+=FORMATION_LENGTH*(orient*WorldEntity::BACK); 498 498 } 499 (elem)->setTargetOrientation(orient);500 (elem)->setTargetPosition(pos);499 slave->setTargetOrientation(orient); 500 slave->setTargetPosition(pos); 501 501 left=!left; 502 502 } … … 569 569 if(this->state_ != MASTER) return; 570 570 571 for( auto & elem: slaves_)572 { 573 (elem)->state_ = FREE;574 (elem)->myMaster_ = nullptr;571 for(FormationController* slave : slaves_) 572 { 573 slave->state_ = FREE; 574 slave->myMaster_ = nullptr; 575 575 } 576 576 this->slaves_.clear(); … … 584 584 if(this->state_ != MASTER) return; 585 585 586 for( auto & elem: slaves_)587 { 588 (elem)->state_ = FREE;589 (elem)->forceFreedom();590 (elem)->targetPosition_ = this->targetPosition_;591 (elem)->bShooting_ = true;586 for(FormationController* slave : slaves_) 587 { 588 slave->state_ = FREE; 589 slave->forceFreedom(); 590 slave->targetPosition_ = this->targetPosition_; 591 slave->bShooting_ = true; 592 592 // (*it)->getControllableEntity()->fire(0);// fire once for fun 593 593 } … … 650 650 this->slaves_.push_back(this->myMaster_); 651 651 //set this as new master 652 for( auto & elem: slaves_)653 { 654 (elem)->myMaster_=this;652 for(FormationController* slave : slaves_) 653 { 654 slave->myMaster_=this; 655 655 } 656 656 this->myMaster_=nullptr; … … 694 694 if (this->state_ == MASTER) 695 695 { 696 for( auto & elem: slaves_)697 { 698 (elem)->formationMode_ = val;696 for(FormationController* slave : slaves_) 697 { 698 slave->formationMode_ = val; 699 699 if (val == ATTACK) 700 (elem)->forgetTarget();700 slave->forgetTarget(); 701 701 } 702 702 } -
code/branches/cpp11_v2/src/orxonox/controllers/WaypointController.cc
r10821 r10916 44 44 WaypointController::~WaypointController() 45 45 { 46 for ( auto & elem: this->waypoints_)46 for (WorldEntity* waypoint : this->waypoints_) 47 47 { 48 if( elem)49 elem->destroy();48 if(waypoint) 49 waypoint->destroy(); 50 50 } 51 51 } -
code/branches/cpp11_v2/src/orxonox/gamestates/GSLevel.cc
r10821 r10916 251 251 252 252 // delete states 253 for ( auto &state : states)253 for (GSLevelMementoState* state : states) 254 254 delete state; 255 255 } -
code/branches/cpp11_v2/src/orxonox/gametypes/Dynamicmatch.cc
r10821 r10916 405 405 void Dynamicmatch::rewardPig() 406 406 { 407 for (auto & elem: this->playerParty_) //durch alle Spieler iterieren und alle piggys finden408 { 409 if ( elem.second==piggy)//Spieler mit der Pig-party frags++410 { 411 this->playerScored( elem.first);407 for (auto& mapEntry : this->playerParty_) //durch alle Spieler iterieren und alle piggys finden 408 { 409 if (mapEntry.second==piggy)//Spieler mit der Pig-party frags++ 410 { 411 this->playerScored(mapEntry.first); 412 412 } 413 413 } … … 422 422 423 423 std::set<WorldEntity*> pawnAttachments = pawn->getAttachedObjects(); 424 for ( const auto &pawnAttachment : pawnAttachments)425 { 426 if ( (pawnAttachment)->isA(Class(TeamColourable)))424 for (WorldEntity* pawnAttachment : pawnAttachments) 425 { 426 if (pawnAttachment->isA(Class(TeamColourable))) 427 427 { 428 428 TeamColourable* tc = orxonox_cast<TeamColourable*>(pawnAttachment); … … 441 441 if (tutorial) // Announce selectionphase 442 442 { 443 for (auto & elem: this->playerParty_)444 { 445 if (! elem.first)//in order to catch nullpointer443 for (auto& mapEntry : this->playerParty_) 444 { 445 if (!mapEntry.first)//in order to catch nullpointer 446 446 continue; 447 if ( elem.first->getClientID() == NETWORK_PEER_ID_UNKNOWN)447 if (mapEntry.first->getClientID() == NETWORK_PEER_ID_UNKNOWN) 448 448 continue; 449 this->gtinfo_->sendStaticMessage("Selection phase: Shoot at everything that moves.", elem.first->getClientID(),ColourValue(1.0f, 1.0f, 0.5f));449 this->gtinfo_->sendStaticMessage("Selection phase: Shoot at everything that moves.",mapEntry.first->getClientID(),ColourValue(1.0f, 1.0f, 0.5f)); 450 450 } 451 451 } … … 456 456 if(tutorial&&(!notEnoughKillers)&&(!notEnoughChasers)) //Selection phase over 457 457 { 458 for (auto & elem: this->playerParty_)458 for (auto& mapEntry : this->playerParty_) 459 459 { 460 if (! elem.first)//in order to catch nullpointer460 if (!mapEntry.first)//in order to catch nullpointer 461 461 continue; 462 if ( elem.first->getClientID() == NETWORK_PEER_ID_UNKNOWN)462 if (mapEntry.first->getClientID() == NETWORK_PEER_ID_UNKNOWN) 463 463 continue; 464 else if ( elem.second==chaser)464 else if (mapEntry.second==chaser) 465 465 { 466 466 if (numberOf[killer]>0) 467 this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible. Defend yourself against the killers.", elem.first->getClientID(),partyColours_[piggy]);467 this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible. Defend yourself against the killers.",mapEntry.first->getClientID(),partyColours_[piggy]); 468 468 else 469 this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible.", elem.first->getClientID(),partyColours_[piggy]);469 this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible.",mapEntry.first->getClientID(),partyColours_[piggy]); 470 470 //this->gtinfo_->sendFadingMessage("You're now a chaser.",it->first->getClientID()); 471 471 } 472 else if ( elem.second==piggy)473 { 474 this->gtinfo_->sendStaticMessage("Either hide or shoot a chaser.", elem.first->getClientID(),partyColours_[chaser]);472 else if (mapEntry.second==piggy) 473 { 474 this->gtinfo_->sendStaticMessage("Either hide or shoot a chaser.",mapEntry.first->getClientID(),partyColours_[chaser]); 475 475 //this->gtinfo_->sendFadingMessage("You're now a victim.",it->first->getClientID()); 476 476 } 477 else if ( elem.second==killer)478 { 479 this->gtinfo_->sendStaticMessage("Take the chasers down.", elem.first->getClientID(),partyColours_[chaser]);477 else if (mapEntry.second==killer) 478 { 479 this->gtinfo_->sendStaticMessage("Take the chasers down.",mapEntry.first->getClientID(),partyColours_[chaser]); 480 480 //this->gtinfo_->sendFadingMessage("You're now a killer.",it->first->getClientID()); 481 481 } … … 490 490 if (tutorial) // Announce selectionphase 491 491 { 492 for (auto & elem: this->playerParty_)493 { 494 if (! elem.first)//in order to catch nullpointer492 for (auto& mapEntry : this->playerParty_) 493 { 494 if (!mapEntry.first)//in order to catch nullpointer 495 495 continue; 496 if ( elem.first->getClientID() == NETWORK_PEER_ID_UNKNOWN)496 if (mapEntry.first->getClientID() == NETWORK_PEER_ID_UNKNOWN) 497 497 continue; 498 this->gtinfo_->sendStaticMessage("Selection phase: Shoot at everything that moves.", elem.first->getClientID(),ColourValue(1.0f, 1.0f, 0.5f));498 this->gtinfo_->sendStaticMessage("Selection phase: Shoot at everything that moves.",mapEntry.first->getClientID(),ColourValue(1.0f, 1.0f, 0.5f)); 499 499 } 500 500 } … … 505 505 if(tutorial&&(!notEnoughPigs)&&(!notEnoughChasers)) //Selection phase over 506 506 { 507 for (auto & elem: this->playerParty_)507 for (auto& mapEntry : this->playerParty_) 508 508 { 509 if (! elem.first)509 if (!mapEntry.first) 510 510 continue; 511 if ( elem.first->getClientID() == NETWORK_PEER_ID_UNKNOWN)511 if (mapEntry.first->getClientID() == NETWORK_PEER_ID_UNKNOWN) 512 512 continue; 513 else if ( elem.second==chaser)513 else if (mapEntry.second==chaser) 514 514 { 515 515 if (numberOf[killer]>0) 516 this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible. Defend yourself against the killers.", elem.first->getClientID(),partyColours_[piggy]);516 this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible. Defend yourself against the killers.",mapEntry.first->getClientID(),partyColours_[piggy]); 517 517 else 518 this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible.", elem.first->getClientID(),partyColours_[piggy]);518 this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible.",mapEntry.first->getClientID(),partyColours_[piggy]); 519 519 //this->gtinfo_->sendFadingMessage("You're now a chaser.",it->first->getClientID()); 520 520 } 521 else if ( elem.second==piggy)522 { 523 this->gtinfo_->sendStaticMessage("Either hide or shoot a chaser.", elem.first->getClientID(),partyColours_[piggy]);521 else if (mapEntry.second==piggy) 522 { 523 this->gtinfo_->sendStaticMessage("Either hide or shoot a chaser.",mapEntry.first->getClientID(),partyColours_[piggy]); 524 524 //this->gtinfo_->sendFadingMessage("You're now a victim.",it->first->getClientID()); 525 525 } 526 else if ( elem.second==killer)527 { 528 this->gtinfo_->sendStaticMessage("Take the chasers down.", elem.first->getClientID(),partyColours_[piggy]);526 else if (mapEntry.second==killer) 527 { 528 this->gtinfo_->sendStaticMessage("Take the chasers down.",mapEntry.first->getClientID(),partyColours_[piggy]); 529 529 //this->gtinfo_->sendFadingMessage("You're now a killer.",it->first->getClientID()); 530 530 } … … 540 540 if (tutorial) // Announce selectionphase 541 541 { 542 for (auto & elem: this->playerParty_)543 { 544 if (! elem.first)//in order to catch nullpointer542 for (auto& mapEntry : this->playerParty_) 543 { 544 if (!mapEntry.first)//in order to catch nullpointer 545 545 continue; 546 if ( elem.first->getClientID() == NETWORK_PEER_ID_UNKNOWN)546 if (mapEntry.first->getClientID() == NETWORK_PEER_ID_UNKNOWN) 547 547 continue; 548 this->gtinfo_->sendStaticMessage("Selection phase: Shoot at everything that moves.", elem.first->getClientID(),ColourValue(1.0f, 1.0f, 0.5f));548 this->gtinfo_->sendStaticMessage("Selection phase: Shoot at everything that moves.",mapEntry.first->getClientID(),ColourValue(1.0f, 1.0f, 0.5f)); 549 549 } 550 550 } … … 555 555 if(tutorial&&(!notEnoughPigs)&&(!notEnoughKillers)) //Selection phase over 556 556 { 557 for (auto & elem: this->playerParty_)557 for (auto& mapEntry : this->playerParty_) 558 558 { 559 if (! elem.first)559 if (!mapEntry.first) 560 560 continue; 561 if ( elem.first->getClientID() == NETWORK_PEER_ID_UNKNOWN)561 if (mapEntry.first->getClientID() == NETWORK_PEER_ID_UNKNOWN) 562 562 continue; 563 else if ( elem.second==chaser)563 else if (mapEntry.second==chaser) 564 564 { 565 565 if (numberOf[killer]>0) 566 this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible. Defend yourself against the killers.", elem.first->getClientID(),partyColours_[piggy]);566 this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible. Defend yourself against the killers.",mapEntry.first->getClientID(),partyColours_[piggy]); 567 567 else 568 this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible.", elem.first->getClientID(),partyColours_[piggy]);568 this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible.",mapEntry.first->getClientID(),partyColours_[piggy]); 569 569 //this->gtinfo_->sendFadingMessage("You're now a chaser.",it->first->getClientID()); 570 570 } 571 else if ( elem.second==piggy)572 { 573 this->gtinfo_->sendStaticMessage("Either hide or shoot a chaser.", elem.first->getClientID(),partyColours_[chaser]);571 else if (mapEntry.second==piggy) 572 { 573 this->gtinfo_->sendStaticMessage("Either hide or shoot a chaser.",mapEntry.first->getClientID(),partyColours_[chaser]); 574 574 //this->gtinfo_->sendFadingMessage("You're now a victim.",it->first->getClientID()); 575 575 } 576 else if ( elem.second==killer)577 { 578 this->gtinfo_->sendStaticMessage("Take the chasers down.", elem.first->getClientID(),partyColours_[chaser]);576 else if (mapEntry.second==killer) 577 { 578 this->gtinfo_->sendStaticMessage("Take the chasers down.",mapEntry.first->getClientID(),partyColours_[chaser]); 579 579 //this->gtinfo_->sendFadingMessage("You're now a killer.",it->first->getClientID()); 580 580 } … … 620 620 else if(tutorial) // Announce selectionphase 621 621 { 622 for (auto & elem: this->playerParty_)623 { 624 if ( elem.first->getClientID() == NETWORK_PEER_ID_UNKNOWN)622 for (auto& mapEntry : this->playerParty_) 623 { 624 if (mapEntry.first->getClientID() == NETWORK_PEER_ID_UNKNOWN) 625 625 continue; 626 this->gtinfo_->sendStaticMessage("Selection phase: Shoot at everything that moves.", elem.first->getClientID(),ColourValue(1.0f, 1.0f, 0.5f));626 this->gtinfo_->sendStaticMessage("Selection phase: Shoot at everything that moves.",mapEntry.first->getClientID(),ColourValue(1.0f, 1.0f, 0.5f)); 627 627 } 628 628 } … … 676 676 unsigned int randomspawn = static_cast<unsigned int>(rnd(static_cast<float>(teamSpawnPoints.size()))); 677 677 unsigned int index = 0; 678 for ( const auto &teamSpawnPoint : teamSpawnPoints)678 for (SpawnPoint* teamSpawnPoint : teamSpawnPoints) 679 679 { 680 680 if (index == randomspawn) 681 return (teamSpawnPoint);681 return teamSpawnPoint; 682 682 683 683 ++index; -
code/branches/cpp11_v2/src/orxonox/gametypes/Gametype.cc
r10821 r10916 139 139 if (!this->gtinfo_->hasStarted()) 140 140 { 141 for (auto & elem: this->players_)141 for (auto& mapEntry : this->players_) 142 142 { 143 143 // Inform the GametypeInfo that the player is ready to spawn. 144 if( elem.first->isHumanPlayer() && elem.first->isReadyToSpawn())145 this->gtinfo_->playerReadyToSpawn( elem.first);144 if(mapEntry.first->isHumanPlayer() && mapEntry.first->isReadyToSpawn()) 145 this->gtinfo_->playerReadyToSpawn(mapEntry.first); 146 146 } 147 147 … … 169 169 } 170 170 171 for (auto & elem: this->players_)172 { 173 if ( elem.first->getControllableEntity())174 { 175 ControllableEntity* oldentity = elem.first->getControllableEntity();171 for (auto& mapEntry : this->players_) 172 { 173 if (mapEntry.first->getControllableEntity()) 174 { 175 ControllableEntity* oldentity = mapEntry.first->getControllableEntity(); 176 176 177 177 ControllableEntity* entity = this->defaultControllableEntity_.fabricate(oldentity->getContext()); … … 186 186 entity->setOrientation(oldentity->getWorldOrientation()); 187 187 } 188 elem.first->startControl(entity);188 mapEntry.first->startControl(entity); 189 189 } 190 190 else 191 this->spawnPlayerAsDefaultPawn( elem.first);191 this->spawnPlayerAsDefaultPawn(mapEntry.first); 192 192 } 193 193 } … … 341 341 unsigned int index = 0; 342 342 std::vector<SpawnPoint*> activeSpawnPoints; 343 for ( const auto & elem: this->spawnpoints_)343 for (SpawnPoint* spawnpoint : this->spawnpoints_) 344 344 { 345 345 if (index == randomspawn) 346 fallbackSpawnPoint = (elem);347 348 if ( elem != nullptr && (elem)->isActive())349 activeSpawnPoints.push_back( elem);346 fallbackSpawnPoint = spawnpoint; 347 348 if (spawnpoint != nullptr && spawnpoint->isActive()) 349 activeSpawnPoints.push_back(spawnpoint); 350 350 351 351 ++index; … … 366 366 void Gametype::assignDefaultPawnsIfNeeded() 367 367 { 368 for (auto & elem: this->players_)369 { 370 if (! elem.first->getControllableEntity())371 { 372 elem.second.state_ = PlayerState::Dead;373 374 if (! elem.first->isReadyToSpawn() || !this->gtinfo_->hasStarted())375 { 376 this->spawnPlayerAsDefaultPawn( elem.first);377 elem.second.state_ = PlayerState::Dead;368 for (auto& mapEntry : this->players_) 369 { 370 if (!mapEntry.first->getControllableEntity()) 371 { 372 mapEntry.second.state_ = PlayerState::Dead; 373 374 if (!mapEntry.first->isReadyToSpawn() || !this->gtinfo_->hasStarted()) 375 { 376 this->spawnPlayerAsDefaultPawn(mapEntry.first); 377 mapEntry.second.state_ = PlayerState::Dead; 378 378 } 379 379 } … … 404 404 bool allplayersready = true; 405 405 bool hashumanplayers = false; 406 for (auto & elem: this->players_)406 for (auto& mapEntry : this->players_) 407 407 { 408 if (! elem.first->isReadyToSpawn())408 if (!mapEntry.first->isReadyToSpawn()) 409 409 allplayersready = false; 410 if ( elem.first->isHumanPlayer())410 if (mapEntry.first->isHumanPlayer()) 411 411 hashumanplayers = true; 412 412 } … … 430 430 void Gametype::spawnPlayersIfRequested() 431 431 { 432 for (auto & elem: this->players_)433 { 434 if ( elem.first->isReadyToSpawn() || this->bForceSpawn_)435 this->spawnPlayer( elem.first);432 for (auto& mapEntry : this->players_) 433 { 434 if (mapEntry.first->isReadyToSpawn() || this->bForceSpawn_) 435 this->spawnPlayer(mapEntry.first); 436 436 } 437 437 } … … 439 439 void Gametype::spawnDeadPlayersIfRequested() 440 440 { 441 for (auto & elem: this->players_)442 if ( elem.second.state_ == PlayerState::Dead)443 if ( elem.first->isReadyToSpawn() || this->bForceSpawn_)444 this->spawnPlayer( elem.first);441 for (auto& mapEntry : this->players_) 442 if (mapEntry.second.state_ == PlayerState::Dead) 443 if (mapEntry.first->isReadyToSpawn() || this->bForceSpawn_) 444 this->spawnPlayer(mapEntry.first); 445 445 } 446 446 … … 538 538 GSLevelMementoState* Gametype::exportMementoState() 539 539 { 540 for (auto & elem: this->players_)541 { 542 if ( elem.first->isHumanPlayer() && elem.first->getControllableEntity() && elem.first->getControllableEntity()->getCamera())543 { 544 Camera* camera = elem.first->getControllableEntity()->getCamera();540 for (auto& mapEntry : this->players_) 541 { 542 if (mapEntry.first->isHumanPlayer() && mapEntry.first->getControllableEntity() && mapEntry.first->getControllableEntity()->getCamera()) 543 { 544 Camera* camera = mapEntry.first->getControllableEntity()->getCamera(); 545 545 546 546 GametypeMementoState* state = new GametypeMementoState(); … … 559 559 // find correct memento state 560 560 GametypeMementoState* state = nullptr; 561 for ( auto & states_i: states)562 { 563 state = dynamic_cast<GametypeMementoState*>( states_i);561 for (GSLevelMementoState* temp : states) 562 { 563 state = dynamic_cast<GametypeMementoState*>(temp); 564 564 if (state) 565 565 break; … … 587 587 588 588 // find correct player and assign default entity with original position & orientation 589 for (auto & elem: this->players_)590 { 591 if ( elem.first->isHumanPlayer())589 for (auto& mapEntry : this->players_) 590 { 591 if (mapEntry.first->isHumanPlayer()) 592 592 { 593 593 ControllableEntity* entity = this->defaultControllableEntity_.fabricate(scene->getContext()); 594 594 entity->setPosition(state->cameraPosition_); 595 595 entity->setOrientation(state->cameraOrientation_); 596 elem.first->startControl(entity);596 mapEntry.first->startControl(entity); 597 597 break; 598 598 } -
code/branches/cpp11_v2/src/orxonox/gametypes/LastManStanding.cc
r10821 r10916 56 56 void LastManStanding::spawnDeadPlayersIfRequested() 57 57 { 58 for (auto & elem: this->players_)59 if ( elem.second.state_ == PlayerState::Dead)60 { 61 bool alive = (0<playerLives_[ elem.first]&&(inGame_[elem.first]));62 if (alive&&( elem.first->isReadyToSpawn() || this->bForceSpawn_))63 { 64 this->spawnPlayer( elem.first);58 for (auto& mapEntry : this->players_) 59 if (mapEntry.second.state_ == PlayerState::Dead) 60 { 61 bool alive = (0<playerLives_[mapEntry.first]&&(inGame_[mapEntry.first])); 62 if (alive&&(mapEntry.first->isReadyToSpawn() || this->bForceSpawn_)) 63 { 64 this->spawnPlayer(mapEntry.first); 65 65 } 66 66 } … … 114 114 { 115 115 int min=lives; 116 for (auto & elem: this->playerLives_)117 { 118 if ( elem.second<=0)116 for (auto& mapEntry : this->playerLives_) 117 { 118 if (mapEntry.second<=0) 119 119 continue; 120 if ( elem.second<lives)121 min= elem.second;120 if (mapEntry.second<lives) 121 min=mapEntry.second; 122 122 } 123 123 return min; … … 128 128 Gametype::end(); 129 129 130 for (auto & elem: this->playerLives_)131 { 132 if ( elem.first->getClientID() == NETWORK_PEER_ID_UNKNOWN)130 for (auto& mapEntry : this->playerLives_) 131 { 132 if (mapEntry.first->getClientID() == NETWORK_PEER_ID_UNKNOWN) 133 133 continue; 134 134 135 if ( elem.second > 0)136 this->gtinfo_->sendAnnounceMessage("You have won the match!", elem.first->getClientID());135 if (mapEntry.second > 0) 136 this->gtinfo_->sendAnnounceMessage("You have won the match!", mapEntry.first->getClientID()); 137 137 else 138 this->gtinfo_->sendAnnounceMessage("You have lost the match!", elem.first->getClientID());138 this->gtinfo_->sendAnnounceMessage("You have lost the match!", mapEntry.first->getClientID()); 139 139 } 140 140 } … … 237 237 this->end(); 238 238 } 239 for (auto & elem: this->timeToAct_)240 { 241 if (playerGetLives( elem.first)<=0)//Players without lives shouldn't be affected by time.239 for (auto& mapEntry : this->timeToAct_) 240 { 241 if (playerGetLives(mapEntry.first)<=0)//Players without lives shouldn't be affected by time. 242 242 continue; 243 elem.second-=dt;//Decreases punishment time.244 if (!inGame_[ elem.first])//Manages respawn delay - player is forced to respawn after the delaytime is used up.245 { 246 playerDelayTime_[ elem.first]-=dt;247 if (playerDelayTime_[ elem.first]<=0)248 this->inGame_[ elem.first]=true;249 250 if ( elem.first->getClientID()== NETWORK_PEER_ID_UNKNOWN)243 mapEntry.second-=dt;//Decreases punishment time. 244 if (!inGame_[mapEntry.first])//Manages respawn delay - player is forced to respawn after the delaytime is used up. 245 { 246 playerDelayTime_[mapEntry.first]-=dt; 247 if (playerDelayTime_[mapEntry.first]<=0) 248 this->inGame_[mapEntry.first]=true; 249 250 if (mapEntry.first->getClientID()== NETWORK_PEER_ID_UNKNOWN) 251 251 continue; 252 int output=1+(int)playerDelayTime_[ elem.first];252 int output=1+(int)playerDelayTime_[mapEntry.first]; 253 253 const std::string& message = "Respawn in " +multi_cast<std::string>(output)+ " seconds." ;//Countdown 254 this->gtinfo_->sendFadingMessage(message, elem.first->getClientID());255 } 256 else if ( elem.second<0.0f)257 { 258 elem.second=timeRemaining+3.0f;//reset punishment-timer259 if (playerGetLives( elem.first)>0)254 this->gtinfo_->sendFadingMessage(message,mapEntry.first->getClientID()); 255 } 256 else if (mapEntry.second<0.0f) 257 { 258 mapEntry.second=timeRemaining+3.0f;//reset punishment-timer 259 if (playerGetLives(mapEntry.first)>0) 260 260 { 261 this->punishPlayer( elem.first);262 if ( elem.first->getClientID()== NETWORK_PEER_ID_UNKNOWN)261 this->punishPlayer(mapEntry.first); 262 if (mapEntry.first->getClientID()== NETWORK_PEER_ID_UNKNOWN) 263 263 return; 264 264 const std::string& message = ""; // resets Camper-Warning-message 265 this->gtinfo_->sendFadingMessage(message, elem.first->getClientID());265 this->gtinfo_->sendFadingMessage(message,mapEntry.first->getClientID()); 266 266 } 267 267 } 268 else if ( elem.second<timeRemaining/5)//Warning message269 { 270 if ( elem.first->getClientID()== NETWORK_PEER_ID_UNKNOWN)268 else if (mapEntry.second<timeRemaining/5)//Warning message 269 { 270 if (mapEntry.first->getClientID()== NETWORK_PEER_ID_UNKNOWN) 271 271 continue; 272 272 const std::string& message = "Camper Warning! Don't forget to shoot."; 273 this->gtinfo_->sendFadingMessage(message, elem.first->getClientID());273 this->gtinfo_->sendFadingMessage(message,mapEntry.first->getClientID()); 274 274 } 275 275 } -
code/branches/cpp11_v2/src/orxonox/gametypes/LastTeamStanding.cc
r10821 r10916 145 145 void LastTeamStanding::spawnDeadPlayersIfRequested() 146 146 { 147 for (auto & elem: this->players_)148 if ( elem.second.state_ == PlayerState::Dead)149 { 150 bool alive = (0 < playerLives_[ elem.first]&&(inGame_[elem.first]));151 if (alive&&( elem.first->isReadyToSpawn() || this->bForceSpawn_))152 { 153 this->spawnPlayer( elem.first);147 for (auto& mapEntry : this->players_) 148 if (mapEntry.second.state_ == PlayerState::Dead) 149 { 150 bool alive = (0 < playerLives_[mapEntry.first]&&(inGame_[mapEntry.first])); 151 if (alive&&(mapEntry.first->isReadyToSpawn() || this->bForceSpawn_)) 152 { 153 this->spawnPlayer(mapEntry.first); 154 154 } 155 155 } … … 184 184 this->end(); 185 185 } 186 for (auto & elem: this->timeToAct_)187 { 188 if (playerGetLives( elem.first) <= 0)//Players without lives shouldn't be affected by time.186 for (auto& mapEntry : this->timeToAct_) 187 { 188 if (playerGetLives(mapEntry.first) <= 0)//Players without lives shouldn't be affected by time. 189 189 continue; 190 elem.second -= dt;//Decreases punishment time.191 if (!inGame_[ elem.first])//Manages respawn delay - player is forced to respawn after the delaytime is used up.192 { 193 playerDelayTime_[ elem.first] -= dt;194 if (playerDelayTime_[ elem.first] <= 0)195 this->inGame_[ elem.first] = true;196 197 if ( elem.first->getClientID()== NETWORK_PEER_ID_UNKNOWN)190 mapEntry.second -= dt;//Decreases punishment time. 191 if (!inGame_[mapEntry.first])//Manages respawn delay - player is forced to respawn after the delaytime is used up. 192 { 193 playerDelayTime_[mapEntry.first] -= dt; 194 if (playerDelayTime_[mapEntry.first] <= 0) 195 this->inGame_[mapEntry.first] = true; 196 197 if (mapEntry.first->getClientID()== NETWORK_PEER_ID_UNKNOWN) 198 198 continue; 199 int output = 1 + (int)playerDelayTime_[ elem.first];199 int output = 1 + (int)playerDelayTime_[mapEntry.first]; 200 200 const std::string& message = "Respawn in " +multi_cast<std::string>(output)+ " seconds." ;//Countdown 201 this->gtinfo_->sendFadingMessage(message, elem.first->getClientID());202 } 203 else if ( elem.second < 0.0f)204 { 205 elem.second = timeRemaining + 3.0f;//reset punishment-timer206 if (playerGetLives( elem.first) > 0)201 this->gtinfo_->sendFadingMessage(message,mapEntry.first->getClientID()); 202 } 203 else if (mapEntry.second < 0.0f) 204 { 205 mapEntry.second = timeRemaining + 3.0f;//reset punishment-timer 206 if (playerGetLives(mapEntry.first) > 0) 207 207 { 208 this->punishPlayer( elem.first);209 if ( elem.first->getClientID() == NETWORK_PEER_ID_UNKNOWN)208 this->punishPlayer(mapEntry.first); 209 if (mapEntry.first->getClientID() == NETWORK_PEER_ID_UNKNOWN) 210 210 return; 211 211 const std::string& message = ""; // resets Camper-Warning-message 212 this->gtinfo_->sendFadingMessage(message, elem.first->getClientID());212 this->gtinfo_->sendFadingMessage(message, mapEntry.first->getClientID()); 213 213 } 214 214 } 215 else if ( elem.second < timeRemaining/5)//Warning message216 { 217 if ( elem.first->getClientID()== NETWORK_PEER_ID_UNKNOWN)215 else if (mapEntry.second < timeRemaining/5)//Warning message 216 { 217 if (mapEntry.first->getClientID()== NETWORK_PEER_ID_UNKNOWN) 218 218 continue; 219 219 const std::string& message = "Camper Warning! Don't forget to shoot."; 220 this->gtinfo_->sendFadingMessage(message, elem.first->getClientID());220 this->gtinfo_->sendFadingMessage(message, mapEntry.first->getClientID()); 221 221 } 222 222 } … … 229 229 int party = -1; 230 230 //find a player who survived 231 for (auto & elem: this->playerLives_)232 { 233 if ( elem.first->getClientID() == NETWORK_PEER_ID_UNKNOWN)231 for (auto& mapEntry : this->playerLives_) 232 { 233 if (mapEntry.first->getClientID() == NETWORK_PEER_ID_UNKNOWN) 234 234 continue; 235 235 236 if ( elem.second > 0)//a player that is alive236 if (mapEntry.second > 0)//a player that is alive 237 237 { 238 238 //which party has survived? 239 std::map<PlayerInfo*, int>::iterator it2 = this->teamnumbers_.find( elem.first);239 std::map<PlayerInfo*, int>::iterator it2 = this->teamnumbers_.find(mapEntry.first); 240 240 if (it2 != this->teamnumbers_.end()) 241 241 { … … 255 255 { 256 256 int min = lives; 257 for (auto & elem: this->playerLives_)258 { 259 if ( elem.second <= 0)257 for (auto& mapEntry : this->playerLives_) 258 { 259 if (mapEntry.second <= 0) 260 260 continue; 261 if ( elem.second < lives)262 min = elem.second;261 if (mapEntry.second < lives) 262 min = mapEntry.second; 263 263 } 264 264 return min; -
code/branches/cpp11_v2/src/orxonox/gametypes/TeamBaseMatch.cc
r10821 r10916 152 152 int amountControlled2 = 0; 153 153 154 for ( const auto & elem: this->bases_)155 { 156 if( (elem)->getState() == BaseState::ControlTeam1)154 for (TeamBaseMatchBase* base : this->bases_) 155 { 156 if(base->getState() == BaseState::ControlTeam1) 157 157 { 158 158 amountControlled++; 159 159 } 160 if( (elem)->getState() == BaseState::ControlTeam2)160 if(base->getState() == BaseState::ControlTeam2) 161 161 { 162 162 amountControlled2++; … … 187 187 } 188 188 189 for (auto & elem: this->teamnumbers_)190 { 191 if ( elem.first->getClientID() == NETWORK_PEER_ID_UNKNOWN)189 for (auto& mapEntry : this->teamnumbers_) 190 { 191 if (mapEntry.first->getClientID() == NETWORK_PEER_ID_UNKNOWN) 192 192 continue; 193 193 194 if ( elem.second == winningteam)195 this->gtinfo_->sendAnnounceMessage("You have won the match!", elem.first->getClientID());194 if (mapEntry.second == winningteam) 195 this->gtinfo_->sendAnnounceMessage("You have won the match!", mapEntry.first->getClientID()); 196 196 else 197 this->gtinfo_->sendAnnounceMessage("You have lost the match!", elem.first->getClientID());197 this->gtinfo_->sendAnnounceMessage("You have lost the match!", mapEntry.first->getClientID()); 198 198 } 199 199 … … 238 238 int count = 0; 239 239 240 for ( const auto & elem: this->bases_)241 { 242 if ( (elem)->getState() == BaseState::ControlTeam1 && team == 0)240 for (TeamBaseMatchBase* base : this->bases_) 241 { 242 if (base->getState() == BaseState::ControlTeam1 && team == 0) 243 243 count++; 244 if ( (elem)->getState() == BaseState::ControlTeam2 && team == 1)244 if (base->getState() == BaseState::ControlTeam2 && team == 1) 245 245 count++; 246 246 } … … 258 258 { 259 259 unsigned int i = 0; 260 for ( const auto & elem: this->bases_)260 for (TeamBaseMatchBase* base : this->bases_) 261 261 { 262 262 i++; 263 263 if (i > index) 264 return (elem);264 return base; 265 265 } 266 266 return nullptr; -
code/branches/cpp11_v2/src/orxonox/gametypes/TeamDeathmatch.cc
r10821 r10916 69 69 int winnerTeam = 0; 70 70 int highestScore = 0; 71 for (auto & elem: this->players_)71 for (auto& mapEntry : this->players_) 72 72 { 73 if ( this->getTeamScore( elem.first) > highestScore )73 if ( this->getTeamScore(mapEntry.first) > highestScore ) 74 74 { 75 winnerTeam = this->getTeam( elem.first);76 highestScore = this->getTeamScore( elem.first);75 winnerTeam = this->getTeam(mapEntry.first); 76 highestScore = this->getTeamScore(mapEntry.first); 77 77 } 78 78 } -
code/branches/cpp11_v2/src/orxonox/gametypes/TeamGametype.cc
r10821 r10916 99 99 std::vector<unsigned int> playersperteam(this->teams_, 0); 100 100 101 for (auto & elem: this->teamnumbers_)102 if ( elem.second < static_cast<int>(this->teams_) && elem.second >= 0)103 playersperteam[ elem.second]++;101 for (auto& mapEntry : this->teamnumbers_) 102 if (mapEntry.second < static_cast<int>(this->teams_) && mapEntry.second >= 0) 103 playersperteam[mapEntry.second]++; 104 104 105 105 unsigned int minplayers = static_cast<unsigned int>(-1); … … 123 123 if( (this->players_.size() >= maxPlayers_) && (allowedInGame_[player] == true) ) // if there's a "waiting list" 124 124 { 125 for (auto & elem: this->allowedInGame_)126 { 127 if( elem.second == false) // waiting player found128 { elem.second = true; break;} // allow player to enter125 for (auto& mapEntry : this->allowedInGame_) 126 { 127 if(mapEntry.second == false) // waiting player found 128 {mapEntry.second = true; break;} // allow player to enter 129 129 } 130 130 } … … 141 141 void TeamGametype::spawnDeadPlayersIfRequested() 142 142 { 143 for (auto & elem: this->players_)\144 { 145 if(allowedInGame_[ elem.first] == false)//check if dead player is allowed to enter143 for (auto& mapEntry : this->players_)\ 144 { 145 if(allowedInGame_[mapEntry.first] == false)//check if dead player is allowed to enter 146 146 { 147 147 continue; 148 148 } 149 if ( elem.second.state_ == PlayerState::Dead)150 { 151 if (( elem.first->isReadyToSpawn() || this->bForceSpawn_))149 if (mapEntry.second.state_ == PlayerState::Dead) 150 { 151 if ((mapEntry.first->isReadyToSpawn() || this->bForceSpawn_)) 152 152 { 153 this->spawnPlayer( elem.first);153 this->spawnPlayer(mapEntry.first); 154 154 } 155 155 } … … 178 178 if(!player || this->getTeam(player) == -1) 179 179 return 0; 180 for (auto & elem: this->players_)181 { 182 if ( this->getTeam( elem.first) == this->getTeam(player) )183 { 184 teamscore += elem.second.frags_;180 for (auto& mapEntry : this->players_) 181 { 182 if ( this->getTeam(mapEntry.first) == this->getTeam(player) ) 183 { 184 teamscore += mapEntry.second.frags_; 185 185 } 186 186 } … … 191 191 { 192 192 int teamSize = 0; 193 for (auto & elem: this->teamnumbers_)194 { 195 if ( elem.second == team)193 for (auto& mapEntry : this->teamnumbers_) 194 { 195 if (mapEntry.second == team) 196 196 teamSize++; 197 197 } … … 202 202 { 203 203 int teamSize = 0; 204 for (auto & elem: this->teamnumbers_)205 { 206 if ( elem.second == team && elem.first->isHumanPlayer())204 for (auto& mapEntry : this->teamnumbers_) 205 { 206 if (mapEntry.second == team && mapEntry.first->isHumanPlayer()) 207 207 teamSize++; 208 208 } … … 241 241 unsigned int index = 0; 242 242 // Get random fallback spawnpoint in case there is no active SpawnPoint. 243 for ( const auto &teamSpawnPoint : teamSpawnPoints)243 for (SpawnPoint* teamSpawnPoint : teamSpawnPoints) 244 244 { 245 245 if (index == randomspawn) 246 246 { 247 fallbackSpawnPoint = (teamSpawnPoint);247 fallbackSpawnPoint = teamSpawnPoint; 248 248 break; 249 249 } … … 266 266 randomspawn = static_cast<unsigned int>(rnd(static_cast<float>(teamSpawnPoints.size()))); 267 267 index = 0; 268 for ( const auto &teamSpawnPoint : teamSpawnPoints)268 for (SpawnPoint* teamSpawnPoint : teamSpawnPoints) 269 269 { 270 270 if (index == randomspawn) 271 return (teamSpawnPoint);271 return teamSpawnPoint; 272 272 273 273 ++index; … … 364 364 365 365 std::set<WorldEntity*> pawnAttachments = pawn->getAttachedObjects(); 366 for ( const auto &pawnAttachment : pawnAttachments)367 { 368 if ( (pawnAttachment)->isA(Class(TeamColourable)))366 for (WorldEntity* pawnAttachment : pawnAttachments) 367 { 368 if (pawnAttachment->isA(Class(TeamColourable))) 369 369 { 370 370 TeamColourable* tc = orxonox_cast<TeamColourable*>(pawnAttachment); … … 376 376 void TeamGametype::announceTeamWin(int winnerTeam) 377 377 { 378 for (auto & elem: this->teamnumbers_)379 { 380 if ( elem.first->getClientID() == NETWORK_PEER_ID_UNKNOWN)378 for (auto& mapEntry : this->teamnumbers_) 379 { 380 if (mapEntry.first->getClientID() == NETWORK_PEER_ID_UNKNOWN) 381 381 continue; 382 if ( elem.second == winnerTeam)383 { 384 this->gtinfo_->sendAnnounceMessage("Your team has won the match!", elem.first->getClientID());382 if (mapEntry.second == winnerTeam) 383 { 384 this->gtinfo_->sendAnnounceMessage("Your team has won the match!", mapEntry.first->getClientID()); 385 385 } 386 386 else 387 387 { 388 this->gtinfo_->sendAnnounceMessage("Your team has lost the match!", elem.first->getClientID());388 this->gtinfo_->sendAnnounceMessage("Your team has lost the match!", mapEntry.first->getClientID()); 389 389 } 390 390 } -
code/branches/cpp11_v2/src/orxonox/gametypes/UnderAttack.cc
r10821 r10916 74 74 this->gameEnded_ = true; 75 75 76 for (auto & elem: this->teamnumbers_)77 { 78 if ( elem.first->getClientID() == NETWORK_PEER_ID_UNKNOWN)76 for (auto& mapEntry : this->teamnumbers_) 77 { 78 if (mapEntry.first->getClientID() == NETWORK_PEER_ID_UNKNOWN) 79 79 continue; 80 80 81 if ( elem.second == attacker_)82 this->gtinfo_->sendAnnounceMessage("You have won the match!", elem.first->getClientID());81 if (mapEntry.second == attacker_) 82 this->gtinfo_->sendAnnounceMessage("You have won the match!", mapEntry.first->getClientID()); 83 83 else 84 this->gtinfo_->sendAnnounceMessage("You have lost the match!", elem.first->getClientID());84 this->gtinfo_->sendAnnounceMessage("You have lost the match!", mapEntry.first->getClientID()); 85 85 } 86 86 } … … 155 155 ChatManager::message(message); 156 156 157 for (auto & elem: this->teamnumbers_)158 { 159 if ( elem.first->getClientID() == NETWORK_PEER_ID_UNKNOWN)157 for (auto& mapEntry : this->teamnumbers_) 158 { 159 if (mapEntry.first->getClientID() == NETWORK_PEER_ID_UNKNOWN) 160 160 continue; 161 161 162 if ( elem.second == 1)163 this->gtinfo_->sendAnnounceMessage("You have won the match!", elem.first->getClientID());162 if (mapEntry.second == 1) 163 this->gtinfo_->sendAnnounceMessage("You have won the match!", mapEntry.first->getClientID()); 164 164 else 165 this->gtinfo_->sendAnnounceMessage("You have lost the match!", elem.first->getClientID());165 this->gtinfo_->sendAnnounceMessage("You have lost the match!", mapEntry.first->getClientID()); 166 166 } 167 167 } -
code/branches/cpp11_v2/src/orxonox/interfaces/PickupCarrier.cc
r10821 r10916 135 135 // Go recursively through all children to check whether they are the target. 136 136 std::vector<PickupCarrier*>* children = this->getCarrierChildren(); 137 for( auto & elem: *children)137 for(PickupCarrier* child : *children) 138 138 { 139 if(pickup->isTarget( elem))139 if(pickup->isTarget(child)) 140 140 { 141 target = elem;141 target = child; 142 142 break; 143 143 } -
code/branches/cpp11_v2/src/orxonox/interfaces/Pickupable.cc
r10821 r10916 160 160 { 161 161 // Iterate through all targets of this Pickupable. 162 for( const auto & elem: this->targets_)162 for(Identifier* target : this->targets_) 163 163 { 164 if(identifier->isA( elem))164 if(identifier->isA(target)) 165 165 return true; 166 166 } -
code/branches/cpp11_v2/src/orxonox/items/MultiStateEngine.cc
r10821 r10916 219 219 { 220 220 unsigned int i = 0; 221 for ( const auto & elem: this->effectContainers_)221 for (EffectContainer* effectContainer : this->effectContainers_) 222 222 { 223 223 if (i == index) 224 return (elem);224 return effectContainer; 225 225 i++; 226 226 } -
code/branches/cpp11_v2/src/orxonox/items/ShipPart.cc
r10821 r10916 143 143 @brief 144 144 Check whether the ShipPart has a particular Entity. 145 @param engine145 @param search 146 146 A pointer to the Entity to be checked. 147 147 */ 148 bool ShipPart::hasEntity(StaticEntity* entity) const149 { 150 for( auto & elem: this->entityList_)151 { 152 if(e lem == entity)148 bool ShipPart::hasEntity(StaticEntity* search) const 149 { 150 for(StaticEntity* entity : this->entityList_) 151 { 152 if(entity == search) 153 153 return true; 154 154 } -
code/branches/cpp11_v2/src/orxonox/overlays/OverlayGroup.cc
r10821 r10916 62 62 OverlayGroup::~OverlayGroup() 63 63 { 64 for ( const auto & elem: hudElements_)65 (elem)->destroy();64 for (OrxonoxOverlay* hudElement : hudElements_) 65 hudElement->destroy(); 66 66 this->hudElements_.clear(); 67 67 } … … 86 86 void OverlayGroup::setScale(const Vector2& scale) 87 87 { 88 for ( const auto & elem: hudElements_)89 (elem)->scale(scale / this->scale_);88 for (OrxonoxOverlay* hudElement : hudElements_) 89 hudElement->scale(scale / this->scale_); 90 90 this->scale_ = scale; 91 91 } … … 94 94 void OverlayGroup::setScroll(const Vector2& scroll) 95 95 { 96 for ( const auto & elem: hudElements_)97 (elem)->scroll(scroll - this->scroll_);96 for (OrxonoxOverlay* hudElement : hudElements_) 97 hudElement->scroll(scroll - this->scroll_); 98 98 this->scroll_ = scroll; 99 99 } … … 147 147 SUPER( OverlayGroup, changedVisibility ); 148 148 149 for ( const auto & elem: hudElements_)150 (elem)->changedVisibility(); //inform all Child Overlays that our visibility has changed149 for (OrxonoxOverlay* hudElement : hudElements_) 150 hudElement->changedVisibility(); //inform all Child Overlays that our visibility has changed 151 151 } 152 152 … … 155 155 this->owner_ = owner; 156 156 157 for ( const auto & elem: hudElements_)158 (elem)->setOwner(owner);157 for (OrxonoxOverlay* hudElement : hudElements_) 158 hudElement->setOwner(owner); 159 159 } 160 160 -
code/branches/cpp11_v2/src/orxonox/sound/SoundManager.cc
r10821 r10916 407 407 if (ambient != nullptr) 408 408 { 409 for ( auto & elem: this->ambientSounds_)410 { 411 if ( elem.first == ambient)409 for (std::pair<AmbientSound*, bool>& pair : this->ambientSounds_) 410 { 411 if (pair.first == ambient) 412 412 { 413 elem.second = true;414 this->fadeOut( elem.first);413 pair.second = true; 414 this->fadeOut(pair.first); 415 415 return; 416 416 } -
code/branches/cpp11_v2/src/orxonox/sound/SoundStreamer.cc
r10821 r10916 68 68 int current_section; 69 69 70 for( auto& initbuffer : initbuffers)70 for(ALuint& initbuffer : initbuffers) 71 71 { 72 72 long ret = ov_read(&vf, inbuffer, sizeof(inbuffer), 0, 2, 1, ¤t_section); -
code/branches/cpp11_v2/src/orxonox/weaponsystem/Munition.cc
r10821 r10916 55 55 Munition::~Munition() 56 56 { 57 for (auto & elem: this->currentMagazines_)58 delete elem.second;57 for (auto& mapEntry : this->currentMagazines_) 58 delete mapEntry.second; 59 59 } 60 60 … … 268 268 { 269 269 // Return true if any of the current magazines is not full (loading counts as full although it returns 0 munition) 270 for (const auto & elem: this->currentMagazines_)271 if ( elem.second->munition_ < this->maxMunitionPerMagazine_ && elem.second->bLoaded_)270 for (const auto& mapEntry : this->currentMagazines_) 271 if (mapEntry.second->munition_ < this->maxMunitionPerMagazine_ && mapEntry.second->bLoaded_) 272 272 return true; 273 273 } … … 316 316 { 317 317 bool change = false; 318 for (auto & elem: this->currentMagazines_)318 for (auto& mapEntry : this->currentMagazines_) 319 319 { 320 320 // Add munition if the magazine isn't full (but only to loaded magazines) 321 if (amount > 0 && elem.second->munition_ < this->maxMunitionPerMagazine_ && elem.second->bLoaded_)321 if (amount > 0 && mapEntry.second->munition_ < this->maxMunitionPerMagazine_ && mapEntry.second->bLoaded_) 322 322 { 323 elem.second->munition_++;323 mapEntry.second->munition_++; 324 324 amount--; 325 325 change = true; -
code/branches/cpp11_v2/src/orxonox/weaponsystem/Weapon.cc
r10821 r10916 61 61 this->weaponPack_->removeWeapon(this); 62 62 63 for (auto & elem: this->weaponmodes_)64 elem.second->destroy();63 for (auto& mapEntry : this->weaponmodes_) 64 mapEntry.second->destroy(); 65 65 } 66 66 } … … 85 85 { 86 86 unsigned int i = 0; 87 for (const auto & elem: this->weaponmodes_)87 for (const auto& mapEntry : this->weaponmodes_) 88 88 { 89 89 if (i == index) 90 return elem.second;90 return mapEntry.second; 91 91 92 92 ++i; … … 136 136 void Weapon::reload() 137 137 { 138 for (auto & elem: this->weaponmodes_)139 elem.second->reload();138 for (auto& mapEntry : this->weaponmodes_) 139 mapEntry.second->reload(); 140 140 } 141 141 … … 148 148 void Weapon::notifyWeaponModes() 149 149 { 150 for (auto & elem: this->weaponmodes_)151 elem.second->setWeapon(this);150 for (auto& mapEntry : this->weaponmodes_) 151 mapEntry.second->setWeapon(this); 152 152 } 153 153 } -
code/branches/cpp11_v2/src/orxonox/weaponsystem/WeaponPack.cc
r10821 r10916 76 76 void WeaponPack::fire(unsigned int weaponmode) 77 77 { 78 for ( auto & elem: this->weapons_)79 (elem)->fire(weaponmode);78 for (Weapon* weapon : this->weapons_) 79 weapon->fire(weaponmode); 80 80 } 81 81 … … 86 86 void WeaponPack::reload() 87 87 { 88 for ( auto & elem: this->weapons_)89 (elem)->reload();88 for (Weapon* weapon : this->weapons_) 89 weapon->reload(); 90 90 } 91 91 … … 114 114 unsigned int i = 0; 115 115 116 for ( const auto & elem: this->weapons_)116 for (Weapon* weapon : this->weapons_) 117 117 { 118 118 if (i == index) 119 return (elem);119 return weapon; 120 120 ++i; 121 121 } … … 132 132 { 133 133 unsigned int i = 0; 134 for ( const auto & elem: this->links_)134 for (DefaultWeaponmodeLink* link : this->links_) 135 135 { 136 136 if (i == index) 137 return (elem);137 return link; 138 138 139 139 ++i; … … 144 144 unsigned int WeaponPack::getDesiredWeaponmode(unsigned int firemode) const 145 145 { 146 for ( const auto & elem: this->links_)147 if ( (elem)->getFiremode() == firemode)148 return (elem)->getWeaponmode();146 for (DefaultWeaponmodeLink* link : this->links_) 147 if (link->getFiremode() == firemode) 148 return link->getWeaponmode(); 149 149 150 150 return WeaponSystem::WEAPON_MODE_UNASSIGNED; -
code/branches/cpp11_v2/src/orxonox/weaponsystem/WeaponSet.cc
r10821 r10916 63 63 { 64 64 // Fire all WeaponPacks with their defined weaponmode 65 for (auto & elem: this->weaponpacks_)66 if ( elem.second != WeaponSystem::WEAPON_MODE_UNASSIGNED)67 elem.first->fire(elem.second);65 for (auto& mapEntry : this->weaponpacks_) 66 if (mapEntry.second != WeaponSystem::WEAPON_MODE_UNASSIGNED) 67 mapEntry.first->fire(mapEntry.second); 68 68 } 69 69 … … 71 71 { 72 72 // Reload all WeaponPacks with their defined weaponmode 73 for (auto & elem: this->weaponpacks_)74 elem.first->reload();73 for (auto& mapEntry : this->weaponpacks_) 74 mapEntry.first->reload(); 75 75 } 76 76 -
code/branches/cpp11_v2/src/orxonox/weaponsystem/WeaponSystem.cc
r10821 r10916 106 106 { 107 107 unsigned int i = 0; 108 for ( const auto & elem: this->weaponSlots_)108 for (WeaponSlot* weaponSlot : this->weaponSlots_) 109 109 { 110 110 ++i; 111 111 if (i > index) 112 return (elem);112 return weaponSlot; 113 113 } 114 114 return nullptr; … … 153 153 { 154 154 unsigned int i = 0; 155 for (const auto & elem: this->weaponSets_)155 for (const auto& mapEntry : this->weaponSets_) 156 156 { 157 157 ++i; 158 158 if (i > index) 159 return elem.second;159 return mapEntry.second; 160 160 } 161 161 return nullptr; … … 168 168 169 169 unsigned int freeSlots = 0; 170 for ( auto & elem: this->weaponSlots_)171 { 172 if (! (elem)->isOccupied())170 for (WeaponSlot* weaponSlot : this->weaponSlots_) 171 { 172 if (!weaponSlot->isOccupied()) 173 173 ++freeSlots; 174 174 } … … 184 184 // Attach all weapons to the first free slots (and to the Pawn) 185 185 unsigned int i = 0; 186 for ( auto & elem: this->weaponSlots_)187 { 188 if (! (elem)->isOccupied() && i < wPack->getNumWeapons())186 for (WeaponSlot* weaponSlot : this->weaponSlots_) 187 { 188 if (!weaponSlot->isOccupied() && i < wPack->getNumWeapons()) 189 189 { 190 190 Weapon* weapon = wPack->getWeapon(i); 191 (elem)->attachWeapon(weapon);191 weaponSlot->attachWeapon(weapon); 192 192 this->getPawn()->attach(weapon); 193 193 ++i; … … 196 196 197 197 // Assign the desired weaponmode to the firemodes 198 for (auto & elem: this->weaponSets_)199 { 200 unsigned int weaponmode = wPack->getDesiredWeaponmode( elem.first);198 for (auto& mapEntry : this->weaponSets_) 199 { 200 unsigned int weaponmode = wPack->getDesiredWeaponmode(mapEntry.first); 201 201 if (weaponmode != WeaponSystem::WEAPON_MODE_UNASSIGNED) 202 elem.second->setWeaponmodeLink(wPack, weaponmode);202 mapEntry.second->setWeaponmodeLink(wPack, weaponmode); 203 203 } 204 204 … … 219 219 220 220 // Remove all added links from the WeaponSets 221 for (auto & elem: this->weaponSets_)222 elem.second->removeWeaponmodeLink(wPack);221 for (auto& mapEntry : this->weaponSets_) 222 mapEntry.second->removeWeaponmodeLink(wPack); 223 223 224 224 // Remove the WeaponPack from the WeaponSystem … … 231 231 { 232 232 unsigned int i = 0; 233 for ( const auto & elem: this->weaponPacks_)233 for (WeaponPack* weaponPack : this->weaponPacks_) 234 234 { 235 235 ++i; 236 236 if (i > index) 237 return (elem);237 return weaponPack; 238 238 } 239 239 return nullptr; … … 268 268 // Check if the WeaponSet belongs to this WeaponSystem 269 269 bool foundWeaponSet = false; 270 for (auto & elem: this->weaponSets_)271 { 272 if ( elem.second == wSet)270 for (auto& mapEntry : this->weaponSets_) 271 { 272 if (mapEntry.second == wSet) 273 273 { 274 274 foundWeaponSet = true; … … 296 296 void WeaponSystem::reload() 297 297 { 298 for (auto & elem: this->weaponSets_)299 elem.second->reload();298 for (auto& mapEntry : this->weaponSets_) 299 mapEntry.second->reload(); 300 300 } 301 301 -
code/branches/cpp11_v2/src/orxonox/worldentities/ControllableEntity.cc
r10821 r10916 165 165 { 166 166 unsigned int i = 0; 167 for ( const auto & elem: this->cameraPositions_)167 for (CameraPosition* cameraPosition : this->cameraPositions_) 168 168 { 169 169 if (i == index) 170 return (elem);170 return cameraPosition; 171 171 ++i; 172 172 } … … 180 180 181 181 unsigned int counter = 0; 182 for ( const auto & elem: this->cameraPositions_)183 { 184 if ( (elem)== this->currentCameraPosition_)182 for (CameraPosition* cameraPosition : this->cameraPositions_) 183 { 184 if (cameraPosition == this->currentCameraPosition_) 185 185 break; 186 186 counter++; … … 477 477 if (parent) 478 478 { 479 for ( auto & elem: this->cameraPositions_)480 if ( (elem)->getIsAbsolute())481 parent->attach( (elem));479 for (CameraPosition* cameraPosition : this->cameraPositions_) 480 if (cameraPosition->getIsAbsolute()) 481 parent->attach(cameraPosition); 482 482 } 483 483 } -
code/branches/cpp11_v2/src/orxonox/worldentities/EffectContainer.cc
r10821 r10916 89 89 { 90 90 unsigned int i = 0; 91 for ( const auto & elem: this->effects_)91 for (WorldEntity* effect : this->effects_) 92 92 if (i == index) 93 return (elem);93 return effect; 94 94 return nullptr; 95 95 } -
code/branches/cpp11_v2/src/orxonox/worldentities/WorldEntity.cc
r10821 r10916 233 233 234 234 // iterate over all children and change their activity as well 235 for ( const auto & elem: this->getAttachedObjects())235 for (WorldEntity* object : this->getAttachedObjects()) 236 236 { 237 237 if(!this->isActive()) 238 238 { 239 (elem)->bActiveMem_ = (elem)->isActive();240 (elem)->setActive(this->isActive());239 object->bActiveMem_ = object->isActive(); 240 object->setActive(this->isActive()); 241 241 } 242 242 else 243 243 { 244 (elem)->setActive((elem)->bActiveMem_);244 object->setActive(object->bActiveMem_); 245 245 } 246 246 } … … 259 259 { 260 260 // iterate over all children and change their visibility as well 261 for ( const auto & elem: this->getAttachedObjects())261 for (WorldEntity* object : this->getAttachedObjects()) 262 262 { 263 263 if(!this->isVisible()) 264 264 { 265 (elem)->bVisibleMem_ = (elem)->isVisible();266 (elem)->setVisible(this->isVisible());265 object->bVisibleMem_ = object->isVisible(); 266 object->setVisible(this->isVisible()); 267 267 } 268 268 else 269 269 { 270 (elem)->setVisible((elem)->bVisibleMem_);270 object->setVisible(object->bVisibleMem_); 271 271 } 272 272 } … … 518 518 { 519 519 unsigned int i = 0; 520 for ( const auto & elem: this->children_)520 for (WorldEntity* child : this->children_) 521 521 { 522 522 if (i == index) 523 return (elem);523 return child; 524 524 ++i; 525 525 } … … 938 938 // Recalculate mass 939 939 this->childrenMass_ = 0.0f; 940 for ( const auto & elem: this->children_)941 this->childrenMass_ += (elem)->getMass();940 for (WorldEntity* child : this->children_) 941 this->childrenMass_ += child->getMass(); 942 942 recalculateMassProps(); 943 943 // Notify parent WE -
code/branches/cpp11_v2/src/orxonox/worldentities/pawns/ModularSpaceShip.cc
r10821 r10916 99 99 } 100 100 // iterate through all attached parts 101 for( auto & elem: this->partList_)101 for(ShipPart* part : this->partList_) 102 102 { 103 103 // if the name of the part matches the name of the object, add the object to that parts entitylist (unless it was already done). 104 if(( elem->getName() == this->getAttachedObject(i)->getName()) && !elem->hasEntity(orxonox_cast<StaticEntity*>(this->getAttachedObject(i))))104 if((part->getName() == this->getAttachedObject(i)->getName()) && !part->hasEntity(orxonox_cast<StaticEntity*>(this->getAttachedObject(i)))) 105 105 { 106 106 // The Entity is added to the part's entityList_ 107 elem->addEntity(orxonox_cast<StaticEntity*>(this->getAttachedObject(i)));107 part->addEntity(orxonox_cast<StaticEntity*>(this->getAttachedObject(i))); 108 108 // An entry in the partMap_ is created, assigning the part to the entity. 109 this->addPartEntityAssignment((StaticEntity*)(this->getAttachedObject(i)), elem);109 this->addPartEntityAssignment((StaticEntity*)(this->getAttachedObject(i)), part); 110 110 } 111 111 } … … 146 146 ShipPart* ModularSpaceShip::getPartOfEntity(StaticEntity* entity) const 147 147 { 148 for (const auto & elem: this->partMap_)149 { 150 if ( elem.first == entity)151 return elem.second;148 for (const auto& mapEntry : this->partMap_) 149 { 150 if (mapEntry.first == entity) 151 return mapEntry.second; 152 152 } 153 153 return nullptr; … … 242 242 ShipPart* ModularSpaceShip::getShipPartByName(std::string name) 243 243 { 244 for( auto & elem: this->partList_)245 { 246 if(orxonox_cast<ShipPart*>( elem)->getName() == name)247 { 248 return orxonox_cast<ShipPart*>( elem);244 for(ShipPart* part : this->partList_) 245 { 246 if(orxonox_cast<ShipPart*>(part)->getName() == name) 247 { 248 return orxonox_cast<ShipPart*>(part); 249 249 } 250 250 } … … 256 256 @brief 257 257 Check whether the SpaceShip has a particular Engine. 258 @param engine258 @param search 259 259 A pointer to the Engine to be checked. 260 260 */ 261 bool ModularSpaceShip::hasShipPart(ShipPart* part) const262 { 263 for( auto & elem: this->partList_)264 { 265 if( elem == part)261 bool ModularSpaceShip::hasShipPart(ShipPart* search) const 262 { 263 for(ShipPart* part : this->partList_) 264 { 265 if(part == search) 266 266 return true; 267 267 } -
code/branches/cpp11_v2/src/orxonox/worldentities/pawns/SpaceShip.cc
r10821 r10916 158 158 159 159 // Run the engines 160 for( auto & elem: this->engineList_)161 (elem)->run(dt);160 for(Engine* engine : this->engineList_) 161 engine->run(dt); 162 162 163 163 if (this->hasLocalController()) … … 313 313 @brief 314 314 Check whether the SpaceShip has a particular Engine. 315 @param engine315 @param search 316 316 A pointer to the Engine to be checked. 317 317 */ 318 bool SpaceShip::hasEngine(Engine* engine) const319 { 320 for( auto & elem: this->engineList_)321 { 322 if(e lem == engine)318 bool SpaceShip::hasEngine(Engine* search) const 319 { 320 for(Engine* engine : this->engineList_) 321 { 322 if(engine == search) 323 323 return true; 324 324 } … … 350 350 Engine* SpaceShip::getEngineByName(const std::string& name) 351 351 { 352 for( auto & elem: this->engineList_)353 if(e lem->getName() == name)354 return e lem;352 for(Engine* engine : this->engineList_) 353 if(engine->getName() == name) 354 return engine; 355 355 356 356 orxout(internal_warning) << "Couldn't find Engine with name \"" << name << "\"." << endl; … … 396 396 void SpaceShip::addSpeedFactor(float factor) 397 397 { 398 for( auto & elem: this->engineList_)399 e lem->addSpeedMultiply(factor);398 for(Engine* engine : this->engineList_) 399 engine->addSpeedMultiply(factor); 400 400 } 401 401 … … 408 408 void SpaceShip::addSpeed(float speed) 409 409 { 410 for( auto & elem: this->engineList_)411 e lem->addSpeedAdd(speed);410 for(Engine* engine : this->engineList_) 411 engine->addSpeedAdd(speed); 412 412 } 413 413 … … 436 436 { 437 437 float speed=0; 438 for( auto & elem: this->engineList_)439 { 440 if(e lem->getMaxSpeedFront() > speed)441 speed = e lem->getMaxSpeedFront();438 for(Engine* engine : this->engineList_) 439 { 440 if(engine->getMaxSpeedFront() > speed) 441 speed = engine->getMaxSpeedFront(); 442 442 } 443 443 return speed; -
code/branches/cpp11_v2/src/orxonox/worldentities/pawns/TeamBaseMatchBase.cc
r10821 r10916 80 80 81 81 std::set<WorldEntity*> attachments = this->getAttachedObjects(); 82 for ( const auto &attachment : attachments)82 for (WorldEntity* attachment : attachments) 83 83 { 84 if ( (attachment)->isA(Class(TeamColourable)))84 if (attachment->isA(Class(TeamColourable))) 85 85 { 86 86 TeamColourable* tc = orxonox_cast<TeamColourable*>(attachment);
Note: See TracChangeset
for help on using the changeset viewer.