@@ -14,7 +14,7 @@ extern int psSkeletonUpdate;
1414using namespace animation ;
1515// ////////////////////////////////////////////////////////////////////////
1616// BoneInstance methods
17- void CBlendInstance::construct () { ZeroMemory ( this , sizeof (* this ) ); }
17+ void CBlendInstance::construct () { Blend. clear ( ); }
1818void CBlendInstance::blend_add (CBlend* H)
1919{
2020 if (Blend.size () == MAX_BLENDED)
@@ -41,14 +41,14 @@ void CBlendInstance::blend_remove(CBlend* H)
4141void CKinematicsAnimated::Bone_Motion_Start (CBoneData* bd, CBlend* handle)
4242{
4343 LL_GetBlendInstance (bd->GetSelfID ()).blend_add (handle);
44- for (vecBonesIt I = bd->children . begin (); I != bd-> children . end (); I++ )
45- Bone_Motion_Start (*I , handle);
44+ for (auto &it : bd->children )
45+ Bone_Motion_Start (it , handle);
4646}
4747void CKinematicsAnimated::Bone_Motion_Stop (CBoneData* bd, CBlend* handle)
4848{
4949 LL_GetBlendInstance (bd->GetSelfID ()).blend_remove (handle);
50- for (vecBonesIt I = bd->children . begin (); I != bd-> children . end (); I++ )
51- Bone_Motion_Stop (*I , handle);
50+ for (auto &it : bd->children )
51+ Bone_Motion_Stop (it , handle);
5252}
5353void CKinematicsAnimated::Bone_Motion_Start_IM (CBoneData* bd, CBlend* handle)
5454{
@@ -64,10 +64,9 @@ void CKinematicsAnimated::Bone_Motion_Stop_IM(CBoneData* bd, CBlend* handle)
6464std::pair<LPCSTR, LPCSTR> CKinematicsAnimated::LL_MotionDefName_dbg (MotionID ID)
6565{
6666 shared_motions& s_mots = m_Motions[ID.slot ].motions ;
67- accel_map::iterator _I, _E = s_mots.motion_map ()->end ();
68- for (_I = s_mots.motion_map ()->begin (); _I != _E; ++_I)
69- if (_I->second == ID.idx )
70- return std::make_pair (*_I->first , *s_mots.id ());
67+ for (auto &it : *s_mots.motion_map ())
68+ if (it.second == ID.idx )
69+ return std::make_pair (*it.first , *s_mots.id ());
7170 return std::make_pair ((LPCSTR)nullptr , (LPCSTR)nullptr );
7271}
7372
@@ -110,9 +109,8 @@ static void dump_blend(CKinematicsAnimated* K, CBlend& B, u32 index)
110109void CKinematicsAnimated::LL_DumpBlends_dbg ()
111110{
112111 Msg (" ==================dump blends=================================================" );
113- CBlend *I = blend_pool.begin (), *E = blend_pool.end ();
114- for (; I != E; I++)
115- dump_blend (this , *I, u32 (I - blend_pool.begin ()));
112+ for (auto &it : blend_pool)
113+ dump_blend (this , it, u32 (&it - blend_pool.begin ()));
116114}
117115
118116#endif
@@ -126,10 +124,9 @@ CBlend* CKinematicsAnimated::LL_PartBlend(u32 bone_part_id, u32 n)
126124}
127125void CKinematicsAnimated::LL_IterateBlends (IterateBlendsCallback& callback)
128126{
129- CBlend *I = blend_pool.begin (), *E = blend_pool.end ();
130- for (; I != E; I++)
131- if (I->blend_state () != CBlend::eFREE_SLOT)
132- callback (*I);
127+ for (auto &it : blend_pool)
128+ if (it.blend_state () != CBlend::eFREE_SLOT)
129+ callback (it);
133130}
134131/*
135132LPCSTR CKinematicsAnimated::LL_MotionDefName_dbg (LPVOID ptr)
@@ -705,10 +702,9 @@ CBlend* CKinematicsAnimated::IBlend_Create()
705702{
706703 UpdateTracks ();
707704 _DBG_SINGLE_USE_MARKER;
708- CBlend *I = blend_pool.begin (), *E = blend_pool.end ();
709- for (; I != E; I++)
710- if (I->blend_state () == CBlend::eFREE_SLOT)
711- return I;
705+ for (auto &it : blend_pool)
706+ if (it.blend_state () == CBlend::eFREE_SLOT)
707+ return ⁢
712708 FATAL (" Too many blended motions requisted" );
713709 return nullptr ;
714710}
@@ -819,9 +815,9 @@ void CKinematicsAnimated::Load(const char* N, IReader* data, u32 dwFlags)
819815 m_Partition->load (this , N);
820816
821817 // initialize motions
822- for (auto m_it = m_Motions. begin (); m_it != m_Motions. end (); m_it++ )
818+ for (auto & m_it : m_Motions)
823819 {
824- SMotionsSlot& MS = * m_it;
820+ SMotionsSlot& MS = m_it;
825821 MS.bone_motions .resize (bones->size ());
826822 for (u32 i = 0 ; i < bones->size (); i++)
827823 {
@@ -843,10 +839,10 @@ void CKinematicsAnimated::LL_BuldBoneMatrixDequatize(const CBoneData* bd, u8 cha
843839 CBlendInstance& BLEND_INST = LL_GetBlendInstance (SelfID);
844840 const CBlendInstance::BlendSVec& Blend = BLEND_INST.blend_vector ();
845841 CKey BK[MAX_CHANNELS][MAX_BLENDED]; // base keys
846- BlendSVecCIt BI;
847- for (BI = Blend. begin (); BI != Blend. end (); BI++ )
842+
843+ for (auto &it : Blend)
848844 {
849- CBlend* B = *BI ;
845+ CBlend* B = it ;
850846 int & b_count = keys.chanel_blend_conts [B->channel ];
851847 CKey* D = &keys.keys [B->channel ][b_count];
852848 if (!(channel_mask & (1 << B->channel )))
0 commit comments