mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-31 21:45:35 +00:00
consider empty paths as not constructed
This commit is contained in:
parent
57c92673bc
commit
2a583e2337
3 changed files with 6 additions and 17 deletions
|
@ -158,8 +158,10 @@ bool MWMechanics::AiPackage::pathTo(const MWWorld::Ptr& actor, const osg::Vec3f&
|
|||
zTurn(actor, getZAngleToPoint(position, dest));
|
||||
smoothTurn(actor, getXAngleToPoint(position, dest), 0);
|
||||
world->removeActorPath(actor);
|
||||
return isDestReached || mPathFinder.pathWasPossible();
|
||||
return true;
|
||||
}
|
||||
else if (mPathFinder.getPath().empty())
|
||||
return false;
|
||||
|
||||
world->updateActorPath(actor, mPathFinder.getPath(), halfExtents, position, dest);
|
||||
|
||||
|
|
|
@ -318,7 +318,6 @@ namespace MWMechanics
|
|||
mPath.clear();
|
||||
mPath.push_back(endPoint);
|
||||
mConstructed = true;
|
||||
mPossible = true;
|
||||
}
|
||||
|
||||
void PathFinder::buildPathByPathgrid(const osg::Vec3f& startPoint, const osg::Vec3f& endPoint,
|
||||
|
@ -329,8 +328,7 @@ namespace MWMechanics
|
|||
|
||||
buildPathByPathgridImpl(startPoint, endPoint, pathgridGraph, std::back_inserter(mPath));
|
||||
|
||||
mConstructed = true;
|
||||
mPossible = !mPath.empty();
|
||||
mConstructed = !mPath.empty();
|
||||
}
|
||||
|
||||
void PathFinder::buildPathByNavMesh(const MWWorld::ConstPtr& actor, const osg::Vec3f& startPoint,
|
||||
|
@ -343,8 +341,7 @@ namespace MWMechanics
|
|||
if (!buildPathByNavigatorImpl(actor, startPoint, endPoint, halfExtents, flags, areaCosts, std::back_inserter(mPath)))
|
||||
mPath.push_back(endPoint);
|
||||
|
||||
mConstructed = true;
|
||||
mPossible = !mPath.empty();
|
||||
mConstructed = !mPath.empty();
|
||||
}
|
||||
|
||||
void PathFinder::buildPath(const MWWorld::ConstPtr& actor, const osg::Vec3f& startPoint, const osg::Vec3f& endPoint,
|
||||
|
@ -369,8 +366,7 @@ namespace MWMechanics
|
|||
if (!hasNavMesh && mPath.empty())
|
||||
mPath.push_back(endPoint);
|
||||
|
||||
mConstructed = true;
|
||||
mPossible = !mPath.empty();
|
||||
mConstructed = !mPath.empty();
|
||||
}
|
||||
|
||||
bool PathFinder::buildPathByNavigatorImpl(const MWWorld::ConstPtr& actor, const osg::Vec3f& startPoint,
|
||||
|
|
|
@ -74,7 +74,6 @@ namespace MWMechanics
|
|||
public:
|
||||
PathFinder()
|
||||
: mConstructed(false)
|
||||
, mPossible(false)
|
||||
, mCell(nullptr)
|
||||
{
|
||||
}
|
||||
|
@ -82,7 +81,6 @@ namespace MWMechanics
|
|||
void clearPath()
|
||||
{
|
||||
mConstructed = false;
|
||||
mPossible = false;
|
||||
mPath.clear();
|
||||
mCell = nullptr;
|
||||
}
|
||||
|
@ -111,11 +109,6 @@ namespace MWMechanics
|
|||
return mConstructed && mPath.empty();
|
||||
}
|
||||
|
||||
bool pathWasPossible() const
|
||||
{
|
||||
return mPossible;
|
||||
}
|
||||
|
||||
/// In radians
|
||||
float getZAngleToNext(float x, float y) const;
|
||||
|
||||
|
@ -144,7 +137,6 @@ namespace MWMechanics
|
|||
void addPointToPath(const osg::Vec3f& point)
|
||||
{
|
||||
mConstructed = true;
|
||||
mPossible = true;
|
||||
mPath.push_back(point);
|
||||
}
|
||||
|
||||
|
@ -204,7 +196,6 @@ namespace MWMechanics
|
|||
|
||||
private:
|
||||
bool mConstructed;
|
||||
bool mPossible;
|
||||
std::deque<osg::Vec3f> mPath;
|
||||
|
||||
const MWWorld::CellStore* mCell;
|
||||
|
|
Loading…
Reference in a new issue