diff options
author | nerzhul <loic.blot@unix-experience.fr> | 2015-07-16 17:37:46 +0200 |
---|---|---|
committer | Loic Blot <loic.blot@unix-experience.fr> | 2015-07-16 20:27:42 +0200 |
commit | f9dbec6edf94ce20d52d38569545674cfb742eae (patch) | |
tree | fcb4e9f1b3d96a97fb5998d4aea7a67e2d28ba73 /src/environment.cpp | |
parent | 655fc6010ffd4be7de315be261df2a61d5d4538a (diff) | |
download | minetest-f9dbec6edf94ce20d52d38569545674cfb742eae.tar.gz minetest-f9dbec6edf94ce20d52d38569545674cfb742eae.tar.bz2 minetest-f9dbec6edf94ce20d52d38569545674cfb742eae.zip |
Kick players when shutting down server and there is a crash due to a Lua stack exception
Diffstat (limited to 'src/environment.cpp')
-rw-r--r-- | src/environment.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/environment.cpp b/src/environment.cpp index 5affda6fa..cad1f298b 100644 --- a/src/environment.cpp +++ b/src/environment.cpp @@ -39,6 +39,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "mapblock_mesh.h" #include "event.h" #endif +#include "server.h" #include "daynightratio.h" #include "map.h" #include "emerge.h" @@ -425,6 +426,15 @@ bool ServerEnvironment::line_of_sight(v3f pos1, v3f pos2, float stepsize, v3s16 return true; } +void ServerEnvironment::kickAllPlayers(const std::string &reason) +{ + for (std::vector<Player*>::iterator it = m_players.begin(); + it != m_players.end(); + ++it) { + ((Server*)m_gamedef)->DenyAccess_Legacy((*it)->peer_id, utf8_to_wide(reason)); + } +} + void ServerEnvironment::saveLoadedPlayers() { std::string players_path = m_path_world + DIR_DELIM "players"; |