Minor loop simplification.

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