Core/Movement: correct logic wrongly ported in 2a84562dc8

I'm referencing line 97 from ChaseMovementGenerator.
That commit introduced a modification in this use case:
- Chasing target is not my current victim, I should stop moving till it is my victim again
Changed To:
- Chasing target is not my current vicitm, I should stop chasing
My correction:
- I dont care about the relation of my current victim and my chasing target, I'm commanded to chase, something will tell me to stop chasing
--> Most likely: evade, new attackstart, etc.

the rest are just minor changes
This commit is contained in:
ccrs
2019-01-10 22:51:47 +01:00
parent f2bac5d758
commit 9080e7863c
6 changed files with 7 additions and 12 deletions

View File

@@ -66,7 +66,7 @@ inline void MovementGeneratorPointerDeleter(MovementGenerator* a)
delete a; delete a;
} }
void MovementGeneratorDeleter::operator()(MovementGenerator * a) void MovementGeneratorDeleter::operator()(MovementGenerator* a)
{ {
MovementGeneratorPointerDeleter(a); MovementGeneratorPointerDeleter(a);
} }
@@ -123,7 +123,7 @@ uint32 MotionMaster::Size() const
return _defaultGenerator ? 1 : 0 + uint32(_generators.size()); return _defaultGenerator ? 1 : 0 + uint32(_generators.size());
} }
std::vector<MovementGeneratorInformation> MotionMaster::GetMovementGeneratorsInformation() const std::vector<MovementGeneratorInformation> const MotionMaster::GetMovementGeneratorsInformation() const
{ {
std::vector<MovementGeneratorInformation> list; std::vector<MovementGeneratorInformation> list;

View File

@@ -105,7 +105,7 @@ class TC_GAME_API MotionMaster
bool Empty() const; bool Empty() const;
uint32 Size() const; uint32 Size() const;
std::vector<MovementGeneratorInformation> GetMovementGeneratorsInformation() const; std::vector<MovementGeneratorInformation> const GetMovementGeneratorsInformation() const;
MovementSlot GetCurrentSlot() const; MovementSlot GetCurrentSlot() const;
MovementGenerator* GetCurrentMovementGenerator() const; MovementGenerator* GetCurrentMovementGenerator() const;
MovementGeneratorType GetCurrentMovementGeneratorType() const; MovementGeneratorType GetCurrentMovementGeneratorType() const;

View File

@@ -15,7 +15,6 @@
* with this program. If not, see <http://www.gnu.org/licenses/>. * with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "Common.h"
#include "MovementDefines.h" #include "MovementDefines.h"
#include "ObjectDefines.h" #include "ObjectDefines.h"
#include "Position.h" #include "Position.h"

View File

@@ -90,11 +90,7 @@ bool ChaseMovementGenerator::Update(Unit* owner, uint32 diff)
// our target might have gone away // our target might have gone away
Unit* const target = GetTarget(); Unit* const target = GetTarget();
if (!target) if (!target || !target->IsInWorld())
return false;
// the owner might've selected a different target (feels like we shouldn't check this here...)
if (owner->GetVictim() != target)
return false; return false;
// the owner might be unable to move (rooted or casting), pause movement // the owner might be unable to move (rooted or casting), pause movement

View File

@@ -78,7 +78,7 @@ bool FollowMovementGenerator::Update(Unit* owner, uint32 diff)
// our target might have gone away // our target might have gone away
Unit* const target = GetTarget(); Unit* const target = GetTarget();
if (!target) if (!target || !target->IsInWorld())
return false; return false;
if (owner->HasUnitState(UNIT_STATE_NOT_MOVE) || owner->IsMovementPreventedByCasting()) if (owner->HasUnitState(UNIT_STATE_NOT_MOVE) || owner->IsMovementPreventedByCasting())

View File

@@ -2127,8 +2127,8 @@ public:
float x, y, z; float x, y, z;
unit->GetMotionMaster()->GetDestination(x, y, z); unit->GetMotionMaster()->GetDestination(x, y, z);
std::vector<MovementGeneratorInformation> list = unit->GetMotionMaster()->GetMovementGeneratorsInformation(); std::vector<MovementGeneratorInformation> const list = unit->GetMotionMaster()->GetMovementGeneratorsInformation();
for (MovementGeneratorInformation info : list) for (MovementGeneratorInformation const& info : list)
{ {
switch (info.Type) switch (info.Type)
{ {