From 5405efd3b543b19fde1a4ba44fd9aeadc81ec572 Mon Sep 17 00:00:00 2001 From: elsid Date: Tue, 5 Mar 2019 09:49:56 +0300 Subject: [PATCH] Do not build path by navigator for pure water and flying creatures They don't need to move by surfaces and to open/close doors. --- apps/openmw/mwmechanics/pathfinding.cpp | 3 ++- apps/openmw/mwworld/class.cpp | 4 ++-- apps/openmw/mwworld/class.hpp | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/apps/openmw/mwmechanics/pathfinding.cpp b/apps/openmw/mwmechanics/pathfinding.cpp index 8c7d6fce9..e31da94b1 100644 --- a/apps/openmw/mwmechanics/pathfinding.cpp +++ b/apps/openmw/mwmechanics/pathfinding.cpp @@ -286,7 +286,8 @@ namespace MWMechanics mPath.clear(); mCell = cell; - buildPathByNavigatorImpl(actor, startPoint, endPoint, halfExtents, flags, std::back_inserter(mPath)); + if (!actor.getClass().isPureWaterCreature(actor) && !actor.getClass().isPureFlyingCreature(actor)) + buildPathByNavigatorImpl(actor, startPoint, endPoint, halfExtents, flags, std::back_inserter(mPath)); if (mPath.empty()) buildPathByPathgridImpl(startPoint, endPoint, pathgridGraph, std::back_inserter(mPath)); diff --git a/apps/openmw/mwworld/class.cpp b/apps/openmw/mwworld/class.cpp index 9786ed32b..472db15c5 100644 --- a/apps/openmw/mwworld/class.cpp +++ b/apps/openmw/mwworld/class.cpp @@ -407,7 +407,7 @@ namespace MWWorld return false; } - bool Class::isPureWaterCreature(const MWWorld::Ptr& ptr) const + bool Class::isPureWaterCreature(const ConstPtr& ptr) const { return canSwim(ptr) && !isBipedal(ptr) @@ -415,7 +415,7 @@ namespace MWWorld && !canWalk(ptr); } - bool Class::isPureFlyingCreature(const Ptr& ptr) const + bool Class::isPureFlyingCreature(const ConstPtr& ptr) const { return canFly(ptr) && !isBipedal(ptr) diff --git a/apps/openmw/mwworld/class.hpp b/apps/openmw/mwworld/class.hpp index af88b0dcc..2be54e7ba 100644 --- a/apps/openmw/mwworld/class.hpp +++ b/apps/openmw/mwworld/class.hpp @@ -324,8 +324,8 @@ namespace MWWorld virtual bool canFly(const MWWorld::ConstPtr& ptr) const; virtual bool canSwim(const MWWorld::ConstPtr& ptr) const; virtual bool canWalk(const MWWorld::ConstPtr& ptr) const; - bool isPureWaterCreature(const MWWorld::Ptr& ptr) const; - bool isPureFlyingCreature(const MWWorld::Ptr& ptr) const; + bool isPureWaterCreature(const MWWorld::ConstPtr& ptr) const; + bool isPureFlyingCreature(const MWWorld::ConstPtr& ptr) const; bool isPureLandCreature(const MWWorld::Ptr& ptr) const; bool isMobile(const MWWorld::Ptr& ptr) const;