X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Flibr2c2%2Froute.h;h=3ee7e5ead2306313d2afb293bae4b7931124f439;hb=64340dad429ba4040538fc06b6882aabdb489925;hp=5c87971280300067ed055d5a6d15c3df31f0e576;hpb=7e27b311e33beda1746eb63e0945633f262427f6;p=r2c2.git diff --git a/source/libr2c2/route.h b/source/libr2c2/route.h index 5c87971..3ee7e5e 100644 --- a/source/libr2c2/route.h +++ b/source/libr2c2/route.h @@ -1,10 +1,3 @@ -/* $Id$ - -This file is part of R²C² -Copyright © 2007-2010 Mikkosoft Productions, Mikko Rasa -Distributed under the GPL -*/ - #ifndef LIBR2C2_ROUTE_H_ #define LIBR2C2_ROUTE_H_ @@ -12,7 +5,7 @@ Distributed under the GPL #include #include #include -#include +#include namespace R2C2 { @@ -21,12 +14,32 @@ class Track; class TrackIter; class Zone; +enum RouteValidityMask +{ + ROUTE_INVALID = 0, + ROUTE_LINKED = 1, + ROUTE_LINEAR = 2, + ROUTE_SMOOTH = 4, + ROUTE_VALID = 7 +}; + +class bad_route: public std::logic_error +{ +public: + bad_route(RouteValidityMask m): std::logic_error(get_message(m)) { } + virtual ~bad_route() throw() { } + +private: + static std::string get_message(RouteValidityMask); +}; + + class Route: public sigc::trackable { public: typedef std::map TurnoutMap; - class Loader: public Msp::DataFile::BasicLoader + class Loader: public Msp::DataFile::ObjectLoader { private: TurnoutMap turnouts; @@ -67,7 +80,7 @@ public: bool has_track(Track &) const; void save(std::list &) const; private: - unsigned check_validity(Track &) const; + RouteValidityMask check_validity(Track &) const; void track_removed(Track &); public: