Remove redundant parameter from aStarSearch. Also update some comments.

actorid
cc9cii 11 years ago
parent 5cf8e7e933
commit f59226265a

@ -224,7 +224,7 @@ namespace MWMechanics
// this shouldn't really happen, but just in case
if(endNode.first != -1)
{
mPath = mCell->aStarSearch(startNode, endNode.first, mCell->isExterior());
mPath = mCell->aStarSearch(startNode, endNode.first);
if(!mPath.empty())
{

@ -55,6 +55,7 @@ namespace MWMechanics
, mGraph(0)
, mSCCId(0)
, mSCCIndex(0)
, mIsExterior(0)
{
}
@ -100,6 +101,7 @@ namespace MWMechanics
return false;
mCell = cell;
mIsExterior = cell->isExterior();
mPathgrid = MWBase::Environment::get().getWorld()->getStore().get<ESM::Pathgrid>().search(*cell);
if(!mPathgrid)
@ -221,11 +223,11 @@ namespace MWMechanics
*
* Should be possible to make this MT safe.
*
* Returns path (a list of pathgrid point indexes) which may be empty.
* Returns path which may be empty. path contains pathgrid points in local
* cell co-ordinates (indoors) or world co-ordinates (external).
*
* Input params:
* start, goal - pathgrid point indexes (for this cell)
* isExterior - used to determine whether to convert to world co-ordinates
*
* Variables:
* openset - point indexes to be traversed, lowest cost at the front
@ -239,8 +241,7 @@ namespace MWMechanics
* co-ordinates). Essentially trading speed w/ memory.
*/
std::list<ESM::Pathgrid::Point> PathgridGraph::aStarSearch(const int start,
const int goal,
bool isExterior) const
const int goal) const
{
std::list<ESM::Pathgrid::Point> path;
if(!isPointConnected(start, goal))
@ -316,7 +317,7 @@ namespace MWMechanics
// reconstruct path to return, using world co-ordinates
float xCell = 0;
float yCell = 0;
if (isExterior)
if (mIsExterior)
{
xCell = mPathgrid->mData.mX * ESM::Land::REAL_SIZE;
yCell = mPathgrid->mData.mY * ESM::Land::REAL_SIZE;

@ -29,12 +29,12 @@ namespace MWMechanics
// isOutside is used whether to convert path to world co-ordinates
std::list<ESM::Pathgrid::Point> aStarSearch(const int start,
const int end,
const bool isOutside) const;
const int end) const;
private:
const ESM::Cell *mCell;
const ESM::Pathgrid *mPathgrid;
bool mIsExterior;
struct ConnectedPoint // edge
{

@ -685,12 +685,10 @@ namespace MWWorld
bool CellStore::isPointConnected(const int start, const int end) const
{
return mPathgridGraph.isPointConnected(start, end);
}
std::list<ESM::Pathgrid::Point> CellStore::aStarSearch(const int start, const int end,
const bool isOutside) const
std::list<ESM::Pathgrid::Point> CellStore::aStarSearch(const int start, const int end) const
{
return mPathgridGraph.aStarSearch(start, end, isOutside);
return mPathgridGraph.aStarSearch(start, end);
}
}

@ -145,8 +145,7 @@ namespace MWWorld
bool isPointConnected(const int start, const int end) const;
std::list<ESM::Pathgrid::Point> aStarSearch(const int start, const int end,
const bool isOutside) const;
std::list<ESM::Pathgrid::Point> aStarSearch(const int start, const int end) const;
private:

Loading…
Cancel
Save