block(0),
entry(0),
train(0),
- check_train_direction(false),
check_allocated_blocks(false),
passing(false)
{
void Signal::tick(const Time::TimeDelta &)
{
- if(check_train_direction)
- {
- int train_entry = train->get_entry_to_block(*block);
- if(train_entry>=0 && static_cast<unsigned>(train_entry)==entry)
- {
- if(train_conn)
- train_conn.disconnect();
- train_conn = train->signal_advanced.connect(sigc::mem_fun(this, &Signal::train_advanced));
- }
- check_train_direction = false;
- check_allocated_blocks = true;
- }
-
if(check_allocated_blocks)
{
unsigned n_blocks = 0;
{
if(t)
{
- train = t;
- passing = false;
- check_train_direction = true;
+ int train_entry = t->get_entry_to_block(*block);
+ if(train_entry>=0 && static_cast<unsigned>(train_entry)==entry)
+ {
+ if(train_conn)
+ train_conn.disconnect();
+ train = t;
+ passing = false;
+ train_conn = train->signal_advanced.connect(sigc::mem_fun(this, &Signal::train_advanced));
+ check_allocated_blocks = true;
+ }
}
else
{
train = 0;
if(train_conn)
train_conn.disconnect();
- check_train_direction = false;
check_allocated_blocks = false;
}