]> git.lizzy.rs Git - dragonfireclient.git/blobdiff - src/server.h
Update minetest.conf.example and src/settings_translation_file.cpp
[dragonfireclient.git] / src / server.h
index d16230967eb3eb25ee3cb1cf122e98c08f50dbc9..6d66c938602e20b476c57656cbd54a8fc9c46978 100644 (file)
@@ -32,6 +32,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "util/numeric.h"
 #include "util/thread.h"
 #include "environment.h"
+#include "chat_interface.h"
 #include "clientiface.h"
 #include "network/networkpacket.h"
 #include <string>
@@ -171,7 +172,8 @@ class Server : public con::PeerHandler, public MapEventReceiver,
                const std::string &path_world,
                const SubgameSpec &gamespec,
                bool simple_singleplayer_mode,
-               bool ipv6
+               bool ipv6,
+               ChatInterface *iface = NULL
        );
        ~Server();
        void start(Address bind_addr);
@@ -220,7 +222,8 @@ class Server : public con::PeerHandler, public MapEventReceiver,
 
        void Send(NetworkPacket* pkt);
 
-       // Environment must be locked when called
+       // Both setter and getter need no envlock,
+       // can be called freely from threads
        void setTimeOfDay(u32 time);
 
        /*
@@ -368,6 +371,8 @@ class Server : public con::PeerHandler, public MapEventReceiver,
                        u8* ser_vers, u16* prot_vers, u8* major, u8* minor, u8* patch,
                        std::string* vers_string);
 
+       void printToConsoleOnly(const std::string &text);
+
        void SendPlayerHPOrDie(PlayerSAO *player);
        void SendPlayerBreath(u16 peer_id);
        void SendInventory(PlayerSAO* playerSAO);
@@ -376,6 +381,9 @@ class Server : public con::PeerHandler, public MapEventReceiver,
        // Bind address
        Address m_bind_addr;
 
+       // Environment mutex (envlock)
+       Mutex m_env_mutex;
+
 private:
 
        friend class EmergeThread;
@@ -468,6 +476,12 @@ class Server : public con::PeerHandler, public MapEventReceiver,
        void DeleteClient(u16 peer_id, ClientDeletionReason reason);
        void UpdateCrafting(Player *player);
 
+       // This returns the answer to the sender of wmessage, or "" if there is none
+       std::wstring handleChat(const std::string &name, const std::wstring &wname,
+               const std::wstring &wmessage,
+               u16 peer_id_to_avoid_sending = PEER_ID_INEXISTENT);
+       void handleAdminChat(const ChatEventChat *evt);
+
        v3f findSpawnPos();
 
        // When called, connection mutex should be locked
@@ -516,7 +530,6 @@ class Server : public con::PeerHandler, public MapEventReceiver,
 
        // Environment
        ServerEnvironment *m_env;
-       JMutex m_env_mutex;
 
        // server connection
        con::Connection m_con;
@@ -557,7 +570,7 @@ class Server : public con::PeerHandler, public MapEventReceiver,
        // A buffer for time steps
        // step() increments and AsyncRunStep() run by m_thread reads it.
        float m_step_dtime;
-       JMutex m_step_dtime_mutex;
+       Mutex m_step_dtime_mutex;
 
        // current server step lag counter
        float m_lag;
@@ -594,6 +607,9 @@ class Server : public con::PeerHandler, public MapEventReceiver,
        std::string m_shutdown_msg;
        bool m_shutdown_ask_reconnect;
 
+       ChatInterface *m_admin_chat;
+       std::string m_admin_nick;
+
        /*
                Map edit event queue. Automatically receives all map edits.
                The constructor of this class registers us to receive them through
@@ -647,6 +663,8 @@ class Server : public con::PeerHandler, public MapEventReceiver,
                Particles
        */
        std::vector<u32> m_particlespawner_ids;
+
+       DISABLE_CLASS_COPY(Server);
 };
 
 /*