X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Flibr2c2%2Ftrack.cpp;h=0411f1586c86fd89bc21f3be534905f363995dec;hb=08dea8dfcf923e9296bcd3910455540895d0439b;hp=f1fdd992822180c26ddd5c39a6095bb8145516e4;hpb=399b48a7a80dafde49e7530ff8dfd2820232a73f;p=r2c2.git diff --git a/source/libr2c2/track.cpp b/source/libr2c2/track.cpp index f1fdd99..0411f15 100644 --- a/source/libr2c2/track.cpp +++ b/source/libr2c2/track.cpp @@ -417,6 +417,12 @@ void Track::save(list &st) const st.push_back((DataFile::Statement("flex"), true)); } +void Track::save_dynamic(list &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) @@ -440,6 +446,7 @@ void Track::turnout_failed(unsigned id) Track::Loader::Loader(Track &t): DataFile::ObjectLoader(t) { + add("path", &Loader::path); add("position", &Loader::position); add("rotation", &Loader::rotation); add("tilt", &Loader::tilt); @@ -453,6 +460,16 @@ Track::Loader::Loader(Track &t): 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));