mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-21 09:39:41 +00:00
Pathfinding bugfix.
Observed at Ebonheart (coe 1, -13). Especially at the western tower. Guards try to walk though tower door. Cause: buildPath() adds destination (even when unreachable) when only using single node from pathgrid.
This commit is contained in:
parent
f2c9b9351f
commit
39c2ba8efe
1 changed files with 8 additions and 13 deletions
|
@ -225,19 +225,16 @@ namespace MWMechanics
|
||||||
ESM::Pathgrid::Point temp(mPathgrid->mPoints[startNode]);
|
ESM::Pathgrid::Point temp(mPathgrid->mPoints[startNode]);
|
||||||
converter.ToWorld(temp);
|
converter.ToWorld(temp);
|
||||||
mPath.push_back(temp);
|
mPath.push_back(temp);
|
||||||
|
|
||||||
mPath.push_back(endPoint);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
mPath = mCell->aStarSearch(startNode, endNode.first);
|
|
||||||
if (mPath.empty())
|
|
||||||
return;
|
|
||||||
|
|
||||||
// convert supplied path to world co-ordinates
|
|
||||||
for (std::list<ESM::Pathgrid::Point>::iterator iter(mPath.begin()); iter != mPath.end(); ++iter)
|
|
||||||
{
|
{
|
||||||
converter.ToWorld(*iter);
|
mPath = mCell->aStarSearch(startNode, endNode.first);
|
||||||
|
|
||||||
|
// convert supplied path to world co-ordinates
|
||||||
|
for (std::list<ESM::Pathgrid::Point>::iterator iter(mPath.begin()); iter != mPath.end(); ++iter)
|
||||||
|
{
|
||||||
|
converter.ToWorld(*iter);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If endNode found is NOT the closest PathGrid point to the endPoint,
|
// If endNode found is NOT the closest PathGrid point to the endPoint,
|
||||||
|
@ -254,8 +251,6 @@ namespace MWMechanics
|
||||||
// The AI routines will have to deal with such situations.
|
// The AI routines will have to deal with such situations.
|
||||||
if(endNode.second)
|
if(endNode.second)
|
||||||
mPath.push_back(endPoint);
|
mPath.push_back(endPoint);
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
float PathFinder::getZAngleToNext(float x, float y) const
|
float PathFinder::getZAngleToNext(float x, float y) const
|
||||||
|
|
Loading…
Reference in a new issue