From 63ac62ec8abe30f0d6dd2cfe0ddaab291c36893f Mon Sep 17 00:00:00 2001 From: red-001 Date: Sat, 1 Apr 2017 12:40:56 +0100 Subject: [CSM] Add function and chat command to disconnect from server. (#5487) --- src/client.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/client.cpp') diff --git a/src/client.cpp b/src/client.cpp index 8bbaa83bd..e710624d5 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -260,7 +260,8 @@ Client::Client( m_localdb(NULL), m_script(NULL), m_mod_storage_save_timer(10.0f), - m_game_ui_flags(game_ui_flags) + m_game_ui_flags(game_ui_flags), + m_shutdown(false) { // Add local player m_env.setLocalPlayer(new LocalPlayer(this, playername)); @@ -346,6 +347,7 @@ const ModSpec* Client::getModSpec(const std::string &modname) const void Client::Stop() { + m_shutdown = true; // Don't disable this part when modding is disabled, it's used in builtin m_script->on_shutdown(); //request all client managed threads to stop @@ -361,14 +363,12 @@ void Client::Stop() bool Client::isShutdown() { - - if (!m_mesh_update_thread.isRunning()) return true; - - return false; + return m_shutdown || !m_mesh_update_thread.isRunning(); } Client::~Client() { + m_shutdown = true; m_con.Disconnect(); m_mesh_update_thread.stop(); -- cgit v1.2.3