]> git.tdb.fi Git - r2c2.git/blobdiff - source/libr2c2/vehicle.cpp
Rename various get_axle functions to get_fixed_axle
[r2c2.git] / source / libr2c2 / vehicle.cpp
index 2c31ba19f189467ad07233dc0ff600e87fe6643e..b7355c6a6e2fab2bd73caaeafafd4881ce989b2d 100644 (file)
@@ -29,7 +29,7 @@ Vehicle::Vehicle(Layout &l, const VehicleType &t):
        front_sensor(0),
        back_sensor(0)
 {
-       axles.assign(type.get_axles().begin(), type.get_axles().end());
+       axles.assign(type.get_fixed_axles().begin(), type.get_fixed_axles().end());
        bogies.assign(type.get_bogies().begin(), type.get_bogies().end());
        rods.assign(type.get_rods().begin(), type.get_rods().end());
 
@@ -125,6 +125,13 @@ void Vehicle::advance(float d)
        propagate_position();
 }
 
+const Vehicle::Axle &Vehicle::get_fixed_axle(unsigned i) const
+{
+       if(i>=axles.size())
+               throw InvalidParameterValue("Axle index out of range");
+       return axles[i];
+}
+
 const Vehicle::Bogie &Vehicle::get_bogie(unsigned i) const
 {
        if(i>=bogies.size())
@@ -132,13 +139,6 @@ const Vehicle::Bogie &Vehicle::get_bogie(unsigned i) const
        return bogies[i];
 }
 
-const Vehicle::Axle &Vehicle::get_axle(unsigned i) const
-{
-       if(i>=axles.size())
-               throw InvalidParameterValue("Axle index out of range");
-       return axles[i];
-}
-
 const Vehicle::Axle &Vehicle::get_bogie_axle(unsigned i, unsigned j) const
 {
        if(i>=bogies.size())
@@ -290,7 +290,7 @@ void Vehicle::update_rods()
                        i->position = i->type->pivot_point;
                else if(i->type->pivot==VehicleType::Rod::AXLE)
                {
-                       const Axle &axle = get_axle(i->type->pivot_index);
+                       const Axle &axle = get_fixed_axle(i->type->pivot_index);
                        float c = cos(axle.angle);
                        float s = sin(axle.angle);
                        const Vector &pp = i->type->pivot_point;