Merge branch 'master' into jgrpp

# Conflicts:
#	.github/workflows/release-linux.yml
#	.github/workflows/release.yml
#	src/rail_cmd.cpp
#	src/rail_gui.cpp
#	src/script/api/script_rail.cpp
#	src/settings_gui.cpp
#	src/signal_type.h
#	src/video/sdl2_v.cpp
This commit is contained in:
Jonathan G Rennison
2024-01-16 00:38:56 +00:00
88 changed files with 417 additions and 131 deletions

View File

@@ -3411,9 +3411,10 @@ std::unique_ptr<NWidgetBase> MakeWindowNWidgetTree(const NWidgetPart *nwid_begin
* @param colour The colour in which to draw the button.
* @param max_length Maximal number of company buttons in one row.
* @param button_tooltip The tooltip-string of every button.
* @param resizable Whether the rows are resizable.
* @return Panel with rows of company buttons.
*/
std::unique_ptr<NWidgetBase> MakeCompanyButtonRows(WidgetID widget_first, WidgetID widget_last, Colours button_colour, int max_length, StringID button_tooltip)
std::unique_ptr<NWidgetBase> MakeCompanyButtonRows(WidgetID widget_first, WidgetID widget_last, Colours button_colour, int max_length, StringID button_tooltip, bool resizable)
{
assert(max_length >= 1);
std::unique_ptr<NWidgetVertical> vert = nullptr; // Storage for all rows.
@@ -3440,7 +3441,7 @@ std::unique_ptr<NWidgetBase> MakeCompanyButtonRows(WidgetID widget_first, Widget
auto panel = std::make_unique<NWidgetBackground>(WWT_PANEL, button_colour, widnum);
panel->SetMinimalSize(sprite_size.width, sprite_size.height);
panel->SetFill(1, 1);
panel->SetResize(1, 0);
if (resizable) panel->SetResize(1, 0);
panel->SetDataTip(0x0, button_tooltip);
hor->Add(std::move(panel));
hor_length++;
@@ -3451,7 +3452,7 @@ std::unique_ptr<NWidgetBase> MakeCompanyButtonRows(WidgetID widget_first, Widget
/* Last row is partial, add a spacer at the end to force all buttons to the left. */
auto spc = std::make_unique<NWidgetSpacer>(sprite_size.width, sprite_size.height);
spc->SetFill(1, 1);
spc->SetResize(1, 0);
if (resizable) spc->SetResize(1, 0);
hor->Add(std::move(spc));
}
if (hor != nullptr) vert->Add(std::move(hor));