From 4562557d599fd70d32b15313ffebd976c3ddfa7d Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sun, 14 Feb 2021 16:44:00 +0000 Subject: Maintain a history of links traversed --- game/vehicles/vehicle.h | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'game/vehicles/vehicle.h') diff --git a/game/vehicles/vehicle.h b/game/vehicles/vehicle.h index d59588c..f7defb3 100644 --- a/game/vehicles/vehicle.h +++ b/game/vehicles/vehicle.h @@ -6,13 +6,26 @@ #include #include +class LinkHistory { +public: + using Entry = std::pair; + using Return = std::pair; + Return add(const LinkWPtr &, unsigned char); + Return getAt(float) const; + +private: + std::vector links; + float totalLen; +}; + class Vehicle : public WorldObject, public Physical { public: Vehicle(const LinkPtr & link, const std::string & obj, const std::string & tex); - LinkWPtr link; // Which link are we travelling along - unsigned char linkDir {0}; // Starting end e0->e1 or e1->e0 float linkDist {0}; // distance long current link float speed {50}; // speed in m/s (~75 km/h) + +protected: + LinkHistory linkHist; }; #endif -- cgit v1.2.3