mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-28 14:53:58 +00:00
Use rbegin
This commit is contained in:
parent
fbaa525c6f
commit
925d909fea
@ -148,9 +148,8 @@ bool MWMechanics::AiPackage::pathTo(const MWWorld::Ptr& actor, const osg::Vec3f&
|
|||||||
if (destInLOS && mPathFinder.getPath().size() > 1)
|
if (destInLOS && mPathFinder.getPath().size() > 1)
|
||||||
{
|
{
|
||||||
// get point just before dest
|
// get point just before dest
|
||||||
auto pPointBeforeDest = mPathFinder.getPath().end();
|
auto pPointBeforeDest = mPathFinder.getPath().rbegin();
|
||||||
--pPointBeforeDest;
|
++pPointBeforeDest;
|
||||||
--pPointBeforeDest;
|
|
||||||
|
|
||||||
// if start point is closer to the target then last point of path (excluding target itself) then go straight on the target
|
// if start point is closer to the target then last point of path (excluding target itself) then go straight on the target
|
||||||
if (distance(start, dest) <= distance(dest, *pPointBeforeDest))
|
if (distance(start, dest) <= distance(dest, *pPointBeforeDest))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user