@@ -577,7 +577,7 @@ END_PREDICTION_DATA()
577
577
void SpewInterpolatedVar( CInterpolatedVar< Vector > *pVar )
578
578
{
579
579
Msg ( " --------------------------------------------------\n " );
580
- int i = pVar->GetHead ();
580
+ intp i = pVar->GetHead ();
581
581
Vector v0 (0 , 0 , 0 );
582
582
CApparentVelocity<Vector> apparent (v0);
583
583
float prevtime = 0 .0f ;
@@ -601,7 +601,7 @@ void SpewInterpolatedVar( CInterpolatedVar< Vector > *pVar, float flNow, float f
601
601
float target = flNow - flInterpAmount;
602
602
603
603
Msg ( " --------------------------------------------------\n " );
604
- int i = pVar->GetHead ();
604
+ intp i = pVar->GetHead ();
605
605
Vector v0 (0 , 0 , 0 );
606
606
CApparentVelocity<Vector> apparent (v0);
607
607
float newtime = 999999 .0f ;
@@ -631,8 +631,7 @@ void SpewInterpolatedVar( CInterpolatedVar< Vector > *pVar, float flNow, float f
631
631
else
632
632
{
633
633
bSpew = true ;
634
- int savei = i;
635
- i = pVar->GetNext ( i );
634
+ intp savei = std::exchange (i, pVar->GetNext ( i ));
636
635
float oldtertime = 0 .0f ;
637
636
pVar->GetHistoryValue ( i, oldtertime );
638
637
@@ -670,7 +669,7 @@ void SpewInterpolatedVar( CInterpolatedVar< Vector > *pVar, float flNow, float f
670
669
void SpewInterpolatedVar ( CInterpolatedVar< float > *pVar )
671
670
{
672
671
Msg ( " --------------------------------------------------\n " );
673
- int i = pVar->GetHead ();
672
+ intp i = pVar->GetHead ();
674
673
CApparentVelocity<float > apparent (0 .0f );
675
674
while ( 1 )
676
675
{
@@ -692,7 +691,7 @@ void GetInterpolatedVarTimeRange( CInterpolatedVar<T> *pVar, float &flMin, float
692
691
flMin = 1e23 ;
693
692
flMax = -1e23 ;
694
693
695
- int i = pVar->GetHead ();
694
+ intp i = pVar->GetHead ();
696
695
Vector v0 (0 , 0 , 0 );
697
696
CApparentVelocity<Vector> apparent (v0);
698
697
while ( 1 )
@@ -802,13 +801,11 @@ void C_BaseEntity::Interp_SetupMappings( VarMapping_t *map )
802
801
if ( !map )
803
802
return ;
804
803
805
- int c = map->m_Entries .Count ();
806
- for ( int i = 0 ; i < c; i++ )
804
+ for ( auto &e : map->m_Entries )
807
805
{
808
- VarMapEntry_t *e = &map->m_Entries [ i ];
809
- IInterpolatedVar *watcher = e->watcher ;
810
- void *data = e->data ;
811
- int type = e->type ;
806
+ IInterpolatedVar *watcher = e.watcher ;
807
+ void *data = e.data ;
808
+ int type = e.type ;
812
809
813
810
watcher->Setup ( data, type );
814
811
watcher->SetInterpolationAmount ( GetInterpolationAmount ( watcher->GetType () ) );
@@ -825,11 +822,9 @@ void C_BaseEntity::Interp_RestoreToLastNetworked( VarMapping_t *map )
825
822
QAngle oldAngles = GetLocalAngles ();
826
823
Vector oldVel = GetLocalVelocity ();
827
824
828
- int c = map->m_Entries .Count ();
829
- for ( int i = 0 ; i < c; i++ )
825
+ for ( auto &e : map->m_Entries )
830
826
{
831
- VarMapEntry_t *e = &map->m_Entries [ i ];
832
- IInterpolatedVar *watcher = e->watcher ;
827
+ IInterpolatedVar *watcher = e.watcher ;
833
828
watcher->RestoreToLastNetworked ();
834
829
}
835
830
@@ -841,11 +836,9 @@ void C_BaseEntity::Interp_UpdateInterpolationAmounts( VarMapping_t *map )
841
836
if ( !map )
842
837
return ;
843
838
844
- int c = map->m_Entries .Count ();
845
- for ( int i = 0 ; i < c; i++ )
839
+ for ( auto &e : map->m_Entries )
846
840
{
847
- VarMapEntry_t *e = &map->m_Entries [ i ];
848
- IInterpolatedVar *watcher = e->watcher ;
841
+ IInterpolatedVar *watcher = e.watcher ;
849
842
watcher->SetInterpolationAmount ( GetInterpolationAmount ( watcher->GetType () ) );
850
843
}
851
844
}
@@ -2272,11 +2265,8 @@ void C_BaseEntity::MarkAimEntsDirty()
2272
2265
// will cause the aim-ent's (and all its children's) dirty state to be correctly updated.
2273
2266
//
2274
2267
// Then we will iterate over the loop a second time and call CalcAbsPosition on them,
2275
- int i;
2276
- int c = g_AimEntsList.Count ();
2277
- for ( i = 0 ; i < c; ++i )
2268
+ for ( auto *pEnt : g_AimEntsList )
2278
2269
{
2279
- C_BaseEntity *pEnt = g_AimEntsList[ i ];
2280
2270
Assert ( pEnt && pEnt->GetMoveParent () );
2281
2271
if ( pEnt->IsEffectActive (EF_BONEMERGE | EF_PARENT_ANIMATES) )
2282
2272
{
@@ -2289,11 +2279,8 @@ void C_BaseEntity::MarkAimEntsDirty()
2289
2279
void C_BaseEntity::CalcAimEntPositions ()
2290
2280
{
2291
2281
VPROF (" CalcAimEntPositions" );
2292
- int i;
2293
- int c = g_AimEntsList.Count ();
2294
- for ( i = 0 ; i < c; ++i )
2282
+ for ( auto *pEnt : g_AimEntsList )
2295
2283
{
2296
- C_BaseEntity *pEnt = g_AimEntsList[ i ];
2297
2284
Assert ( pEnt );
2298
2285
Assert ( pEnt->GetMoveParent () );
2299
2286
if ( pEnt->IsEffectActive (EF_BONEMERGE) )
@@ -5860,11 +5847,9 @@ void C_BaseEntity::EstimateAbsVelocity( Vector& vel )
5860
5847
void C_BaseEntity::Interp_Reset ( VarMapping_t *map )
5861
5848
{
5862
5849
PREDICTION_TRACKVALUECHANGESCOPE_ENTITY ( this , " reset" );
5863
- int c = map->m_Entries .Count ();
5864
- for ( int i = 0 ; i < c; i++ )
5850
+ for ( auto &e : map->m_Entries )
5865
5851
{
5866
- VarMapEntry_t *e = &map->m_Entries [ i ];
5867
- IInterpolatedVar *watcher = e->watcher ;
5852
+ IInterpolatedVar *watcher = e.watcher ;
5868
5853
5869
5854
watcher->Reset ();
5870
5855
}
0 commit comments