From 4700adb8c09be88528e146cad94376e24d8ce3a1 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Tue, 5 Sep 2017 03:36:25 +0200 Subject: [PATCH] rwengine: std::map::end returns an iterator to the past-the-end element Use std::map::rbegin instead --- rwengine/src/data/CutsceneData.hpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/rwengine/src/data/CutsceneData.hpp b/rwengine/src/data/CutsceneData.hpp index 50d88f05..175814da 100644 --- a/rwengine/src/data/CutsceneData.hpp +++ b/rwengine/src/data/CutsceneData.hpp @@ -35,13 +35,13 @@ struct CutsceneTracks { std::map zoom; std::map rotation; std::map position; - std::map - target; /// Rotation is around the direction to this vector + std::map target; + /* Rotation is angle around the target vector */ float duration{0.f}; glm::vec3 getPositionAt(float time) { - glm::vec3 p = position.end()->second; + glm::vec3 p = position.rbegin()->second; for (auto it = position.begin(); it != position.end(); ++it) { if (it->first <= time) { auto a = it->second; @@ -64,7 +64,7 @@ struct CutsceneTracks { } glm::vec3 getTargetAt(float time) { - glm::vec3 p = position.end()->second; + glm::vec3 p = position.rbegin()->second; for (auto it = target.begin(); it != target.end(); ++it) { if (it->first <= time) { auto a = it->second; @@ -87,7 +87,7 @@ struct CutsceneTracks { } float getZoomAt(float time) { - float r = zoom.end()->second; + float r = zoom.rbegin()->second; for (auto it = zoom.begin(); it != zoom.end(); ++it) { if (it->first <= time) { auto a = it->second; @@ -110,7 +110,7 @@ struct CutsceneTracks { } float getRotationAt(float time) { - float r = rotation.end()->second; + float r = rotation.rbegin()->second; for (auto it = rotation.begin(); it != rotation.end(); ++it) { if (it->first <= time) { auto a = it->second;