1
0
forked from mirrors/0ad

Fix entities being able to attack allied structures in rare cases.

Caused by not checking the attack type while performing an attack.

Closes: #5511
Differential revision: D3840
References #3484

This was SVN commit r25242.
This commit is contained in:
Freagarach
2021-04-12 12:41:35 +00:00
parent b7db124cb5
commit 189d00d811
@@ -452,7 +452,7 @@ Attack.prototype.StartAttacking = function(target, type, callerIID)
if (this.target)
this.StopAttacking();
if (!this.CanAttack(target))
if (!this.CanAttack(target, [type]))
return false;
let timings = this.GetTimers(type);
@@ -522,7 +522,7 @@ Attack.prototype.StopAttacking = function(reason)
*/
Attack.prototype.Attack = function(type, lateness)
{
if (!this.CanAttack(this.target))
if (!this.CanAttack(this.target, [type]))
{
this.StopAttacking("TargetInvalidated");
return;