X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Flibmarklin%2Ftrack.cpp;h=b6674aec0a2ea86e8242cc5fd8053a86a8fb57ab;hb=3df8cb5c78fbb0b919bcb79677c6c788b8028482;hp=e544081d04f6754f6c9074245df581e358c3b8f2;hpb=319f90fd59587efc1242c34f307abc29f323642b;p=r2c2.git diff --git a/source/libmarklin/track.cpp b/source/libmarklin/track.cpp index e544081..b6674ae 100644 --- a/source/libmarklin/track.cpp +++ b/source/libmarklin/track.cpp @@ -12,8 +12,6 @@ Distributed under the GPL using namespace std; using namespace Msp; -#include - namespace Marklin { Track::Track(const TrackType &t): @@ -319,12 +317,22 @@ Track *Track::copy() const return trk; } -/******************* -** Track::Loader -*/ +void Track::save(list &st) const +{ + st.push_back((DataFile::Statement("position"), pos.x, pos.y, pos.z)); + st.push_back((DataFile::Statement("rotation"), rot)); + st.push_back((DataFile::Statement("slope"), slope)); + if(turnout_id) + st.push_back((DataFile::Statement("turnout_id"), turnout_id)); + if(sensor_id) + st.push_back((DataFile::Statement("sensor_id"), sensor_id)); + if(flex) + st.push_back((DataFile::Statement("flex"), true)); +} + Track::Loader::Loader(Track &t): - track(t) + DataFile::BasicLoader(t) { add("position", &Loader::position); add("rotation", &Track::rot); @@ -336,7 +344,7 @@ Track::Loader::Loader(Track &t): void Track::Loader::position(float x, float y, float z) { - track.pos=Point(x, y, z); + obj.pos=Point(x, y, z); } } // namespace Marklin