# HG changeset patch # User IBBoard # Date 1243453480 0 # Node ID 4e5e382fbd2ef9a5b88c128d756f4d2aff5854a2 # Parent c687bbe901f8af8f91b95255e9da79066d5274da Re #10 (Code readability) and Re #86 (Complete GTK# GUI): * Update UnitDisplayWidget to use new way of getting unit stats diff -r c687bbe901f8 -r 4e5e382fbd2e Widgets/UnitDisplayWidget.cs --- a/Widgets/UnitDisplayWidget.cs Thu Apr 09 15:33:33 2009 +0000 +++ b/Widgets/UnitDisplayWidget.cs Wed May 27 19:44:40 2009 +0000 @@ -43,13 +43,13 @@ { //GameSystem system = unit.Army.GameSystem; //SystemStats stats = system.StandardSystemStats; - Stats stats = unit.UnitType.UnitStats; CellRendererText renderer = new CellRendererText(); unitStats.AppendColumn(Translation.GetTranslation("UnitNameColumn", "Unit Type", null), renderer, new TreeCellDataFunc(RenderUnitName)); - TreeCellDataFunc statFunc = new TreeCellDataFunc(RenderUnitStat); + TreeCellDataFunc statFunc = new TreeCellDataFunc(RenderUnitStat); + Stat[] stats = unit.UnitStatsArray; - int length = stats.StatCount; + int length = stats.Length; for (int i = 0; i < length; i++) { @@ -79,8 +79,7 @@ if (o is IBBoard.WarFoundry.API.Objects.Unit) { IBBoard.WarFoundry.API.Objects.Unit u = (IBBoard.WarFoundry.API.Objects.Unit)o; - //TODO Check for correct value based on the column - (cell as CellRendererText).Text = u.UnitStats[column.Title].SlotValueString; + (cell as CellRendererText).Text = u.GetStatValue(column.Title); } }