Skip to content

Commit d0141f3

Browse files
committed
game/client: Use correct types for loop indexes
1 parent 95594dc commit d0141f3

File tree

5 files changed

+14
-12
lines changed

5 files changed

+14
-12
lines changed

game/client/c_baseflex.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1822,7 +1822,7 @@ int C_BaseFlex::FlexControllerLocalToGlobal( const flexsettinghdr_t *pSettinghdr
18221822
{
18231823
FS_LocalToGlobal_t entry( pSettinghdr );
18241824

1825-
int idx = m_LocalToGlobal.Find( entry );
1825+
auto idx = m_LocalToGlobal.Find( entry );
18261826
if ( idx == m_LocalToGlobal.InvalidIndex() )
18271827
{
18281828
// This should never happen!!!

game/client/c_func_breakablesurf.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,11 @@ class C_BreakableSurface : public C_BaseEntity, public IBrushRenderer
145145

146146
void DrawRenderList( IBrushSurface* pBrushSurface);
147147
void DrawRenderListHighlights( IBrushSurface* pBrushSurface );
148-
int FindRenderPanel(int nWidth, int nHeight, WinSide_t nSide);
148+
// dimhotepus: int -> unsigned short.
149+
unsigned short FindRenderPanel(int nWidth, int nHeight, WinSide_t nSide);
149150
void AddToRenderList(int nWidth, int nHeight, WinSide_t nSide, WinEdge_t nEdgeType, int forceStyle);
150-
int FindFirstRenderTexture(WinEdge_t nEdgeType, int nStyle);
151+
// dimhotepus: int -> unsigned short.
152+
unsigned short FindFirstRenderTexture(WinEdge_t nEdgeType, int nStyle);
151153

152154
inline void SetStyleType( int w, int h, int type )
153155
{
@@ -809,9 +811,9 @@ void C_BreakableSurface::UpdateEdgeType(int nWidth, int nHeight, int forceStyle
809811
// Input :
810812
// Output :
811813
//--------------------------------------------------------------------------------
812-
int C_BreakableSurface::FindRenderPanel(int nWidth, int nHeight, WinSide_t nWinSide)
814+
unsigned short C_BreakableSurface::FindRenderPanel(int nWidth, int nHeight, WinSide_t nWinSide)
813815
{
814-
for( unsigned short i = m_RenderList.Head(); i != m_RenderList.InvalidIndex(); i = m_RenderList.Next(i) )
816+
for( auto i = m_RenderList.Head(); i != m_RenderList.InvalidIndex(); i = m_RenderList.Next(i) )
815817
{
816818
if (m_RenderList[i].m_nSide == nWinSide &&
817819
m_RenderList[i].m_nWidth == nWidth &&
@@ -828,9 +830,9 @@ int C_BreakableSurface::FindRenderPanel(int nWidth, int nHeight, WinSide_t nWinS
828830
// Input :
829831
// Output :
830832
//----------------------------------------------------------------------------------
831-
int C_BreakableSurface::FindFirstRenderTexture(WinEdge_t nEdgeType, int nStyle)
833+
unsigned short C_BreakableSurface::FindFirstRenderTexture(WinEdge_t nEdgeType, int nStyle)
832834
{
833-
for( unsigned short i = m_RenderList.Head(); i != m_RenderList.InvalidIndex(); i = m_RenderList.Next(i) )
835+
for( auto i = m_RenderList.Head(); i != m_RenderList.InvalidIndex(); i = m_RenderList.Next(i) )
834836
{
835837
if (m_RenderList[i].m_nStyle == nStyle &&
836838
m_RenderList[i].m_nEdgeType == nEdgeType )
@@ -850,7 +852,7 @@ void C_BreakableSurface::AddToRenderList(int nWidth, int nHeight, WinSide_t nSid
850852
{
851853
// -----------------------------------------------------
852854
// Try to find old panel
853-
int nOldPanelIndex = FindRenderPanel(nWidth,nHeight,nSide);
855+
unsigned short nOldPanelIndex = FindRenderPanel(nWidth,nHeight,nSide);
854856

855857
// -----------------------------------------------------
856858
// If I have an old panel, get it's style and remove it

game/client/hud_closecaption.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2858,7 +2858,7 @@ void CHudCloseCaption::FindSound( char const *pchANSI )
28582858
Msg( "found '%s' in %s\n", streamANSI, fn );
28592859

28602860
// Now find the sounds that will hash to this
2861-
for ( int k = soundemitterbase->First(); k != soundemitterbase->InvalidIndex(); k = soundemitterbase->Next( k ) )
2861+
for ( auto k = soundemitterbase->First(); k != soundemitterbase->InvalidIndex(); k = soundemitterbase->Next( k ) )
28622862
{
28632863
char const *pchSoundName = soundemitterbase->GetSoundName( k );
28642864

game/client/hud_lcd.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -616,8 +616,8 @@ void CLCD::ShowItems_R( CLCDPage *page, unsigned int dwCurTime, CUtlVector< CLCD
616616

617617
void CLCD::DisplayCurrentPage( unsigned int dwCurTime )
618618
{
619-
int pageCount = m_Pages.Count();
620-
for ( int i = 0; i < pageCount; ++i )
619+
intp pageCount = m_Pages.Count();
620+
for ( intp i = 0; i < pageCount; ++i )
621621
{
622622
bool bShowItems = ( i == m_nCurrentPage ) ? true : false;
623623

game/client/viewpostprocess.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1094,7 +1094,7 @@ static void SetToneMapScale(IMatRenderContext *pRenderContext, float newvalue, f
10941094
else
10951095
{
10961096
// scroll, losing oldest
1097-
for( ptrdiff_t i = 0;i < ssize( s_MovingAverageToneMapScale ) - 1;i ++ )
1097+
for( intp i = 0;i < ssize( s_MovingAverageToneMapScale ) - 1;i ++ )
10981098
s_MovingAverageToneMapScale[i] = s_MovingAverageToneMapScale[i + 1];
10991099
s_MovingAverageToneMapScale[std::size( s_MovingAverageToneMapScale ) - 1]= newvalue;
11001100
}

0 commit comments

Comments
 (0)