diff --git a/lib/irrlicht/include/ISceneNode.h b/lib/irrlicht/include/ISceneNode.h index a4a9b4497..b6c4698e8 100644 --- a/lib/irrlicht/include/ISceneNode.h +++ b/lib/irrlicht/include/ISceneNode.h @@ -24,8 +24,6 @@ namespace scene { class ISceneManager; - //! Typedef for list of scene nodes - typedef core::list ISceneNodeList; //! Typedef for list of scene node animators typedef core::list ISceneNodeAnimatorList; @@ -92,9 +90,8 @@ namespace scene { if (IsVisible) { - ISceneNodeList::Iterator it = Children.begin(); - for (; it != Children.end(); ++it) - (*it)->OnRegisterSceneNode(); + for (unsigned i = 0; i < Children.size(); ++i) + Children[i]->OnRegisterSceneNode(); } } @@ -127,9 +124,8 @@ namespace scene // perform the post render process on all children - ISceneNodeList::Iterator it = Children.begin(); - for (; it != Children.end(); ++it) - (*it)->OnAnimate(timeMs); + for (unsigned i = 0; i < Children.size(); ++i) + Children[i]->OnAnimate(timeMs); } } @@ -142,9 +138,8 @@ namespace scene // perform the post render process on all children - ISceneNodeList::Iterator it = Children.begin(); - for (; it != Children.end(); ++it) - (*it)->recursiveUpdateAbsolutePosition(); + for (unsigned i = 0; i < Children.size(); ++i) + Children[i]->recursiveUpdateAbsolutePosition(); } } @@ -314,16 +309,16 @@ namespace scene e.g. because it couldn't be found in the children list. */ virtual bool removeChild(ISceneNode* child) { - ISceneNodeList::Iterator it = Children.begin(); - for (; it != Children.end(); ++it) - if ((*it) == child) + for (unsigned i = 0; i < Children.size(); ++i) + { + if (Children[i] == child) { - (*it)->Parent = 0; - (*it)->drop(); - Children.erase(it); + child->Parent = 0; + child->drop(); + Children.erase(i); return true; } - + } _IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX; return false; } @@ -335,13 +330,11 @@ namespace scene */ virtual void removeAll() { - ISceneNodeList::Iterator it = Children.begin(); - for (; it != Children.end(); ++it) + for (unsigned i = 0; i < Children.size(); ++i) { - (*it)->Parent = 0; - (*it)->drop(); + Children[i]->Parent = 0; + Children[i]->drop(); } - Children.clear(); } @@ -598,14 +591,14 @@ namespace scene //! Returns a const reference to the list of all children. /** \return The list of all children of this node. */ - const core::list& getChildren() const + const core::array& getChildren() const { return Children; } //! Returns a list of all children (non-const version). /** \return The list of all children of this node. */ - core::list& getChildren() + core::array& getChildren() { return Children; } @@ -794,10 +787,8 @@ namespace scene // clone children - ISceneNodeList::Iterator it = toCopyFrom->Children.begin(); - for (; it != toCopyFrom->Children.end(); ++it) - (*it)->clone(this, newManager); - + for (unsigned i = 0; i < Children.size(); ++i) + Children[i]->clone(this, newManager); // clone animators ISceneNodeAnimatorList::Iterator ait = toCopyFrom->Animators.begin(); @@ -818,9 +809,9 @@ namespace scene { SceneManager = newManager; - ISceneNodeList::Iterator it = Children.begin(); - for (; it != Children.end(); ++it) - (*it)->setSceneManager(newManager); + for (unsigned i = 0; i < Children.size(); ++i) + Children[i]->setSceneManager(newManager); + } //! Name of the scene node. @@ -842,7 +833,7 @@ namespace scene ISceneNode* Parent; //! List of all children of this node - core::list Children; + core::array Children; //! List of all animator nodes core::list Animators; diff --git a/lib/irrlicht/source/Irrlicht/CBoneSceneNode.cpp b/lib/irrlicht/source/Irrlicht/CBoneSceneNode.cpp index af5401102..348d8deac 100644 --- a/lib/irrlicht/source/Irrlicht/CBoneSceneNode.cpp +++ b/lib/irrlicht/source/Irrlicht/CBoneSceneNode.cpp @@ -77,9 +77,8 @@ void CBoneSceneNode::OnAnimate(u32 timeMs) //updateAbsolutePosition(); // perform the post render process on all children - ISceneNodeList::Iterator it = Children.begin(); - for (; it != Children.end(); ++it) - (*it)->OnAnimate(timeMs); + for (unsigned i = 0; i < Children.size(); ++i) + Children[i]->OnAnimate(timeMs); } } @@ -88,10 +87,9 @@ void CBoneSceneNode::helper_updateAbsolutePositionOfAllChildren(ISceneNode *Node { Node->updateAbsolutePosition(); - ISceneNodeList::ConstIterator it = Node->getChildren().begin(); - for (; it != Node->getChildren().end(); ++it) + for (unsigned i = 0; i < Node->getChildren().size(); ++i) { - helper_updateAbsolutePositionOfAllChildren( (*it) ); + helper_updateAbsolutePositionOfAllChildren( Node->getChildren()[i] ); } } diff --git a/lib/irrlicht/source/Irrlicht/CSceneCollisionManager.cpp b/lib/irrlicht/source/Irrlicht/CSceneCollisionManager.cpp index cda41333d..8cb6a9bc0 100644 --- a/lib/irrlicht/source/Irrlicht/CSceneCollisionManager.cpp +++ b/lib/irrlicht/source/Irrlicht/CSceneCollisionManager.cpp @@ -74,13 +74,11 @@ void CSceneCollisionManager::getPickedNodeBB(ISceneNode* root, core::line3df& ray, s32 bits, bool noDebugObjects, f32& outbestdistance, ISceneNode*& outbestnode) { - const ISceneNodeList& children = root->getChildren(); const core::vector3df rayVector = ray.getVector().normalize(); - ISceneNodeList::ConstIterator it = children.begin(); - for (; it != children.end(); ++it) + for (unsigned i = 0; i != root->getChildren().size(); ++i) { - ISceneNode* current = *it; + ISceneNode* current = root->getChildren()[i]; if (current->isVisible()) { @@ -275,12 +273,9 @@ void CSceneCollisionManager::getPickedNodeFromBBAndSelector( core::vector3df & outBestCollisionPoint, core::triangle3df & outBestTriangle) { - const ISceneNodeList& children = root->getChildren(); - - ISceneNodeList::ConstIterator it = children.begin(); - for (; it != children.end(); ++it) + for (unsigned i = 0; i != root->getChildren().size(); ++i) { - ISceneNode* current = *it; + ISceneNode* current = root->getChildren()[i]; ITriangleSelector * selector = current->getTriangleSelector(); if (selector && current->isVisible() && diff --git a/lib/irrlicht/source/Irrlicht/CSceneManager.cpp b/lib/irrlicht/source/Irrlicht/CSceneManager.cpp index af215d536..f57da6a2c 100644 --- a/lib/irrlicht/source/Irrlicht/CSceneManager.cpp +++ b/lib/irrlicht/source/Irrlicht/CSceneManager.cpp @@ -1668,11 +1668,9 @@ ISceneNode* CSceneManager::getSceneNodeFromName(const char* name, ISceneNode* st ISceneNode* node = 0; - const ISceneNodeList& list = start->getChildren(); - ISceneNodeList::ConstIterator it = list.begin(); - for (; it!=list.end(); ++it) + for (unsigned i = 0; i < start->getChildren().size(); ++i) { - node = getSceneNodeFromName(name, *it); + node = getSceneNodeFromName(name, start->getChildren()[i]); if (node) return node; } @@ -1692,11 +1690,9 @@ ISceneNode* CSceneManager::getSceneNodeFromId(s32 id, ISceneNode* start) ISceneNode* node = 0; - const ISceneNodeList& list = start->getChildren(); - ISceneNodeList::ConstIterator it = list.begin(); - for (; it!=list.end(); ++it) + for (unsigned i = 0; i < start->getChildren().size(); ++i) { - node = getSceneNodeFromId(id, *it); + node = getSceneNodeFromId(id, start->getChildren()[i]); if (node) return node; } @@ -1716,11 +1712,9 @@ ISceneNode* CSceneManager::getSceneNodeFromType(scene::ESCENE_NODE_TYPE type, IS ISceneNode* node = 0; - const ISceneNodeList& list = start->getChildren(); - ISceneNodeList::ConstIterator it = list.begin(); - for (; it!=list.end(); ++it) + for (unsigned i = 0; i < start->getChildren().size(); ++i) { - node = getSceneNodeFromType(type, *it); + node = getSceneNodeFromType(type, start->getChildren()[i]); if (node) return node; } @@ -1738,12 +1732,9 @@ void CSceneManager::getSceneNodesFromType(ESCENE_NODE_TYPE type, core::arraygetType() == type || ESNT_ANY == type) outNodes.push_back(start); - const ISceneNodeList& list = start->getChildren(); - ISceneNodeList::ConstIterator it = list.begin(); - - for (; it!=list.end(); ++it) + for (unsigned i = 0; i < start->getChildren().size(); ++i) { - getSceneNodesFromType(type, outNodes, *it); + getSceneNodesFromType(type, outNodes, start->getChildren()[i]); } } @@ -2101,9 +2092,8 @@ void CSceneManager::writeSceneNode(io::IXMLWriter* writer, ISceneNode* node, ISc } else { - ISceneNodeList::ConstIterator it = node->getChildren().begin(); - for (; it != node->getChildren().end(); ++it) - writeSceneNode(writer, (*it), userDataSerializer, currentPath); + for (unsigned i = 0; i < node->getChildren().size(); ++i) + writeSceneNode(writer, node->getChildren()[i], userDataSerializer, currentPath); } attr->drop(); diff --git a/src/graphics/draw_calls.cpp b/src/graphics/draw_calls.cpp index 5e8b3663d..2398ff6a3 100644 --- a/src/graphics/draw_calls.cpp +++ b/src/graphics/draw_calls.cpp @@ -136,49 +136,48 @@ void DrawCalls::renderBoundingBoxes() } // renderBoundingBoxes // ---------------------------------------------------------------------------- -void DrawCalls::parseSceneManager(core::list &List, +void DrawCalls::parseSceneManager(core::array &List, const scene::ICameraSceneNode *cam) { - core::list::Iterator I = List.begin(), E = List.end(); - for (; I != E; ++I) + for (unsigned i = 0; i < List.size(); ++i) { - if (LODNode *node = dynamic_cast(*I)) + if (LODNode *node = dynamic_cast(List[i])) { node->updateVisibility(); } - (*I)->updateAbsolutePosition(); - if (!(*I)->isVisible()) + List[i]->updateAbsolutePosition(); + if (!List[i]->isVisible()) continue; - if (STKParticle *node = dynamic_cast(*I)) + if (STKParticle *node = dynamic_cast(List[i])) { - if (!isCulledPrecise(cam, *I, irr_driver->getBoundingBoxesViz())) + if (!isCulledPrecise(cam, List[i], irr_driver->getBoundingBoxesViz())) CPUParticleManager::getInstance()->addParticleNode(node); continue; } if (scene::IBillboardSceneNode *node = - dynamic_cast(*I)) + dynamic_cast(List[i])) { - if (!isCulledPrecise(cam, *I)) + if (!isCulledPrecise(cam, List[i])) CPUParticleManager::getInstance()->addBillboardNode(node); continue; } if (STKTextBillboard *tb = - dynamic_cast(*I)) + dynamic_cast(List[i])) { - if (!isCulledPrecise(cam, *I, irr_driver->getBoundingBoxesViz())) + if (!isCulledPrecise(cam, List[i], irr_driver->getBoundingBoxesViz())) TextBillboardDrawer::addTextBillboard(tb); continue; } - SP::SPMeshNode* node = dynamic_cast(*I); + SP::SPMeshNode* node = dynamic_cast(List[i]); if (node) { SP::addObject(node); } - parseSceneManager((*I)->getChildren(), cam); + parseSceneManager(List[i]->getChildren(), cam); } } diff --git a/src/graphics/draw_calls.hpp b/src/graphics/draw_calls.hpp index 547b68b8d..78ed23b32 100644 --- a/src/graphics/draw_calls.hpp +++ b/src/graphics/draw_calls.hpp @@ -33,7 +33,7 @@ private: GLsync m_sync; std::vector m_bounding_boxes; - void parseSceneManager(core::list &List, + void parseSceneManager(core::array &List, const scene::ICameraSceneNode *cam); bool isCulledPrecise(const scene::ICameraSceneNode *cam, diff --git a/src/graphics/lod_node.cpp b/src/graphics/lod_node.cpp index 65d0c0db9..199226731 100644 --- a/src/graphics/lod_node.cpp +++ b/src/graphics/lod_node.cpp @@ -129,15 +129,14 @@ void LODNode::OnAnimate(u32 timeMs) Box = m_nodes[m_detail.size()-1]->getBoundingBox(); // If this node has children other than the LOD nodes, animate it - core::list::Iterator it; - for (it = Children.begin(); it != Children.end(); it++) + for (unsigned i = 0; i < Children.size(); ++i) { - if (m_nodes_set.find(*it) == m_nodes_set.end()) + if (m_nodes_set.find(Children[i]) == m_nodes_set.end()) { - assert(*it != NULL); - if ((*it)->isVisible()) + assert(Children[i] != NULL); + if (Children[i]->isVisible()) { - (*it)->OnAnimate(timeMs); + Children[i]->OnAnimate(timeMs); } } } @@ -178,11 +177,8 @@ void LODNode::OnRegisterSceneNode() #ifndef SERVER_ONLY if (!CVS->isGLSL()) { - for (core::list::Iterator it = Children.begin(); - it != Children.end(); it++) - { - (*it)->updateAbsolutePosition(); - } + for (unsigned i = 0; i < Children.size(); ++i) + Children[i]->updateAbsolutePosition(); } #endif scene::ISceneNode::OnRegisterSceneNode(); diff --git a/src/graphics/stk_text_billboard.cpp b/src/graphics/stk_text_billboard.cpp index a50e9d0d8..15d170b7b 100644 --- a/src/graphics/stk_text_billboard.cpp +++ b/src/graphics/stk_text_billboard.cpp @@ -453,14 +453,13 @@ void STKTextBillboard::reload() } // reload // ---------------------------------------------------------------------------- -static void updateTextBillboard(core::list& List) +static void updateTextBillboard(core::array& List) { - core::list::Iterator I = List.begin(), E = List.end(); - for (; I != E; ++I) + for (unsigned i = 0; i < List.size(); i++) { - if (STKTextBillboard* tb = dynamic_cast(*I)) + if (STKTextBillboard* tb = dynamic_cast(List[i])) tb->reload(); - updateTextBillboard((*I)->getChildren()); + updateTextBillboard(List[i]->getChildren()); } } // updateTextBillboard diff --git a/src/modes/three_strikes_battle.cpp b/src/modes/three_strikes_battle.cpp index 5436bd0bb..1b4801f6a 100644 --- a/src/modes/three_strikes_battle.cpp +++ b/src/modes/three_strikes_battle.cpp @@ -124,11 +124,9 @@ void ThreeStrikesBattle::reset(bool restart) scene::ISceneNode* kart_node = m_karts[n]->getNode(); - core::list& children = kart_node->getChildren(); - for (core::list::Iterator it = children.begin(); - it != children.end(); it++) + for (unsigned i = 0; i < kart_node->getChildren().size(); i++) { - scene::ISceneNode* curr = *it; + scene::ISceneNode* curr = kart_node->getChildren()[i]; if (core::stringc(curr->getName()) == "tire1") { @@ -302,11 +300,9 @@ bool ThreeStrikesBattle::kartHit(int kart_id, int hitter) } scene::ISceneNode* kart_node = m_karts[kart_id]->getNode(); - core::list& children = kart_node->getChildren(); - for (core::list::Iterator it = children.begin(); - it != children.end(); it++) + for (unsigned i = 0; i < kart_node->getChildren().size(); i++) { - scene::ISceneNode* curr = *it; + scene::ISceneNode* curr = kart_node->getChildren()[i]; if (core::stringc(curr->getName()) == "tire1") { @@ -590,11 +586,9 @@ void ThreeStrikesBattle::addKartLife(unsigned int id) updateKartRanks(); scene::ISceneNode* kart_node = m_karts[id]->getNode(); - core::list& children = kart_node->getChildren(); - for (core::list::Iterator it = children.begin(); - it != children.end(); it++) + for (unsigned i = 0; i < kart_node->getChildren().size(); i++) { - scene::ISceneNode* curr = *it; + scene::ISceneNode* curr = kart_node->getChildren()[i]; if (core::stringc(curr->getName()) == "tire1") { curr->setVisible(m_kart_info[id].m_lives >= 3); diff --git a/src/tracks/track.cpp b/src/tracks/track.cpp index 7d9997bce..fd4afac65 100644 --- a/src/tracks/track.cpp +++ b/src/tracks/track.cpp @@ -1747,11 +1747,8 @@ static void recursiveUpdatePosition(scene::ISceneNode *node) { node->updateAbsolutePosition(); - scene::ISceneNodeList::ConstIterator it = node->getChildren().begin(); - for (; it != node->getChildren().end(); ++it) - { - recursiveUpdatePosition(*it); - } + for (unsigned i = 0; i < node->getChildren().size(); i++) + recursiveUpdatePosition(node->getChildren()[i]); } // recursiveUpdatePosition // ----------------------------------------------------------------------------