throw InvalidParameterValue("Invalid path");
layout.get_driver().set_turnout(turnout_id, p&1);
- if(type.get_n_paths()>2)
+ if(type.is_double_address())
layout.get_driver().set_turnout(turnout_id+1, p&2);
+ else if(type.get_n_paths()>2)
+ active_path = (active_path&1) | (p&2);
}
int Track::get_endpoint_by_link(const Track &other) const
namespace Marklin {
TrackType::TrackType(unsigned a):
- art_nr(a)
+ art_nr(a),
+ double_address(false)
{ }
float TrackType::get_total_length() const
return endpoints.size()>2;
}
-bool TrackType::is_double_address() const
-{
- return get_n_paths()>2;
-}
-
TrackPoint TrackType::get_point(unsigned epi, unsigned path, float d) const
{
if(epi>=endpoints.size())
Msp::DataFile::BasicLoader<TrackType>(t)
{
add("description", &TrackType::description);
+ add("double_address", &TrackType::double_address);
add("part", &Loader::part);
}
std::string description;
std::vector<TrackPart> parts;
std::vector<Endpoint> endpoints;
+ bool double_address;
public:
TrackType(unsigned);
unsigned get_paths() const;
unsigned get_n_paths() const;
bool is_turnout() const;
- bool is_double_address() const;
+ bool is_double_address() const { return double_address; }
const std::vector<TrackPart> &get_parts() const { return parts; }
const std::vector<Endpoint> &get_endpoints() const { return endpoints; }
TrackPoint get_point(unsigned, unsigned, float) const;
track 24630
{
description "Turnout, 3-way";
+ double_address true;
part
{
length 188.3;