diff --git a/OpenRA.Game/Widgets/BuildPaletteWidget.cs b/OpenRA.Game/Widgets/BuildPaletteWidget.cs index ac124e605b..505b95d8e4 100644 --- a/OpenRA.Game/Widgets/BuildPaletteWidget.cs +++ b/OpenRA.Game/Widgets/BuildPaletteWidget.cs @@ -458,9 +458,13 @@ namespace OpenRA.Widgets var info = Rules.Info[unit]; var buildable = info.Traits.Get(); - var longDescSize = Game.chrome.renderer.RegularFont.Measure(buildable.LongDesc.Replace("\\n", "\n")); + var buildings = Rules.TechTree.GatherBuildings( world.LocalPlayer ); + var canBuildThis = Rules.TechTree.CanBuild(info, world.LocalPlayer, buildings); - WidgetUtils.DrawPanel("dialog4", new Rectangle(Game.viewport.Width - 300, pos.Y, 300, longDescSize.Y + 50)); + var longDescSize = Game.chrome.renderer.RegularFont.Measure(buildable.LongDesc.Replace("\\n", "\n")).Y; + if (!canBuildThis) longDescSize += 8; + + WidgetUtils.DrawPanel("dialog4", new Rectangle(Game.viewport.Width - 300, pos.Y, 300, longDescSize + 50)); Game.chrome.renderer.BoldFont.DrawText(buildable.Description, p.ToInt2() + new int2(5, 5), Color.White); @@ -473,10 +477,9 @@ namespace OpenRA.Widgets world.LocalPlayer.PowerProvided - world.LocalPlayer.PowerDrained + bi.Power >= 0 ? Color.White : Color.Red); - var buildings = Rules.TechTree.GatherBuildings( world.LocalPlayer ); - p += new int2(5, 5); - p += new int2(0, 15); - if (!Rules.TechTree.CanBuild(info, world.LocalPlayer, buildings)) + + p += new int2(5, 20); + if (!canBuildThis) { var prereqs = buildable.Prerequisites .Select( a => Description( a ) ); @@ -484,6 +487,8 @@ namespace OpenRA.Widgets "Requires {0}".F(string.Join(", ", prereqs.ToArray())), p.ToInt2(), Color.White); + + p += new int2(0, 8); } p += new int2(0, 15); diff --git a/mods/ra/infantry.yaml b/mods/ra/infantry.yaml index df6525f230..90bf721198 100644 --- a/mods/ra/infantry.yaml +++ b/mods/ra/infantry.yaml @@ -24,7 +24,7 @@ E1: Owner: allies,soviet Cost: 100 Description: Rifle Infantry - LongDesc: General-purpose infantry. Strong vs Infantry\n Weak vs Vehicles + LongDesc: General-purpose infantry.\n Strong vs Infantry\n Weak vs Vehicles Selectable: Bounds: 12,17,0,-9 Unit: