]> git.tdb.fi Git - r2c2.git/blobdiff - source/network/train.cpp
Strip Id tags and copyright notices from files
[r2c2.git] / source / network / train.cpp
index 6a0c3a8b8fa99006c56275e9382618f05998b962..eb9563786aa982bd08eb299ae7e2252555cbc909 100644 (file)
@@ -1,16 +1,9 @@
-/* $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),
@@ -32,6 +25,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;
@@ -82,4 +81,4 @@ void NetTrain::process_packet(const TrainRoutePacket &pkt)
        signal_route_changed.emit(route);
 }
 
-} // namespace Marklin
+} // namespace R2C2