]> git.tdb.fi Git - r2c2.git/blobdiff - source/libr2c2/vehicle.cpp
Detect conflicting blocks and avoid creating duplicate sensors
[r2c2.git] / source / libr2c2 / vehicle.cpp
index 2ad716600f50a293ae07c1fa47be0e47fdd4268c..02fb1afce6d4c719367560d3dbf677e208b1c795 100644 (file)
@@ -33,6 +33,8 @@ Vehicle::Vehicle(Layout &l, const VehicleType &t):
                for(unsigned j=0; j<i->axles.size(); ++j)
                        i->axles[j] = &axles[i->type->first_axle+j];
 
+       update_rods();
+
        layout.add(*this);
 }
 
@@ -353,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)