3 This file is part of R²C²
4 Copyright © 2009 Mikkosoft Productions, Mikko Rasa
5 Distributed under the GPL
8 #ifndef R2C2_NET_TRAIN_H_
9 #define R2C2_NET_TRAIN_H_
11 #include <sigc++/signal.h>
12 #include "libr2c2/vehicletype.h"
22 sigc::signal<void, const std::string &> signal_name_changed;
23 sigc::signal<void, const std::string &, float> signal_control_changed;
24 sigc::signal<void, unsigned, bool> signal_function_changed;
25 sigc::signal<void, const std::string &> signal_route_changed;
26 sigc::signal<void, const std::string &> signal_status_changed;
30 const VehicleType &loco_type;
33 std::map<std::string, float> controls;
39 NetTrain(Client &, const TrainInfoPacket &);
41 const VehicleType &get_loco_type() const { return loco_type; }
42 unsigned get_address() const { return address; }
43 const std::string &get_name() const { return name; }
44 void set_control(const std::string &, float);
45 float get_control(const std::string &) const;
46 void set_function(unsigned, bool);
47 bool get_function(unsigned i) const { return (functions>>i)&1; }
48 void set_route(const std::string &);
49 const std::string &get_route() const { return route; }
51 void process_packet(const TrainControlPacket &);
52 void process_packet(const TrainFunctionPacket &);
53 void process_packet(const TrainRoutePacket &);
54 void process_packet(const TrainStatusPacket &);