From 4e1f50035e860a00636ca5d804c267119df99601 Mon Sep 17 00:00:00 2001 From: Kahrl Date: Sun, 11 Aug 2013 04:09:45 +0200 Subject: Omnicleanup: header cleanup, add ModApiUtil shared between game and mainmenu --- src/client.h | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 52 insertions(+), 3 deletions(-) (limited to 'src/client.h') diff --git a/src/client.h b/src/client.h index fc26f3178..9146941e8 100644 --- a/src/client.h +++ b/src/client.h @@ -25,12 +25,12 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "irrlichttypes_extrabloated.h" #include "jmutex.h" #include +#include #include #include #include "clientobject.h" #include "gamedef.h" #include "inventorymanager.h" -#include "filesys.h" #include "filecache.h" #include "localplayer.h" #include "server.h" @@ -246,6 +246,57 @@ struct ClientEvent }; }; +/* + Packet counter +*/ + +class PacketCounter +{ +public: + PacketCounter() + { + } + + void add(u16 command) + { + std::map::iterator n = m_packets.find(command); + if(n == m_packets.end()) + { + m_packets[command] = 1; + } + else + { + n->second++; + } + } + + void clear() + { + for(std::map::iterator + i = m_packets.begin(); + i != m_packets.end(); ++i) + { + i->second = 0; + } + } + + void print(std::ostream &o) + { + for(std::map::iterator + i = m_packets.begin(); + i != m_packets.end(); ++i) + { + o<<"cmd "<first + <<" count "<second + < m_packets; +}; + class Client : public con::PeerHandler, public InventoryManager, public IGameDef { public: @@ -419,8 +470,6 @@ private: 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); -- cgit v1.2.3