fixes crash on production structure being destroyed; refund instead

This commit is contained in:
Chris Forbes
2009-11-18 19:26:58 +13:00
parent de05f58aef
commit 00d633cbeb

View File

@@ -342,7 +342,7 @@ namespace OpenRa.Game
&& producerTypes.Contains(a.unitInfo.Name) && a.Owner == player);
if (producer == null)
throw new InvalidOperationException("BuildUnit without suitable production structure!");
player.CancelProduction(Rules.UnitCategory[name]);
Actor unit;
@@ -375,7 +375,7 @@ namespace OpenRa.Game
}
world.Add(unit);
player.FinishProduction( Rules.UnitCategory[ unit.unitInfo.Name ] );
player.FinishProduction(Rules.UnitCategory[name]);
if (producer.traits.Contains<RenderWarFactory>())
producer.traits.Get<RenderWarFactory>().EjectUnit();