X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Flibr2c2%2Fintellibox.cpp;h=338aed2544127844dff4de200cf7bbffc90f2a2a;hb=5a02a4f42dfc5dc6b4daef5fc02431bdfb2968d8;hp=73c2057942edb295eba784d596336048048cd941;hpb=3051264c306adc12b6028061a3257f523c211f81;p=r2c2.git diff --git a/source/libr2c2/intellibox.cpp b/source/libr2c2/intellibox.cpp index 73c2057..338aed2 100644 --- a/source/libr2c2/intellibox.cpp +++ b/source/libr2c2/intellibox.cpp @@ -114,6 +114,11 @@ void Intellibox::add_loco(unsigned addr, const string &proto_name, const Vehicle } } +void Intellibox::remove_loco(unsigned addr) +{ + locos.erase(addr); +} + void Intellibox::set_loco_speed(unsigned addr, unsigned speed) { Locomotive &loco = locos[addr]; @@ -197,6 +202,11 @@ void Intellibox::add_turnout(unsigned addr, const TrackType &type) add_turnout(addr, type.get_state_bits(), false); } +void Intellibox::remove_turnout(unsigned addr) +{ + turnouts.erase(addr); +} + void Intellibox::add_turnout(unsigned addr, unsigned bits, bool signal) { if(!turnouts.count(addr)) @@ -264,6 +274,11 @@ void Intellibox::add_signal(unsigned addr, const SignalType &) add_turnout(addr, 1, true); } +void Intellibox::remove_signal(unsigned addr) +{ + remove_turnout(addr); +} + void Intellibox::set_signal(unsigned addr, unsigned state) { set_turnout(addr, state); @@ -283,6 +298,12 @@ void Intellibox::add_sensor(unsigned addr) } } +void Intellibox::remove_sensor(unsigned addr) +{ + sensors.erase(addr); + update_sensors = true; +} + bool Intellibox::get_sensor(unsigned addr) const { map::const_iterator i = sensors.find(addr); @@ -740,10 +761,12 @@ void Intellibox::error(Command cmd, Error err) Intellibox::Locomotive::Locomotive(): + protocol(NONE), ext_func(false), speed(0), reverse(false), - funcs(0) + funcs(0), + pending_half_step(0) { }