Don't allow whitespace player names, closes #840
parent
6e4764b97c
commit
856ee9a0fe
|
@ -133,7 +133,7 @@ std::string CPlayerProfile::GetLastName()
|
||||||
{
|
{
|
||||||
std::string name;
|
std::string name;
|
||||||
|
|
||||||
if(!GetConfigFile().GetStringProperty("Gamer", "LastName", name))
|
if(!GetConfigFile().GetStringProperty("Gamer", "LastName", name) || name.empty())
|
||||||
GetResource(RES_TEXT, RT_NAME_DEFAULT, name);
|
GetResource(RES_TEXT, RT_NAME_DEFAULT, name);
|
||||||
|
|
||||||
return name;
|
return name;
|
||||||
|
|
|
@ -40,6 +40,8 @@
|
||||||
#include "ui/controls/list.h"
|
#include "ui/controls/list.h"
|
||||||
#include "ui/controls/window.h"
|
#include "ui/controls/window.h"
|
||||||
|
|
||||||
|
#include <boost/algorithm/string/trim.hpp>
|
||||||
|
|
||||||
namespace Ui
|
namespace Ui
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -245,6 +247,7 @@ void CScreenPlayerSelect::UpdateNameControl()
|
||||||
total = pl->GetTotal();
|
total = pl->GetTotal();
|
||||||
sel = pl->GetSelect();
|
sel = pl->GetSelect();
|
||||||
name = pe->GetText(100);
|
name = pe->GetText(100);
|
||||||
|
boost::trim(name);
|
||||||
|
|
||||||
pb = static_cast<CButton*>(pw->SearchControl(EVENT_INTERFACE_NDELETE));
|
pb = static_cast<CButton*>(pw->SearchControl(EVENT_INTERFACE_NDELETE));
|
||||||
if ( pb != nullptr )
|
if ( pb != nullptr )
|
||||||
|
@ -379,6 +382,7 @@ bool CScreenPlayerSelect::NameCreate()
|
||||||
|
|
||||||
std::string name;
|
std::string name;
|
||||||
name = pe->GetText(100);
|
name = pe->GetText(100);
|
||||||
|
boost::trim(name);
|
||||||
if ( name.empty() )
|
if ( name.empty() )
|
||||||
{
|
{
|
||||||
m_sound->Play(SOUND_TZOING);
|
m_sound->Play(SOUND_TZOING);
|
||||||
|
|
Loading…
Reference in New Issue