X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Flibr2c2%2Ftimetable.cpp;h=5be3a03ce07c893df50b05ea4b4985d9e22606b9;hb=2922bc5d2ba68979d186fd09df8b4ec6ba98402b;hp=44e859e9a5b9becbb3d943adc8bb198287428f1a;hpb=1c072afdb1866ba397ee8e6155f5f68c6c7ab4da;p=r2c2.git diff --git a/source/libr2c2/timetable.cpp b/source/libr2c2/timetable.cpp index 44e859e..5be3a03 100644 --- a/source/libr2c2/timetable.cpp +++ b/source/libr2c2/timetable.cpp @@ -5,6 +5,7 @@ #include "driver.h" #include "layout.h" #include "timetable.h" +#include "trackcircuit.h" #include "train.h" using namespace std; @@ -24,7 +25,7 @@ Timetable::Timetable(Train &t): train.signal_advanced.connect(sigc::mem_fun(this, &Timetable::train_advanced)); train.signal_ai_event.connect(sigc::mem_fun(this, &Timetable::event)); Layout &layout = train.get_layout(); - layout.signal_block_state_changed.connect(sigc::mem_fun(this, &Timetable::block_state_changed)); + layout.signal_sensor_state_changed.connect(sigc::mem_fun(this, &Timetable::sensor_state_changed)); layout.signal_block_reserved.connect(sigc::mem_fun(this, &Timetable::block_reserved)); } @@ -97,7 +98,7 @@ void Timetable::tick(const Time::TimeStamp &t, const Time::TimeDelta &) case TRAVEL_TO: { Block *block = &get_sensor(row.get_param(0)); - if(block->get_train()!=&train || block->get_state()get_train()!=&train || block->get_sensor().get_state()(0)); Block *block = &get_sensor(row.get_param(1)); - if(block->get_train()!=other_train || block->get_state()get_train()!=other_train || block->get_sensor().get_state()=Block::MAYBE_ACTIVE) + Block *block = 0; + if(TrackCircuit *tc = dynamic_cast(&sensor)) + block = &tc->get_block(); + else + return; + + if(block==pending_block && block->get_train()==pending_train && state>=Sensor::MAYBE_ACTIVE) { pending_block = 0; current_row = (current_row+1)%rows.size();