X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Flibr2c2%2Ftrain.cpp;h=aa2ba3f528627beb093dc936446b1f2b3bbd4d81;hb=c4daf1cc6b53cae34e46d4125a993ceed500de1a;hp=b2a49c722e7732938cfce5ed3cdefa95b5838d9b;hpb=218f194f537dfda55d32ce8d8739e322a3d0c07d;p=r2c2.git diff --git a/source/libr2c2/train.cpp b/source/libr2c2/train.cpp index b2a49c7..aa2ba3f 100644 --- a/source/libr2c2/train.cpp +++ b/source/libr2c2/train.cpp @@ -422,9 +422,14 @@ void Train::loco_func_event(unsigned addr, unsigned func, bool state) void Train::sensor_state_changed(Sensor &sensor, Sensor::State state) { + if(state!=Sensor::MAYBE_ACTIVE) + return; + Block *block = sensor.get_block(); + if(!block || block->get_train()!=this) + return; - if(block && block->get_train()==this && state==Sensor::MAYBE_ACTIVE) + if(dynamic_cast(&sensor)) { if(last_entry_block) {