fix attack crashing game
This commit is contained in:
@@ -26,9 +26,12 @@ namespace OpenRa.Game.Traits
|
|||||||
|
|
||||||
protected override void QueueAttack( Actor self, Order order )
|
protected override void QueueAttack( Actor self, Order order )
|
||||||
{
|
{
|
||||||
var b = self.traits.Get<Building>();
|
if (self.traits.Contains<Building>())
|
||||||
if (b != null && b.InsuffientPower())
|
{
|
||||||
return;
|
var b = self.traits.Get<Building>();
|
||||||
|
if (b != null && b.InsuffientPower())
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const int RangeTolerance = 1; /* how far inside our maximum range we should try to sit */
|
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 */
|
/* todo: choose the appropriate weapon, when only one works against this target */
|
||||||
@@ -39,6 +42,7 @@ namespace OpenRa.Game.Traits
|
|||||||
Math.Max( 0, (int)Rules.WeaponInfo[ weapon ].Range - RangeTolerance ) ) );
|
Math.Max( 0, (int)Rules.WeaponInfo[ weapon ].Range - RangeTolerance ) ) );
|
||||||
|
|
||||||
target = order.TargetActor;
|
target = order.TargetActor;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool buildComplete = false;
|
bool buildComplete = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user