]> git.tdb.fi Git - r2c2.git/blobdiff - source/network/server.h
Add a vehicle property for swapping directions
[r2c2.git] / source / network / server.h
index ced08aac06eb2df544a9dd8e741cf6cdcfc75e2f..badced0dbd7d8dd612cf690319e8515c9f5ed63a 100644 (file)
@@ -1,7 +1,7 @@
 /* $Id$
 
 This file is part of R²C²
-Copyright © 2009-2010  Mikkosoft Productions, Mikko Rasa
+Copyright © 2009-2011  Mikkosoft Productions, Mikko Rasa
 Distributed under the GPL
 */
 
@@ -13,6 +13,7 @@ Distributed under the GPL
 #include <msp/net/streamsocket.h>
 #include <msp/net/streamlistensocket.h>
 #include "libr2c2/layout.h"
+#include "libr2c2/trainstatus.h"
 #include "packets.h"
 #include "protocol.h"
 
@@ -21,9 +22,10 @@ namespace R2C2 {
 class Server
 {
 private:
-       struct Connection: private Msp::Net::PacketReceiver<TrainControlPacket>,
-               private Msp::Net::PacketReceiver<TrainFunctionPacket>,
-               private Msp::Net::PacketReceiver<TrainRoutePacket>
+       struct Connection: Msp::Net::PacketReceiver<DriverStatePacket>,
+               Msp::Net::PacketReceiver<TrainControlPacket>,
+               Msp::Net::PacketReceiver<TrainFunctionPacket>,
+               Msp::Net::PacketReceiver<TrainRoutePacket>
        {
                Server &server;
                Msp::Net::StreamSocket *socket;
@@ -35,6 +37,7 @@ private:
 
                void handshake_done();
                void end_of_file();
+               virtual void receive(const DriverStatePacket &);
                virtual void receive(const TrainControlPacket &);
                virtual void receive(const TrainFunctionPacket &);
                virtual void receive(const TrainRoutePacket &);
@@ -53,6 +56,8 @@ public:
 private:
        void incoming_connection();
 
+       void driver_state_changed();
+       void emergency(const std::string &);
        void train_added(Train &);
        void train_control_changed(const Train &, const std::string &, float);
        void train_function_changed(const Train &, unsigned, bool);