diff --git a/src/monster.cpp b/src/monster.cpp index 178ec172cd..2f0be22df5 100644 --- a/src/monster.cpp +++ b/src/monster.cpp @@ -527,30 +527,22 @@ void Monster::goToFollowCreature() FindPathParams fpp; getPathSearchParams(followCreature, fpp); - if (!isSummon()) { - Direction dir = DIRECTION_NONE; - - if (isFleeing()) { - getDistanceStep(followCreature->getPosition(), dir, true); - } else { // maxTargetDist > 1 - if (!getDistanceStep(followCreature->getPosition(), dir)) { - // if we can't get anything then let the A* calculate - updateFollowCreaturePath(fpp); - return; - } - } + const auto simpleStep = !isSummon() && (isFleeing() || fpp.maxTargetDist > 1); + if (simpleStep) { + auto direction = DIRECTION_NONE; + if (getDistanceStep(followCreature->getPosition(), direction, isFleeing())) { + hasFollowPath = true; - if (dir != DIRECTION_NONE) { - listWalkDir.clear(); - listWalkDir.push_back(dir); + if (direction != DIRECTION_NONE) { + startAutoWalk(direction); + } - hasFollowPath = true; - startAutoWalk(); + onFollowCreatureComplete(); + return; } - } else { - updateFollowCreaturePath(fpp); } + updateFollowCreaturePath(fpp); onFollowCreatureComplete(); }