@@ -54,13 +54,15 @@ CObjectList::~CObjectList()
5454
5555IGameObject* CObjectList::FindObjectByName (shared_str name)
5656{
57- for (Objects::iterator I = objects_active.begin (); I != objects_active.end (); I++)
58- if ((*I)->cName ().equal (name))
59- return (*I);
60- for (Objects::iterator I = objects_sleeping.begin (); I != objects_sleeping.end (); I++)
61- if ((*I)->cName ().equal (name))
62- return (*I);
63- return NULL ;
57+ for (auto it : objects_active)
58+ if (it->cName ().equal (name))
59+ return it;
60+
61+ for (auto & it : objects_sleeping)
62+ if (it->cName ().equal (name))
63+ return it;
64+
65+ return nullptr ;
6466}
6567IGameObject* CObjectList::FindObjectByName (LPCSTR name) { return FindObjectByName (shared_str (name)); }
6668IGameObject* CObjectList::FindObjectByCLS_ID (CLASS_ID cls)
@@ -297,17 +299,15 @@ void CObjectList::Update(bool bForce)
297299 for (int it = destroy_queue.size () - 1 ; it >= 0 ; it--)
298300 Sound->object_relcase (destroy_queue[it]);
299301
300- RELCASE_CALLBACK_VEC::iterator It = m_relcase_callbacks.begin ();
301- RELCASE_CALLBACK_VEC::iterator Ite = m_relcase_callbacks.end ();
302- for (; It != Ite ; ++It )
302+ RELCASE_CALLBACK_VEC::iterator it = m_relcase_callbacks.begin ();
303+ const RELCASE_CALLBACK_VEC::iterator ite = m_relcase_callbacks.end ();
304+ for (; it != ite ; ++it )
303305 {
304- VERIFY (*(*It).m_ID == (It - m_relcase_callbacks.begin ()));
305- Objects::iterator dIt = destroy_queue.begin ();
306- Objects::iterator dIte = destroy_queue.end ();
307- for (; dIt != dIte; ++dIt)
306+ VERIFY (*(*it).m_ID == (it - m_relcase_callbacks.begin ()));
307+ for (auto & dit : destroy_queue)
308308 {
309- (*It ).m_Callback (*dIt );
310- g_hud->net_Relcase (*dIt );
309+ (*it ).m_Callback (dit );
310+ g_hud->net_Relcase (dit );
311311 }
312312 }
313313
@@ -567,13 +567,10 @@ void CObjectList::relcase_unregister(int* ID)
567567
568568void CObjectList::dump_list (Objects& v, LPCSTR reason)
569569{
570- Objects::iterator it = v.begin ();
571- Objects::iterator it_e = v.end ();
572570#ifdef DEBUG
573- Msg (" ----------------dump_list [%s]" , reason);
574- for (; it != it_e; ++it)
575- Msg (" %x - name [%s] ID[%d] parent[%s] getDestroy()=[%s]" , (*it), (*it)->cName ().c_str (), (*it)->ID (),
576- ((*it)->H_Parent ()) ? (*it)->H_Parent ()->cName ().c_str () : " " , ((*it)->getDestroy ()) ? " yes" : " no" );
571+ for (auto & it : v)
572+ Msg (" %x - name [%s] ID[%d] parent[%s] getDestroy()=[%s]" , it, it->cName ().c_str (), it->ID (),
573+ it->H_Parent () ? it->H_Parent ()->cName ().c_str () : " " , it->getDestroy () ? " yes" : " no" );
577574#endif // #ifdef DEBUG
578575}
579576
@@ -593,29 +590,25 @@ void CObjectList::register_object_to_destroy(IGameObject* object_to_destroy)
593590 // Msg("CObjectList::register_object_to_destroy [%x]", object_to_destroy);
594591 destroy_queue.push_back (object_to_destroy);
595592
596- Objects::iterator it = objects_active.begin ();
597- Objects::iterator it_e = objects_active.end ();
598- for (; it != it_e; ++it)
593+ for (auto & it : objects_active)
599594 {
600- IGameObject* O = * it;
595+ IGameObject* O = it;
601596 if (!O->getDestroy () && O->H_Parent () == object_to_destroy)
602597 {
603598 Msg (" setDestroy called, but not-destroyed child found parent[%d] child[%d]" , object_to_destroy->ID (),
604599 O->ID (), Device.dwFrame );
605- O->setDestroy (TRUE );
600+ O->setDestroy (true );
606601 }
607602 }
608603
609- it = objects_sleeping.begin ();
610- it_e = objects_sleeping.end ();
611- for (; it != it_e; ++it)
604+ for (auto & it : objects_sleeping)
612605 {
613- IGameObject* O = * it;
606+ IGameObject* O = it;
614607 if (!O->getDestroy () && O->H_Parent () == object_to_destroy)
615608 {
616609 Msg (" setDestroy called, but not-destroyed child found parent[%d] child[%d]" , object_to_destroy->ID (),
617610 O->ID (), Device.dwFrame );
618- O->setDestroy (TRUE );
611+ O->setDestroy (true );
619612 }
620613 }
621614}
0 commit comments