Tooltips: Unify the tooltip[] and list[] description tooltip display functions (...
[oweals/minetest.git] / src / client.h
index 0dd519308308d1e7b8d538da8a74a18844d94e45..b4145c76ff207127c08084f2dfcdb9f29e72e053 100644 (file)
@@ -38,6 +38,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "tileanimation.h"
 #include "mesh_generator_thread.h"
 
+#define CLIENT_CHAT_MESSAGE_LIMIT_PER_10S 10.0f
+
 struct MeshMakeData;
 class MapBlockMesh;
 class IWritableTextureSource;
@@ -257,6 +259,7 @@ public:
                        IrrlichtDevice *device,
                        const char *playername,
                        const std::string &password,
+                       const std::string &address_name,
                        MapDrawControl &control,
                        IWritableTextureSource *tsrc,
                        IWritableShaderSource *shsrc,
@@ -284,9 +287,7 @@ public:
                The name of the local player should already be set when
                calling this, as it is sent in the initialization.
        */
-       void connect(Address address,
-                       const std::string &address_name,
-                       bool is_local_server);
+       void connect(Address address, bool is_local_server);
 
        /*
                Stuff that references the environment is valid only as
@@ -361,6 +362,7 @@ public:
                const StringMap &fields);
        void sendInventoryAction(InventoryAction *a);
        void sendChatMessage(const std::wstring &message);
+       void clearOutChatQueue();
        void sendChangePassword(const std::string &oldpassword,
                const std::string &newpassword);
        void sendDamage(u8 damage);
@@ -468,8 +470,7 @@ public:
        Minimap* getMinimap() { return m_minimap; }
        void setCamera(Camera* camera) { m_camera = camera; }
 
-       Camera* getCamera ()
-       { return m_camera; }
+       Camera* getCamera () { return m_camera; }
 
        bool shouldShowMinimap() const;
 
@@ -525,6 +526,16 @@ public:
 
        IrrlichtDevice *getDevice() const { return m_device; }
 
+       const Address getServerAddress()
+       {
+               return m_con.GetPeerAddress(PEER_ID_SERVER);
+       }
+
+       const std::string &getAddressName() const
+       {
+               return m_address_name;
+       }
+
 private:
 
        // Virtual methods from con::PeerHandler
@@ -557,6 +568,8 @@ private:
        inline std::string getPlayerName()
        { return m_env.getLocalPlayer()->getName(); }
 
+       bool canSendChatMessage() const;
+
        float m_packetcounter_timer;
        float m_connection_reinit_timer;
        float m_avg_rtt_timer;
@@ -576,6 +589,7 @@ private:
        ClientEnvironment m_env;
        ParticleManager m_particle_manager;
        con::Connection m_con;
+       std::string m_address_name;
        IrrlichtDevice *m_device;
        Camera *m_camera;
        Minimap *m_minimap;
@@ -603,6 +617,9 @@ private:
        //s32 m_daynight_i;
        //u32 m_daynight_ratio;
        std::queue<std::wstring> m_chat_queue;
+       std::queue<std::wstring> m_out_chat_queue;
+       u32 m_last_chat_message_sent;
+       float m_chat_message_allowance;
 
        // The authentication methods we can use to enter sudo mode (=change password)
        u32 m_sudo_auth_methods;