]> git.tdb.fi Git - r2c2.git/blobdiff - source/network/train.cpp
Ignore the click that causes manipulator to finish
[r2c2.git] / source / network / train.cpp
index 5c4b457bad9bb3093edb962887d567798e6d8777..4b6c8e86e1233955d3d4d04b19b6e1d27c522670 100644 (file)
@@ -14,7 +14,7 @@ namespace Marklin {
 
 NetTrain::NetTrain(Client &c, const TrainInfoPacket &pkt):
        client(c),
-       loco_type(client.get_catalogue().get_locomotive(pkt.loco_type)),
+       loco_type(client.get_catalogue().get_vehicle(pkt.loco_type)),
        address(pkt.address),
        name(pkt.name),
        functions(0)
@@ -32,6 +32,12 @@ void NetTrain::set_control(const string &c, float v)
        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;