X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fnetwork%2Ftrain.cpp;h=df9367e2062366140c166e5c5fd43de4b8e75b5f;hb=b14059de03324aecde3efc649293d98ce5b7aaf2;hp=5c4b457bad9bb3093edb962887d567798e6d8777;hpb=9ddcd066e37e4c72685817c042c30897786ece05;p=r2c2.git diff --git a/source/network/train.cpp b/source/network/train.cpp index 5c4b457..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,11 +10,11 @@ Distributed under the GPL using namespace std; -namespace Marklin { +namespace R2C2 { 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::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