diff options
Diffstat (limited to 'src/client')
-rw-r--r-- | src/client/client.cpp | 22 | ||||
-rw-r--r-- | src/client/client.h | 8 | ||||
-rw-r--r-- | src/client/clientlauncher.cpp | 1 | ||||
-rw-r--r-- | src/client/game.cpp | 34 |
4 files changed, 20 insertions, 45 deletions
diff --git a/src/client/client.cpp b/src/client/client.cpp index 93a403e81..d81ee434e 100644 --- a/src/client/client.cpp +++ b/src/client/client.cpp @@ -100,7 +100,8 @@ Client::Client( MtEventManager *event, RenderingEngine *rendering_engine, bool ipv6, - GameUI *game_ui + GameUI *game_ui, + ELoginRegister allow_login_or_register ): m_tsrc(tsrc), m_shsrc(shsrc), @@ -124,7 +125,8 @@ Client::Client( m_media_downloader(new ClientMediaDownloader()), m_state(LC_Created), m_game_ui(game_ui), - m_modchannel_mgr(new ModChannelMgr()) + m_modchannel_mgr(new ModChannelMgr()), + m_allow_login_or_register(allow_login_or_register) { // Add local player m_env.setLocalPlayer(new LocalPlayer(this, playername)); @@ -396,10 +398,6 @@ 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) { @@ -1078,18 +1076,6 @@ 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; diff --git a/src/client/client.h b/src/client/client.h index cb1227768..f01510ddb 100644 --- a/src/client/client.h +++ b/src/client/client.h @@ -37,6 +37,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "mesh_generator_thread.h" #include "network/address.h" #include "network/peerhandler.h" +#include "gameparams.h" #include <fstream> #define CLIENT_CHAT_MESSAGE_LIMIT_PER_10S 10.0f @@ -127,7 +128,8 @@ public: MtEventManager *event, RenderingEngine *rendering_engine, bool ipv6, - GameUI *game_ui + GameUI *game_ui, + ELoginRegister allow_login_or_register ); ~Client(); @@ -347,8 +349,7 @@ public: u16 getProtoVersion() { return m_proto_ver; } - void confirmRegistration(); - bool m_is_registration_confirmation_state = false; + ELoginRegister m_allow_login_or_register = ELoginRegister::Any; bool m_simple_singleplayer_mode; float mediaReceiveProgress(); @@ -460,7 +461,6 @@ private: static AuthMechanism choseAuthMech(const u32 mechs); void sendInit(const std::string &playerName); - void promptConfirmRegistration(AuthMechanism chosen_auth_mechanism); void startAuth(AuthMechanism chosen_auth_mechanism); void sendDeletedBlocks(std::vector<v3s16> &blocks); void sendGotBlocks(const std::vector<v3s16> &blocks); diff --git a/src/client/clientlauncher.cpp b/src/client/clientlauncher.cpp index 54c561d11..60c9525f3 100644 --- a/src/client/clientlauncher.cpp +++ b/src/client/clientlauncher.cpp @@ -451,6 +451,7 @@ bool ClientLauncher::launch_game(std::string &error_message, start_data.name = menudata.name; start_data.password = menudata.password; start_data.address = std::move(menudata.address); + start_data.allow_login_or_register = menudata.allow_login_or_register; server_name = menudata.servername; server_description = menudata.serverdescription; diff --git a/src/client/game.cpp b/src/client/game.cpp index d6e0cc8b8..441054631 100644 --- a/src/client/game.cpp +++ b/src/client/game.cpp @@ -43,7 +43,6 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "gameparams.h" #include "gettext.h" #include "gui/guiChatConsole.h" -#include "gui/guiConfirmRegistration.h" #include "gui/guiFormSpecMenu.h" #include "gui/guiKeyChangeMenu.h" #include "gui/guiPasswordChange.h" @@ -1480,7 +1479,8 @@ bool Game::connectToServer(const GameStartData &start_data, start_data.password, start_data.address, *draw_control, texture_src, shader_src, itemdef_manager, nodedef_manager, sound, eventmgr, - m_rendering_engine, connect_address.isIPv6(), m_game_ui.get()); + m_rendering_engine, connect_address.isIPv6(), m_game_ui.get(), + start_data.allow_login_or_register); client->migrateModStorage(); } catch (const BaseException &e) { *error_message = fmtgettext("Error creating client: %s", e.what()); @@ -1543,28 +1543,16 @@ bool Game::connectToServer(const GameStartData &start_data, break; } - if (client->m_is_registration_confirmation_state) { - if (registration_confirmation_shown) { - // Keep drawing the GUI - m_rendering_engine->draw_menu_scene(guienv, dtime, true); - } else { - registration_confirmation_shown = true; - (new GUIConfirmRegistration(guienv, guienv->getRootGUIElement(), -1, - &g_menumgr, client, start_data.name, start_data.password, - connection_aborted, texture_src))->drop(); - } - } else { - wait_time += dtime; - // Only time out if we aren't waiting for the server we started - if (!start_data.address.empty() && wait_time > 10) { - *error_message = gettext("Connection timed out."); - errorstream << *error_message << std::endl; - break; - } - - // Update status - showOverlayMessage(N_("Connecting to server..."), dtime, 20); + wait_time += dtime; + // Only time out if we aren't waiting for the server we started + if (!start_data.address.empty() && wait_time > 10) { + *error_message = gettext("Connection timed out."); + errorstream << *error_message << std::endl; + break; } + + // Update status + showOverlayMessage(N_("Connecting to server..."), dtime, 20); } } catch (con::PeerNotFoundException &e) { // TODO: Should something be done here? At least an info/error |