Merge pull request #5801 from Mailaender/building-influence-crash

Fixed a crash when trying to capture husks that have been destroyed.
This commit is contained in:
Paul Chote
2014-07-05 11:36:54 +12:00
4 changed files with 11 additions and 1 deletions

View File

@@ -217,6 +217,9 @@ namespace OpenRA
{
World.AddFrameEndTask(w =>
{
if (this.Destroyed)
return;
var oldOwner = Owner;
// momentarily remove from world so the ownership queries don't get confused

View File

@@ -39,6 +39,9 @@ namespace OpenRA.Mods.RA.Activities
self.World.AddFrameEndTask(w =>
{
if (actor.IsDead())
return;
var lowEnoughHealth = health.HP <= capturableInfo.CaptureThreshold * health.MaxHP;
if (!capturesInfo.Sabotage || lowEnoughHealth || actor.Owner.NonCombatant)
{

View File

@@ -59,6 +59,9 @@ namespace OpenRA.Mods.RA.Activities
self.World.AddFrameEndTask(w =>
{
if (target.Actor.IsDead())
return;
var oldOwner = target.Actor.Owner;
target.Actor.ChangeOwner(self.Owner);

View File

@@ -12,6 +12,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.RA.Buildings
{
[Desc("A dictionary of buildings placed on the map. Attach this to the world actor.")]
public class BuildingInfluenceInfo : ITraitInfo
{
public object Create(ActorInitializer init) { return new BuildingInfluence(init.world); }
@@ -28,7 +29,7 @@ namespace OpenRA.Mods.RA.Buildings
influence = new CellLayer<Actor>(map);
world.ActorAdded += a =>
world.ActorAdded += a =>
{
var b = a.TraitOrDefault<Building>();
if (b == null)