Changeset 10919 for code/branches/cpp11_v2/src/libraries
- Timestamp:
- Dec 5, 2015, 10:47:51 PM (9 years ago)
- Location:
- code/branches/cpp11_v2/src/libraries
- Files:
-
- 40 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/cpp11_v2/src/libraries/core/BaseObject.cc
r10916 r10919 163 163 this->setName(name); 164 164 165 for ( ObjectList<XMLNameListener>::iterator it = ObjectList<XMLNameListener>::begin(); it != ObjectList<XMLNameListener>::end(); ++it)166 it->loadedNewXMLName(this);165 for (XMLNameListener* listener : ObjectList<XMLNameListener>()) 166 listener->loadedNewXMLName(this); 167 167 } 168 168 -
code/branches/cpp11_v2/src/libraries/core/ClassTreeMask.cc
r10916 r10919 915 915 916 916 // Iterate through all subnodes 917 for ( std::list<ClassTreeMaskNode*>::iterator it1 = node->subnodes_.begin(); it1 != node->subnodes_.end(); ++it1)917 for (ClassTreeMaskNode* subnode : node->subnodes_) 918 918 { 919 919 // Recursive call to this function with the subnode 920 this->create( *it1);920 this->create(subnode); 921 921 922 922 // Only execute the following code if the current node is included, meaning some of the subnodes might be included too … … 926 926 927 927 // Iterate through all direct children 928 for (std::set<const Identifier*>::iterator it 2 = directChildren.begin(); it2 != directChildren.end(); ++it2)928 for (std::set<const Identifier*>::iterator it = directChildren.begin(); it != directChildren.end(); ++it) 929 929 { 930 930 // Check if the subnode (it1) is a child of the directChild (it2) 931 if ( (*it1)->getClass()->isA(*it2))931 if (subnode->getClass()->isA(*it)) 932 932 { 933 933 // Yes it is - remove the directChild (it2) from the list, because it will already be handled by a recursive call to the create() function 934 directChildren.erase(it 2);934 directChildren.erase(it); 935 935 936 936 // Check if the removed directChild was exactly the subnode 937 if (! (*it1)->getClass()->isExactlyA(*it2))937 if (!subnode->getClass()->isExactlyA(*it)) 938 938 { 939 939 // No, it wasn't exactly the subnode - therefore there are some classes between 940 940 941 941 // Add the previously removed directChild (it2) to the subclass-list 942 this->subclasses_.insert(this->subclasses_.end(), std::pair<const Identifier*, bool>(*it 2, true));942 this->subclasses_.insert(this->subclasses_.end(), std::pair<const Identifier*, bool>(*it, true)); 943 943 944 944 // Insert all directChildren of the directChild 945 directChildren.insert((*it 2)->getDirectChildren().begin(), (*it2)->getDirectChildren().end());945 directChildren.insert((*it)->getDirectChildren().begin(), (*it)->getDirectChildren().end()); 946 946 947 947 // Restart the scan with the expanded set of directChildren -
code/branches/cpp11_v2/src/libraries/core/Core.cc
r10916 r10919 460 460 { 461 461 // Update UpdateListeners before general ticking 462 for ( ObjectList<UpdateListener>::iterator it = ObjectList<UpdateListener>::begin(); it != ObjectList<UpdateListener>::end(); ++it)463 it->preUpdate(time);462 for (UpdateListener* listener : ObjectList<UpdateListener>()) 463 listener->preUpdate(time); 464 464 if (this->bGraphicsLoaded_) 465 465 { … … 479 479 { 480 480 // Update UpdateListeners just before rendering 481 for ( ObjectList<UpdateListener>::iterator it = ObjectList<UpdateListener>::begin(); it != ObjectList<UpdateListener>::end(); ++it)482 it->postUpdate(time);481 for (UpdateListener* listener : ObjectList<UpdateListener>()) 482 listener->postUpdate(time); 483 483 if (this->bGraphicsLoaded_) 484 484 { -
code/branches/cpp11_v2/src/libraries/core/CoreConfig.cc
r10813 r10919 108 108 { 109 109 // Inform listeners 110 ObjectList<DevModeListener>::iterator it = ObjectList<DevModeListener>::begin(); 111 for (; it != ObjectList<DevModeListener>::end(); ++it) 112 it->devModeChanged(bDevMode_); 110 for (DevModeListener* listener : ObjectList<DevModeListener>()) 111 listener->devModeChanged(bDevMode_); 113 112 } 114 113 -
code/branches/cpp11_v2/src/libraries/core/CoreStaticInitializationHandler.cc
r10916 r10919 129 129 { 130 130 // iterate over all contexts 131 for ( ObjectList<Context>::iterator it_context = ObjectList<Context>::begin(); it_context != ObjectList<Context>::end(); ++it_context)132 it_context->destroyObjectList(identifier);131 for (Context* context : ObjectList<Context>()) 132 context->destroyObjectList(identifier); 133 133 } 134 134 } -
code/branches/cpp11_v2/src/libraries/core/Game.cc
r10918 r10919 115 115 116 116 // After the core has been created, we can safely instantiate the GameStates that don't require graphics 117 for (std::map<std::string, GameStateInfo>::const_iterator it = gameStateDeclarations_s.begin(); 118 it != gameStateDeclarations_s.end(); ++it) 119 { 120 if (!it->second.bGraphicsMode) 121 constructedStates_[it->second.stateName] = GameStateFactory::fabricate(it->second); 117 for (const auto& mapEntry : gameStateDeclarations_s) 118 { 119 if (!mapEntry.second.bGraphicsMode) 120 constructedStates_[mapEntry.second.stateName] = GameStateFactory::fabricate(mapEntry.second); 122 121 } 123 122 … … 262 261 { 263 262 // Note: The first element is the empty root state, which doesn't need ticking 264 for (GameStateVector::const_iterator it = this->loadedStates_.begin() + 1; 265 it != this->loadedStates_.end(); ++it) 263 for (const std::shared_ptr<GameState>& state : this->loadedStates_) 266 264 { 267 265 try … … 269 267 // Add tick time for most of the states 270 268 uint64_t timeBeforeTick = 0; 271 if ( (*it)->getInfo().bIgnoreTickTime)269 if (state->getInfo().bIgnoreTickTime) 272 270 timeBeforeTick = this->gameClock_->getRealMicroseconds(); 273 (*it)->update(*this->gameClock_);274 if ( (*it)->getInfo().bIgnoreTickTime)271 state->update(*this->gameClock_); 272 if (state->getInfo().bIgnoreTickTime) 275 273 this->subtractTickTime(static_cast<int32_t>(this->gameClock_->getRealMicroseconds() - timeBeforeTick)); 276 274 } 277 275 catch (...) 278 276 { 279 orxout(user_error) << "An exception occurred while updating '" << (*it)->getName() << "': " << Exception::handleMessage() << endl;277 orxout(user_error) << "An exception occurred while updating '" << state->getName() << "': " << Exception::handleMessage() << endl; 280 278 orxout(user_error) << "This should really never happen!" << endl; 281 279 orxout(user_error) << "Unloading all GameStates depending on the one that crashed." << endl; 282 280 std::shared_ptr<GameStateTreeNode> current = this->loadedTopStateNode_; 283 while (current->name_ != (*it)->getName() && current)281 while (current->name_ != state->getName() && current) 284 282 current = current->parent_.lock(); 285 283 if (current && current->parent_.lock()) … … 520 518 521 519 // Construct all the GameStates that require graphics 522 for (std::map<std::string, GameStateInfo>::const_iterator it = gameStateDeclarations_s.begin(); 523 it != gameStateDeclarations_s.end(); ++it) 524 { 525 if (it->second.bGraphicsMode) 520 for (const auto& mapEntry : gameStateDeclarations_s) 521 { 522 if (mapEntry.second.bGraphicsMode) 526 523 { 527 524 // Game state loading failure is serious --> don't catch 528 std::shared_ptr<GameState> gameState = GameStateFactory::fabricate( it->second);525 std::shared_ptr<GameState> gameState = GameStateFactory::fabricate(mapEntry.second); 529 526 if (!constructedStates_.insert(std::make_pair( 530 it->second.stateName, gameState)).second)527 mapEntry.second.stateName, gameState)).second) 531 528 assert(false); // GameState was already created! 532 529 } -
code/branches/cpp11_v2/src/libraries/core/GraphicsManager.cc
r10845 r10919 389 389 GUIManager::getInstance().setCamera(camera); 390 390 391 for ( ObjectList<ViewportEventListener>::iterator it = ObjectList<ViewportEventListener>::begin(); it != ObjectList<ViewportEventListener>::end(); ++it)392 it->cameraChanged(this->viewport_, oldCamera);391 for (ViewportEventListener* listener : ObjectList<ViewportEventListener>()) 392 listener->cameraChanged(this->viewport_, oldCamera); 393 393 } 394 394 -
code/branches/cpp11_v2/src/libraries/core/NamespaceNode.cc
r10917 r10919 149 149 150 150 int i = 0; 151 for ( std::map<std::string, NamespaceNode*>::const_iterator it = this->subnodes_.begin(); it != this->subnodes_.end(); i++, ++it)151 for (const auto& mapEntry : this->subnodes_) 152 152 { 153 153 if (i > 0) 154 154 output += ", "; 155 155 156 output += it->second->toString(); 156 output += mapEntry.second->toString(); 157 i++; 157 158 } 158 159 -
code/branches/cpp11_v2/src/libraries/core/ThreadPool.cc
r8394 r10919 83 83 bool ThreadPool::passFunction( const ExecutorPtr& executor, bool addThread ) 84 84 { 85 std::vector<Thread*>::iterator it; 86 for ( it=this->threadPool_.begin(); it!=this->threadPool_.end(); ++it ) 85 for ( Thread* thread : threadPool_ ) 87 86 { 88 if ( ! (*it)->isWorking() )87 if ( ! thread->isWorking() ) 89 88 { 90 89 // If that fails, then there is some code error 91 OrxVerify( (*it)->evaluateExecutor( executor ), "ERROR: could not evaluate Executor" );90 OrxVerify( thread->evaluateExecutor( executor ), "ERROR: could not evaluate Executor" ); 92 91 return true; 93 92 } … … 105 104 void ThreadPool::synchronise() 106 105 { 107 std::vector<Thread*>::iterator it; 108 for ( it=this->threadPool_.begin(); it!=this->threadPool_.end(); ++it ) 106 for ( Thread* thread : this->threadPool_ ) 109 107 { 110 (*it)->waitUntilFinished();108 thread->waitUntilFinished(); 111 109 } 112 110 } -
code/branches/cpp11_v2/src/libraries/core/WindowEventListener.cc
r10624 r10919 45 45 /*static*/ void WindowEventListener::moveWindow() 46 46 { 47 for ( ObjectList<WindowEventListener>::iterator it = ObjectList<WindowEventListener>::begin(); it; ++it)48 it->windowMoved();47 for (WindowEventListener* listener : ObjectList<WindowEventListener>()) 48 listener->windowMoved(); 49 49 } 50 50 … … 54 54 windowWidth_s = newWidth; 55 55 windowHeight_s = newHeight; 56 for ( ObjectList<WindowEventListener>::iterator it = ObjectList<WindowEventListener>::begin(); it; ++it)57 it->windowResized(newWidth, newHeight);56 for (WindowEventListener* listener : ObjectList<WindowEventListener>()) 57 listener->windowResized(newWidth, newHeight); 58 58 } 59 59 … … 61 61 /*static*/ void WindowEventListener::changeWindowFocus(bool bFocus) 62 62 { 63 for ( ObjectList<WindowEventListener>::iterator it = ObjectList<WindowEventListener>::begin(); it; ++it)64 it->windowFocusChanged(bFocus);63 for (WindowEventListener* listener : ObjectList<WindowEventListener>()) 64 listener->windowFocusChanged(bFocus); 65 65 } 66 66 } -
code/branches/cpp11_v2/src/libraries/core/class/Identifier.cc
r10917 r10919 79 79 delete this->factory_; 80 80 81 for ( std::list<const InheritsFrom*>::const_iterator it = this->manualDirectParents_.begin(); it != this->manualDirectParents_.end(); ++it)82 delete (*it);81 for (const InheritsFrom* manualDirectParent : this->manualDirectParents_) 82 delete manualDirectParent; 83 83 84 84 // erase this Identifier from all related identifiers 85 for ( std::list<const Identifier*>::const_iterator it = this->parents_.begin(); it != this->parents_.end(); ++it)86 const_cast<Identifier*>( *it)->children_.erase(this);87 for ( std::list<const Identifier*>::const_iterator it = this->directParents_.begin(); it != this->directParents_.end(); ++it)88 const_cast<Identifier*>( *it)->directChildren_.erase(this);85 for (const Identifier* parent : this->parents_) 86 const_cast<Identifier*>(parent)->children_.erase(this); 87 for (const Identifier* directParent : this->directParents_) 88 const_cast<Identifier*>(directParent)->directChildren_.erase(this); 89 89 for (const Identifier* child : this->children_) 90 90 const_cast<Identifier*>(child)->parents_.remove(this); … … 184 184 185 185 // initialize all parents 186 for ( std::list<const Identifier*>::const_iterator it = this->parents_.begin(); it != this->parents_.end(); ++it)187 const_cast<Identifier*>( *it)->finishInitialization(); // initialize parent186 for (const Identifier* parent : this->parents_) 187 const_cast<Identifier*>(parent)->finishInitialization(); // initialize parent 188 188 189 189 // parents of parents are no direct parents of this identifier 190 190 this->directParents_ = this->parents_; 191 for ( std::list<const Identifier*>::const_iterator it_parent = this->parents_.begin(); it_parent != this->parents_.end(); ++it_parent)192 for ( std::list<const Identifier*>::const_iterator it_parent_parent = const_cast<Identifier*>(*it_parent)->parents_.begin(); it_parent_parent != const_cast<Identifier*>(*it_parent)->parents_.end(); ++it_parent_parent)193 this->directParents_.remove( *it_parent_parent);191 for (const Identifier* parent : this->parents_) 192 for (const Identifier* parent_parent : const_cast<Identifier*>(parent)->parents_) 193 this->directParents_.remove(parent_parent); 194 194 195 195 this->verifyIdentifierTrace(); … … 200 200 201 201 // initialize all direct parents 202 for ( std::list<const InheritsFrom*>::const_iterator it = this->manualDirectParents_.begin(); it != this->manualDirectParents_.end(); ++it)202 for (const InheritsFrom* manualDirectParent : this->manualDirectParents_) 203 203 { 204 Identifier* directParent = (*it)->getParent();204 Identifier* directParent = manualDirectParent->getParent(); 205 205 this->directParents_.push_back(directParent); 206 206 directParent->finishInitialization(); // initialize parent … … 208 208 209 209 // direct parents and their parents are also parents of this identifier (but only add them once) 210 for ( std::list<const Identifier*>::const_iterator it_parent = this->directParents_.begin(); it_parent != this->directParents_.end(); ++it_parent)210 for (const Identifier* parent : this->directParents_) 211 211 { 212 for ( std::list<const Identifier*>::const_iterator it_parent_parent = const_cast<Identifier*>(*it_parent)->parents_.begin(); it_parent_parent != const_cast<Identifier*>(*it_parent)->parents_.end(); ++it_parent_parent)213 this->addIfNotExists(this->parents_, *it_parent_parent);214 this->addIfNotExists(this->parents_, *it_parent);212 for (const Identifier* parent_parent : const_cast<Identifier*>(parent)->parents_) 213 this->addIfNotExists(this->parents_, parent_parent); 214 this->addIfNotExists(this->parents_, parent); 215 215 } 216 216 } … … 224 224 225 225 // tell all parents that this identifier is a child 226 for ( std::list<const Identifier*>::const_iterator it = this->parents_.begin(); it != this->parents_.end(); ++it)227 const_cast<Identifier*>( *it)->children_.insert(this);226 for (const Identifier* parent : this->parents_) 227 const_cast<Identifier*>(parent)->children_.insert(this); 228 228 229 229 // tell all direct parents that this identifier is a direct child 230 for ( std::list<const Identifier*>::const_iterator it = this->directParents_.begin(); it != this->directParents_.end(); ++it)231 { 232 const_cast<Identifier*>( *it)->directChildren_.insert(this);230 for (const Identifier* directChild : this->directParents_) 231 { 232 const_cast<Identifier*>(directChild)->directChildren_.insert(this); 233 233 234 234 // Create the super-function dependencies 235 (*it)->createSuperFunctionCaller();235 directChild->createSuperFunctionCaller(); 236 236 } 237 237 … … 265 265 if (parent->isVirtualBase()) 266 266 { 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 this->addIfNotExists(expectedIdentifierTrace, *it_parent_parent);267 for (const Identifier* parent_parent : const_cast<Identifier*>(parent)->parents_) 268 this->addIfNotExists(expectedIdentifierTrace, parent_parent); 269 269 this->addIfNotExists(expectedIdentifierTrace, parent); 270 270 } … … 274 274 for (const Identifier* directParent : this->directParents_) 275 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 this->addIfNotExists(expectedIdentifierTrace, *it_parent_parent);276 for (const Identifier* parent_parent : const_cast<Identifier*>(directParent)->parents_) 277 this->addIfNotExists(expectedIdentifierTrace, parent_parent); 278 278 this->addIfNotExists(expectedIdentifierTrace, directParent); 279 279 } … … 290 290 291 291 orxout(internal_warning) << " Expected trace (according to class hierarchy definitions):" << endl << " "; 292 for ( std::list<const Identifier*>::const_iterator it_parent = expectedIdentifierTrace.begin(); it_parent != expectedIdentifierTrace.end(); ++it_parent)293 orxout(internal_warning) << " " << (*it_parent)->getName();292 for (const Identifier* parent : expectedIdentifierTrace) 293 orxout(internal_warning) << " " << parent->getName(); 294 294 orxout(internal_warning) << endl; 295 295 -
code/branches/cpp11_v2/src/libraries/core/class/Identifier.h
r10918 r10919 458 458 return; 459 459 460 for ( ObjectListIterator<T> it = ObjectList<T>::begin(); it; ++it)461 this->setConfigValues( *it, *it);460 for (T* object : ObjectList<T>()) 461 this->setConfigValues(object, object); 462 462 463 463 if (updateChildren) -
code/branches/cpp11_v2/src/libraries/core/class/Super.h
r10817 r10919 103 103 { \ 104 104 ClassIdentifier<T>* identifier = ClassIdentifier<T>::getIdentifier(); \ 105 for ( std::set<const Identifier*>::iterator it = identifier->getDirectChildren().begin(); it != identifier->getDirectChildren().end(); ++it) \105 for (const Identifier* child : identifier->getDirectChildren()) \ 106 106 { \ 107 if (((ClassIdentifier<T>*) (*it))->bSuperFunctionCaller_##functionname##_isFallback_ && ((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_) \107 if (((ClassIdentifier<T>*)child)->bSuperFunctionCaller_##functionname##_isFallback_ && ((ClassIdentifier<T>*)child)->superFunctionCaller_##functionname##_) \ 108 108 { \ 109 delete ((ClassIdentifier<T>*) (*it))->superFunctionCaller_##functionname##_; \110 ((ClassIdentifier<T>*) (*it))->superFunctionCaller_##functionname##_ = nullptr; \111 ((ClassIdentifier<T>*) (*it))->bSuperFunctionCaller_##functionname##_isFallback_ = false; \109 delete ((ClassIdentifier<T>*)child)->superFunctionCaller_##functionname##_; \ 110 ((ClassIdentifier<T>*)child)->superFunctionCaller_##functionname##_ = nullptr; \ 111 ((ClassIdentifier<T>*)child)->bSuperFunctionCaller_##functionname##_isFallback_ = false; \ 112 112 } \ 113 113 \ 114 if (!((ClassIdentifier<T>*) (*it))->superFunctionCaller_##functionname##_) \114 if (!((ClassIdentifier<T>*)child)->superFunctionCaller_##functionname##_) \ 115 115 { \ 116 orxout(verbose, context::super) << "Added SuperFunctionCaller for " << #functionname << ": " << ClassIdentifier<T>::getIdentifier()->getName() << " <- " << ((ClassIdentifier<T>*) (*it))->getName() << endl; \117 ((ClassIdentifier<T>*) (*it))->superFunctionCaller_##functionname##_ = new SuperFunctionClassCaller_##functionname <T>; \116 orxout(verbose, context::super) << "Added SuperFunctionCaller for " << #functionname << ": " << ClassIdentifier<T>::getIdentifier()->getName() << " <- " << ((ClassIdentifier<T>*)child)->getName() << endl; \ 117 ((ClassIdentifier<T>*)child)->superFunctionCaller_##functionname##_ = new SuperFunctionClassCaller_##functionname <T>; \ 118 118 } \ 119 else if (((ClassIdentifier<T>*) (*it))->superFunctionCaller_##functionname##_->getParentIdentifier() != ClassIdentifier<T>::getIdentifier()) \120 orxout(internal_warning, context::super) << "SuperFunctionCaller for " << #functionname << " in " << ((ClassIdentifier<T>*) (*it))->getName() << " calls function of " << ((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_->getParentIdentifier()->getName() << " but " << ClassIdentifier<T>::getIdentifier()->getName() << " is also possible (do you use multiple inheritance?)" << endl; \119 else if (((ClassIdentifier<T>*)child)->superFunctionCaller_##functionname##_->getParentIdentifier() != ClassIdentifier<T>::getIdentifier()) \ 120 orxout(internal_warning, context::super) << "SuperFunctionCaller for " << #functionname << " in " << ((ClassIdentifier<T>*)child)->getName() << " calls function of " << ((ClassIdentifier<T>*)child)->superFunctionCaller_##functionname##_->getParentIdentifier()->getName() << " but " << ClassIdentifier<T>::getIdentifier()->getName() << " is also possible (do you use multiple inheritance?)" << endl; \ 121 121 } \ 122 122 } \ … … 171 171 172 172 // Iterate through all children 173 for ( std::set<const Identifier*>::iterator it = identifier->getDirectChildren().begin(); it != identifier->getDirectChildren().end(); ++it)173 for (const Identifier* child : identifier->getDirectChildren()) 174 174 { 175 175 // Check if the caller is a fallback-caller 176 if (((ClassIdentifier<T>*) (*it))->bSuperFunctionCaller_##functionname##_isFallback_ && ((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_)176 if (((ClassIdentifier<T>*)child)->bSuperFunctionCaller_##functionname##_isFallback_ && ((ClassIdentifier<T>*)child)->superFunctionCaller_##functionname##_) 177 177 { 178 178 // Delete the fallback caller an prepare to get a real caller 179 delete ((ClassIdentifier<T>*) (*it))->superFunctionCaller_##functionname##_;180 ((ClassIdentifier<T>*) (*it))->superFunctionCaller_##functionname##_ = nullptr;181 ((ClassIdentifier<T>*) (*it))->bSuperFunctionCaller_##functionname##_isFallback_ = false;179 delete ((ClassIdentifier<T>*)child)->superFunctionCaller_##functionname##_; 180 ((ClassIdentifier<T>*)child)->superFunctionCaller_##functionname##_ = nullptr; 181 ((ClassIdentifier<T>*)child)->bSuperFunctionCaller_##functionname##_isFallback_ = false; 182 182 } 183 183 184 184 // Check if there's not already a caller 185 if (!((ClassIdentifier<T>*) (*it))->superFunctionCaller_##functionname##_)185 if (!((ClassIdentifier<T>*)child)->superFunctionCaller_##functionname##_) 186 186 { 187 187 // Add the SuperFunctionCaller 188 orxout(verbose, context::super) << "adding functionpointer to " << ((ClassIdentifier<T>*) (*it))->getName() << endl;189 ((ClassIdentifier<T>*) (*it))->superFunctionCaller_##functionname##_ = new SuperFunctionClassCaller_##functionname <T>;188 orxout(verbose, context::super) << "adding functionpointer to " << ((ClassIdentifier<T>*)child)->getName() << endl; 189 ((ClassIdentifier<T>*)child)->superFunctionCaller_##functionname##_ = new SuperFunctionClassCaller_##functionname <T>; 190 190 } 191 191 192 192 // If there is already a caller, but for another parent, print a warning 193 else if (((ClassIdentifier<T>*) (*it))->superFunctionCaller_##functionname##_->getParentIdentifier() != ClassIdentifier<T>::getIdentifier())194 orxout(internal_warning, context::super) << "SuperFunctionCaller for " << #functionname << " in " << ((ClassIdentifier<T>*) (*it))->getName() << " calls function of " << ((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_->getParentIdentifier()->getName() << " but " << ClassIdentifier<T>::getIdentifier()->getName() << " is also possible (do you use multiple inheritance?)" << endl;193 else if (((ClassIdentifier<T>*)child)->superFunctionCaller_##functionname##_->getParentIdentifier() != ClassIdentifier<T>::getIdentifier()) 194 orxout(internal_warning, context::super) << "SuperFunctionCaller for " << #functionname << " in " << ((ClassIdentifier<T>*)child)->getName() << " calls function of " << ((ClassIdentifier<T>*)child)->superFunctionCaller_##functionname##_->getParentIdentifier()->getName() << " but " << ClassIdentifier<T>::getIdentifier()->getName() << " is also possible (do you use multiple inheritance?)" << endl; 195 195 } 196 196 } -
code/branches/cpp11_v2/src/libraries/core/command/ArgumentCompletionFunctions.cc
r10918 r10919 334 334 ArgumentCompletionList threads; 335 335 336 for ( std::list<unsigned int>::const_iterator it = threadnumbers.begin(); it != threadnumbers.end(); ++it)337 threads.emplace_back(multi_cast<std::string>( *it));336 for (unsigned int threadnumber : threadnumbers) 337 threads.emplace_back(multi_cast<std::string>(threadnumber)); 338 338 339 339 return threads; -
code/branches/cpp11_v2/src/libraries/core/command/CommandEvaluation.cc
r10916 r10919 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& 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;330 for (const auto& mapEntryGroup : ConsoleCommandManager::getInstance().getCommandsLC()) 331 { 332 if (mapEntryGroup.first != "") 333 { 334 for (const auto& mapEntryName : mapEntryGroup.second) 335 { 336 std::string command = mapEntryGroup.first + " " + mapEntryName.first; 337 337 unsigned int distance = getLevenshteinDistance(command, token0_LC + " " + token1_LC); 338 338 if (distance < nearestDistance) -
code/branches/cpp11_v2/src/libraries/core/command/TclThreadManager.cc
r10916 r10919 145 145 { 146 146 boost::shared_lock<boost::shared_mutex> lock(*this->interpreterBundlesMutex_); 147 for ( std::map<unsigned int, TclInterpreterBundle*>::const_iterator it = this->interpreterBundles_.begin(); it != this->interpreterBundles_.end(); ++it)147 for (const auto& mapEntry : this->interpreterBundles_) 148 148 { 149 if ( it->first == 0)149 if (mapEntry.first == 0) 150 150 continue; // We'll handle the default interpreter later (and without threads of course) 151 151 152 TclInterpreterBundle* bundle = it->second;152 TclInterpreterBundle* bundle = mapEntry.second; 153 153 if (!bundle->queue_.empty()) 154 154 { -
code/branches/cpp11_v2/src/libraries/core/commandline/CommandLineParser.cc
r10916 r10919 110 110 { 111 111 // first shove all the shortcuts in a map 112 for (std::map<std::string, CommandLineArgument*>::const_iterator it = cmdLineArgs_.begin(); 113 it != cmdLineArgs_.end(); ++it) 112 for (const auto& mapEntry : cmdLineArgs_) 114 113 { 115 OrxAssert(cmdLineArgsShortcut_.find( it->second->getShortcut()) == cmdLineArgsShortcut_.end(),114 OrxAssert(cmdLineArgsShortcut_.find(mapEntry.second->getShortcut()) == cmdLineArgsShortcut_.end(), 116 115 "Cannot have two command line shortcut with the same name."); 117 if (! it->second->getShortcut().empty())118 cmdLineArgsShortcut_[ it->second->getShortcut()] = it->second;116 if (!mapEntry.second->getShortcut().empty()) 117 cmdLineArgsShortcut_[mapEntry.second->getShortcut()] = mapEntry.second; 119 118 } 120 119 bFirstTimeParse_ = false; … … 257 256 // determine maximum name size 258 257 size_t maxNameSize = 0; 259 for (std::map<std::string, CommandLineArgument*>::const_iterator it = inst.cmdLineArgs_.begin(); 260 it != inst.cmdLineArgs_.end(); ++it) 261 { 262 maxNameSize = std::max(it->second->getName().size(), maxNameSize); 258 for (const auto& mapEntry : inst.cmdLineArgs_) 259 { 260 maxNameSize = std::max(mapEntry.second->getName().size(), maxNameSize); 263 261 } 264 262 … … 267 265 infoStr << "Available options:" << endl; 268 266 269 for (std::map<std::string, CommandLineArgument*>::const_iterator it = inst.cmdLineArgs_.begin(); 270 it != inst.cmdLineArgs_.end(); ++it) 271 { 272 if (!it->second->getShortcut().empty()) 273 infoStr << " [-" << it->second->getShortcut() << "] "; 267 for (const auto& mapEntry : inst.cmdLineArgs_) 268 { 269 if (!mapEntry.second->getShortcut().empty()) 270 infoStr << " [-" << mapEntry.second->getShortcut() << "] "; 274 271 else 275 272 infoStr << " "; 276 infoStr << "--" << it->second->getName() << ' ';277 if ( it->second->getValue().isType<bool>())273 infoStr << "--" << mapEntry.second->getName() << ' '; 274 if (mapEntry.second->getValue().isType<bool>()) 278 275 infoStr << " "; 279 276 else 280 277 infoStr << "ARG "; 281 278 // fill with the necessary amount of blanks 282 infoStr << std::string(maxNameSize - it->second->getName().size(), ' ');283 infoStr << ": " << it->second->getInformation();279 infoStr << std::string(maxNameSize - mapEntry.second->getName().size(), ' '); 280 infoStr << ": " << mapEntry.second->getInformation(); 284 281 infoStr << endl; 285 282 } -
code/branches/cpp11_v2/src/libraries/core/config/SettingsConfigFile.cc
r10768 r10919 142 142 // todo: can this be done more efficiently? looks like some identifiers will be updated multiple times. 143 143 144 for ( ContainerMap::const_iterator it = this->containers_.begin(); it != this->containers_.end(); ++it)145 { 146 it->second.second->update();147 it->second.second->getIdentifier()->updateConfigValues();144 for (const auto& mapEntry : this->containers_) 145 { 146 mapEntry.second.second->update(); 147 mapEntry.second.second->getIdentifier()->updateConfigValues(); 148 148 } 149 149 } -
code/branches/cpp11_v2/src/libraries/core/input/InputBuffer.cc
r10916 r10919 75 75 InputBuffer::~InputBuffer() 76 76 { 77 for (std::list<BaseInputBufferListenerTuple*>::const_iterator it = this->listeners_.begin(); 78 it != this->listeners_.end(); ++it) 79 delete *it; 77 for (BaseInputBufferListenerTuple* listener : this->listeners_) 78 delete listener; 80 79 } 81 80 -
code/branches/cpp11_v2/src/libraries/core/input/InputManager.cc
r10917 r10919 531 531 { 532 532 // Make sure we don't add two high priority states with the same priority 533 for (std::map<std::string, InputState*>::const_iterator it = this->statesByName_.begin(); 534 it != this->statesByName_.end(); ++it) 533 for (const auto& mapEntry : this->statesByName_) 535 534 { 536 if ( it->second->getPriority() == priority)535 if (mapEntry.second->getPriority() == priority) 537 536 { 538 537 orxout(internal_warning, context::input) << "Could not add an InputState with the same priority '" -
code/branches/cpp11_v2/src/libraries/core/input/JoyStickQuantityListener.cc
r10624 r10919 47 47 { 48 48 joyStickList_s = joyStickList; 49 for ( ObjectList<JoyStickQuantityListener>::iterator it = ObjectList<JoyStickQuantityListener>::begin(); it; ++it)50 it->JoyStickQuantityChanged(joyStickList);49 for (JoyStickQuantityListener* listener : ObjectList<JoyStickQuantityListener>()) 50 listener->JoyStickQuantityChanged(joyStickList); 51 51 } 52 52 } -
code/branches/cpp11_v2/src/libraries/core/input/KeyBinder.cc
r10918 r10919 274 274 275 275 // Parse bindings and create the ConfigValueContainers if necessary 276 for ( std::map<std::string, Button*>::const_iterator it = allButtons_.begin(); it != allButtons_.end(); ++it)277 { 278 it->second->readBinding(this->configFile_, this->fallbackConfigFile_);279 addButtonToCommand( it->second->bindingString_, it->second);276 for (const auto& mapEntry : allButtons_) 277 { 278 mapEntry.second->readBinding(this->configFile_, this->fallbackConfigFile_); 279 addButtonToCommand(mapEntry.second->bindingString_, mapEntry.second); 280 280 } 281 281 … … 380 380 void KeyBinder::clearBindings() 381 381 { 382 for ( std::map<std::string, Button*>::const_iterator it = allButtons_.begin(); it != allButtons_.end(); ++it)383 it->second->clear();382 for (const auto& mapEntry : allButtons_) 383 mapEntry.second->clear(); 384 384 385 385 for (BufferedParamCommand* command : paramCommandBuffer_) -
code/branches/cpp11_v2/src/libraries/core/input/KeyBinderManager.cc
r10829 r10919 76 76 { 77 77 // Delete all remaining KeyBinders 78 for ( std::map<std::string, KeyBinder*>::const_iterator it = this->binders_.begin(); it != this->binders_.end(); ++it)79 delete it->second;78 for (const auto& mapEntry : this->binders_) 79 delete mapEntry.second; 80 80 81 81 // Reset console commands -
code/branches/cpp11_v2/src/libraries/core/input/KeyDetector.cc
r10765 r10919 70 70 { 71 71 // Assign every button/axis the same command, but with its name as argument 72 for ( std::map<std::string, Button*>::const_iterator it = allButtons_.begin(); it != allButtons_.end(); ++it)73 it->second->parse(__CC_KeyDetector_callback_name + ' ' + it->second->groupName_ + "." + it->second->name_);72 for (const auto& mapEntry : allButtons_) 73 mapEntry.second->parse(__CC_KeyDetector_callback_name + ' ' + mapEntry.second->groupName_ + "." + mapEntry.second->name_); 74 74 } 75 75 -
code/branches/cpp11_v2/src/libraries/core/module/ModuleInstance.cc
r10917 r10919 76 76 this->staticallyInitializedInstancesByType_.clear(); 77 77 for (const auto& mapEntry : copy) 78 for ( std::set<StaticallyInitializedInstance*>::iterator it2 = mapEntry.second.begin(); it2 != mapEntry.second.end(); ++it2)79 delete (*it2);78 for (StaticallyInitializedInstance* instance : mapEntry.second) 79 delete instance; 80 80 } 81 81 -
code/branches/cpp11_v2/src/libraries/network/Client.cc
r10624 r10919 161 161 { 162 162 std::vector<packet::Gamestate*> gamestates = GamestateManager::getGamestates(); 163 std::vector<packet::Gamestate*>::iterator it; 164 for( it = gamestates.begin(); it != gamestates.end(); ++it ) 163 for( packet::Gamestate* gamestate : gamestates ) 165 164 { 166 (*it)->send( static_cast<Host*>(this) );165 gamestate->send( static_cast<Host*>(this) ); 167 166 } 168 167 } -
code/branches/cpp11_v2/src/libraries/network/ClientConnectionListener.cc
r10624 r10919 44 44 void ClientConnectionListener::broadcastClientConnected(unsigned int clientID) 45 45 { 46 for ( ObjectList<ClientConnectionListener>::iterator it = ObjectList<ClientConnectionListener>::begin(); it != ObjectList<ClientConnectionListener>::end(); ++it)47 it->clientConnected(clientID);46 for (ClientConnectionListener* listener : ObjectList<ClientConnectionListener>()) 47 listener->clientConnected(clientID); 48 48 } 49 49 50 50 void ClientConnectionListener::broadcastClientDisconnected(unsigned int clientID) 51 51 { 52 for ( ObjectList<ClientConnectionListener>::iterator it = ObjectList<ClientConnectionListener>::begin(); it != ObjectList<ClientConnectionListener>::end(); ++it)53 it->clientDisconnected(clientID);52 for (ClientConnectionListener* listener : ObjectList<ClientConnectionListener>()) 53 listener->clientDisconnected(clientID); 54 54 } 55 55 -
code/branches/cpp11_v2/src/libraries/network/Connection.cc
r10768 r10919 237 237 void Connection::disconnectPeersInternal() 238 238 { 239 std::map<uint32_t, ENetPeer*>::iterator it; 240 for( it=this->peerMap_.begin(); it!=this->peerMap_.end(); ++it ) 241 { 242 enet_peer_disconnect(it->second, 0); 239 for( const auto& mapEntry : this->peerMap_ ) 240 { 241 enet_peer_disconnect(mapEntry.second, 0); 243 242 } 244 243 uint32_t iterations = NETWORK_DISCONNECT_TIMEOUT/NETWORK_WAIT_TIMEOUT; -
code/branches/cpp11_v2/src/libraries/network/FunctionCallManager.cc
r10918 r10919 54 54 void FunctionCallManager::sendCalls(orxonox::Host* host) 55 55 { 56 std::map<uint32_t, packet::FunctionCalls*>::iterator it; 57 for (it = FunctionCallManager::sPeerMap_.begin(); it != FunctionCallManager::sPeerMap_.end(); ++it ) 56 for (const auto& mapEntry : FunctionCallManager::sPeerMap_ ) 58 57 { 59 58 assert(!FunctionCallManager::sPeerMap_.empty()); 60 it->second->send(host);59 mapEntry.second->send(host); 61 60 } 62 61 FunctionCallManager::sPeerMap_.clear(); -
code/branches/cpp11_v2/src/libraries/network/GamestateManager.cc
r10769 r10919 70 70 { 71 71 if( this->currentGamestate_ ) 72 delete this->currentGamestate_;std::map<unsigned int, packet::Gamestate*>::iterator it; 73 for( it = gamestateQueue.begin(); it != gamestateQueue.end(); ++it ) 74 delete it->second; 75 std::map<uint32_t, peerInfo>::iterator peerIt; 76 std::map<uint32_t, packet::Gamestate*>::iterator gamestateIt; 77 for( peerIt = peerMap_.begin(); peerIt != peerMap_.end(); ++peerIt ) 78 { 79 for( gamestateIt = peerIt->second.gamestates.begin(); gamestateIt != peerIt->second.gamestates.end(); ++gamestateIt ) 80 delete gamestateIt->second; 72 delete this->currentGamestate_; 73 for( const auto& mapEntry : gamestateQueue ) 74 delete mapEntry.second; 75 for( const auto& mapEntryPeer : peerMap_ ) 76 { 77 for( const auto& mapEntryGamestate : mapEntryPeer.second.gamestates ) 78 delete mapEntryGamestate.second; 81 79 } 82 80 // this->trafficControl_->destroy(); … … 107 105 if( this->gamestateQueue.empty() ) 108 106 return true; 109 std::map<unsigned int, packet::Gamestate*>::iterator it;110 107 // now push only the most recent gamestates we received (ignore obsolete ones) 111 for( it = gamestateQueue.begin(); it!=gamestateQueue.end(); it++)112 { 113 OrxVerify(processGamestate( it->second), "ERROR: could not process Gamestate");114 sendAck( it->second->getID(), it->second->getPeerID() );115 delete it->second;108 for(const auto& mapEntry : gamestateQueue) 109 { 110 OrxVerify(processGamestate(mapEntry.second), "ERROR: could not process Gamestate"); 111 sendAck( mapEntry.second->getID(), mapEntry.second->getPeerID() ); 112 delete mapEntry.second; 116 113 } 117 114 // now clear the queue … … 177 174 std::vector<packet::Gamestate*> peerGamestates; 178 175 179 std::map<uint32_t, peerInfo>::iterator peerIt; 180 for( peerIt=peerMap_.begin(); peerIt!=peerMap_.end(); ++peerIt ) 181 { 182 if( !peerIt->second.isSynched ) 176 for( const auto& mapEntry : peerMap_ ) 177 { 178 if( !mapEntry.second.isSynched ) 183 179 { 184 180 orxout(verbose_more, context::network) << "Server: not sending gamestate" << endl; 185 181 continue; 186 182 } 187 orxout(verbose_more, context::network) << "client id: " << peerIt->first << endl;183 orxout(verbose_more, context::network) << "client id: " << mapEntry.first << endl; 188 184 orxout(verbose_more, context::network) << "Server: doing gamestate gamestate preparation" << endl; 189 int peerID = peerIt->first; //get client id190 191 unsigned int lastAckedGamestateID = peerIt->second.lastAckedGamestateID;185 int peerID = mapEntry.first; //get client id 186 187 unsigned int lastAckedGamestateID = mapEntry.second.lastAckedGamestateID; 192 188 193 189 packet::Gamestate* baseGamestate=nullptr; … … 340 336 { 341 337 assert(peerMap_.find(peerID)!=peerMap_.end()); 342 std::map<uint32_t, packet::Gamestate*>::iterator peerIt; 343 for( peerIt = peerMap_[peerID].gamestates.begin(); peerIt!=peerMap_[peerID].gamestates.end(); ++peerIt ) 344 { 345 delete peerIt->second; 338 for( const auto& mapEntry : peerMap_[peerID].gamestates ) 339 { 340 delete mapEntry.second; 346 341 } 347 342 peerMap_.erase(peerMap_.find(peerID)); -
code/branches/cpp11_v2/src/libraries/network/Host.cc
r10916 r10919 107 107 void Host::doReceiveChat(const std::string& message, unsigned int sourceID, unsigned int targetID) 108 108 { 109 for ( ObjectList<NetworkChatListener>::iterator it = ObjectList<NetworkChatListener>::begin(); it != ObjectList<NetworkChatListener>::end(); ++it)110 it->incomingChat(message, sourceID);109 for (NetworkChatListener* listener : ObjectList<NetworkChatListener>()) 110 listener->incomingChat(message, sourceID); 111 111 } 112 112 -
code/branches/cpp11_v2/src/libraries/network/MasterServer.cc
r10765 r10919 49 49 MasterServer::listServers( void ) 50 50 { 51 /* get an iterator */52 std::list<ServerListElem>::iterator i;53 54 51 /* print list header */ 55 52 orxout(user_info) << "List of connected servers" << std::endl; 56 53 57 54 /* loop through list elements */ 58 for( i = MasterServer::getInstance()->mainlist.serverlist.begin(); 59 i != MasterServer::getInstance()->mainlist.serverlist.end(); ++i ) 55 for( const ServerListElem& elem : MasterServer::getInstance()->mainlist.serverlist ) 60 56 { 61 orxout(user_info) << " " << (*i).ServerInfo.getServerIP() << std::endl;57 orxout(user_info) << " " << elem.ServerInfo.getServerIP() << std::endl; 62 58 } 63 59 … … 112 108 MasterServer::helper_sendlist( ENetEvent *event ) 113 109 { 114 /* get an iterator */115 std::list<ServerListElem>::iterator i;116 117 110 /* packet holder */ 118 111 ENetPacket *reply; 119 112 120 113 /* loop through list elements */ 121 for( i = mainlist.serverlist.begin(); i 122 != mainlist.serverlist.end(); ++i ) 114 for( const ServerListElem& elem : mainlist.serverlist ) 123 115 { 124 116 /* send this particular server */ 125 117 /* build reply string */ 126 int packetlen = MSPROTO_SERVERLIST_ITEM_LEN + 1 + (*i).ServerInfo.getServerIP().length() + 1 + (*i).ServerInfo.getServerName().length() + 1 + sizeof((*i).ServerInfo.getClientNumber()) + 1;118 int packetlen = MSPROTO_SERVERLIST_ITEM_LEN + 1 + elem.ServerInfo.getServerIP().length() + 1 + elem.ServerInfo.getServerName().length() + 1 + sizeof(elem.ServerInfo.getClientNumber()) + 1; 127 119 char *tosend = (char *)calloc(packetlen ,1 ); 128 120 if( !tosend ) … … 131 123 } 132 124 sprintf( tosend, "%s %s %s %u", MSPROTO_SERVERLIST_ITEM, 133 (*i).ServerInfo.getServerIP().c_str(), (*i).ServerInfo.getServerName().c_str(), (*i).ServerInfo.getClientNumber());125 elem.ServerInfo.getServerIP().c_str(), elem.ServerInfo.getServerName().c_str(), elem.ServerInfo.getClientNumber()); 134 126 135 127 /* create packet from it */ … … 167 159 MasterServer::helper_cleanupServers( void ) 168 160 { 169 /* get an iterator */170 std::list<ServerListElem>::iterator i;171 172 161 if( mainlist.serverlist.size() == 0 ) 173 162 return; 174 163 175 164 /* loop through list elements */ 176 for( i = mainlist.serverlist.begin(); i 177 != mainlist.serverlist.end(); ++i ) 165 for( const ServerListElem& elem : mainlist.serverlist ) 178 166 { /* see if we have a disconnected peer */ 179 if( (*i).peer &&180 ( (*i).peer->state == ENET_PEER_STATE_DISCONNECTED ||181 (*i).peer->state == ENET_PEER_STATE_ZOMBIE ))167 if( elem.peer && 168 (elem.peer->state == ENET_PEER_STATE_DISCONNECTED || 169 elem.peer->state == ENET_PEER_STATE_ZOMBIE )) 182 170 { 183 171 /* Remove it from the list */ 184 orxout(internal_warning) << (char*) (*i).peer->data << " timed out.\n";185 mainlist.delServerByName( (*i).ServerInfo.getServerName() );172 orxout(internal_warning) << (char*)elem.peer->data << " timed out.\n"; 173 mainlist.delServerByName( elem.ServerInfo.getServerName() ); 186 174 187 175 /* stop iterating, we manipulated the list */ -
code/branches/cpp11_v2/src/libraries/network/PeerList.cc
r10765 r10919 65 65 bool 66 66 PeerList::remPeerByAddr( ENetAddress addr ) 67 { /* get an iterator */ 68 std::list<ENetPeer *>::iterator i; 69 67 { 70 68 /* loop through list elements */ 71 for( i = peerlist.begin(); i != peerlist.end(); ++i)72 if( !sub_compAddr( (*i)->address, addr ) )69 for( ENetPeer* peer : peerlist ) 70 if( !sub_compAddr(peer->address, addr ) ) 73 71 { /* found this name, remove and quit */ 74 this->peerlist.remove( *i);72 this->peerlist.remove( peer ); 75 73 return true; 76 74 } … … 82 80 ENetPeer * 83 81 PeerList::findPeerByAddr( ENetAddress addr ) 84 { /* get an iterator */ 85 std::list<ENetPeer *>::iterator i; 86 82 { 87 83 /* loop through list elements */ 88 for( i = peerlist.begin(); i != peerlist.end(); ++i)89 if( !sub_compAddr( (*i)->address, addr ) )84 for( ENetPeer* peer : peerlist ) 85 if( !sub_compAddr(peer->address, addr ) ) 90 86 /* found this name, remove and quit */ 91 return *i;87 return peer; 92 88 93 89 /* not found */ -
code/branches/cpp11_v2/src/libraries/network/Server.cc
r10768 r10919 232 232 { 233 233 std::vector<packet::Gamestate*> gamestates = GamestateManager::getGamestates(); 234 std::vector<packet::Gamestate*>::iterator it; 235 for( it = gamestates.begin(); it != gamestates.end(); ++it ) 234 for( packet::Gamestate* gamestate : gamestates ) 236 235 { 237 (*it)->send(static_cast<Host*>(this));236 gamestate->send(static_cast<Host*>(this)); 238 237 } 239 238 return true; … … 434 433 return true; 435 434 436 std::vector<uint32_t>::iterator it; 437 for( it=this->clientIDs_.begin(); it!=this->clientIDs_.end(); ++it ) 438 if( *it == targetID ) 435 for( uint32_t id : this->clientIDs_ ) 436 if( id == targetID ) 439 437 return true; 440 438 -
code/branches/cpp11_v2/src/libraries/network/packet/ClassID.cc
r10769 r10919 55 55 56 56 //calculate total needed size (for all strings and integers) 57 std::map<std::string, Identifier*>::const_iterator it = IdentifierManager::getInstance().getIdentifierByStringMap().begin(); 58 for(;it != IdentifierManager::getInstance().getIdentifierByStringMap().end();++it){ 59 id = it->second; 57 for(const auto& mapEntry : IdentifierManager::getInstance().getIdentifierByStringMap()){ 58 id = mapEntry.second; 60 59 if(id == nullptr || !id->hasFactory()) 61 60 continue; -
code/branches/cpp11_v2/src/libraries/network/packet/Gamestate.cc
r10918 r10919 213 213 { 214 214 std::list<uint32_t> v1; 215 ObjectList<Synchronisable>::iterator it; 216 for (it = ObjectList<Synchronisable>::begin(); it != ObjectList<Synchronisable>::end(); ++it) 217 { 218 if (it->getObjectID() == OBJECTID_UNKNOWN) 219 { 220 if (it->objectMode_ != 0x0) 215 for (Synchronisable* synchronisable : ObjectList<Synchronisable>()) 216 { 217 if (synchronisable->getObjectID() == OBJECTID_UNKNOWN) 218 { 219 if (synchronisable->objectMode_ != 0x0) 221 220 { 222 221 orxout(user_error, context::packets) << "Found object with OBJECTID_UNKNOWN on the client with objectMode != 0x0!" << endl; 223 222 orxout(user_error, context::packets) << "Possible reason for this error: Client created a synchronized object without the Server's approval." << endl; 224 orxout(user_error, context::packets) << "Objects class: " << it->getIdentifier()->getName() << endl;223 orxout(user_error, context::packets) << "Objects class: " << synchronisable->getIdentifier()->getName() << endl; 225 224 assert(false); 226 225 } … … 228 227 else 229 228 { 230 std::list<uint32_t>::iterator it2; 231 for (it2 = v1.begin(); it2 != v1.end(); ++it2) 229 for (uint32_t id : v1) 232 230 { 233 if ( it->getObjectID() == *it2)231 if (synchronisable->getObjectID() == id) 234 232 { 235 233 orxout(user_error, context::packets) << "Found duplicate objectIDs on the client!" << endl … … 239 237 } 240 238 } 241 v1.push_back( it->getObjectID());239 v1.push_back(synchronisable->getObjectID()); 242 240 } 243 241 } … … 762 760 uint32_t size = 0; 763 761 uint32_t nrOfVariables = 0; 764 // get the start of the Synchronisable list765 ObjectList<Synchronisable>::iterator it;766 762 // get total size of gamestate 767 for( it = ObjectList<Synchronisable>::begin(); it; ++it){768 size+= it->getSize(id, mode); // size of the actual data of the synchronisable769 nrOfVariables += it->getNrOfVariables();763 for(Synchronisable* synchronisable : ObjectList<Synchronisable>()){ 764 size+=synchronisable->getSize(id, mode); // size of the actual data of the synchronisable 765 nrOfVariables += synchronisable->getNrOfVariables(); 770 766 } 771 767 // orxout() << "allocating " << nrOfVariables << " ints" << endl; -
code/branches/cpp11_v2/src/libraries/network/packet/ServerInformation.h
r10857 r10919 50 50 void send( ENetPeer* peer ); 51 51 void setServerName(std::string name) { this->serverName_ = name; } 52 std::string getServerName() { return this->serverName_; }52 std::string getServerName() const { return this->serverName_; } 53 53 void setServerIP( std::string IP ) { this->serverIP_ = IP; } 54 std::string getServerIP() { return this->serverIP_; }54 std::string getServerIP() const { return this->serverIP_; } 55 55 void setClientNumber( int clientNumber ) { this->clientNumber_ = clientNumber; } 56 int getClientNumber() { return this->clientNumber_; }57 uint32_t getServerRTT() { return this->serverRTT_; }56 int getClientNumber() const { return this->clientNumber_; } 57 uint32_t getServerRTT() const { return this->serverRTT_; } 58 58 59 59 private: -
code/branches/cpp11_v2/src/libraries/network/synchronisable/Synchronisable.cc
r10916 r10919 266 266 assert(this->classID_==this->getIdentifier()->getNetworkID()); 267 267 assert(this->objectID_!=OBJECTID_UNKNOWN); 268 std::vector<SynchronisableVariableBase*>::iterator i;269 268 270 269 // start copy header … … 276 275 // orxout(verbose, context::network) << "objectid: " << this->objectID_ << ":"; 277 276 // copy to location 278 for( i=syncList_.begin(); i!=syncList_.end(); ++i)279 { 280 uint32_t varsize = (*i)->getData( mem, mode );277 for(SynchronisableVariableBase* variable : syncList_) 278 { 279 uint32_t varsize = variable->getData( mem, mode ); 281 280 // orxout(verbose, context::network) << " " << varsize; 282 281 tempsize += varsize; … … 348 347 assert( this->getContextID() == syncHeader2.getContextID() ); 349 348 mem += SynchronisableHeader::getSize(); 350 std::vector<SynchronisableVariableBase *>::iterator i; 351 for(i=syncList_.begin(); i!=syncList_.end(); ++i) 349 for(SynchronisableVariableBase* variable : syncList_) 352 350 { 353 351 assert( mem <= data+syncHeader2.getDataSize()+SynchronisableHeader::getSize() ); // always make sure we don't exceed the datasize in our stream 354 (*i)->putData( mem, mode, forceCallback );352 variable->putData( mem, mode, forceCallback ); 355 353 } 356 354 assert(mem == data+syncHeaderLight.getDataSize()+SynchronisableHeader::getSize() ); … … 388 386 assert( mode==state_ ); 389 387 tsize += this->dataSize_; 390 std::vector<SynchronisableVariableBase*>::iterator i; 391 for(i=stringList_.begin(); i!=stringList_.end(); ++i) 392 { 393 tsize += (*i)->getSize( mode ); 388 for(SynchronisableVariableBase* variable : stringList_) 389 { 390 tsize += variable->getSize( mode ); 394 391 } 395 392 return tsize; -
code/branches/cpp11_v2/src/libraries/tools/interfaces/ToolsInterfaceCompilation.cc
r10624 r10919 60 60 float oldFactor = TimeFactorListener::timefactor_s; 61 61 TimeFactorListener::timefactor_s = factor; 62 for ( ObjectList<TimeFactorListener>::iterator it = ObjectList<TimeFactorListener>::begin(); it != ObjectList<TimeFactorListener>::end(); ++it)63 it->changedTimeFactor(factor, oldFactor);62 for (TimeFactorListener* listener : ObjectList<TimeFactorListener>()) 63 listener->changedTimeFactor(factor, oldFactor); 64 64 } 65 65 -
code/branches/cpp11_v2/src/libraries/util/Serialise.h
r10916 r10919 679 679 template <class T> inline void saveAndIncrease( const std::set<T>& variable, uint8_t*& mem ) 680 680 { 681 typename std::set<T>::const_iterator it = variable.begin();682 681 saveAndIncrease( (uint32_t)variable.size(), mem ); 683 for( ; it!=variable.end(); ++it)684 saveAndIncrease( *it, mem );682 for( const T& elem : variable ) 683 saveAndIncrease( elem, mem ); 685 684 } 686 685
Note: See TracChangeset
for help on using the changeset viewer.