summaryrefslogtreecommitdiff
path: root/src/client.cpp
diff options
context:
space:
mode:
authorred-001 <red-001@outlook.ie>2017-04-01 12:40:56 +0100
committerLoïc Blot <nerzhul@users.noreply.github.com>2017-04-01 13:40:56 +0200
commit63ac62ec8abe30f0d6dd2cfe0ddaab291c36893f (patch)
tree76707d22d37fc2fd29e5c5326f3848780599eb36 /src/client.cpp
parent813a9a36b22a4e2d7383622311b6f52e31a94733 (diff)
downloadminetest-63ac62ec8abe30f0d6dd2cfe0ddaab291c36893f.tar.gz
minetest-63ac62ec8abe30f0d6dd2cfe0ddaab291c36893f.tar.bz2
minetest-63ac62ec8abe30f0d6dd2cfe0ddaab291c36893f.zip
[CSM] Add function and chat command to disconnect from server. (#5487)
Diffstat (limited to 'src/client.cpp')
-rw-r--r--src/client.cpp10
1 files changed, 5 insertions, 5 deletions
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();