From 762fb78d53f8be2003944fbdcc84f87e7851f453 Mon Sep 17 00:00:00 2001 From: =?utf8?q?R=C3=A9mi=20Verschelde?= Date: Sun, 29 Jan 2017 23:47:50 +0100 Subject: [PATCH] Fix feedback on prev commits from MCMic --- Source/GameDraw.cpp | 2 +- Source/Objects/Person.cpp | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Source/GameDraw.cpp b/Source/GameDraw.cpp index fd21a64..de4d97d 100644 --- a/Source/GameDraw.cpp +++ b/Source/GameDraw.cpp @@ -664,7 +664,7 @@ int Game::DrawGLScene(StereoSide side) } } - /* Drowing dialogs */ + /* Drawing dialogs */ if (Dialog::inDialog() && !mainmenu) { glDisable(GL_DEPTH_TEST); glDisable(GL_CULL_FACE); diff --git a/Source/Objects/Person.cpp b/Source/Objects/Person.cpp index 27bd61d..55b6209 100644 --- a/Source/Objects/Person.cpp +++ b/Source/Objects/Person.cpp @@ -8443,10 +8443,11 @@ void Person::doAI() //chase player XYZ rotatetarget = Person::players[0]->coords + Person::players[0]->velocity; XYZ targetpoint = Person::players[0]->coords; - if (findLength(&velocity) != 0 && + float vellength = findLength(&velocity); + if (vellength != 0 && distsq(&Person::players[0]->coords, &coords) < distsq(&rotatetarget, &coords)) { targetpoint += Person::players[0]->velocity * - findDistance(&Person::players[0]->coords, &coords) / findLength(&velocity); + findDistance(&Person::players[0]->coords, &coords) / vellength; } targetyaw = roughDirectionTo(coords, targetpoint); lookyaw = targetyaw; -- 2.39.5