summaryrefslogtreecommitdiffstats
path: root/pacman-c++/server.h
diff options
context:
space:
mode:
Diffstat (limited to 'pacman-c++/server.h')
-rw-r--r--pacman-c++/server.h25
1 files changed, 22 insertions, 3 deletions
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 @@
5 5
6#include <QtGui> 6#include <QtGui>
7#include "actor.h" 7#include "actor.h"
8#include "pacman.pb.h"
9
10class QTcpSocket;
8 11
9class Server 12class Server
10 : public SceneHolder 13 : public SceneHolder
@@ -13,13 +16,29 @@ class Server
13public: 16public:
14 Server(QWidget *parent = 0); 17 Server(QWidget *parent = 0);
15 18
19protected slots:
20 void tick();
21
22 // receive updates of client
23 void keyPressUpdate();
24
16protected: 25protected:
17 // returns packets read from network until now 26
18 // for clients not sending a direction, no change is assumed 27 // block until we have connections from all clients
19 QMap<Color::Color, Actor::Movement> getActorDirections(); 28 void waitForClientConnections();
20 29
21 // calculate updates of current tick for sending to client 30 // calculate updates of current tick for sending to client
22 Transmission::map_t calculateUpdates(); 31 Transmission::map_t calculateUpdates();
32
33 QSharedPointer<ProtoBuf::MapUpdate> createUpdatePacket(Transmission::map_t);
34
35 // update client maps
36 void sendUpdate(QSharedPointer< ProtoBuf::MapUpdate > );
37
38 QMap<Color::Color, QTcpSocket*> m_clientConnections;
39
40 // current movements. required to make pacmans continue their movement.
41 QMap<Color::Color, Actor::Movement> m_actorMovements;
23}; 42};
24 43
25#endif // SERVER_H 44#endif // SERVER_H