mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-27 12:35:46 +00:00
Use if-continue to skip build path
This commit is contained in:
parent
5e12073b47
commit
e82d65a2c7
@ -309,22 +309,25 @@ namespace MWMechanics
|
|||||||
mDestination = osg::Vec3f(destinationX, destinationY, destinationZ);
|
mDestination = osg::Vec3f(destinationX, destinationY, destinationZ);
|
||||||
|
|
||||||
// Check if land creature will walk onto water or if water creature will swim onto land
|
// Check if land creature will walk onto water or if water creature will swim onto land
|
||||||
if ((!isWaterCreature && !destinationIsAtWater(actor, mDestination)) ||
|
if (!isWaterCreature && destinationIsAtWater(actor, mDestination))
|
||||||
(isWaterCreature && !destinationThroughGround(currentPosition, mDestination)))
|
continue;
|
||||||
{
|
|
||||||
const osg::Vec3f halfExtents = MWBase::Environment::get().getWorld()->getPathfindingHalfExtents(actor);
|
|
||||||
mPathFinder.buildPath(actor, currentPosition, mDestination, actor.getCell(),
|
|
||||||
getPathGridGraph(actor.getCell()), halfExtents, getNavigatorFlags(actor));
|
|
||||||
mPathFinder.addPointToPath(mDestination);
|
|
||||||
|
|
||||||
if (mPathFinder.isPathConstructed())
|
if (isWaterCreature && destinationThroughGround(currentPosition, mDestination))
|
||||||
{
|
continue;
|
||||||
storage.setState(AiWanderStorage::Wander_Walking, true);
|
|
||||||
mHasDestination = true;
|
const osg::Vec3f halfExtents = MWBase::Environment::get().getWorld()->getPathfindingHalfExtents(actor);
|
||||||
mUsePathgrid = false;
|
mPathFinder.buildPath(actor, currentPosition, mDestination, actor.getCell(),
|
||||||
}
|
getPathGridGraph(actor.getCell()), halfExtents, getNavigatorFlags(actor));
|
||||||
return;
|
mPathFinder.addPointToPath(mDestination);
|
||||||
|
|
||||||
|
if (mPathFinder.isPathConstructed())
|
||||||
|
{
|
||||||
|
storage.setState(AiWanderStorage::Wander_Walking, true);
|
||||||
|
mHasDestination = true;
|
||||||
|
mUsePathgrid = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
} while (--attempts);
|
} while (--attempts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user