X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Flibmarklin%2Ftrackpart.cpp;h=943832fff413577dc77eabdef5d7d16840d61dbc;hb=e6b7f8c4dd12199c3c5c0bec555fa73c87079729;hp=1ef6e753d509d562692e99c7786a6aaa214fe884;hpb=3e9c210ddc036cd015228504cc0803c909e27f84;p=r2c2.git diff --git a/source/libmarklin/trackpart.cpp b/source/libmarklin/trackpart.cpp index 1ef6e75..943832f 100644 --- a/source/libmarklin/trackpart.cpp +++ b/source/libmarklin/trackpart.cpp @@ -1,7 +1,7 @@ /* $Id$ This file is part of the MSP Märklin suite -Copyright © 2006-2008 Mikkosoft Productions, Mikko Rasa +Copyright © 2006-2009 Mikkosoft Productions, Mikko Rasa Distributed under the GPL */ @@ -13,8 +13,6 @@ using namespace std; namespace Marklin { TrackPart::TrackPart(): - x(0), - y(0), dir(0), length(0), radius(0), @@ -22,28 +20,40 @@ TrackPart::TrackPart(): dead_end(false) { } -void TrackPart::collect_endpoints(vector &eps) +void TrackPart::collect_endpoints(vector &eps) const { - eps.push_back(Endpoint(x, y, dir+M_PI, 1<(p) { add("start", &Loader::start); add("length", &TrackPart::length); @@ -54,24 +64,23 @@ TrackPart::Loader::Loader(TrackPart &p): void TrackPart::Loader::finish() { - if(part.radius) + if(obj.radius) { - part.length*=M_PI/180; - part.radius/=1000; + obj.length *= M_PI/180; + obj.radius /= 1000; } else - part.length/=1000; + obj.length /= 1000; - part.x/=1000; - part.y/=1000; - part.dir*=M_PI/180; + obj.pos.x /= 1000; + obj.pos.y /= 1000; + obj.dir *= M_PI/180; } void TrackPart::Loader::start(float x, float y, float d) { - part.x=x; - part.y=y; - part.dir=d; + obj.pos = Point(x, y); + obj.dir = d; } } // namespace Marklin