]> git.lizzy.rs Git - dragonfireclient.git/blobdiff - src/client.h
Omnicleanup: header cleanup, add ModApiUtil shared between game and mainmenu
[dragonfireclient.git] / src / client.h
index f59588680729f523b519aff24409e7ae1f530738..9146941e8263dbb02f3906d3eaac52f5401671db 100644 (file)
@@ -25,12 +25,12 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "irrlichttypes_extrabloated.h"
 #include "jmutex.h"
 #include <ostream>
+#include <map>
 #include <set>
 #include <vector>
 #include "clientobject.h"
 #include "gamedef.h"
 #include "inventorymanager.h"
-#include "filesys.h"
 #include "filecache.h"
 #include "localplayer.h"
 #include "server.h"
@@ -230,6 +230,8 @@ struct ClientEvent
                        u32 number;
                        u32 item;
                        u32 dir;
+                       v2f *align;
+                       v2f *offset;
                } hudadd;
                struct{
                        u32 id;
@@ -244,6 +246,57 @@ struct ClientEvent
        };
 };
 
+/*
+       Packet counter
+*/
+
+class PacketCounter
+{
+public:
+       PacketCounter()
+       {
+       }
+
+       void add(u16 command)
+       {
+               std::map<u16, u16>::iterator n = m_packets.find(command);
+               if(n == m_packets.end())
+               {
+                       m_packets[command] = 1;
+               }
+               else
+               {
+                       n->second++;
+               }
+       }
+
+       void clear()
+       {
+               for(std::map<u16, u16>::iterator
+                               i = m_packets.begin();
+                               i != m_packets.end(); ++i)
+               {
+                       i->second = 0;
+               }
+       }
+
+       void print(std::ostream &o)
+       {
+               for(std::map<u16, u16>::iterator
+                               i = m_packets.begin();
+                               i != m_packets.end(); ++i)
+               {
+                       o<<"cmd "<<i->first
+                                       <<" count "<<i->second
+                                       <<std::endl;
+               }
+       }
+
+private:
+       // command, count
+       std::map<u16, u16> m_packets;
+};
+
 class Client : public con::PeerHandler, public InventoryManager, public IGameDef
 {
 public:
@@ -261,7 +314,8 @@ class Client : public con::PeerHandler, public InventoryManager, public IGameDef
                        IWritableItemDefManager *itemdef,
                        IWritableNodeDefManager *nodedef,
                        ISoundManager *sound,
-                       MtEventManager *event
+                       MtEventManager *event,
+                       bool ipv6
        );
        
        ~Client();
@@ -303,6 +357,7 @@ class Client : public con::PeerHandler, public InventoryManager, public IGameDef
        void sendChangePassword(const std::wstring oldpassword,
                        const std::wstring newpassword);
        void sendDamage(u8 damage);
+       void sendBreath(u16 breath);
        void sendRespawn();
 
        ClientEnvironment& getEnv()
@@ -347,6 +402,7 @@ class Client : public con::PeerHandler, public InventoryManager, public IGameDef
        void setCrack(int level, v3s16 pos);
 
        u16 getHP();
+       u16 getBreath();
 
        bool checkPrivilege(const std::string &priv)
        { return (m_privileges.count(priv) != 0); }
@@ -383,7 +439,7 @@ class Client : public con::PeerHandler, public InventoryManager, public IGameDef
        bool nodedefReceived()
        { return m_nodedef_received; }
        
-       void afterContentReceived();
+       void afterContentReceived(IrrlichtDevice *device, gui::IGUIFont* font);
 
        float getRTT(void);
 
@@ -414,8 +470,6 @@ class Client : public con::PeerHandler, public InventoryManager, public IGameDef
        void Receive();
        
        void sendPlayerPos();
-       // This sends the player's current name etc to the server
-       void sendPlayerInfo();
        // Send the item number 'item' as player item to the server
        void sendPlayerItem(u16 item);
        
@@ -468,7 +522,6 @@ class Client : public con::PeerHandler, public InventoryManager, public IGameDef
        u32 m_media_received_count;
        bool m_itemdef_received;
        bool m_nodedef_received;
-       friend class FarMesh;
 
        // time_of_day speed approximation for old protocol
        bool m_time_of_day_set;