forked from teamnwah/openmw-tes3coop
Merge remote-tracking branch 'dteviot/FixRunningInCircles'
This commit is contained in:
commit
5a5c2bb5bc
3 changed files with 4 additions and 20 deletions
|
@ -4,8 +4,6 @@
|
|||
#include "pathfinding.hpp"
|
||||
#include <components/esm/defs.hpp>
|
||||
|
||||
#include "../mwworld/cellstore.hpp"
|
||||
|
||||
#include "obstacle.hpp"
|
||||
#include "aistate.hpp"
|
||||
|
||||
|
@ -16,6 +14,7 @@ namespace MWWorld
|
|||
|
||||
namespace ESM
|
||||
{
|
||||
struct Cell;
|
||||
namespace AiSequence
|
||||
{
|
||||
struct AiSequence;
|
||||
|
|
|
@ -114,8 +114,7 @@ namespace MWMechanics
|
|||
}
|
||||
|
||||
PathFinder::PathFinder()
|
||||
: mIsPathConstructed(false),
|
||||
mPathgrid(NULL),
|
||||
: mPathgrid(NULL),
|
||||
mCell(NULL)
|
||||
{
|
||||
}
|
||||
|
@ -124,7 +123,6 @@ namespace MWMechanics
|
|||
{
|
||||
if(!mPath.empty())
|
||||
mPath.clear();
|
||||
mIsPathConstructed = false;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -180,7 +178,6 @@ namespace MWMechanics
|
|||
static_cast<float>(endPoint.mX), static_cast<float>(endPoint.mY), static_cast<float>(endPoint.mZ)))
|
||||
{
|
||||
mPath.push_back(endPoint);
|
||||
mIsPathConstructed = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -197,7 +194,6 @@ namespace MWMechanics
|
|||
if(!mPathgrid || mPathgrid->mPoints.empty())
|
||||
{
|
||||
mPath.push_back(endPoint);
|
||||
mIsPathConstructed = true;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -235,7 +231,6 @@ namespace MWMechanics
|
|||
if(startNode == endNode.first)
|
||||
{
|
||||
mPath.push_back(endPoint);
|
||||
mIsPathConstructed = true;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -243,7 +238,6 @@ namespace MWMechanics
|
|||
|
||||
if(!mPath.empty())
|
||||
{
|
||||
mIsPathConstructed = true;
|
||||
// Add the destination (which may be different to the closest
|
||||
// pathgrid point). However only add if endNode was the closest
|
||||
// point to endPoint.
|
||||
|
@ -256,14 +250,8 @@ namespace MWMechanics
|
|||
if(endNode.second)
|
||||
mPath.push_back(endPoint);
|
||||
}
|
||||
else
|
||||
mIsPathConstructed = false;
|
||||
}
|
||||
else
|
||||
mIsPathConstructed = false;
|
||||
}
|
||||
else
|
||||
mIsPathConstructed = false;
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -271,7 +259,7 @@ namespace MWMechanics
|
|||
float PathFinder::getZAngleToNext(float x, float y) const
|
||||
{
|
||||
// This should never happen (programmers should have an if statement checking
|
||||
// mIsPathConstructed that prevents this call if otherwise).
|
||||
// isPathConstructed that prevents this call if otherwise).
|
||||
if(mPath.empty())
|
||||
return 0.;
|
||||
|
||||
|
@ -293,7 +281,6 @@ namespace MWMechanics
|
|||
mPath.pop_front();
|
||||
if(mPath.empty())
|
||||
{
|
||||
mIsPathConstructed = false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ namespace MWMechanics
|
|||
|
||||
bool isPathConstructed() const
|
||||
{
|
||||
return mIsPathConstructed;
|
||||
return !mPath.empty();
|
||||
}
|
||||
|
||||
int getPathSize() const
|
||||
|
@ -96,8 +96,6 @@ namespace MWMechanics
|
|||
|
||||
private:
|
||||
|
||||
bool mIsPathConstructed;
|
||||
|
||||
std::list<ESM::Pathgrid::Point> mPath;
|
||||
|
||||
const ESM::Pathgrid *mPathgrid;
|
||||
|
|
Loading…
Reference in a new issue