aboutsummaryrefslogtreecommitdiff
path: root/src/client.h
diff options
context:
space:
mode:
authorKahrl <kahrl@gmx.net>2013-08-11 04:09:45 +0200
committerKahrl <kahrl@gmx.net>2013-08-14 21:03:33 +0200
commit4e1f50035e860a00636ca5d804c267119df99601 (patch)
treec6cab522305ef2a5b9cfdb3685340d57590f1ff1 /src/client.h
parent6228d634fb31d1ce925d1fdc2dac022629a007ef (diff)
downloadminetest-4e1f50035e860a00636ca5d804c267119df99601.tar.gz
minetest-4e1f50035e860a00636ca5d804c267119df99601.tar.bz2
minetest-4e1f50035e860a00636ca5d804c267119df99601.zip
Omnicleanup: header cleanup, add ModApiUtil shared between game and mainmenu
Diffstat (limited to 'src/client.h')
-rw-r--r--src/client.h55
1 files changed, 52 insertions, 3 deletions
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 <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"
@@ -246,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:
@@ -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);