merge duplicate code
This commit is contained in:
@@ -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
|
// poke once at all the explanation metrics so that we catch missing ones early
|
||||||
for( r=0; r<m_iNumOptionRows; r++ ) // foreach line
|
for( r=0; r<m_iNumOptionRows; r++ ) // foreach line
|
||||||
{
|
GetExplanationText( r );
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
CHECKPOINT;
|
CHECKPOINT;
|
||||||
|
|
||||||
@@ -287,6 +278,16 @@ ScreenOptions::~ScreenOptions()
|
|||||||
delete m_textItems[i][j];
|
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 )
|
BitmapText &ScreenOptions::GetTextItemForRow( PlayerNumber pn, int iRow )
|
||||||
{
|
{
|
||||||
@@ -753,19 +754,9 @@ void ScreenOptions::OnChange( PlayerNumber pn )
|
|||||||
}
|
}
|
||||||
|
|
||||||
if( bIsExitRow )
|
if( bIsExitRow )
|
||||||
{
|
|
||||||
pText->SetText( "" );
|
pText->SetText( "" );
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
pText->SetText( GetExplanationText(iCurRow) );
|
||||||
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) );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ protected:
|
|||||||
virtual void ExportOptions() = 0;
|
virtual void ExportOptions() = 0;
|
||||||
void InitOptionsText();
|
void InitOptionsText();
|
||||||
void GetWidthXY( PlayerNumber pn, int iRow, int &iWidthOut, int &iXOut, int &iYOut );
|
void GetWidthXY( PlayerNumber pn, int iRow, int &iWidthOut, int &iXOut, int &iYOut );
|
||||||
|
CString GetExplanationText( int row ) const;
|
||||||
BitmapText &GetTextItemForRow( PlayerNumber pn, int iRow );
|
BitmapText &GetTextItemForRow( PlayerNumber pn, int iRow );
|
||||||
void PositionUnderlines();
|
void PositionUnderlines();
|
||||||
void PositionIcons();
|
void PositionIcons();
|
||||||
|
|||||||
Reference in New Issue
Block a user