X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Flibr2c2%2Ftracktype.h;h=a292e5532b625439de120555899ff3637391047b;hb=d0af7846e05691d65d8021e46c8f81e8ca05199a;hp=fb40ac9473708623c3560ac586f4b79a8557902b;hpb=247742fbc1c27bfc9fdef4630afcdc2408cdd550;p=r2c2.git diff --git a/source/libr2c2/tracktype.h b/source/libr2c2/tracktype.h index fb40ac9..a292e55 100644 --- a/source/libr2c2/tracktype.h +++ b/source/libr2c2/tracktype.h @@ -1,14 +1,7 @@ -/* $Id$ - -This file is part of R²C² -Copyright © 2006-2010 Mikkosoft Productions, Mikko Rasa -Distributed under the GPL -*/ - #ifndef LIBR2C2_TRACKTYPE_H_ #define LIBR2C2_TRACKTYPE_H_ -#include +#include #include "articlenumber.h" #include "geometry.h" #include "trackpart.h" @@ -20,14 +13,14 @@ class TrackType public: struct Endpoint { - Point pos; + Vector pos; float dir; // Direction outwards from the endpoint unsigned paths; Endpoint(float, float, float, unsigned); }; - class Loader: public Msp::DataFile::BasicLoader + class Loader: public Msp::DataFile::ObjectLoader { private: bool state_bits_set; @@ -48,6 +41,7 @@ private: std::vector endpoints; unsigned state_bits; unsigned autofit_preference; + std::string object; public: TrackType(const ArticleNumber &); @@ -62,10 +56,13 @@ public: bool is_turnout() const; bool is_dead_end() const; unsigned get_autofit_preference() const { return autofit_preference; } + const std::string &get_object() const { return object; } const std::vector &get_parts() const { return parts; } const std::vector &get_endpoints() const { return endpoints; } const Endpoint &get_endpoint(unsigned) const; TrackPoint get_point(unsigned, unsigned, float) const; + TrackPoint get_nearest_point(const Vector &) const; + bool collide_ray(const Vector &, const Vector &, float) const; private: void collect_endpoints();