Fix crash in BasicAttackBehavior (#862)

* Add failArmor server side

Address out of bounds reading in behavior

Address the basicAttackBehavior reading out of bounds memory and reading bits that didnt exist, which occasionally caused crashes and also caused the behavior to do undefined behavior due to the bad reads.

Tested that attacking a wall anywhere with a projectile now does not crash the game.  Tested with logs that the behavior correctly returned when there were no allocated bits or returned when other states were met.

Add back logs and add fail handle

Remove comment block

Revert "Add back logs and add fail handle"

This reverts commit db19be0906fc8bf35bf89037e2bfba39f5ef9c0c.

Split out checks

* Remove case 2

* Update SkillComponent.cpp
This commit is contained in:
David Markowitz
2022-12-15 22:10:58 -08:00
committed by GitHub
parent b7341c8106
commit 213c3c37b0
3 changed files with 65 additions and 63 deletions

View File

@@ -319,34 +319,7 @@ void SkillComponent::CalculateUpdate(const float deltaTime) {
const auto distance = Vector3::DistanceSquared(targetPosition, closestPoint);
if (distance > 3 * 3) {
/*
if (entry.TrackTarget && distance <= entry.TrackRadius)
{
const auto rotation = NiQuaternion::LookAtUnlocked(position, targetPosition);
const auto speed = entry.Velocity.Length();
const auto homingTarget = rotation.GetForwardVector() * speed;
Vector3 homing;
// Move towards
const auto difference = homingTarget - entry.Velocity;
const auto mag = difference.Length();
if (mag <= speed || mag == 0)
{
homing = homingTarget;
}
else
{
entry.Velocity + homingTarget / mag * speed;
}
entry.Velocity = homing;
}
*/
// TODO There is supposed to be an implementation for homing projectiles here
continue;
}