overlay->add_graphic(obj3d, "trackcircuit");
overlay->set_label(obj3d, lexical_cast<string>(saddr));
}
- else if(unsigned taddr = track->get_turnout_address())
+ else if(track->get_type().is_turnout())
{
+ unsigned taddr = track->get_turnout_address();
if(taddr<0x800)
{
overlay->add_graphic(obj3d, "turnout");
{
if(mode!=CATALOGUE && abs(track->get_tilt()).radians()>1e-4)
info += format(" (slope %.1f%%)", abs(tan(track->get_tilt())*100));
- if(track->get_turnout_address())
+ if(track->get_type().is_turnout())
info += format(" (turnout %d)", track->get_turnout_address());
else if(track->get_sensor_address())
info += format(" (sensor %d)", track->get_sensor_address());
Track3D &t3d = layout_3d->get_3d(**i);
Path3D *path = new Path3D(t3d);
path->set_color(GL::Color(0.5, 0.8, 1.0));
- if(unsigned taddr = (*i)->get_turnout_address())
- path->set_path(route.get_turnout(taddr));
+ if((*i)->get_type().is_turnout())
+ path->set_path(route.get_turnout((*i)->get_turnout_address()));
highlight_paths.push_back(path);
}
}
Object *obj = pick_object(pointer);
if(Track *track = dynamic_cast<Track *>(obj))
{
- if(track->get_turnout_address())
+ if(track->get_type().is_turnout())
{
Block &block = track->get_block();
if(block.get_train() && block.get_train()->is_block_critical(block))
const set<Track *> &tracks = layout.get_all<Track>();
for(set<Track *>::const_iterator i=tracks.begin(); i!=tracks.end(); ++i)
- if((*i)->get_turnout_address())
+ if((*i)->get_type().is_turnout())
{
(*i)->signal_path_changing.connect(sigc::hide(sigc::bind(sigc::mem_fun(this, &BlockAllocator::turnout_path_changing), sigc::ref(**i))));
(*i)->signal_path_changed.connect(sigc::hide(sigc::bind(sigc::mem_fun(this, &BlockAllocator::turnout_path_changed), sigc::ref(**i))));
set<unsigned> used_addrs;
const set<Track *> &tracks = objects.get<Track>();
for(set<Track *>::const_iterator i=tracks.begin(); i!=tracks.end(); ++i)
- if((*i)->get_turnout_address())
+ if((*i)->get_type().is_turnout())
used_addrs.insert((*i)->get_turnout_address());
unsigned result = next_turnout_addr;
const set<Track *> &tracks = objects.get<Track>();
for(set<Track *>::const_iterator i=tracks.begin(); i!=tracks.end(); ++i)
- if(unsigned taddr = (*i)->get_turnout_address())
- writer.write((DataFile::Statement("turnout"), taddr, (*i)->get_active_path()));
+ if((*i)->get_type().is_turnout())
+ writer.write((DataFile::Statement("turnout"), (*i)->get_turnout_address(), (*i)->get_active_path()));
for(map<unsigned, Train *>::const_iterator i=trains.begin(); i!=trains.end(); ++i)
{
unsigned Route::get_path(Track &trk) const
{
- if(unsigned taddr = trk.get_turnout_address())
+ if(trk.get_type().is_turnout())
{
- map<unsigned, int>::const_iterator i = turnouts.find(taddr);
+ map<unsigned, int>::const_iterator i = turnouts.find(trk.get_turnout_address());
if(i!=turnouts.end())
return i->second;
}