Tooltips: Unify the tooltip[] and list[] description tooltip display functions (...
[oweals/minetest.git] / src / client.h
index f5b03f19df2a0689e2e45b56ac7ae8e64896083e..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;
@@ -77,6 +79,7 @@ enum ClientEventType
        CE_HUDCHANGE,
        CE_SET_SKY,
        CE_OVERRIDE_DAY_NIGHT_RATIO,
+       CE_CLOUD_PARAMS,
 };
 
 struct ClientEvent
@@ -173,11 +176,21 @@ struct ClientEvent
                        video::SColor *bgcolor;
                        std::string *type;
                        std::vector<std::string> *params;
+                       bool clouds;
                } set_sky;
                struct{
                        bool do_override;
                        float ratio_f;
                } override_day_night_ratio;
+               struct {
+                       f32 density;
+                       u32 color_bright;
+                       u32 color_ambient;
+                       f32 height;
+                       f32 thickness;
+                       f32 speed_x;
+                       f32 speed_y;
+               } cloud_params;
        };
 };
 
@@ -246,6 +259,7 @@ public:
                        IrrlichtDevice *device,
                        const char *playername,
                        const std::string &password,
+                       const std::string &address_name,
                        MapDrawControl &control,
                        IWritableTextureSource *tsrc,
                        IWritableShaderSource *shsrc,
@@ -273,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
@@ -318,6 +330,7 @@ public:
        void handleCommand_ItemDef(NetworkPacket* pkt);
        void handleCommand_PlaySound(NetworkPacket* pkt);
        void handleCommand_StopSound(NetworkPacket* pkt);
+       void handleCommand_FadeSound(NetworkPacket *pkt);
        void handleCommand_Privileges(NetworkPacket* pkt);
        void handleCommand_InventoryFormSpec(NetworkPacket* pkt);
        void handleCommand_DetachedInventory(NetworkPacket* pkt);
@@ -331,6 +344,7 @@ public:
        void handleCommand_HudSetFlags(NetworkPacket* pkt);
        void handleCommand_HudSetParam(NetworkPacket* pkt);
        void handleCommand_HudSetSky(NetworkPacket* pkt);
+       void handleCommand_CloudParams(NetworkPacket* pkt);
        void handleCommand_OverrideDayNightRatio(NetworkPacket* pkt);
        void handleCommand_LocalPlayerAnimations(NetworkPacket* pkt);
        void handleCommand_EyeOffset(NetworkPacket* pkt);
@@ -348,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);
@@ -455,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;
 
@@ -512,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
@@ -544,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;
@@ -563,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;
@@ -590,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;