]> git.tdb.fi Git - r2c2.git/blobdiff - source/libr2c2/vehicle.cpp
Make vehicles aware of which train they are in
[r2c2.git] / source / libr2c2 / vehicle.cpp
index 457cb332dc2f5148327988ad797184205fee632a..a9d5135e9d7806955148e62b8558bd854339372a 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)