From 792752997c5ae2aaa4f54d0a2e2af2a96d7d1e9f Mon Sep 17 00:00:00 2001 From: Muhammad Rifqi Priyo Susanto Date: Sat, 13 Jan 2018 18:07:16 +0700 Subject: Add confirmation on new player registration (#6849) * Attempt to add registration confirmation Using SRP auth mechanism, if server sent AUTH_MECHANISM_FIRST_SRP that means the player isn't exist. Also tell player about the server and chosen username. Local game has localhost as IP address of the server. Add RenderingEngine::draw_menu_scene() to draw GUI and clouds background. aborted -> connection_aborted * Rewrite information message text Client::promptConfirmRegister() -> Client::promptConfirmRegistration() --- src/client.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/client.cpp') diff --git a/src/client.cpp b/src/client.cpp index e6af5c324..90f1c4e01 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -318,6 +318,10 @@ void Client::step(float dtime) initial_step = false; } else if(m_state == LC_Created) { + if (m_is_registration_confirmation_state) { + // Waiting confirmation + return; + } float &counter = m_connection_reinit_timer; counter -= dtime; if(counter <= 0.0) { @@ -974,6 +978,18 @@ void Client::sendInit(const std::string &playerName) Send(&pkt); } +void Client::promptConfirmRegistration(AuthMechanism chosen_auth_mechanism) +{ + m_chosen_auth_mech = chosen_auth_mechanism; + m_is_registration_confirmation_state = true; +} + +void Client::confirmRegistration() +{ + m_is_registration_confirmation_state = false; + startAuth(m_chosen_auth_mech); +} + void Client::startAuth(AuthMechanism chosen_auth_mechanism) { m_chosen_auth_mech = chosen_auth_mechanism; -- cgit v1.2.3