diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2021-02-14 16:44:00 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2021-02-14 16:44:00 +0000 |
commit | 4562557d599fd70d32b15313ffebd976c3ddfa7d (patch) | |
tree | 54d0a6798be87fb1f38f2152c12e60b1dc033639 /game/vehicles/vehicle.h | |
parent | Broken down Brush47 (diff) | |
download | ilt-4562557d599fd70d32b15313ffebd976c3ddfa7d.tar.bz2 ilt-4562557d599fd70d32b15313ffebd976c3ddfa7d.tar.xz ilt-4562557d599fd70d32b15313ffebd976c3ddfa7d.zip |
Maintain a history of links traversed
Diffstat (limited to 'game/vehicles/vehicle.h')
-rw-r--r-- | game/vehicles/vehicle.h | 17 |
1 files changed, 15 insertions, 2 deletions
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 <game/worldobject.h> #include <string> +class LinkHistory { +public: + using Entry = std::pair<LinkWPtr, unsigned char /*dir*/>; + using Return = std::pair<LinkCPtr, unsigned char /*dir*/>; + Return add(const LinkWPtr &, unsigned char); + Return getAt(float) const; + +private: + std::vector<Entry> 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 |