-/* $Id$
-
-This file is part of R²C²
-Copyright © 2010 Mikkosoft Productions, Mikko Rasa
-Distributed under the GPL
-*/
-
+#include <msp/core/maputils.h>
#include "vehicletype.h"
using namespace std;
VehicleType::VehicleType(const ArticleNumber &an):
art_nr(an),
locomotive(false),
+ swap_direction(false),
length(0),
width(0),
height(0)
return (--functions.end())->first;
}
-const VehicleType::Axle &VehicleType::get_axle(unsigned i) const
+const VehicleType::Axle &VehicleType::get_fixed_axle(unsigned i) const
{
if(i>=axles.size())
throw InvalidParameterValue("Axle index out of range");
add("name", &VehicleType::name);
add("object", &VehicleType::object);
add("rod", &Loader::rod);
+ add("swap_direction", &VehicleType::swap_direction);
add("width", &Loader::width);
}
void VehicleType::Rod::Loader::connect(const string &t, float px, float pz, float ox, float oz)
{
- map<string, unsigned>::const_iterator i = tags.find(t);
- if(i==tags.end())
- throw KeyError("Unknown rod tag", t);
- obj.connect_index = i->second;
+ obj.connect_index = get_item(tags, t);
obj.connect_point = Vector(px/1000, 0, pz/1000);
obj.connect_offset = Vector(ox/1000, 0, oz/1000);
}
void VehicleType::Rod::Loader::pivot_rod(const string &t)
{
- map<string, unsigned>::const_iterator i = tags.find(t);
- if(i==tags.end())
- throw KeyError("Unknown rod tag", t);
+ obj.pivot_index = get_item(tags, t);
obj.pivot = ROD;
- obj.pivot_index = i->second;
}
void VehicleType::Rod::Loader::position(float x, float y, float z)