@@ -465,36 +465,30 @@ void CRender::add_leafs_Dynamic(dxRender_Visual* pVisual)
465465 return ;
466466
467467 // Visual is 100% visible - simply add it
468- xr_vector<dxRender_Visual *>::iterator I, E; // it may be useful for 'hierrarhy' visual
469-
470468 switch (pVisual->Type )
471469 {
472470 case MT_PARTICLE_GROUP:
473471 {
474472 // Add all children, doesn't perform any tests
475473 PS::CParticleGroup* pG = (PS::CParticleGroup*)pVisual;
476- for (auto i_it = pG->items . begin (); i_it != pG-> items . end (); i_it++ )
474+ for (auto &it : pG->items )
477475 {
478- PS::CParticleGroup::SItem& I = *i_it ;
476+ PS::CParticleGroup::SItem& I = it ;
479477 if (I._effect )
480478 add_leafs_Dynamic (I._effect );
481- for (xr_vector<dxRender_Visual*>::iterator pit = I._children_related .begin ();
482- pit != I._children_related .end (); pit++)
483- add_leafs_Dynamic (*pit);
484- for (xr_vector<dxRender_Visual*>::iterator pit = I._children_free .begin (); pit != I._children_free .end ();
485- pit++)
486- add_leafs_Dynamic (*pit);
479+ for (auto &pit : I._children_related )
480+ add_leafs_Dynamic (pit);
481+ for (auto &pit : I._children_free )
482+ add_leafs_Dynamic (pit);
487483 }
488484 }
489485 return ;
490486 case MT_HIERRARHY:
491487 {
492488 // Add all children, doesn't perform any tests
493489 FHierrarhyVisual* pV = (FHierrarhyVisual*)pVisual;
494- I = pV->children .begin ();
495- E = pV->children .end ();
496- for (; I != E; I++)
497- add_leafs_Dynamic (*I);
490+ for (auto &i : pV->children )
491+ add_leafs_Dynamic (i);
498492 }
499493 return ;
500494 case MT_SKELETON_ANIM:
@@ -520,10 +514,8 @@ void CRender::add_leafs_Dynamic(dxRender_Visual* pVisual)
520514 {
521515 pV->CalculateBones (TRUE );
522516 pV->CalculateWallmarks (); // . bug?
523- I = pV->children .begin ();
524- E = pV->children .end ();
525- for (; I != E; I++)
526- add_leafs_Dynamic (*I);
517+ for (auto &i : pV->children )
518+ add_leafs_Dynamic (i);
527519 }
528520 }
529521 return ;
@@ -545,36 +537,30 @@ void CRender::add_leafs_Static(dxRender_Visual* pVisual)
545537 return ;
546538
547539 // Visual is 100% visible - simply add it
548- xr_vector<dxRender_Visual *>::iterator I, E; // it may be usefull for 'hierrarhy' visuals
549-
550540 switch (pVisual->Type )
551541 {
552542 case MT_PARTICLE_GROUP:
553543 {
554544 // Add all children, doesn't perform any tests
555545 PS::CParticleGroup* pG = (PS::CParticleGroup*)pVisual;
556- for (auto i_it = pG->items . begin (); i_it != pG-> items . end (); i_it++ )
546+ for (auto &it : pG->items )
557547 {
558- PS::CParticleGroup::SItem& I = *i_it ;
548+ PS::CParticleGroup::SItem& I = it ;
559549 if (I._effect )
560550 add_leafs_Dynamic (I._effect );
561- for (xr_vector<dxRender_Visual*>::iterator pit = I._children_related .begin ();
562- pit != I._children_related .end (); pit++)
563- add_leafs_Dynamic (*pit);
564- for (xr_vector<dxRender_Visual*>::iterator pit = I._children_free .begin (); pit != I._children_free .end ();
565- pit++)
566- add_leafs_Dynamic (*pit);
551+ for (auto &pit : I._children_related )
552+ add_leafs_Dynamic (pit);
553+ for (auto &pit : I._children_free )
554+ add_leafs_Dynamic (pit);
567555 }
568556 }
569557 return ;
570558 case MT_HIERRARHY:
571559 {
572560 // Add all children, doesn't perform any tests
573561 FHierrarhyVisual* pV = (FHierrarhyVisual*)pVisual;
574- I = pV->children .begin ();
575- E = pV->children .end ();
576- for (; I != E; I++)
577- add_leafs_Static (*I);
562+ for (auto &i : pV->children )
563+ add_leafs_Static (i);
578564 }
579565 return ;
580566 case MT_SKELETON_ANIM:
@@ -583,10 +569,8 @@ void CRender::add_leafs_Static(dxRender_Visual* pVisual)
583569 // Add all children, doesn't perform any tests
584570 CKinematics* pV = (CKinematics*)pVisual;
585571 pV->CalculateBones (TRUE );
586- I = pV->children .begin ();
587- E = pV->children .end ();
588- for (; I != E; I++)
589- add_leafs_Static (*I);
572+ for (auto &i : pV->children )
573+ add_leafs_Static (i);
590574 }
591575 return ;
592576 case MT_LOD:
@@ -610,10 +594,8 @@ void CRender::add_leafs_Static(dxRender_Visual* pVisual)
610594#endif
611595 {
612596 // Add all children, doesn't perform any tests
613- I = pV->children .begin ();
614- E = pV->children .end ();
615- for (; I != E; I++)
616- add_leafs_Static (*I);
597+ for (auto &i : pV->children )
598+ add_leafs_Static (i);
617599 }
618600 }
619601 return ;
@@ -648,38 +630,32 @@ BOOL CRender::add_Dynamic(dxRender_Visual* pVisual, u32 planes)
648630 return FALSE ;
649631
650632 // If we get here visual is visible or partially visible
651- xr_vector<dxRender_Visual *>::iterator I, E; // it may be usefull for 'hierrarhy' visuals
652-
653633 switch (pVisual->Type )
654634 {
655635 case MT_PARTICLE_GROUP:
656636 {
657637 // Add all children, doesn't perform any tests
658638 PS::CParticleGroup* pG = (PS::CParticleGroup*)pVisual;
659- for (auto i_it = pG->items . begin (); i_it != pG-> items . end (); i_it++ )
639+ for (auto &it : pG->items )
660640 {
661- PS::CParticleGroup::SItem& I = *i_it ;
641+ PS::CParticleGroup::SItem& I = it ;
662642 if (fcvPartial == VIS)
663643 {
664644 if (I._effect )
665645 add_Dynamic (I._effect , planes);
666- for (xr_vector<dxRender_Visual*>::iterator pit = I._children_related .begin ();
667- pit != I._children_related .end (); pit++)
668- add_Dynamic (*pit, planes);
669- for (xr_vector<dxRender_Visual*>::iterator pit = I._children_free .begin ();
670- pit != I._children_free .end (); pit++)
671- add_Dynamic (*pit, planes);
646+ for (auto &pit : I._children_related )
647+ add_Dynamic (pit, planes);
648+ for (auto &pit : I._children_free )
649+ add_Dynamic (pit, planes);
672650 }
673651 else
674652 {
675653 if (I._effect )
676654 add_leafs_Dynamic (I._effect );
677- for (xr_vector<dxRender_Visual*>::iterator pit = I._children_related .begin ();
678- pit != I._children_related .end (); pit++)
679- add_leafs_Dynamic (*pit);
680- for (xr_vector<dxRender_Visual*>::iterator pit = I._children_free .begin ();
681- pit != I._children_free .end (); pit++)
682- add_leafs_Dynamic (*pit);
655+ for (auto &pit : I._children_related )
656+ add_leafs_Dynamic (pit);
657+ for (auto &pit : I._children_free )
658+ add_leafs_Dynamic (pit);
683659 }
684660 }
685661 }
@@ -688,17 +664,15 @@ BOOL CRender::add_Dynamic(dxRender_Visual* pVisual, u32 planes)
688664 {
689665 // Add all children
690666 FHierrarhyVisual* pV = (FHierrarhyVisual*)pVisual;
691- I = pV->children .begin ();
692- E = pV->children .end ();
693667 if (fcvPartial == VIS)
694668 {
695- for (; I != E; I++ )
696- add_Dynamic (*I , planes);
669+ for (auto &i : pV-> children )
670+ add_Dynamic (i , planes);
697671 }
698672 else
699673 {
700- for (; I != E; I++ )
701- add_leafs_Dynamic (*I );
674+ for (auto &i : pV-> children )
675+ add_leafs_Dynamic (i );
702676 }
703677 }
704678 break ;
@@ -725,20 +699,9 @@ BOOL CRender::add_Dynamic(dxRender_Visual* pVisual, u32 planes)
725699 {
726700 pV->CalculateBones (TRUE );
727701 pV->CalculateWallmarks (); // . bug?
728- I = pV->children .begin ();
729- E = pV->children .end ();
730- for (; I != E; I++)
731- add_leafs_Dynamic (*I);
702+ for (auto &i : pV->children )
703+ add_leafs_Dynamic (i);
732704 }
733- /*
734- I = pV->children.begin ();
735- E = pV->children.end ();
736- if (fcvPartial==VIS) {
737- for (; I!=E; I++) add_Dynamic (*I,planes);
738- } else {
739- for (; I!=E; I++) add_leafs_Dynamic (*I);
740- }
741- */
742705 }
743706 break ;
744707 default :
@@ -764,38 +727,32 @@ void CRender::add_Static(dxRender_Visual* pVisual, u32 planes)
764727 return ;
765728
766729 // If we get here visual is visible or partially visible
767- xr_vector<dxRender_Visual *>::iterator I, E; // it may be usefull for 'hierrarhy' visuals
768-
769730 switch (pVisual->Type )
770731 {
771732 case MT_PARTICLE_GROUP:
772733 {
773734 // Add all children, doesn't perform any tests
774735 PS::CParticleGroup* pG = (PS::CParticleGroup*)pVisual;
775- for (auto i_it = pG->items . begin (); i_it != pG-> items . end (); i_it++ )
736+ for (auto &it : pG->items )
776737 {
777- PS::CParticleGroup::SItem& I = *i_it ;
738+ PS::CParticleGroup::SItem& I = it ;
778739 if (fcvPartial == VIS)
779740 {
780741 if (I._effect )
781742 add_Dynamic (I._effect , planes);
782- for (xr_vector<dxRender_Visual*>::iterator pit = I._children_related .begin ();
783- pit != I._children_related .end (); pit++)
784- add_Dynamic (*pit, planes);
785- for (xr_vector<dxRender_Visual*>::iterator pit = I._children_free .begin ();
786- pit != I._children_free .end (); pit++)
787- add_Dynamic (*pit, planes);
743+ for (auto &pit : I._children_related )
744+ add_Dynamic (pit, planes);
745+ for (auto &pit : I._children_free )
746+ add_Dynamic (pit, planes);
788747 }
789748 else
790749 {
791750 if (I._effect )
792751 add_leafs_Dynamic (I._effect );
793- for (xr_vector<dxRender_Visual*>::iterator pit = I._children_related .begin ();
794- pit != I._children_related .end (); pit++)
795- add_leafs_Dynamic (*pit);
796- for (xr_vector<dxRender_Visual*>::iterator pit = I._children_free .begin ();
797- pit != I._children_free .end (); pit++)
798- add_leafs_Dynamic (*pit);
752+ for (auto &pit : I._children_related )
753+ add_leafs_Dynamic (pit);
754+ for (auto &pit : I._children_free )
755+ add_leafs_Dynamic (pit);
799756 }
800757 }
801758 }
@@ -804,17 +761,15 @@ void CRender::add_Static(dxRender_Visual* pVisual, u32 planes)
804761 {
805762 // Add all children
806763 FHierrarhyVisual* pV = (FHierrarhyVisual*)pVisual;
807- I = pV->children .begin ();
808- E = pV->children .end ();
809764 if (fcvPartial == VIS)
810765 {
811- for (; I != E; I++ )
812- add_Static (*I , planes);
766+ for (auto &i : pV-> children )
767+ add_Static (i , planes);
813768 }
814769 else
815770 {
816- for (; I != E; I++ )
817- add_leafs_Static (*I );
771+ for (auto &i : pV-> children )
772+ add_leafs_Static (i );
818773 }
819774 }
820775 break ;
@@ -824,17 +779,15 @@ void CRender::add_Static(dxRender_Visual* pVisual, u32 planes)
824779 // Add all children, doesn't perform any tests
825780 CKinematics* pV = (CKinematics*)pVisual;
826781 pV->CalculateBones (TRUE );
827- I = pV->children .begin ();
828- E = pV->children .end ();
829782 if (fcvPartial == VIS)
830783 {
831- for (; I != E; I++ )
832- add_Static (*I , planes);
784+ for (auto &i : pV-> children )
785+ add_Static (i , planes);
833786 }
834787 else
835788 {
836- for (; I != E; I++ )
837- add_leafs_Static (*I );
789+ for (auto &i : pV-> children )
790+ add_leafs_Static (i );
838791 }
839792 }
840793 break ;
@@ -859,10 +812,8 @@ void CRender::add_Static(dxRender_Visual* pVisual, u32 planes)
859812#endif
860813 {
861814 // Add all children, perform tests
862- I = pV->children .begin ();
863- E = pV->children .end ();
864- for (; I != E; I++)
865- add_leafs_Static (*I);
815+ for (auto &i : pV->children )
816+ add_leafs_Static (i);
866817 }
867818 }
868819 break ;
0 commit comments