]> git.tdb.fi Git - r2c2.git/blobdiff - source/libmarklin/trackpart.h
Fix memory leaks and other bad stuff
[r2c2.git] / source / libmarklin / trackpart.h
index 043dd0d0d78f71db2d7f0bcc37aab40b9080929d..0411d72ab3ee2d649851656dea18c6efd2dcb8a7 100644 (file)
@@ -1,37 +1,41 @@
+/* $Id$
+
+This file is part of the MSP Märklin suite
+Copyright © 2006-2009 Mikkosoft Productions, Mikko Rasa
+Distributed under the GPL
+*/
+
 #ifndef MARKLIN_TRACKPART_H_
 #define MARKLIN_TRACKPART_H_
 
 #include <msp/datafile/loader.h>
 #include "endpoint.h"
+#include "geometry.h"
 
 namespace Marklin {
 
 struct TrackPart
 {
-       class Loader: public Msp::DataFile::Loader
+       class Loader: public Msp::DataFile::BasicLoader<TrackPart>
        {
-       private:
-               TrackPart &part;
-
        public:
                Loader(TrackPart &);
-               TrackPart &get_object() { return part; }
        private:
                virtual void finish();
-
                void start(float, float, float);
        };
 
-       float    x, y;
-       float    dir;
-       float    length;
-       float    radius;
-       unsigned route;
-       bool     dead_end;
+       Point pos;
+       float dir;
+       float length;
+       float radius;
+       unsigned path;
+       bool dead_end;
 
        TrackPart();
 
-       void collect_endpoints(std::vector<Endpoint> &);
+       void collect_endpoints(std::vector<Endpoint> &) const;
+       Point get_point(float) const;
 };
 
 } // namespace Marklin