X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fnetwork%2Ftrain.cpp;h=df9367e2062366140c166e5c5fd43de4b8e75b5f;hb=1ff06c5bc46a677fa389ef86c6b26664368f1653;hp=6a0c3a8b8fa99006c56275e9382618f05998b962;hpb=378f04522aa762729c0d5651fb60ad7e4d8ba9f3;p=r2c2.git diff --git a/source/network/train.cpp b/source/network/train.cpp index 6a0c3a8..df9367e 100644 --- a/source/network/train.cpp +++ b/source/network/train.cpp @@ -1,6 +1,6 @@ /* $Id$ -This file is part of the MSP Märklin suite +This file is part of R²C² Copyright © 2009 Mikkosoft Productions, Mikko Rasa Distributed under the GPL */ @@ -10,7 +10,7 @@ Distributed under the GPL using namespace std; -namespace Marklin { +namespace R2C2 { NetTrain::NetTrain(Client &c, const TrainInfoPacket &pkt): client(c), @@ -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::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 +88,4 @@ void NetTrain::process_packet(const TrainRoutePacket &pkt) signal_route_changed.emit(route); } -} // namespace Marklin +} // namespace R2C2