cargo: don't crash.

This commit is contained in:
Chris Forbes
2010-01-05 15:33:22 +13:00
parent 53386d8d86
commit 30e7693862

View File

@@ -15,12 +15,14 @@ namespace OpenRa.Game.Traits
public Order IssueOrder(Actor self, int2 xy, MouseInput mi, Actor underCursor)
{
var unit = underCursor.traits.GetOrDefault<Unit>();
if (unit.Altitude > 0) return null;
// todo: check if there is an unoccupied `land` tile adjacent
if (mi.Button == MouseButton.Right && underCursor == self && cargo.Count > 0)
{
var unit = underCursor.traits.GetOrDefault<Unit>();
if (unit != null && unit.Altitude > 0) return null;
return new Order("Deploy", self, null, int2.Zero, null);
}
return null;
}