honor m_sLastUsedHighScoreName
This commit is contained in:
@@ -195,11 +195,25 @@ ScreenNameEntryTraditional::ScreenNameEntryTraditional( CString sClassName ) : S
|
|||||||
m_textSelection[p].LoadFromFont( THEME->GetPathToF("ScreenNameEntryTraditional entry") );
|
m_textSelection[p].LoadFromFont( THEME->GetPathToF("ScreenNameEntryTraditional entry") );
|
||||||
SET_XY_AND_ON_COMMAND( m_textSelection[p] );
|
SET_XY_AND_ON_COMMAND( m_textSelection[p] );
|
||||||
this->AddChild( &m_textSelection[p] );
|
this->AddChild( &m_textSelection[p] );
|
||||||
UpdateSelectionText( p );
|
|
||||||
|
|
||||||
m_SelectedChar[p] = 0;
|
m_SelectedChar[p] = 0;
|
||||||
|
|
||||||
PositionCharsAndCursor( p );
|
PositionCharsAndCursor( p );
|
||||||
|
|
||||||
|
// load last used ranking name if any
|
||||||
|
const Profile* pProfile = PROFILEMAN->GetProfile((PlayerNumber)p);
|
||||||
|
if( pProfile && !pProfile->m_sLastUsedHighScoreName.empty() )
|
||||||
|
{
|
||||||
|
m_sSelection[p] = CStringToWstring( pProfile->m_sLastUsedHighScoreName );
|
||||||
|
if( (int) m_sSelection[p].size() > MAX_RANKING_NAME_LENGTH )
|
||||||
|
m_sSelection[p].erase( MAX_RANKING_NAME_LENGTH );
|
||||||
|
ASSERT( (int) m_sSelection[p].size() <= MAX_RANKING_NAME_LENGTH );
|
||||||
|
if( m_sSelection[p].size() )
|
||||||
|
SelectChar( (PlayerNumber) p, CHAR_OK );
|
||||||
|
}
|
||||||
|
|
||||||
|
UpdateSelectionText( p );
|
||||||
|
|
||||||
|
/* Don't tween to the initial position. */
|
||||||
unsigned i;
|
unsigned i;
|
||||||
for( i = 0; i < m_textAlphabet[p].size(); ++i )
|
for( i = 0; i < m_textAlphabet[p].size(); ++i )
|
||||||
m_textAlphabet[p][i]->FinishTweening();
|
m_textAlphabet[p][i]->FinishTweening();
|
||||||
@@ -482,16 +496,19 @@ void ScreenNameEntryTraditional::MenuStart( PlayerNumber pn, const InputEventTyp
|
|||||||
|
|
||||||
/* If that filled the string, set the cursor on OK. */
|
/* If that filled the string, set the cursor on OK. */
|
||||||
if( (int) m_sSelection[pn].size() == MAX_RANKING_NAME_LENGTH )
|
if( (int) m_sSelection[pn].size() == MAX_RANKING_NAME_LENGTH )
|
||||||
{
|
SelectChar( pn, CHAR_OK );
|
||||||
m_SelectedChar[pn] = 0;
|
|
||||||
while( m_AlphabetLetter[pn][m_SelectedChar[pn]] != CHAR_OK )
|
|
||||||
++m_SelectedChar[pn];
|
|
||||||
ASSERT( m_AlphabetLetter[pn][m_SelectedChar[pn]] == CHAR_OK );
|
|
||||||
PositionCharsAndCursor( pn );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ScreenNameEntryTraditional::SelectChar( PlayerNumber pn, int c )
|
||||||
|
{
|
||||||
|
m_SelectedChar[pn] = 0;
|
||||||
|
while( m_AlphabetLetter[pn][m_SelectedChar[pn]] != CHAR_OK )
|
||||||
|
++m_SelectedChar[pn];
|
||||||
|
ASSERT( m_AlphabetLetter[pn][m_SelectedChar[pn]] == CHAR_OK );
|
||||||
|
PositionCharsAndCursor( pn );
|
||||||
|
}
|
||||||
|
|
||||||
void ScreenNameEntryTraditional::MenuLeft( PlayerNumber pn, const InputEventType type )
|
void ScreenNameEntryTraditional::MenuLeft( PlayerNumber pn, const InputEventType type )
|
||||||
{
|
{
|
||||||
if( !m_bStillEnteringName[pn] || m_Menu.IsTransitioning() )
|
if( !m_bStillEnteringName[pn] || m_Menu.IsTransitioning() )
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ private:
|
|||||||
void Finish( PlayerNumber pn );
|
void Finish( PlayerNumber pn );
|
||||||
void UpdateSelectionText( int pn );
|
void UpdateSelectionText( int pn );
|
||||||
void ChangeDisplayedFeat();
|
void ChangeDisplayedFeat();
|
||||||
|
void SelectChar( PlayerNumber pn, int c );
|
||||||
|
|
||||||
int m_NumFeats[NUM_PLAYERS], m_CurFeat[NUM_PLAYERS];
|
int m_NumFeats[NUM_PLAYERS], m_CurFeat[NUM_PLAYERS];
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user