X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Flibr2c2%2Fcentralstation.cpp;h=124c1beed8aa14efba0fc96bc59a8ab17ca7a709;hb=73e4a36bbf828e07b83a779b696875e1f80045cc;hp=2138e10702ee27497e70a641edc8fbd12d9d20ab;hpb=b28062f2dc88e082ee5a28b2e1f7c4c8bd989023;p=r2c2.git diff --git a/source/libr2c2/centralstation.cpp b/source/libr2c2/centralstation.cpp index 2138e10..124c1be 100644 --- a/source/libr2c2/centralstation.cpp +++ b/source/libr2c2/centralstation.cpp @@ -88,7 +88,7 @@ unsigned CentralStation::get_protocol_speed_steps(const string &name) const } } -void CentralStation::add_loco(unsigned addr, const string &proto_name, const VehicleType &type) +unsigned CentralStation::add_loco(unsigned addr, const string &proto_name, const VehicleType &type) { Protocol proto = map_protocol(proto_name); @@ -109,6 +109,8 @@ void CentralStation::add_loco(unsigned addr, const string &proto_name, const Veh } else command(format("request(%d, view, control, force)", id)); + + return addr; } void CentralStation::remove_loco(unsigned addr) @@ -147,7 +149,7 @@ void CentralStation::set_loco_function(unsigned addr, unsigned func, bool state) command(format("set(%d, func[%d, %d])", id, func, state)); } -void CentralStation::add_turnout(unsigned addr, const TrackType &type) +unsigned CentralStation::add_turnout(unsigned addr, const TrackType &type) { unsigned straight = type.get_paths(); bool left = false; @@ -180,6 +182,8 @@ void CentralStation::add_turnout(unsigned addr, const TrackType &type) MagnetAccessory &turnout = add_accessory(addr, MagnetAccessory::TURNOUT, symbol); turnout.bits = type.get_state_bits(); + + return addr; } void CentralStation::remove_turnout(unsigned addr) @@ -197,9 +201,10 @@ unsigned CentralStation::get_turnout(unsigned addr) const return get_accessory_state(addr, MagnetAccessory::TURNOUT); } -void CentralStation::add_signal(unsigned addr, const SignalType &) +unsigned CentralStation::add_signal(unsigned addr, const SignalType &) { add_accessory(addr, MagnetAccessory::SIGNAL, MagnetAccessory::SEMAPHORE_HOME); + return addr; } void CentralStation::remove_signal(unsigned addr) @@ -298,7 +303,7 @@ void CentralStation::accessory_state_changed(const MagnetAccessory &accessory) c signal_signal.emit(accessory.address, accessory.state); } -void CentralStation::add_sensor(unsigned addr) +unsigned CentralStation::add_sensor(unsigned addr) { sensors.insert(SensorMap::value_type(addr, Sensor())); @@ -307,6 +312,8 @@ void CentralStation::add_sensor(unsigned addr) if(addr>s88.size()*16) command("create(26, add[0])"); } + + return addr; } void CentralStation::remove_sensor(unsigned)