3 This file is part of the MSP Märklin suite
4 Copyright © 2010 Mikkosoft Productions, Mikko Rasa
5 Distributed under the GPL
8 #include "vehicletype.h"
15 VehicleType::VehicleType(unsigned n):
22 unsigned VehicleType::get_max_function() const
26 return (--functions.end())->first;
30 VehicleType::Axle::Axle():
37 VehicleType::Bogie::Bogie():
43 VehicleType::Loader::Loader(VehicleType &vt):
44 DataFile::ObjectLoader<VehicleType>(vt)
46 add("axle", &Loader::axle);
47 add("bogie", &Loader::bogie);
48 add("function", &Loader::function);
49 add("height", &Loader::height);
50 add("length", &Loader::length);
51 add("locomotive", &VehicleType::locomotive);
52 add("object", &VehicleType::object);
53 add("name", &VehicleType::name);
54 add("width", &Loader::width);
57 void VehicleType::Loader::axle()
61 obj.axles.push_back(axl);
64 void VehicleType::Loader::bogie()
68 obj.bogies.push_back(bog);
71 void VehicleType::Loader::function(unsigned i, const string &f)
76 void VehicleType::Loader::height(float h)
81 void VehicleType::Loader::length(float l)
86 void VehicleType::Loader::width(float w)
92 VehicleType::Axle::Loader::Loader(Axle &a):
93 DataFile::ObjectLoader<Axle>(a)
95 add("position", &Loader::position);
96 add("powered", &Axle::powered);
97 add("wheel_diameter", &Loader::wheel_diameter);
100 void VehicleType::Axle::Loader::position(float p)
102 obj.position = p/1000;
105 void VehicleType::Axle::Loader::wheel_diameter(float d)
107 obj.wheel_dia = d/1000;
111 VehicleType::Bogie::Loader::Loader(Bogie &b):
112 DataFile::ObjectLoader<Bogie>(b)
114 add("axle", &Loader::axle);
115 add("object", &Bogie::object);
116 add("position", &Loader::position);
117 add("rotate_object", &Bogie::rotate_object);
120 void VehicleType::Bogie::Loader::axle()
124 obj.axles.push_back(axl);
127 void VehicleType::Bogie::Loader::position(float p)
129 obj.position = p/1000;
132 } // namespace Marklin