X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Flibr2c2%2Fvehicle.cpp;h=d1819a0fbe5c9e652b7a165970ab0d54bdd19cae;hb=0b75458245997b9df6da47cc4534341c8426084b;hp=250aefd568064e2d3ee979d354af27626803587e;hpb=b88d3630a0e3fdd763db018bbe5dbfe3180a95f2;p=r2c2.git diff --git a/source/libr2c2/vehicle.cpp b/source/libr2c2/vehicle.cpp index 250aefd..d1819a0 100644 --- a/source/libr2c2/vehicle.cpp +++ b/source/libr2c2/vehicle.cpp @@ -398,6 +398,29 @@ TrackPoint Vehicle::get_point(const TrackPosition &pos, float tdist, float ratio return get_point(front.get_point().pos, back.get_point().pos, ratio); } +unsigned Vehicle::get_n_link_slots() const +{ + return 2; +} + +Vehicle *Vehicle::get_link(unsigned i) const +{ + if(i>=2) + throw out_of_range("Vehicle::get_link"); + + return (i==0 ? prev : next); +} + +int Vehicle::get_link_slot(const Object &other) const +{ + if(&other==prev) + return 0; + else if(&other==next) + return 1; + else + return -1; +} + Vehicle::Axle::Axle(const VehicleType::Axle &t): type(&t),