From: Mikko Rasa Date: Wed, 16 Mar 2011 10:13:49 +0000 (+0000) Subject: Rename various get_axle functions to get_fixed_axle X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=d18d5c1c3cf417e20840238eec4f3caa431fa2b5;p=r2c2.git Rename various get_axle functions to get_fixed_axle --- diff --git a/source/3d/axle.cpp b/source/3d/axle.cpp index 2da94b9..c8a6dd5 100644 --- a/source/3d/axle.cpp +++ b/source/3d/axle.cpp @@ -16,10 +16,10 @@ using namespace Msp; namespace R2C2 { Axle3D::Axle3D(const Vehicle3D &v, unsigned a): - GL::ObjectInstance(*v.get_type().get_axle_object(a)), + GL::ObjectInstance(*v.get_type().get_fixed_axle_object(a)), vehicle(v.get_vehicle()), bogie(0), - axle(vehicle.get_axle(a)) + axle(vehicle.get_fixed_axle(a)) { } Axle3D::Axle3D(const Vehicle3D &v, unsigned b, unsigned a): diff --git a/source/3d/vehicle.cpp b/source/3d/vehicle.cpp index 42ac924..8e3da13 100644 --- a/source/3d/vehicle.cpp +++ b/source/3d/vehicle.cpp @@ -26,9 +26,9 @@ Vehicle3D::Vehicle3D(Layout3D &l, Vehicle &v): vehicle(v), type(layout.get_catalogue().get_vehicle(vehicle.get_type())) { - unsigned n_axles = vehicle.get_type().get_axles().size(); + unsigned n_axles = vehicle.get_type().get_fixed_axles().size(); for(unsigned i=0; i &axles = type.get_axles(); + const vector &axles = type.get_fixed_axles(); for(vector::const_iterator i=axles.begin(); i!=axles.end(); ++i) axle_objects[0].push_back(get_object(i->object)); @@ -63,7 +63,7 @@ VehicleType3D::~VehicleType3D() delete i->second; } -const GL::Object *VehicleType3D::get_axle_object(unsigned i) const +const GL::Object *VehicleType3D::get_fixed_axle_object(unsigned i) const { if(i>=axle_objects[0].size()) throw InvalidParameterValue("Axle index out of range"); diff --git a/source/3d/vehicletype.h b/source/3d/vehicletype.h index 8be9f3a..f65a1d6 100644 --- a/source/3d/vehicletype.h +++ b/source/3d/vehicletype.h @@ -1,7 +1,7 @@ /* $Id$ This file is part of R²C² -Copyright © 2010 Mikkosoft Productions, Mikko Rasa +Copyright © 2010-2011 Mikkosoft Productions, Mikko Rasa Distributed under the GPL */ @@ -32,7 +32,7 @@ public: ~VehicleType3D(); const Msp::GL::Object *get_body_object() const { return body_object; } - const Msp::GL::Object *get_axle_object(unsigned) const; + const Msp::GL::Object *get_fixed_axle_object(unsigned) const; const Msp::GL::Object *get_bogie_object(unsigned) const; const Msp::GL::Object *get_bogie_axle_object(unsigned, unsigned) const; const Msp::GL::Object *get_rod_object(unsigned) const; diff --git a/source/libr2c2/vehicle.cpp b/source/libr2c2/vehicle.cpp index 2c31ba1..b7355c6 100644 --- a/source/libr2c2/vehicle.cpp +++ b/source/libr2c2/vehicle.cpp @@ -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; diff --git a/source/libr2c2/vehicle.h b/source/libr2c2/vehicle.h index b9c36d9..ce56666 100644 --- a/source/libr2c2/vehicle.h +++ b/source/libr2c2/vehicle.h @@ -1,7 +1,7 @@ /* $Id$ This file is part of R²C² -Copyright © 2010 Mikkosoft Productions, Mikko Rasa +Copyright © 2010-2011 Mikkosoft Productions, Mikko Rasa Distributed under the GPL */ @@ -101,7 +101,7 @@ public: float get_offset() const { return track_pos.offs; } const Vector &get_position() const { return position; } float get_direction() const { return direction; } - const Axle &get_axle(unsigned) const; + const Axle &get_fixed_axle(unsigned) const; const Bogie &get_bogie(unsigned) const; const Axle &get_bogie_axle(unsigned, unsigned) const; const Rod &get_rod(unsigned) const; diff --git a/source/libr2c2/vehicletype.cpp b/source/libr2c2/vehicletype.cpp index 7b355ac..52dc7b0 100644 --- a/source/libr2c2/vehicletype.cpp +++ b/source/libr2c2/vehicletype.cpp @@ -1,7 +1,7 @@ /* $Id$ This file is part of R²C² -Copyright © 2010 Mikkosoft Productions, Mikko Rasa +Copyright © 2010-2011 Mikkosoft Productions, Mikko Rasa Distributed under the GPL */ @@ -27,7 +27,7 @@ unsigned VehicleType::get_max_function() const 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"); diff --git a/source/libr2c2/vehicletype.h b/source/libr2c2/vehicletype.h index 97942af..461a3be 100644 --- a/source/libr2c2/vehicletype.h +++ b/source/libr2c2/vehicletype.h @@ -1,7 +1,7 @@ /* $Id$ This file is part of R²C² -Copyright © 2010 Mikkosoft Productions, Mikko Rasa +Copyright © 2010-2011 Mikkosoft Productions, Mikko Rasa Distributed under the GPL */ @@ -153,8 +153,8 @@ public: float get_length() const { return length; } float get_width() const { return width; } float get_height() const { return height; } - const AxleArray &get_axles() const { return axles; } - const Axle &get_axle(unsigned) const; + const AxleArray &get_fixed_axles() const { return axles; } + const Axle &get_fixed_axle(unsigned) const; const BogieArray &get_bogies() const { return bogies; } const Bogie &get_bogie(unsigned) const; const Axle &get_bogie_axle(unsigned, unsigned) const;