Fix Vehicle::attach_front to actually attach to the front
Initialize VehicleType::locomotive
next = &veh;
veh.prev = this;
+
+ if(track_pos.track)
+ propagate_backward();
}
void Vehicle::attach_front(Vehicle &veh)
if(prev || veh.next)
throw InvalidState("Already attached");
- next = &veh;
- veh.prev = this;
+ prev = &veh;
+ veh.next = this;
+
+ if(prev->get_track())
+ prev->propagate_backward();
}
void Vehicle::detach_back()
VehicleType::VehicleType(unsigned n):
art_nr(n),
+ locomotive(false),
length(0),
width(0),
height(0)