merge duplicate code

This commit is contained in:
Glenn Maynard
2003-11-08 02:46:12 +00:00
parent 555d12b49e
commit f810930dab
2 changed files with 13 additions and 21 deletions
+12 -21
View File
@@ -232,16 +232,7 @@ void ScreenOptions::Init( InputMode im, OptionRow OptionRows[], int iNumOptionLi
// poke once at all the explanation metrics so that we catch missing ones early
for( r=0; r<m_iNumOptionRows; r++ ) // foreach line
{
CString sLineName = m_OptionRow[r].name;
if( sLineName=="" )
sLineName = m_OptionRow[r].choices[0];
sLineName.Replace("\n-","");
sLineName.Replace("\n","");
sLineName.Replace(" ","");
CString sExplanation = THEME->GetMetric(m_sName,sLineName);
}
GetExplanationText( r );
CHECKPOINT;
@@ -287,6 +278,16 @@ ScreenOptions::~ScreenOptions()
delete m_textItems[i][j];
}
CString ScreenOptions::GetExplanationText( int row ) const
{
CString sLineName = m_OptionRow[row].name;
if( sLineName=="" )
sLineName = m_OptionRow[row].choices[0];
sLineName.Replace("\n-","");
sLineName.Replace("\n","");
sLineName.Replace(" ","");
return THEME->GetMetric( m_sName,sLineName );
}
BitmapText &ScreenOptions::GetTextItemForRow( PlayerNumber pn, int iRow )
{
@@ -753,19 +754,9 @@ void ScreenOptions::OnChange( PlayerNumber pn )
}
if( bIsExitRow )
{
pText->SetText( "" );
}
else
{
CString sLineName = m_OptionRow[iCurRow].name;
if( sLineName=="" )
sLineName = m_OptionRow[iCurRow].choices[0];
sLineName.Replace("\n-","");
sLineName.Replace("\n","");
sLineName.Replace(" ","");
pText->SetText( THEME->GetMetric(m_sName,sLineName) );
}
pText->SetText( GetExplanationText(iCurRow) );
}