]> git.jsancho.org Git - lugaru.git/commitdiff
Attempt at fixing the crash in DoAnimation
authorCôme Chilliet <come@chilliet.eu>
Sat, 10 Dec 2016 17:57:04 +0000 (00:57 +0700)
committerCôme Chilliet <come@chilliet.eu>
Sat, 10 Dec 2016 17:57:04 +0000 (00:57 +0700)
Source/Person.cpp

index a9b5983919f8b45507ce5e1f364d73b23f1b5322..acd6647a81866e4d88a86b76f3c1102f15d4e6d3 100644 (file)
@@ -4181,6 +4181,9 @@ void Person::DoAnimations()
                 oldrot = 0;
                 targetrot = 0;
             }
+            if (frameCurrent >= Animation::animations[animCurrent].frames.size()) {
+                frameCurrent = Animation::animations[animCurrent].frames.size() - 1;
+            }
             if (animCurrent != oldanimCurrent || animTarget != oldanimTarget || ((frameCurrent != oldframeCurrent || frameTarget != oldframeTarget) && !calcrot)) {
                 //Old rotates
                 for (int i = 0; i < skeleton.joints.size(); i++) {
@@ -4234,9 +4237,6 @@ void Person::DoAnimations()
                     }
                 }
             }
-            if (frameCurrent >= Animation::animations[animCurrent].frames.size()) {
-                frameCurrent = Animation::animations[animCurrent].frames.size() - 1;
-            }
 
             oldanimCurrent = animCurrent;
             oldanimTarget = animTarget;