]> git.tdb.fi Git - r2c2.git/blobdiff - source/libr2c2/vehicletype.h
Make vehicles aware of which train they are in
[r2c2.git] / source / libr2c2 / vehicletype.h
index 461a3bec535198931f1a74604d2618c6c533f91e..841664e375f10f61b079b52a535318c79cd4ea76 100644 (file)
@@ -1,23 +1,16 @@
-/* $Id$
-
-This file is part of R²C²
-Copyright © 2010-2011  Mikkosoft Productions, Mikko Rasa
-Distributed under the GPL
-*/
-
 #ifndef LIBR2C2_VEHICLETYPE_H_
 #define LIBR2C2_VEHICLETYPE_H_
 
 #include <msp/datafile/objectloader.h>
-#include "articlenumber.h"
 #include "geometry.h"
+#include "objecttype.h"
 
 namespace R2C2 {
 
-class VehicleType
+class VehicleType: public ObjectType
 {
 public:
-       class Loader: public Msp::DataFile::ObjectLoader<VehicleType>
+       class Loader: public Msp::DataFile::DerivedObjectLoader<VehicleType, ObjectType::Loader>
        {
        private:
                std::map<std::string, unsigned> rod_tags;
@@ -129,11 +122,12 @@ public:
 
        typedef std::vector<Rod> RodArray;
 
+       typedef std::map<unsigned, std::string> FunctionMap;
+
 private:
-       ArticleNumber art_nr;
-       std::string name;
        bool locomotive;
-       std::map<unsigned, std::string> functions;
+       FunctionMap functions;
+       bool swap_direction;
        float length;
        float width;
        float height;
@@ -141,15 +135,15 @@ private:
        BogieArray bogies;
        RodArray rods;
        std::string object;
+       bool rotate_object;
 
 public:
        VehicleType(const ArticleNumber &);
 
-       const ArticleNumber &get_article_number() const { return art_nr; }
-       const std::string &get_name() const { return name; }
        bool is_locomotive() const { return locomotive; }
        unsigned get_max_function() const;
-       const std::map<unsigned, std::string> &get_functions() const { return functions; }
+       const FunctionMap &get_functions() const { return functions; }
+       bool get_swap_direction() const { return swap_direction; }
        float get_length() const { return length; }
        float get_width() const { return width; }
        float get_height() const { return height; }
@@ -163,6 +157,7 @@ public:
        float get_front_axle_offset() const;
        float get_back_axle_offset() const;
        const std::string &get_object() const { return object; }
+       bool get_rotate_object() const { return rotate_object; }
 };
 
 } // namespace R2C2