From 4f88849caf6533d965849952c9ea153fd8c518c5 Mon Sep 17 00:00:00 2001 From: totycro Date: Sat, 9 Apr 2011 19:20:13 +0200 Subject: first version of multiplayer --- pacman-c++/server.h | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) (limited to 'pacman-c++/server.h') diff --git a/pacman-c++/server.h b/pacman-c++/server.h index 006b104..6ffbb35 100644 --- a/pacman-c++/server.h +++ b/pacman-c++/server.h @@ -5,6 +5,9 @@ #include #include "actor.h" +#include "pacman.pb.h" + +class QTcpSocket; class Server : public SceneHolder @@ -13,13 +16,29 @@ class Server public: Server(QWidget *parent = 0); +protected slots: + void tick(); + + // receive updates of client + void keyPressUpdate(); + protected: - // returns packets read from network until now - // for clients not sending a direction, no change is assumed - QMap getActorDirections(); + + // block until we have connections from all clients + void waitForClientConnections(); // calculate updates of current tick for sending to client Transmission::map_t calculateUpdates(); + + QSharedPointer createUpdatePacket(Transmission::map_t); + + // update client maps + void sendUpdate(QSharedPointer< ProtoBuf::MapUpdate > ); + + QMap m_clientConnections; + + // current movements. required to make pacmans continue their movement. + QMap m_actorMovements; }; #endif // SERVER_H -- cgit v1.2.3