X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Fserver.h;h=7ee15a4638a5f1e75975e9ae61cf5e115eed6e5e;hb=d1df09841d0eac7a88f638676b80ec848522cca5;hp=a4be7d3fb78039be4fec1abc44dd86ecd658b630;hpb=c56d7fe0eba7905b0a63c4a1cfe909988653c23d;p=dragonfireclient.git diff --git a/src/server.h b/src/server.h index a4be7d3fb..7ee15a463 100644 --- a/src/server.h +++ b/src/server.h @@ -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 @@ -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); @@ -223,7 +225,6 @@ class Server : public con::PeerHandler, public MapEventReceiver, // Both setter and getter need no envlock, // can be called freely from threads void setTimeOfDay(u32 time); - inline u32 getTimeOfDay(); /* Shall be called with the environment locked. @@ -274,7 +275,8 @@ class Server : public con::PeerHandler, public MapEventReceiver, void spawnParticle(const std::string &playername, v3f pos, v3f velocity, v3f acceleration, float expirationtime, float size, - bool collisiondetection, bool vertical, const std::string &texture); + bool collisiondetection, bool collision_removal, + bool vertical, const std::string &texture); u32 addParticleSpawner(u16 amount, float spawntime, v3f minpos, v3f maxpos, @@ -282,10 +284,12 @@ class Server : public con::PeerHandler, public MapEventReceiver, v3f minacc, v3f maxacc, float minexptime, float maxexptime, float minsize, float maxsize, - bool collisiondetection, bool vertical, const std::string &texture, + bool collisiondetection, bool collision_removal, + bool vertical, const std::string &texture, const std::string &playername); void deleteParticleSpawner(const std::string &playername, u32 id); + void deleteParticleSpawnerAll(u32 id); // Creates or resets inventory Inventory* createDetachedInventory(const std::string &name); @@ -370,6 +374,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); @@ -378,6 +384,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; @@ -449,7 +458,8 @@ class Server : public con::PeerHandler, public MapEventReceiver, v3f minacc, v3f maxacc, float minexptime, float maxexptime, float minsize, float maxsize, - bool collisiondetection, bool vertical, std::string texture, u32 id); + bool collisiondetection, bool collision_removal, + bool vertical, const std::string &texture, u32 id); void SendDeleteParticleSpawner(u16 peer_id, u32 id); @@ -457,7 +467,8 @@ class Server : public con::PeerHandler, public MapEventReceiver, void SendSpawnParticle(u16 peer_id, v3f pos, v3f velocity, v3f acceleration, float expirationtime, float size, - bool collisiondetection, bool vertical, std::string texture); + bool collisiondetection, bool collision_removal, + bool vertical, const std::string &texture); u32 SendActiveObjectRemoveAdd(u16 peer_id, const std::string &datas); void SendActiveObjectMessages(u16 peer_id, const std::string &datas, bool reliable = true); @@ -470,6 +481,15 @@ class Server : public con::PeerHandler, public MapEventReceiver, void DeleteClient(u16 peer_id, ClientDeletionReason reason); void UpdateCrafting(Player *player); + void handleChatInterfaceEvent(ChatEvent *evt); + + // 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, + bool check_shout_priv = false, + u16 peer_id_to_avoid_sending = PEER_ID_INEXISTENT); + void handleAdminChat(const ChatEventChat *evt); + v3f findSpawnPos(); // When called, connection mutex should be locked @@ -518,7 +538,6 @@ class Server : public con::PeerHandler, public MapEventReceiver, // Environment ServerEnvironment *m_env; - Mutex m_env_mutex; // server connection con::Connection m_con; @@ -596,6 +615,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 @@ -645,11 +667,6 @@ class Server : public con::PeerHandler, public MapEventReceiver, // key = name std::map m_detached_inventories; - /* - Particles - */ - std::vector m_particlespawner_ids; - DISABLE_CLASS_COPY(Server); };