Fix last merge

This commit is contained in:
kaelima
2012-12-22 02:22:44 +01:00
parent 0a88787dfc
commit a0239c2210
2 changed files with 14 additions and 2 deletions

View File

@@ -49,16 +49,28 @@ void TargetedMovementGeneratorMedium<T,D>::_setTargetLocation(T* owner, bool upd
}
else
{
float dist;
float size;
// Pets need special handling.
// We need to subtract GetObjectSize() because it gets added back further down the chain
// and that makes pets too far away. Subtracting it allows pets to properly
// be (GetCombatReach() + i_offset) away.
if (owner->isPet())
// Only applies when i_target is pet's owner otherwise pets and mobs end up
// doing a "dance" while fighting
if (owner->isPet() && i_target->GetTypeId() == TYPEID_PLAYER)
{
dist = i_target->GetCombatReach();
size = i_target->GetCombatReach() - i_target->GetObjectSize();
}
else
{
dist = i_offset + 1.0f;
size = owner->GetObjectSize();
}
if (i_target->IsWithinDistInMap(owner, dist))
return;
// to at i_offset distance from target and i_angle from target facing
i_target->GetClosePoint(x, y, z, size, i_offset, i_angle);

View File

@@ -78,11 +78,11 @@ namespace Movement
UpdateResult _updateState(int32& ms_time_diff);
int32 next_timestamp() const { return spline.length(point_Idx+1); }
int32 segment_time_elapsed() const { return next_timestamp()-time_passed; }
int32 Duration() const { return spline.length(); }
int32 timeElapsed() const { return Duration() - time_passed; }
int32 timePassed() const { return time_passed; }
public:
int32 Duration() const { return spline.length(); }
const MySpline& _Spline() const { return spline; }
int32 _currentSplineIdx() const { return point_Idx; }
void _Finalize();