mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-21 21:09:40 +00:00
Use if-continue to skip build path
This commit is contained in:
parent
5e12073b47
commit
e82d65a2c7
1 changed files with 17 additions and 14 deletions
|
@ -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…
Reference in a new issue