Minor loop simplification.

This commit is contained in:
Glenn Maynard
2002-08-20 07:08:54 +00:00
parent 2e78a4d08f
commit 8b7b267dbe
+5 -6
View File
@@ -208,14 +208,15 @@ ScreenSelectGroup::ScreenSelectGroup()
for( int r=0; r<TITLES_ROWS; r++ ) // foreach row for( int r=0; r<TITLES_ROWS; r++ ) // foreach row
{ {
int iIndex = c*TITLES_ROWS + r; int iIndex = c*TITLES_ROWS + r;
if( iIndex < aSongs.GetSize() ) if( iIndex >= aSongs.GetSize() )
{ continue;
if( c == TITLES_COLUMNS-1 && r == TITLES_ROWS-1 ) if( c == TITLES_COLUMNS-1 && r == TITLES_ROWS-1 )
{ {
sText += ssprintf( "%d more.....", aSongs.GetSize() - TITLES_COLUMNS * TITLES_ROWS - 1 ); sText += ssprintf( "%d more.....", aSongs.GetSize() - TITLES_COLUMNS * TITLES_ROWS - 1 );
continue;
} }
else
{
CString sTitle = aSongs[iIndex]->GetFullTitle(); CString sTitle = aSongs[iIndex]->GetFullTitle();
// TODO: Move this crop threshold into a theme metric or make automatic based on column width // TODO: Move this crop threshold into a theme metric or make automatic based on column width
if( sTitle.GetLength() > 40 ) if( sTitle.GetLength() > 40 )
@@ -225,8 +226,6 @@ ScreenSelectGroup::ScreenSelectGroup()
} }
sText += sTitle + "\n"; sText += sTitle + "\n";
} }
}
}
m_sContentsText[i][c] = sText; m_sContentsText[i][c] = sText;
} }
} }