Core/Position: Refactor GetAngle -> GetAbsoluteAngle because code clarity is good.

(cherry picked from commit 4692e10ca2)
This commit is contained in:
Treeston
2018-04-01 13:52:36 +02:00
committed by Shauren
parent bf958da148
commit bc89e1cdb0
38 changed files with 71 additions and 89 deletions

View File

@@ -8342,15 +8342,15 @@ bool WorldObjectSpellTrajTargetCheck::operator()(WorldObject* target) const
WorldObjectSpellLineTargetCheck::WorldObjectSpellLineTargetCheck(Position const* srcPosition, Position const* dstPosition, float lineWidth, float range, WorldObject* caster,
SpellInfo const* spellInfo, SpellTargetCheckTypes selectionType, ConditionContainer const* condList, SpellTargetObjectTypes objectType)
: WorldObjectSpellAreaTargetCheck(range, caster, caster, caster, spellInfo, selectionType, condList, objectType), _srcPosition(srcPosition), _dstPosition(dstPosition), _lineWidth(lineWidth) { }
: WorldObjectSpellAreaTargetCheck(range, caster, caster, caster, spellInfo, selectionType, condList, objectType), _position(*srcPosition), _lineWidth(lineWidth)
{
if (dstPosition && *srcPosition != *dstPosition)
_position.SetOrientation(srcPosition->GetAbsoluteAngle(dstPosition));
}
bool WorldObjectSpellLineTargetCheck::operator()(WorldObject* target) const
{
float angle = _caster->GetOrientation();
if (*_srcPosition != *_dstPosition)
angle = _srcPosition->GetAngle(_dstPosition);
if (!_caster->HasInLine(target, target->GetCombatReach(), _lineWidth, angle))
if (!_position.HasInLine(target, target->GetCombatReach(), _lineWidth))
return false;
return WorldObjectSpellTargetCheck::operator ()(target);