From 2c6daa74a9e5afbba4e29b27e6f0baf354d1ad76 Mon Sep 17 00:00:00 2001 From: elsid Date: Sat, 18 Aug 2018 13:51:31 +0300 Subject: [PATCH] Simplify PathFinder::checkPathCompleted --- apps/openmw/mwmechanics/pathfinding.cpp | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/apps/openmw/mwmechanics/pathfinding.cpp b/apps/openmw/mwmechanics/pathfinding.cpp index 410bde5127..b2b96539ac 100644 --- a/apps/openmw/mwmechanics/pathfinding.cpp +++ b/apps/openmw/mwmechanics/pathfinding.cpp @@ -265,19 +265,10 @@ namespace MWMechanics bool PathFinder::checkPathCompleted(float x, float y, float tolerance) { - if(mPath.empty()) - return true; - - if (sqrDistanceIgnoreZ(mPath.front(), x, y) < tolerance*tolerance) - { + if (!mPath.empty() && sqrDistanceIgnoreZ(mPath.front(), x, y) < tolerance*tolerance) mPath.pop_front(); - if(mPath.empty()) - { - return true; - } - } - return false; + return mPath.empty(); } // see header for the rationale