fix crash on telling {sam,agun} to attack ground
This commit is contained in:
@@ -257,6 +257,6 @@ namespace OpenRA.Mods.RA
|
||||
public bool HasAnyValidWeapons(Target t) { return Weapons.Any(w => w.IsValidAgainst(t)); }
|
||||
public float GetMaximumRange() { return Weapons.Max(w => w.Info.Range); }
|
||||
|
||||
public Weapon ChooseWeaponForTarget(Target t) { return Weapons.First(w => w.IsValidAgainst(t)); }
|
||||
public Weapon ChooseWeaponForTarget(Target t) { return Weapons.FirstOrDefault(w => w.IsValidAgainst(t)); }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,6 +51,8 @@ namespace OpenRA.Mods.RA
|
||||
const int RangeTolerance = 1; /* how far inside our maximum range we should try to sit */
|
||||
/* todo: choose the appropriate weapon, when only one works against this target */
|
||||
var weapon = ChooseWeaponForTarget(Target.FromOrder(order));
|
||||
if (weapon == null)
|
||||
return;
|
||||
|
||||
target = Target.FromOrder(order);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user