Removed cancel button from player selection screen

Not really needed, and it had a bug with removing players (it would still go back to the deleted player)
master
krzys-h 2015-09-01 16:29:58 +02:00
parent 6f38ec1911
commit 78e4e440b5
4 changed files with 1 additions and 34 deletions

View File

@ -250,7 +250,6 @@ void InitializeEventTypeTexts()
EVENT_TYPE_TEXT[EVENT_INTERFACE_NEDIT] = "EVENT_INTERFACE_NEDIT";
EVENT_TYPE_TEXT[EVENT_INTERFACE_NLIST] = "EVENT_INTERFACE_NLIST";
EVENT_TYPE_TEXT[EVENT_INTERFACE_NOK] = "EVENT_INTERFACE_NOK";
EVENT_TYPE_TEXT[EVENT_INTERFACE_NCANCEL] = "EVENT_INTERFACE_NCANCEL";
EVENT_TYPE_TEXT[EVENT_INTERFACE_NDELETE] = "EVENT_INTERFACE_NDELETE";
EVENT_TYPE_TEXT[EVENT_INTERFACE_NLABEL] = "EVENT_INTERFACE_NLABEL";

View File

@ -277,7 +277,6 @@ enum EventType
EVENT_INTERFACE_NEDIT = 580,
EVENT_INTERFACE_NLIST = 581,
EVENT_INTERFACE_NOK = 582,
EVENT_INTERFACE_NCANCEL = 583,
EVENT_INTERFACE_NDELETE = 584,
EVENT_INTERFACE_NLABEL = 585,

View File

@ -268,7 +268,6 @@ void InitializeRestext()
stringsEvent[EVENT_INTERFACE_NEDIT] = TR("\\New player name");
stringsEvent[EVENT_INTERFACE_NOK] = TR("OK\\Choose the selected player");
stringsEvent[EVENT_INTERFACE_NCANCEL] = TR("Cancel\\Keep current player name");
stringsEvent[EVENT_INTERFACE_NDELETE] = TR("Delete player\\Deletes the player from the list");
stringsEvent[EVENT_INTERFACE_NLABEL] = TR("Player name");

View File

@ -138,13 +138,6 @@ void CScreenPlayerSelect::CreateInterface()
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_NDELETE);
pb->SetState(STATE_SHADOW);
pos.x = 380.0f/640.0f;
pos.y = 100.0f/480.0f;
ddim.x =100.0f/640.0f;
ddim.y = 32.0f/480.0f;
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_NCANCEL);
pb->SetState(STATE_SHADOW);
SetBackground("textures/interface/interface.png");
CreateVersionDisplay();
@ -156,7 +149,6 @@ void CScreenPlayerSelect::CreateInterface()
bool CScreenPlayerSelect::EventProcess(const Event &event)
{
CWindow* pw;
CButton* pb;
CList* pl;
std::string name;
char* gamer;
@ -166,21 +158,10 @@ bool CScreenPlayerSelect::EventProcess(const Event &event)
case EVENT_KEY_DOWN:
{
auto data = event.GetData<KeyEventData>();
if (data->key == KEY(RETURN))
if (data->key == KEY(RETURN) || data->key == KEY(ESCAPE))
{
NameSelect();
}
if (data->key == KEY(ESCAPE))
{
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
if ( pw == nullptr ) break;
pb = static_cast<CButton*>(pw->SearchControl(EVENT_INTERFACE_NCANCEL));
if ( pb == nullptr ) break;
if ( pb->TestState(STATE_ENABLE) )
{
m_main->ChangePhase(PHASE_MAIN_MENU);
}
}
break;
}
@ -202,10 +183,6 @@ bool CScreenPlayerSelect::EventProcess(const Event &event)
m_main->ChangePhase(PHASE_APPERANCE);
break;
case EVENT_INTERFACE_NCANCEL:
m_main->ChangePhase(PHASE_MAIN_MENU);
break;
case EVENT_INTERFACE_NDELETE:
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
if ( pw == nullptr ) break;
@ -260,17 +237,10 @@ void CScreenPlayerSelect::UpdateNameControl()
pe = static_cast<CEdit*>(pw->SearchControl(EVENT_INTERFACE_NEDIT));
if ( pe == nullptr ) return;
std::string gamer = m_main->GetPlayerProfile()->GetName();
total = pl->GetTotal();
sel = pl->GetSelect();
pe->GetText(name, 100);
pb = static_cast<CButton*>(pw->SearchControl(EVENT_INTERFACE_NCANCEL));
if ( pb != nullptr )
{
pb->SetState(STATE_ENABLE, !gamer.empty());
}
pb = static_cast<CButton*>(pw->SearchControl(EVENT_INTERFACE_NDELETE));
if ( pb != nullptr )
{