From 8c8ff01b1061f15de4f71acb7b76318ddb5684dd Mon Sep 17 00:00:00 2001 From: Taryn Hill Date: Sun, 20 Mar 2016 18:06:23 -0500 Subject: [PATCH] Add an explicit YamlException to ParatroopersPower.SendParatroppers --- OpenRA.Mods.RA/Traits/SupportPowers/ParatroopersPower.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/OpenRA.Mods.RA/Traits/SupportPowers/ParatroopersPower.cs b/OpenRA.Mods.RA/Traits/SupportPowers/ParatroopersPower.cs index 7fd6522f4d..5d7de97992 100644 --- a/OpenRA.Mods.RA/Traits/SupportPowers/ParatroopersPower.cs +++ b/OpenRA.Mods.RA/Traits/SupportPowers/ParatroopersPower.cs @@ -73,7 +73,12 @@ namespace OpenRA.Mods.RA.Traits if (randomize) dropFacing = 256 * self.World.SharedRandom.Next(info.QuantizedFacings) / info.QuantizedFacings; - var altitude = self.World.Map.Rules.Actors[info.UnitType].TraitInfo().CruiseAltitude.Length; + var utLower = info.UnitType.ToLowerInvariant(); + ActorInfo unitType; + if (!self.World.Map.Rules.Actors.TryGetValue(utLower, out unitType)) + throw new YamlException("Actors ruleset does not include the entry '{0}'".F(utLower)); + + var altitude = unitType.TraitInfo().CruiseAltitude.Length; var dropRotation = WRot.FromFacing(dropFacing); var delta = new WVec(0, -1024, 0).Rotate(dropRotation); target = target + new WVec(0, 0, altitude);