Made Valued optional for traits who do not require it.

This commit is contained in:
Andre Mohren
2018-07-22 12:25:10 +02:00
committed by Paul Chote
parent ec15acbc80
commit a86f41cd5c
4 changed files with 22 additions and 7 deletions

View File

@@ -70,7 +70,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var tooltip = actor.TraitInfos<TooltipInfo>().FirstOrDefault(info => info.EnabledByDefault);
var name = tooltip != null ? tooltip.Name : actor.Name;
var buildable = actor.TraitInfo<BuildableInfo>();
var cost = actor.TraitInfo<ValuedInfo>().Cost;
var valued = actor.TraitInfoOrDefault<ValuedInfo>();
var cost = valued != null ? valued.Cost : 0;
nameLabel.Text = name;