More cleaning up.

actorid
cc9cii 11 years ago
parent 2447f0f4aa
commit c652cb1568

@ -47,7 +47,6 @@ namespace MWMechanics
mStartTime = MWBase::Environment::get().getWorld()->getTimeStamp();
mPlayedIdle = 0;
//mPathgrid = NULL;
mIdleChanceMultiplier =
MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find("fIdleChanceMultiplier")->getFloat();
@ -104,14 +103,15 @@ namespace MWMechanics
* TODO: non-time critical operations should be run once every 250ms or so.
*
* TODO: It would be great if door opening/closing can be detected and pathgrid
* links dynamically updated. Currently (0.29.0) AiWander allows destination
* beyond closed doors which sometimes makes the actors stuck at the door and
* impossible for the player to open the door.
* links dynamically updated. Currently (0.29.0) AiWander allows choosing a
* destination beyond closed doors which sometimes makes the actors stuck at the
* door and impossible for the player to open the door.
*
* For now detect being stuck at the door and simply delete the nodes from the
* allowed set. The issue is when the door opens the allowed set is not
* re-calculated. Normally this would not be an issue since hostile actors will
* enter combat (i.e. no longer wandering)
* re-calculated. However this would not be an issue in most cases since hostile
* actors will enter combat (i.e. no longer wandering) and different pathfinding
* will kick in.
*/
bool AiWander::execute (const MWWorld::Ptr& actor,float duration)
{
@ -473,8 +473,8 @@ namespace MWMechanics
ESM::Pathgrid::Point pt = paths.back();
for(int j = 0; j < nodes.size(); j++)
{
// NOTE: doesn't hadle a door with the same X/Y
// coordinates but with a different Z
// FIXME: doesn't hadle a door with the same X/Y
// co-ordinates but with a different Z
if(nodes[j].mX == pt.mX && nodes[j].mY == pt.mY)
{
nodes.erase(nodes.begin() + j);

@ -65,13 +65,10 @@ namespace MWMechanics
const PathFinder& pathfinder);
PathFinder mPathFinder;
//const ESM::Pathgrid *mPathgrid;
ObstacleCheck mObstacleCheck;
float mDoorCheckDuration;
int mStuckCount;
//float mReaction;
};
}

@ -44,16 +44,7 @@ namespace MWMechanics
MWWorld::LiveCellRef<ESM::Door>& ref = *it;
if(pos.squaredDistance(Ogre::Vector3(ref.mRef.mPos.pos)) < minSqr &&
ref.mData.getLocalRotation().rot[2] == (closed ? 0 : 1))
{
//#if 0
std::cout << "\""+actor.getClass().getName(actor)+"\" "
<<"next to door "+ref.mRef.mRefID
//+", enabled? "+std::to_string(ref.mData.isEnabled())
+", dist "+std::to_string(sqrt(pos.squaredDistance(Ogre::Vector3(ref.mRef.mPos.pos))))
<< std::endl;
//#endif
return true; // found, stop searching
}
}
return false; // none found
}
@ -158,12 +149,6 @@ namespace MWMechanics
return true;
else
{
//#if 0
std::cout << "evade \""+actor.getClass().getName(actor)+"\" "
//<<"dist spot "+std::to_string(mDistSameSpot)
//+", speed "+std::to_string(cls.getSpeed(actor))
<< std::endl;
//#endif
// tried to evade, assume all is ok and start again
mWalkState = State_Norm;
mEvadeDuration = 0;

@ -231,7 +231,7 @@ namespace MWMechanics
// deleting allowed nodes if not. Hence a path needs to be created
// even if the start and the end points are the same.
// NOTE: aStarSearch will return an empty path if the start and end
// nodes are the same
// nodes are the same
if(startNode == endNode.first)
{
mPath.push_back(endPoint);

Loading…
Cancel
Save