]> git.tdb.fi Git - r2c2.git/blobdiff - source/libr2c2/trackcircuit.cpp
Don't crash if a train has no router
[r2c2.git] / source / libr2c2 / trackcircuit.cpp
index 2bdfe8b2fe4ba63666472f71a1888fac015c5d94..851a2ba0669c595d42a05d35f0fedd804c14737c 100644 (file)
@@ -1,13 +1,21 @@
+#include <stdexcept>
 #include "block.h"
 #include "trackcircuit.h"
 
+using namespace std;
+
 namespace R2C2 {
 
 TrackCircuit::TrackCircuit(Layout &l, Block &b):
        Sensor(l),
        block(b)
 {
-       address = block.get_sensor_id();
+       Sensor::set_address(block.get_sensor_address());
+}
+
+void TrackCircuit::set_address(unsigned)
+{
+       throw logic_error("use Track::set_sensor_id");
 }
 
 } // namespace R2C2