From: Mikko Rasa Date: Wed, 30 Oct 2013 22:00:39 +0000 (+0200) Subject: Don't collide rays with unplaced vehicles X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=26a8dbeae14c685c6aef1aad3aa75c6f1a75e458;p=r2c2.git Don't collide rays with unplaced vehicles --- 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