const Vehicle &veh = train.get_vehicle(rev ? 0 : train.get_n_vehicles()-1);
const Block &veh_block = veh.get_placement().get_position(rev ? VehiclePlacement::FRONT_AXLE : VehiclePlacement::BACK_AXLE)->get_block();
+ bool pending_cleared = false;
+
/* Sensors aren't guaranteed to be detriggered in order. Go through the
block list and locate the first sensor that's still active. */
BlockList::iterator end = blocks.end();
end = i;
}
+ if(block==pending_block)
+ pending_cleared = true;
+
// Stop if we encounter an active sensor or the train's last vehicle
if(block==&veh_block || active_sensor)
{
release_blocks_begin(end);
signal_rear_advanced.emit(*last());
}
+
+ if(pending_cleared)
+ reserve_more();
+
return;
}
}