- Sensor *last_inactive = 0;
- for(BlockList::iterator i=blocks.begin(); (i!=cur_blocks_end && i->block()!=&veh_block); ++i)
+ BlockList::iterator end = blocks.end();
+ for(BlockList::iterator i=blocks.begin(); i!=cur_blocks_end; ++i)
+ {
+ Block *block = &**i;
+ list<Sensor *> sensors;
+
+ /* Collect all sensors from the block in the order they are expected to
+ detrigger. */
+ for(TrackIter j=i->track_iter(); (j && &j->get_block()==block); j=j.next())
+ if(!j->get_attachments().empty())
+ {
+ Track::AttachmentList attachments = j->get_attachments_ordered(j.entry());
+ for(Track::AttachmentList::const_iterator k=attachments.begin(); k!=attachments.end(); ++k)
+ if(BeamGate *gate = dynamic_cast<BeamGate *>(*k))
+ sensors.push_back(gate);
+ }
+