Fix crashes related to transports

Fixes two specific causes of transport related crashes, one prevents
infantry from continuing to take damage by Tiberium if loaded into the
transport over Tiberium, and one fixes the edge case where an infantry
dies in the same tick cycle as it was loaded into the transport.
This commit is contained in:
Squiggles211
2014-05-15 20:27:17 -05:00
parent 0f591bb3ba
commit a0458eeb24
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;
self.World.AddFrameEndTask(w =>
{
if(self.IsDead() || transport.IsDead() || !cargo.CanLoad(transport, self))
return;
cargo.Load(transport, self);
self.World.AddFrameEndTask(w => w.Remove(self));
w.Remove(self);
});
return this;
}