Core/Movement: kill some dead code from chase movement generator

This commit is contained in:
Ovahlord committed 2023-08-24 20:19:10 +02:00
1 parent 0840143137
commit a1e0459859
1 file changed
-67
@@ -275,70 +275,3 @@ void ChaseMovementGenerator::launchSpline(Unit* owner, Unit* target, Position& d
owner->AddUnitState(UNIT_STATE_CHASE_MOVE);
}
}
/*
{
Unit* target = GetTarget();
// Owner may launch a new spline
Position dest = target->GetVehicle() ? target->GetVehicle()->GetBase()->GetPosition() : target->GetPosition();
// Predict chase destination to keep up with chase target
bool predictDestination = !backward && !mutualChase && target->isMoving();
if (predictDestination)
{
UnitMoveType moveType = MOVE_RUN;
if (target->CanFly())
moveType = target->HasUnitMovementFlag(MOVEMENTFLAG_BACKWARD) ? MOVE_FLIGHT_BACK : MOVE_FLIGHT;
else
{
if (target->IsWalking())
moveType = MOVE_WALK;
else
moveType = target->HasUnitMovementFlag(MOVEMENTFLAG_BACKWARD) ? MOVE_RUN_BACK : MOVE_RUN;
}
float additionalRange = target->GetSpeed(moveType) * 0.5f;
if (!owner->HasUnitState(UNIT_STATE_IGNORE_PATHFINDING))
target->MovePositionToFirstCollision(dest, additionalRange, _angle ? Position::NormalizeOrientation(target->GetOrientation() - _angle->RelativeAngle + float(M_PI)) : target->GetRelativeAngle(owner) + float(M_PI));
else
target->GetNearPoint(owner, dest.m_positionX, dest.m_positionY, dest.m_positionZ, additionalRange - target->GetCombatReach() - owner->GetCombatReach(), Position::NormalizeOrientation(target->GetOrientation() + float(M_PI) + (_angle ? _angle->RelativeAngle : 0.f)));
}
else if (!owner->HasUnitState(UNIT_STATE_IGNORE_PATHFINDING))
target->MovePositionToFirstCollision(dest, chaseRange, _angle ? target->NormalizeOrientation(target->GetOrientation() - _angle->RelativeAngle) : target->GetRelativeAngle(owner));
else
target->GetNearPoint(owner, dest.m_positionX, dest.m_positionY, dest.m_positionZ, chaseRange - target->GetCombatReach() - owner->GetCombatReach(), Position::NormalizeOrientation(target->GetOrientation() + (_angle ? _angle->RelativeAngle : 0.f)));
owner->UpdateAllowedPositionZ(dest.GetPositionX(), dest.GetPositionY(), dest.m_positionZ);
Creature* creature = owner->ToCreature();
Movement::MoveSplineInit init(owner);
PathGenerator path(owner);
bool success = path.CalculatePath(dest.GetPositionX(), dest.GetPositionY(), dest.GetPositionZ(), owner->CanFly());
if (!success || (path.GetPathType() & (PATHFIND_NOPATH /*| PATHFIND_INCOMPLETE)))
{
if (creature)
creature->SetCannotReachTarget(true);
owner->StopMoving();
return;
}
init.MovebyPath(path.GetPath());
init.SetWalk(false);
if (backward)
init.SetBackward();
else
init.SetFacing(target);
init.Launch();
if (!backward)
owner->AddUnitState(UNIT_STATE_CHASE_MOVE);
if (creature)
creature->SetCannotReachTarget(false);
}
*/