]> git.tdb.fi Git - r2c2.git/blobdiff - source/libr2c2/intellibox.cpp
Remove things from the driver when no longer used
[r2c2.git] / source / libr2c2 / intellibox.cpp
index d4129ec7535162d44deb3225de1608423d76c759..338aed2544127844dff4de200cf7bbffc90f2a2a 100644 (file)
@@ -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<unsigned, Sensor>::const_iterator i = sensors.find(addr);