fix 1036 -- GiveUnitCrateAction can give units which don't have BuildableInfo, to anyone
This commit is contained in:
@@ -32,11 +32,11 @@ namespace OpenRA.Mods.RA.Crates
|
||||
|
||||
public override int GetSelectionShares(Actor collector)
|
||||
{
|
||||
var bi = Rules.Info[Info.Unit].Traits.Get<BuildableInfo>();
|
||||
var bi = Rules.Info[Info.Unit].Traits.GetOrDefault<BuildableInfo>();
|
||||
|
||||
// this unit is not buildable by the collector's country, so
|
||||
// don't give them free ones either.
|
||||
if (!bi.Owner.Contains(collector.Owner.Country.Race)) return 0;
|
||||
if (bi != null && !bi.Owner.Contains(collector.Owner.Country.Race)) return 0;
|
||||
|
||||
// avoid dumping tanks in the sea, and ships on dry land.
|
||||
if (!GetSuitableCells(collector.Location).Any()) return 0;
|
||||
|
||||
Reference in New Issue
Block a user