Fix #621 (trimming of spaces in name)

Entered names are trimmed before checking for duplicates and the trimmed
version is the one that gets saved.


git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@11167 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
wardje 2012-04-26 22:16:05 +00:00
parent 803b0acfe7
commit a4ba8d2162
2 changed files with 56 additions and 56 deletions

View File

@ -98,7 +98,7 @@ void EnterPlayerNameDialog::onEnterPressedInternal()
// ---- Otherwise, accept entered name
TextBoxWidget* textCtrl = getWidget<TextBoxWidget>("textfield");
stringw playerName = textCtrl->getText();
stringw playerName = textCtrl->getText().trim();
const int size = playerName.size();
// sanity check
@ -148,7 +148,7 @@ void EnterPlayerNameDialog::onUpdate(float dt)
if (m_self_destroy)
{
TextBoxWidget* textCtrl = getWidget<TextBoxWidget>("textfield");
stringw playerName = textCtrl->getText();
stringw playerName = textCtrl->getText().trim();
// irrLicht is too stupid to remove focus from deleted widgets
// so do it by hand

View File

@ -225,7 +225,7 @@ GUIEngine::EventPropagation PlayerInfoDialog::processEvent(const std::string& ev
if (eventSource == "renameplayer")
{
// accept entered name
stringw playerName = textCtrl->getText();
stringw playerName = textCtrl->getText().trim();
const int playerAmount = UserConfigParams::m_all_players.size();
for(int n=0; n<playerAmount; n++)