diff options
Diffstat (limited to 'game/vehicles/vehicle.cpp')
-rw-r--r-- | game/vehicles/vehicle.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/game/vehicles/vehicle.cpp b/game/vehicles/vehicle.cpp index 569063d..f722cff 100644 --- a/game/vehicles/vehicle.cpp +++ b/game/vehicles/vehicle.cpp @@ -24,15 +24,26 @@ LinkHistory::add(const LinkWPtr & l, unsigned char d) } LinkHistory::Return -LinkHistory::getAt(float len) const +LinkHistory::getCurrent() const +{ + return {links.front().first.lock(), links.front().second}; +} + +LinkHistory::Return +LinkHistory::getAt(float len, float * rem) const { auto litr = links.begin(); while (len > 0.F && litr != links.end()) { - len -= litr->first.lock()->length; litr++; + if (litr != links.end()) { + len -= litr->first.lock()->length; + } } if (litr == links.end()) { litr--; } + if (rem) { + *rem = -len; + } return {litr->first.lock(), litr->second}; } |