diff --git a/OpenRA.Mods.Common/Widgets/ProductionPaletteWidget.cs b/OpenRA.Mods.Common/Widgets/ProductionPaletteWidget.cs index 7ed4db3aab..162464df2f 100644 --- a/OpenRA.Mods.Common/Widgets/ProductionPaletteWidget.cs +++ b/OpenRA.Mods.Common/Widgets/ProductionPaletteWidget.cs @@ -56,6 +56,9 @@ namespace OpenRA.Mods.Common.Widgets public readonly World World; readonly OrderManager orderManager; + public int MinimumRows = 4; + public int MaximumRows = int.MaxValue; + public int IconRowOffset = 0; public int MaxIconRowOffset = int.MaxValue; diff --git a/OpenRA.Mods.RA/Widgets/Logic/ClassicProductionLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/ClassicProductionLogic.cs index e4e2e6b086..a950637432 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/ClassicProductionLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/ClassicProductionLogic.cs @@ -88,8 +88,8 @@ namespace OpenRA.Mods.RA.Widgets.Logic Action updateBackground = (_, icons) => { - // Minimum of four rows to make space for the production buttons. - var rows = Math.Max(4, (icons + palette.Columns - 1) / palette.Columns); + var rows = Math.Max(palette.MinimumRows, (icons + palette.Columns - 1) / palette.Columns); + rows = Math.Min(rows, palette.MaximumRows); if (background != null) { @@ -189,7 +189,8 @@ namespace OpenRA.Mods.RA.Widgets.Logic // Check if icon heights exceed y resolution var maxItemsHeight = screenHeight - sidebarProductionHeight; - productionPalette.MaxIconRowOffset = (maxItemsHeight / productionPalette.IconSize.Y) - 1; + var maxIconRowOffest = (maxItemsHeight / productionPalette.IconSize.Y) - 1; + productionPalette.MaxIconRowOffset = Math.Min(maxIconRowOffest, productionPalette.MaximumRows); } } } diff --git a/mods/d2k/chrome/ingame-player.yaml b/mods/d2k/chrome/ingame-player.yaml index ee8ad938ff..d29d3d4c08 100644 --- a/mods/d2k/chrome/ingame-player.yaml +++ b/mods/d2k/chrome/ingame-player.yaml @@ -233,6 +233,8 @@ Container@PLAYER_WIDGETS: IconSize: 58, 48 IconMargin: 2, 0 IconSpriteOffset: 0, 0 + MinimumRows: 4 + MaximumRows: 6 Container@PALETTE_FOREGROUND: X: 64 Y: 0