]> git.tdb.fi Git - r2c2.git/blobdiff - source/libr2c2/vehicle.cpp
Use beam gates for positioning vehicles
[r2c2.git] / source / libr2c2 / vehicle.cpp
index 457cb332dc2f5148327988ad797184205fee632a..a8c3b48dc2f925e9b00812799f4f4afd0c77c95d 100644 (file)
@@ -16,6 +16,7 @@ namespace R2C2 {
 Vehicle::Vehicle(Layout &l, const VehicleType &t):
        Object(l),
        type(t),
+       train(0),
        next(0),
        prev(0),
        front_sensor(0),
@@ -45,6 +46,11 @@ Vehicle *Vehicle::clone(Layout *to_layout) const
        return veh;
 }
 
+void Vehicle::set_train(Train *t)
+{
+       train = t;
+}
+
 void Vehicle::attach_back(Vehicle &veh)
 {
        if(next || veh.prev)
@@ -200,6 +206,7 @@ void Vehicle::update_position()
        position = tp.pos;
        position.z += layout.get_catalogue().get_rail_elevation();
        rotation = tp.dir;
+       signal_moved.emit();
 }
 
 void Vehicle::update_position_from(const Vehicle &veh)