From f67b7dae913352d15cff4dfc75ddcac2f82dfd06 Mon Sep 17 00:00:00 2001 From: scrawl Date: Mon, 28 Jul 2014 17:28:00 +0200 Subject: [PATCH] Sheath weapon in all Ai packages except for AiCombat --- apps/openmw/mwmechanics/aiactivate.cpp | 4 ++++ apps/openmw/mwmechanics/aiescort.cpp | 4 ++++ apps/openmw/mwmechanics/aifollow.cpp | 2 ++ apps/openmw/mwmechanics/aipursue.cpp | 2 ++ apps/openmw/mwmechanics/aitravel.cpp | 2 ++ 5 files changed, 14 insertions(+) diff --git a/apps/openmw/mwmechanics/aiactivate.cpp b/apps/openmw/mwmechanics/aiactivate.cpp index 9e01c3fe7..7310b27ab 100644 --- a/apps/openmw/mwmechanics/aiactivate.cpp +++ b/apps/openmw/mwmechanics/aiactivate.cpp @@ -5,6 +5,8 @@ #include "../mwbase/world.hpp" #include "../mwbase/environment.hpp" +#include "../mwmechanics/creaturestats.hpp" + #include "../mwworld/class.hpp" #include "../mwworld/cellstore.hpp" @@ -24,6 +26,8 @@ bool MWMechanics::AiActivate::execute (const MWWorld::Ptr& actor,float duration) ESM::Position pos = actor.getRefData().getPosition(); //position of the actor const MWWorld::Ptr target = MWBase::Environment::get().getWorld()->searchPtr(mObjectId, false); //The target to follow + actor.getClass().getCreatureStats(actor).setDrawState(DrawState_Nothing); + if(target == MWWorld::Ptr()) return true; //Target doesn't exist diff --git a/apps/openmw/mwmechanics/aiescort.cpp b/apps/openmw/mwmechanics/aiescort.cpp index 3f5724077..cc8dead8a 100644 --- a/apps/openmw/mwmechanics/aiescort.cpp +++ b/apps/openmw/mwmechanics/aiescort.cpp @@ -9,6 +9,8 @@ #include "../mwworld/cellstore.hpp" #include "../mwworld/class.hpp" +#include "../mwmechanics/creaturestats.hpp" + #include "steering.hpp" #include "movement.hpp" @@ -72,6 +74,8 @@ namespace MWMechanics return true; } + actor.getClass().getCreatureStats(actor).setDrawState(DrawState_Nothing); + const MWWorld::Ptr follower = MWBase::Environment::get().getWorld()->getPtr(mActorId, false); const float* const leaderPos = actor.getRefData().getPosition().pos; const float* const followerPos = follower.getRefData().getPosition().pos; diff --git a/apps/openmw/mwmechanics/aifollow.cpp b/apps/openmw/mwmechanics/aifollow.cpp index 13c4a9891..27d944657 100644 --- a/apps/openmw/mwmechanics/aifollow.cpp +++ b/apps/openmw/mwmechanics/aifollow.cpp @@ -35,6 +35,8 @@ bool MWMechanics::AiFollow::execute (const MWWorld::Ptr& actor,float duration) if(target == MWWorld::Ptr()) return true; //Target doesn't exist + actor.getClass().getCreatureStats(actor).setDrawState(DrawState_Nothing); + ESM::Position pos = actor.getRefData().getPosition(); //position of the actor if(!mAlwaysFollow) //Update if you only follow for a bit diff --git a/apps/openmw/mwmechanics/aipursue.cpp b/apps/openmw/mwmechanics/aipursue.cpp index 60f671c12..2995a8c36 100644 --- a/apps/openmw/mwmechanics/aipursue.cpp +++ b/apps/openmw/mwmechanics/aipursue.cpp @@ -38,6 +38,8 @@ bool AiPursue::execute (const MWWorld::Ptr& actor, float duration) if(target == MWWorld::Ptr()) return true; //Target doesn't exist + actor.getClass().getCreatureStats(actor).setDrawState(DrawState_Nothing); + //Set the target desition from the actor ESM::Pathgrid::Point dest = target.getRefData().getPosition().pos; diff --git a/apps/openmw/mwmechanics/aitravel.cpp b/apps/openmw/mwmechanics/aitravel.cpp index db137037d..3fd4704d9 100644 --- a/apps/openmw/mwmechanics/aitravel.cpp +++ b/apps/openmw/mwmechanics/aitravel.cpp @@ -44,6 +44,8 @@ namespace MWMechanics actor.getClass().getCreatureStats(actor).setMovementFlag(CreatureStats::Flag_Run, false); + actor.getClass().getCreatureStats(actor).setDrawState(DrawState_Nothing); + MWWorld::Ptr player = world->getPlayerPtr(); if(cell->mData.mX != player.getCell()->getCell()->mData.mX) {