From 26a8dbeae14c685c6aef1aad3aa75c6f1a75e458 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Thu, 31 Oct 2013 00:00:39 +0200 Subject: [PATCH] Don't collide rays with unplaced vehicles --- source/libr2c2/vehicle.cpp | 8 ++++++++ source/libr2c2/vehicle.h | 2 ++ 2 files changed, 10 insertions(+) diff --git a/source/libr2c2/vehicle.cpp b/source/libr2c2/vehicle.cpp index 79e3cbe..02fb1af 100644 --- a/source/libr2c2/vehicle.cpp +++ b/source/libr2c2/vehicle.cpp @@ -355,6 +355,14 @@ int Vehicle::get_link_slot(const Object &other) const return -1; } +bool Vehicle::collide_ray(const Ray &ray) const +{ + if(is_placed()) + return Object::collide_ray(ray); + else + return false; +} + Vehicle::Axle::Axle(const VehicleType::Axle &t): type(&t) diff --git a/source/libr2c2/vehicle.h b/source/libr2c2/vehicle.h index 11e51d5..33ca728 100644 --- a/source/libr2c2/vehicle.h +++ b/source/libr2c2/vehicle.h @@ -107,6 +107,8 @@ public: virtual unsigned get_n_link_slots() const; virtual Vehicle *get_link(unsigned) const; virtual int get_link_slot(const Object &) const; + + virtual bool collide_ray(const Ray &) const; }; } // namespace R2C2 -- 2.45.2