}
}
-unsigned Layout::allocate_turnout_id()
+unsigned Layout::allocate_turnout_id(bool dbl)
{
- return next_turnout_id++;
+ unsigned result = next_turnout_id++;
+ if(dbl)
+ ++next_turnout_id;
+ return result;
}
void Layout::add_block(Block &b)
void add_track(Track &);
const std::set<Track *> &get_tracks() const { return tracks; }
void remove_track(Track &);
- unsigned allocate_turnout_id();
+ unsigned allocate_turnout_id(bool);
void add_block(Block &);
Block &get_block(unsigned) const;
rot(0),
slope(0),
flex(false),
- turnout_id(type.is_turnout() ? layout.allocate_turnout_id() : 0),
+ turnout_id(type.is_turnout() ? layout.allocate_turnout_id(type.is_double_address()) : 0),
sensor_id(0),
links(type.get_endpoints().size()),
active_path(0)
float c = cos(rot);
float s = sin(rot);
- p.pos = Point(pos.x+c*p.pos.x-s*p.pos.y, pos.y+s*p.pos.x+c*p.pos.y, 0);
+ p.pos = Point(pos.x+c*p.pos.x-s*p.pos.y, pos.y+s*p.pos.x+c*p.pos.y, pos.z);
p.dir += rot;
if(type.get_endpoints().size()==2)
{
float grade = slope/len;
if(epi==0)
{
- p.pos.z = pos.z+grade*d;
+ p.pos.z += grade*d;
p.grade = grade;
}
else
{
- p.pos.z = pos.z+slope-grade*d;
+ p.pos.z += slope-grade*d;
p.grade = -grade;
}
}
}
else if(end_of_route && rsv_blocks.empty())
{
+ set_active(false);
signal_arrived.emit();
set_route(0);
}
{
const BlockRef &blkref = obj.cur_blocks.front();
const Block::Endpoint &bep = blkref.block->get_endpoints()[blkref.entry];
- obj.vehicles.back()->place(*bep.track, bep.track_ep, 0, Vehicle::BACK_BUFFER);
+ float offset = 2*obj.layout.get_catalogue().get_scale();
+ obj.vehicles.back()->place(*bep.track, bep.track_ep, offset, Vehicle::BACK_BUFFER);
obj.set_status("Stopped");
}