-/* $Id$
-
-This file is part of the MSP Märklin suite
-Copyright © 2009 Mikkosoft Productions, Mikko Rasa
-Distributed under the GPL
-*/
-
#include "client.h"
#include "train.h"
using namespace std;
-namespace Marklin {
+namespace R2C2 {
NetTrain::NetTrain(Client &c, const TrainInfoPacket &pkt):
client(c),
- loco_type(client.get_catalogue().get_vehicle(pkt.loco_type)),
+ loco_type(client.get_catalogue().get<VehicleType>(pkt.loco_type)),
address(pkt.address),
name(pkt.name),
functions(0)
client.send(pkt);
}
+float NetTrain::get_control(const string &c) const
+{
+ map<string, float>::const_iterator i = controls.find(c);
+ return i!=controls.end() ? i->second : 0;
+}
+
void NetTrain::set_function(unsigned i, bool set)
{
TrainFunctionPacket pkt;
signal_route_changed.emit(route);
}
-} // namespace Marklin
+} // namespace R2C2