mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-26 18:35:20 +00:00
Consider a path completed if it was non-empty
This commit is contained in:
parent
cdf0bc1d8d
commit
57c92673bc
@ -158,7 +158,7 @@ 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;
|
||||
return isDestReached || mPathFinder.pathWasPossible();
|
||||
}
|
||||
|
||||
world->updateActorPath(actor, mPathFinder.getPath(), halfExtents, position, dest);
|
||||
|
@ -318,6 +318,7 @@ namespace MWMechanics
|
||||
mPath.clear();
|
||||
mPath.push_back(endPoint);
|
||||
mConstructed = true;
|
||||
mPossible = true;
|
||||
}
|
||||
|
||||
void PathFinder::buildPathByPathgrid(const osg::Vec3f& startPoint, const osg::Vec3f& endPoint,
|
||||
@ -329,6 +330,7 @@ namespace MWMechanics
|
||||
buildPathByPathgridImpl(startPoint, endPoint, pathgridGraph, std::back_inserter(mPath));
|
||||
|
||||
mConstructed = true;
|
||||
mPossible = !mPath.empty();
|
||||
}
|
||||
|
||||
void PathFinder::buildPathByNavMesh(const MWWorld::ConstPtr& actor, const osg::Vec3f& startPoint,
|
||||
@ -342,6 +344,7 @@ namespace MWMechanics
|
||||
mPath.push_back(endPoint);
|
||||
|
||||
mConstructed = true;
|
||||
mPossible = !mPath.empty();
|
||||
}
|
||||
|
||||
void PathFinder::buildPath(const MWWorld::ConstPtr& actor, const osg::Vec3f& startPoint, const osg::Vec3f& endPoint,
|
||||
@ -367,6 +370,7 @@ namespace MWMechanics
|
||||
mPath.push_back(endPoint);
|
||||
|
||||
mConstructed = true;
|
||||
mPossible = !mPath.empty();
|
||||
}
|
||||
|
||||
bool PathFinder::buildPathByNavigatorImpl(const MWWorld::ConstPtr& actor, const osg::Vec3f& startPoint,
|
||||
|
@ -74,6 +74,7 @@ namespace MWMechanics
|
||||
public:
|
||||
PathFinder()
|
||||
: mConstructed(false)
|
||||
, mPossible(false)
|
||||
, mCell(nullptr)
|
||||
{
|
||||
}
|
||||
@ -81,6 +82,7 @@ namespace MWMechanics
|
||||
void clearPath()
|
||||
{
|
||||
mConstructed = false;
|
||||
mPossible = false;
|
||||
mPath.clear();
|
||||
mCell = nullptr;
|
||||
}
|
||||
@ -109,6 +111,11 @@ namespace MWMechanics
|
||||
return mConstructed && mPath.empty();
|
||||
}
|
||||
|
||||
bool pathWasPossible() const
|
||||
{
|
||||
return mPossible;
|
||||
}
|
||||
|
||||
/// In radians
|
||||
float getZAngleToNext(float x, float y) const;
|
||||
|
||||
@ -137,6 +144,7 @@ namespace MWMechanics
|
||||
void addPointToPath(const osg::Vec3f& point)
|
||||
{
|
||||
mConstructed = true;
|
||||
mPossible = true;
|
||||
mPath.push_back(point);
|
||||
}
|
||||
|
||||
@ -196,6 +204,7 @@ namespace MWMechanics
|
||||
|
||||
private:
|
||||
bool mConstructed;
|
||||
bool mPossible;
|
||||
std::deque<osg::Vec3f> mPath;
|
||||
|
||||
const MWWorld::CellStore* mCell;
|
||||
|
Loading…
x
Reference in New Issue
Block a user