Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Minor] Fix two issues of enhanced straight trajectory #1500

Merged
merged 1 commit into from
Jan 20, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/Ext/Bullet/Trajectories/StraightTrajectory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ void StraightTrajectory::BulletDetonateLastCheck(BulletClass* pBullet, HouseClas
pBullet->SetTarget(pDetonateAt);
pBullet->TargetCoords = position;

if (std::abs(velocity) > 1e-10)
if (std::abs(velocity) > 1e-10 && distance < velocity)
pBullet->Velocity *= distance / velocity;

if (this->ProximityImpact != 0)
Expand All @@ -634,7 +634,7 @@ void StraightTrajectory::BulletDetonateLastCheck(BulletClass* pBullet, HouseClas
if (pType->ProximityDirect)
pDetonateAt->ReceiveDamage(&damage, 0, pWH, pBullet->Owner, false, false, pOwner);
else
WarheadTypeExt::DetonateAt(pWH, pType->ProximityMedial ? pBullet->Location : position, pBullet->Owner, damage, pOwner, pDetonateAt);
WarheadTypeExt::DetonateAt(pWH, pType->ProximityMedial ? pBullet->Location : position, pBullet->Owner, damage, pOwner, pType->ProximityMedial ? nullptr : pDetonateAt);

this->CalculateNewDamage(pBullet);
}
Expand Down Expand Up @@ -923,7 +923,7 @@ void StraightTrajectory::PrepareForDetonateAt(BulletClass* pBullet, HouseClass*
if (pType->ProximityDirect)
pTechno->ReceiveDamage(&damage, 0, pWH, pBullet->Owner, false, false, pOwner);
else
WarheadTypeExt::DetonateAt(pWH, pType->ProximityMedial ? pBullet->Location : pTechno->GetCoords(), pBullet->Owner, damage, pOwner, pTechno);
WarheadTypeExt::DetonateAt(pWH, pType->ProximityMedial ? pBullet->Location : pTechno->GetCoords(), pBullet->Owner, damage, pOwner, pType->ProximityMedial ? nullptr : pTechno);

this->CalculateNewDamage(pBullet);

Expand Down
Loading