mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-15 18:39:51 +00:00
More cleaning up.
This commit is contained in:
parent
2447f0f4aa
commit
c652cb1568
@ -47,7 +47,6 @@ namespace MWMechanics
|
|||||||
|
|
||||||
mStartTime = MWBase::Environment::get().getWorld()->getTimeStamp();
|
mStartTime = MWBase::Environment::get().getWorld()->getTimeStamp();
|
||||||
mPlayedIdle = 0;
|
mPlayedIdle = 0;
|
||||||
//mPathgrid = NULL;
|
|
||||||
mIdleChanceMultiplier =
|
mIdleChanceMultiplier =
|
||||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find("fIdleChanceMultiplier")->getFloat();
|
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: 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
|
* TODO: It would be great if door opening/closing can be detected and pathgrid
|
||||||
* links dynamically updated. Currently (0.29.0) AiWander allows destination
|
* links dynamically updated. Currently (0.29.0) AiWander allows choosing a
|
||||||
* beyond closed doors which sometimes makes the actors stuck at the door and
|
* destination beyond closed doors which sometimes makes the actors stuck at the
|
||||||
* impossible for the player to open the door.
|
* 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
|
* 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
|
* 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
|
* re-calculated. However this would not be an issue in most cases since hostile
|
||||||
* enter combat (i.e. no longer wandering)
|
* actors will enter combat (i.e. no longer wandering) and different pathfinding
|
||||||
|
* will kick in.
|
||||||
*/
|
*/
|
||||||
bool AiWander::execute (const MWWorld::Ptr& actor,float duration)
|
bool AiWander::execute (const MWWorld::Ptr& actor,float duration)
|
||||||
{
|
{
|
||||||
@ -473,8 +473,8 @@ namespace MWMechanics
|
|||||||
ESM::Pathgrid::Point pt = paths.back();
|
ESM::Pathgrid::Point pt = paths.back();
|
||||||
for(int j = 0; j < nodes.size(); j++)
|
for(int j = 0; j < nodes.size(); j++)
|
||||||
{
|
{
|
||||||
// NOTE: doesn't hadle a door with the same X/Y
|
// FIXME: doesn't hadle a door with the same X/Y
|
||||||
// coordinates but with a different Z
|
// co-ordinates but with a different Z
|
||||||
if(nodes[j].mX == pt.mX && nodes[j].mY == pt.mY)
|
if(nodes[j].mX == pt.mX && nodes[j].mY == pt.mY)
|
||||||
{
|
{
|
||||||
nodes.erase(nodes.begin() + j);
|
nodes.erase(nodes.begin() + j);
|
||||||
|
@ -65,13 +65,10 @@ namespace MWMechanics
|
|||||||
const PathFinder& pathfinder);
|
const PathFinder& pathfinder);
|
||||||
|
|
||||||
PathFinder mPathFinder;
|
PathFinder mPathFinder;
|
||||||
//const ESM::Pathgrid *mPathgrid;
|
|
||||||
|
|
||||||
ObstacleCheck mObstacleCheck;
|
ObstacleCheck mObstacleCheck;
|
||||||
float mDoorCheckDuration;
|
float mDoorCheckDuration;
|
||||||
int mStuckCount;
|
int mStuckCount;
|
||||||
|
|
||||||
//float mReaction;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,16 +44,7 @@ namespace MWMechanics
|
|||||||
MWWorld::LiveCellRef<ESM::Door>& ref = *it;
|
MWWorld::LiveCellRef<ESM::Door>& ref = *it;
|
||||||
if(pos.squaredDistance(Ogre::Vector3(ref.mRef.mPos.pos)) < minSqr &&
|
if(pos.squaredDistance(Ogre::Vector3(ref.mRef.mPos.pos)) < minSqr &&
|
||||||
ref.mData.getLocalRotation().rot[2] == (closed ? 0 : 1))
|
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 true; // found, stop searching
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return false; // none found
|
return false; // none found
|
||||||
}
|
}
|
||||||
@ -158,12 +149,6 @@ namespace MWMechanics
|
|||||||
return true;
|
return true;
|
||||||
else
|
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
|
// tried to evade, assume all is ok and start again
|
||||||
mWalkState = State_Norm;
|
mWalkState = State_Norm;
|
||||||
mEvadeDuration = 0;
|
mEvadeDuration = 0;
|
||||||
|
@ -231,7 +231,7 @@ namespace MWMechanics
|
|||||||
// deleting allowed nodes if not. Hence a path needs to be created
|
// deleting allowed nodes if not. Hence a path needs to be created
|
||||||
// even if the start and the end points are the same.
|
// even if the start and the end points are the same.
|
||||||
// NOTE: aStarSearch will return an empty path if the start and end
|
// NOTE: aStarSearch will return an empty path if the start and end
|
||||||
// nodes are the same
|
// nodes are the same
|
||||||
if(startNode == endNode.first)
|
if(startNode == endNode.first)
|
||||||
{
|
{
|
||||||
mPath.push_back(endPoint);
|
mPath.push_back(endPoint);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user