forked from teamnwah/openmw-tes3coop
Cleanup debug statements.
This commit is contained in:
parent
98f77714ce
commit
325d0616bb
1 changed files with 6 additions and 79 deletions
|
@ -225,9 +225,6 @@ namespace MWMechanics
|
||||||
if(mCell != cell || !mPathgrid)
|
if(mCell != cell || !mPathgrid)
|
||||||
{
|
{
|
||||||
mCell = cell;
|
mCell = cell;
|
||||||
|
|
||||||
// Cache pathgrid as mPathgrid and update on cell changes. There
|
|
||||||
// might be a small gain in avoiding to search for it.
|
|
||||||
mPathgrid = MWBase::Environment::get().getWorld()->getStore().get<ESM::Pathgrid>().search(*mCell->getCell());
|
mPathgrid = MWBase::Environment::get().getWorld()->getStore().get<ESM::Pathgrid>().search(*mCell->getCell());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -236,13 +233,6 @@ namespace MWMechanics
|
||||||
// physics take care of any blockages.
|
// physics take care of any blockages.
|
||||||
if(!mPathgrid || mPathgrid->mPoints.empty())
|
if(!mPathgrid || mPathgrid->mPoints.empty())
|
||||||
{
|
{
|
||||||
//#if 0
|
|
||||||
std::cout << "no pathgrid " <<
|
|
||||||
+"\"" +mCell->getCell()->mName+ "\""
|
|
||||||
+", " +std::to_string(mCell->getCell()->mData.mX)
|
|
||||||
+", " +std::to_string(mCell->getCell()->mData.mY)
|
|
||||||
<< std::endl;
|
|
||||||
//#endif
|
|
||||||
mPath.push_back(endPoint);
|
mPath.push_back(endPoint);
|
||||||
mIsPathConstructed = true;
|
mIsPathConstructed = true;
|
||||||
return;
|
return;
|
||||||
|
@ -257,16 +247,6 @@ namespace MWMechanics
|
||||||
yCell = mCell->getCell()->mData.mY * ESM::Land::REAL_SIZE;
|
yCell = mCell->getCell()->mData.mY * ESM::Land::REAL_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// NOTE: It is possible that getClosestPoint returns a pathgrind point index
|
// NOTE: It is possible that getClosestPoint returns a pathgrind point index
|
||||||
// that is unreachable in some situations. e.g. actor is standing
|
// that is unreachable in some situations. e.g. actor is standing
|
||||||
// outside an area enclosed by walls, but there is a pathgrid
|
// outside an area enclosed by walls, but there is a pathgrid
|
||||||
|
@ -280,14 +260,7 @@ namespace MWMechanics
|
||||||
std::pair<int, bool> endNode = getClosestReachablePoint(mPathgrid, cell,
|
std::pair<int, bool> endNode = getClosestReachablePoint(mPathgrid, cell,
|
||||||
Ogre::Vector3(endPoint.mX - xCell, endPoint.mY - yCell, endPoint.mZ),
|
Ogre::Vector3(endPoint.mX - xCell, endPoint.mY - yCell, endPoint.mZ),
|
||||||
startNode);
|
startNode);
|
||||||
//#if 0
|
|
||||||
if(!mPathgrid)
|
|
||||||
std::cout << "no pathgrid " <<
|
|
||||||
+"\"" +mCell->getCell()->mName+ "\""
|
|
||||||
+", " +std::to_string(mCell->getCell()->mData.mX)
|
|
||||||
+", " +std::to_string(mCell->getCell()->mData.mY)
|
|
||||||
<< std::endl;
|
|
||||||
//#endif
|
|
||||||
// this shouldn't really happen, but just in case
|
// this shouldn't really happen, but just in case
|
||||||
if(endNode.first != -1)
|
if(endNode.first != -1)
|
||||||
{
|
{
|
||||||
|
@ -309,33 +282,14 @@ namespace MWMechanics
|
||||||
mPath.push_back(endPoint);
|
mPath.push_back(endPoint);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
mIsPathConstructed = false;
|
mIsPathConstructed = false;
|
||||||
std::cout << "empty path error " << std::endl;
|
|
||||||
}
|
|
||||||
//mIsPathConstructed = false;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
mIsPathConstructed = false;
|
mIsPathConstructed = false;
|
||||||
std::cout << "second point error " << std::endl;
|
|
||||||
}
|
|
||||||
//mIsPathConstructed = false;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
// FIXME: shouldn't return endpoint if first point error?
|
|
||||||
mIsPathConstructed = false;
|
mIsPathConstructed = false;
|
||||||
std::cout << "first point error " << std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
if(!mIsPathConstructed)
|
|
||||||
{
|
|
||||||
mPath.push_back(endPoint);
|
|
||||||
mIsPathConstructed = true;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -464,18 +418,13 @@ namespace MWMechanics
|
||||||
bool PathgridGraph::initPathgridGraph(const ESM::Cell* cell)
|
bool PathgridGraph::initPathgridGraph(const ESM::Cell* cell)
|
||||||
{
|
{
|
||||||
if(!cell)
|
if(!cell)
|
||||||
{
|
|
||||||
std::cout << "init error " << std::endl;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
mCell = cell;
|
mCell = cell;
|
||||||
mPathgrid = MWBase::Environment::get().getWorld()->getStore().get<ESM::Pathgrid>().search(*cell);
|
mPathgrid = MWBase::Environment::get().getWorld()->getStore().get<ESM::Pathgrid>().search(*cell);
|
||||||
|
|
||||||
if(!mPathgrid)
|
if(!mPathgrid)
|
||||||
{
|
|
||||||
std::cout << "init error " << std::endl;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
mGraph.resize(mPathgrid->mPoints.size());
|
mGraph.resize(mPathgrid->mPoints.size());
|
||||||
for(int i = 0; i < static_cast<int> (mPathgrid->mEdges.size()); i++)
|
for(int i = 0; i < static_cast<int> (mPathgrid->mEdges.size()); i++)
|
||||||
|
@ -493,13 +442,13 @@ namespace MWMechanics
|
||||||
}
|
}
|
||||||
buildConnectedPoints();
|
buildConnectedPoints();
|
||||||
mIsGraphConstructed = true;
|
mIsGraphConstructed = true;
|
||||||
//#if 0
|
//#if 0
|
||||||
std::cout << "loading pathgrid " <<
|
std::cout << "loading pathgrid " <<
|
||||||
+"\""+ mPathgrid->mCell +"\""
|
+"\""+ mPathgrid->mCell +"\""
|
||||||
+", "+ std::to_string(mPathgrid->mData.mX)
|
+", "+ std::to_string(mPathgrid->mData.mX)
|
||||||
+", "+ std::to_string(mPathgrid->mData.mY)
|
+", "+ std::to_string(mPathgrid->mData.mY)
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
//#endif
|
//#endif
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -580,11 +529,11 @@ namespace MWMechanics
|
||||||
if(mSCCPoint[v].first == -1) // undefined (haven't visited)
|
if(mSCCPoint[v].first == -1) // undefined (haven't visited)
|
||||||
recursiveStrongConnect(v);
|
recursiveStrongConnect(v);
|
||||||
}
|
}
|
||||||
//#if 0
|
//#if 0
|
||||||
std::cout << "components: " << std::to_string(mSCCId)
|
std::cout << "components: " << std::to_string(mSCCId)
|
||||||
+", "+ mPathgrid->mCell
|
+", "+ mPathgrid->mCell
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
//#endif
|
//#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PathgridGraph::isPointConnected(const int start, const int end) const
|
bool PathgridGraph::isPointConnected(const int start, const int end) const
|
||||||
|
@ -702,32 +651,10 @@ namespace MWMechanics
|
||||||
xCell = mPathgrid->mData.mX * ESM::Land::REAL_SIZE;
|
xCell = mPathgrid->mData.mX * ESM::Land::REAL_SIZE;
|
||||||
yCell = mPathgrid->mData.mY * ESM::Land::REAL_SIZE;
|
yCell = mPathgrid->mData.mY * ESM::Land::REAL_SIZE;
|
||||||
}
|
}
|
||||||
//#if 0
|
|
||||||
// for debugging only
|
|
||||||
int tmp = current;
|
|
||||||
if(tmp != goal)
|
|
||||||
{
|
|
||||||
std::cout << "aStarSearch: goal and result differ" << std::endl;
|
|
||||||
std::cout << "goal: " << std::to_string(goal)
|
|
||||||
+", result: "+ std::to_string(tmp)
|
|
||||||
<< std::endl;
|
|
||||||
}
|
|
||||||
std::cout << "start: " << std::to_string(start)
|
|
||||||
+", goal: "+ std::to_string(goal)
|
|
||||||
+", result: "+ std::to_string(tmp)
|
|
||||||
<< std::endl;
|
|
||||||
//#endif
|
|
||||||
|
|
||||||
while(graphParent[current] != -1)
|
while(graphParent[current] != -1)
|
||||||
{
|
{
|
||||||
ESM::Pathgrid::Point pt = mPathgrid->mPoints[current];
|
ESM::Pathgrid::Point pt = mPathgrid->mPoints[current];
|
||||||
//#if 0
|
|
||||||
// for debugging only
|
|
||||||
std::cout << " point: "+ std::to_string(current)
|
|
||||||
+", X: "+ std::to_string(pt.mX)
|
|
||||||
+", Y: "+ std::to_string(pt.mY)
|
|
||||||
<< std::endl;
|
|
||||||
//#endif
|
|
||||||
pt.mX += xCell;
|
pt.mX += xCell;
|
||||||
pt.mY += yCell;
|
pt.mY += yCell;
|
||||||
path.push_front(pt);
|
path.push_front(pt);
|
||||||
|
|
Loading…
Reference in a new issue