Merge pull request #5324 from Squiggles211/apc_load_crash

Fixes #4790
Fixes #5270
This commit is contained in:
Matthias Mailänder
2014-05-16 09:00:03 +02:00
2 changed files with 11 additions and 2 deletions

View File

@@ -32,6 +32,9 @@ namespace OpenRA.Mods.Cnc
{
if (--poisonTicks > 0) return;
// Prevents harming infantry in cargo.
if (!self.IsInWorld) return;
var rl = self.World.WorldActor.Trait<ResourceLayer>();
var r = rl.GetResource(self.Location);
if (r == null) return;

View File

@@ -41,8 +41,14 @@ namespace OpenRA.Mods.RA.Activities
if (!cells.Contains(self.Location))
return NextActivity;
cargo.Load(transport, self);
self.World.AddFrameEndTask(w => w.Remove(self));
self.World.AddFrameEndTask(w =>
{
if (self.IsDead() || transport.IsDead() || !cargo.CanLoad(transport, self))
return;
cargo.Load(transport, self);
w.Remove(self);
});
return this;
}