3 This file is part of R²C²
4 Copyright © 2010-2011 Mikkosoft Productions, Mikko Rasa
5 Distributed under the GPL
8 #ifndef LIBR2C2_VEHICLETYPE_H_
9 #define LIBR2C2_VEHICLETYPE_H_
11 #include <msp/datafile/objectloader.h>
12 #include "articlenumber.h"
20 class Loader: public Msp::DataFile::ObjectLoader<VehicleType>
23 std::map<std::string, unsigned> rod_tags;
26 Loader(VehicleType &);
30 void function(unsigned, const std::string &);
39 class Loader: public Msp::DataFile::ObjectLoader<Axle>
45 void wheel_diameter(float);
56 typedef std::vector<Axle> AxleArray;
60 class Loader: public Msp::DataFile::ObjectLoader<Bogie>
77 typedef std::vector<Bogie> BogieArray;
96 class Loader: public Msp::DataFile::ObjectLoader<Rod>
99 const std::map<std::string, unsigned> &tags;
103 Loader(Rod &, const std::map<std::string, unsigned> &);
104 const std::string &get_tag() const { return tag; }
106 void connect(const std::string &, float, float, float, float);
109 void pivot_axle(unsigned);
110 void pivot_bogie_axle(unsigned, unsigned);
111 void pivot_rod(const std::string &);
112 void position(float, float, float);
113 void set_tag(const std::string &);
117 unsigned pivot_index;
118 unsigned pivot_index2;
122 Vector connect_point;
123 Vector connect_offset;
130 typedef std::vector<Rod> RodArray;
133 ArticleNumber art_nr;
136 std::map<unsigned, std::string> functions;
146 VehicleType(const ArticleNumber &);
148 const ArticleNumber &get_article_number() const { return art_nr; }
149 const std::string &get_name() const { return name; }
150 bool is_locomotive() const { return locomotive; }
151 unsigned get_max_function() const;
152 const std::map<unsigned, std::string> &get_functions() const { return functions; }
153 float get_length() const { return length; }
154 float get_width() const { return width; }
155 float get_height() const { return height; }
156 const AxleArray &get_fixed_axles() const { return axles; }
157 const Axle &get_fixed_axle(unsigned) const;
158 const BogieArray &get_bogies() const { return bogies; }
159 const Bogie &get_bogie(unsigned) const;
160 const Axle &get_bogie_axle(unsigned, unsigned) const;
161 const RodArray &get_rods() const { return rods; }
162 const Rod &get_rod(unsigned) const;
163 float get_front_axle_offset() const;
164 float get_back_axle_offset() const;
165 const std::string &get_object() const { return object; }