if(!otrack)
return false;
+ float gauge_ratio = otrack->get_type().get_gauge()/type.get_gauge();
+ if(gauge_ratio<0.99 || gauge_ratio>1.01)
+ return false;
+
float limit = type.get_gauge();
if(!flex && !otrack->get_flex())
limit /= 10;
st.push_back((DataFile::Statement("flex"), true));
}
+void Track::save_dynamic(list<DataFile::Statement> &st) const
+{
+ if(turnout_addr)
+ st.push_back((DataFile::Statement("path"), active_path));
+}
+
void Track::turnout_event(unsigned id, unsigned state)
{
if(id==turnout_id)
Track::Loader::Loader(Track &t):
DataFile::ObjectLoader<Track>(t)
{
+ add("path", &Loader::path);
add("position", &Loader::position);
add("rotation", &Loader::rotation);
add("tilt", &Loader::tilt);
add("slope", &Loader::slope);
}
+void Track::Loader::path(unsigned p)
+{
+ obj.set_active_path(p);
+ if(obj.path_changing)
+ {
+ obj.active_path = p;
+ obj.signal_path_changed.emit(p);
+ }
+}
+
void Track::Loader::position(float x, float y, float z)
{
obj.set_position(Vector(x, y, z));