]> git.tdb.fi Git - r2c2.git/blobdiff - source/libr2c2/trackpart.h
Bugfixes for the network server
[r2c2.git] / source / libr2c2 / trackpart.h
index 462290526eb6809bd2663304bbcd1a97cb2a1a75..97e76349d138e769c96f23d34cf0dd268121f8a2 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef LIBR2C2_TRACKPART_H_
 #define LIBR2C2_TRACKPART_H_
 
-#include <msp/datafile/loader.h>
+#include <msp/datafile/objectloader.h>
 #include "geometry.h"
 
 namespace R2C2 {
@@ -9,7 +9,7 @@ namespace R2C2 {
 class TrackPart
 {
 public:
-       class Loader: public Msp::DataFile::BasicLoader<TrackPart>
+       class Loader: public Msp::DataFile::ObjectLoader<TrackPart>
        {
        public:
                Loader(TrackPart &);
@@ -20,24 +20,29 @@ public:
 
 private:
        Vector pos;
-       float dir;
+       Angle dir;
        float length;
        float radius;
        unsigned path;
        bool dead_end;
        TrackPart *links[2];
+       Shape *shape;
+       Transform transform;
 
 public:
        TrackPart();
+       ~TrackPart();
 
        float get_length() const;
        bool is_curved() const { return radius; }
-       TrackPoint get_point(float) const;
+       OrientedPoint get_point(float) const;
+       OrientedPoint get_nearest_point(const Vector &) const;
        unsigned get_path() const { return path; }
        bool is_dead_end() const { return dead_end; }
        void check_link(TrackPart &);
        TrackPart *get_link(unsigned) const;
-       bool collide_ray(const Vector &, const Vector &, float) const;
+       void create_shape();
+       const Shape &get_shape() const { return *shape; }
 };
 
 } // namespace R2C2