]> git.tdb.fi Git - r2c2.git/blobdiff - source/libr2c2/trackpart.h
Rename the project to R²C²
[r2c2.git] / source / libr2c2 / trackpart.h
diff --git a/source/libr2c2/trackpart.h b/source/libr2c2/trackpart.h
new file mode 100644 (file)
index 0000000..0a07b4d
--- /dev/null
@@ -0,0 +1,51 @@
+/* $Id$
+
+This file is part of R²C²
+Copyright © 2006-2010  Mikkosoft Productions, Mikko Rasa
+Distributed under the GPL
+*/
+
+#ifndef LIBR2C2_TRACKPART_H_
+#define LIBR2C2_TRACKPART_H_
+
+#include <msp/datafile/loader.h>
+#include "geometry.h"
+
+namespace R2C2 {
+
+class TrackPart
+{
+public:
+       class Loader: public Msp::DataFile::BasicLoader<TrackPart>
+       {
+       public:
+               Loader(TrackPart &);
+       private:
+               virtual void finish();
+               void start(float, float, float);
+       };
+
+private:
+       Point pos;
+       float dir;
+       float length;
+       float radius;
+       unsigned path;
+       bool dead_end;
+       TrackPart *links[2];
+
+public:
+       TrackPart();
+
+       float get_length() const;
+       bool is_curved() const { return radius; }
+       TrackPoint get_point(float) const;
+       unsigned get_path() const { return path; }
+       bool is_dead_end() const { return dead_end; }
+       void check_link(TrackPart &);
+       TrackPart *get_link(unsigned) const;
+};
+
+} // namespace R2C2
+
+#endif