#include "driver.h"
#include "layout.h"
#include "track.h"
+#include "trackappearance.h"
#include "trackiter.h"
#include "tracktype.h"
#include "vehicle.h"
{
if(!t)
throw invalid_argument("Vehicle::place");
+ float gauge_ratio = t->get_type().get_gauge()/type.get_gauge();
+ if(gauge_ratio<0.99 || gauge_ratio>1.01)
+ throw logic_error("Incompatible gauge");
placement.place(t, a);
{
OrientedPoint p = placement.get_point();
position = p.position;
- position.z += layout.get_catalogue().get_rail_elevation();
+ // TODO Move the z adjustment to VehiclePlacement
+ position.z += placement.get_position(VehiclePlacement::FRONT_AXLE)->get_type().get_appearance().get_rail_elevation();
rotation = p.rotation;
tilt = p.tilt;
void Vehicle::check_sensor(const TrackOffsetIter &t, unsigned &sensor, bool release)
{
- unsigned s = t->get_sensor_id();
+ unsigned s = t->get_sensor_address();
if(s!=sensor)
{
unsigned old = sensor;
return -1;
}
+bool Vehicle::collide_ray(const Ray &ray, float *d) const
+{
+ if(is_placed())
+ return Object::collide_ray(ray, d);
+ else
+ return false;
+}
+
Vehicle::Axle::Axle(const VehicleType::Axle &t):
type(&t)