Merge branch 'master' into jgrpp
# Conflicts: # .github/workflows/ci-build.yml # .github/workflows/release-linux.yml # .github/workflows/release-macos.yml # .github/workflows/release-windows.yml # .gitignore # COMPILING.md # src/company_gui.cpp # src/date_gui.cpp # src/engine.cpp # src/engine_func.h # src/fileio.cpp # src/linkgraph/linkgraph_gui.h # src/newgrf_debug_gui.cpp # src/newgrf_gui.cpp # src/order_gui.cpp # src/osk_gui.cpp # src/rail_gui.cpp # src/road_gui.cpp # src/script/api/script_event_types.hpp # src/sl/oldloader_sl.cpp # src/smallmap_gui.cpp # src/station_cmd.cpp # src/toolbar_gui.cpp # src/town_gui.cpp # src/transparency_gui.cpp # src/vehicle_gui.cpp # src/widget.cpp # src/widget_type.h # src/widgets/dropdown.cpp # src/widgets/dropdown_func.h # src/widgets/dropdown_type.h # src/widgets/group_widget.h # src/widgets/vehicle_widget.h # src/window.cpp # src/window_gui.h # src/window_type.h
This commit is contained in:
@@ -139,7 +139,7 @@ public:
|
||||
this->FinishInitNested(window_number);
|
||||
}
|
||||
|
||||
void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override
|
||||
void UpdateWidgetSize(WidgetID widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override
|
||||
{
|
||||
if (widget >= WID_BT_TYPE_BUTTON_FIRST) {
|
||||
/* Ensure tree type buttons are sized after the largest tree type */
|
||||
@@ -149,7 +149,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void DrawWidget(const Rect &r, int widget) const override
|
||||
void DrawWidget(const Rect &r, WidgetID widget) const override
|
||||
{
|
||||
if (widget >= WID_BT_TYPE_BUTTON_FIRST) {
|
||||
const int index = widget - WID_BT_TYPE_BUTTON_FIRST;
|
||||
@@ -158,7 +158,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override
|
||||
void OnClick([[maybe_unused]] Point pt, WidgetID widget, [[maybe_unused]] int click_count) override
|
||||
{
|
||||
switch (widget) {
|
||||
case WID_BT_TYPE_RANDOM: // tree of random type.
|
||||
@@ -249,7 +249,7 @@ public:
|
||||
* get producing the correct result than dynamically building the widgets is.
|
||||
* @see NWidgetFunctionType
|
||||
*/
|
||||
static NWidgetBase *MakeTreeTypeButtons(int *biggest_index)
|
||||
static std::unique_ptr<NWidgetBase> MakeTreeTypeButtons()
|
||||
{
|
||||
const byte type_base = _tree_base_by_landscape[_settings_game.game_creation.landscape];
|
||||
const byte type_count = _tree_count_by_landscape[_settings_game.game_creation.landscape];
|
||||
@@ -259,21 +259,20 @@ static NWidgetBase *MakeTreeTypeButtons(int *biggest_index)
|
||||
const int num_rows = CeilDiv(type_count, num_columns);
|
||||
byte cur_type = type_base;
|
||||
|
||||
NWidgetVertical *vstack = new NWidgetVertical(NC_EQUALSIZE);
|
||||
auto vstack = std::make_unique<NWidgetVertical>(NC_EQUALSIZE);
|
||||
vstack->SetPIP(0, 1, 0);
|
||||
|
||||
for (int row = 0; row < num_rows; row++) {
|
||||
NWidgetHorizontal *hstack = new NWidgetHorizontal(NC_EQUALSIZE);
|
||||
auto hstack = std::make_unique<NWidgetHorizontal>(NC_EQUALSIZE);
|
||||
hstack->SetPIP(0, 1, 0);
|
||||
vstack->Add(hstack);
|
||||
for (int col = 0; col < num_columns; col++) {
|
||||
if (cur_type > type_base + type_count) break;
|
||||
NWidgetBackground *button = new NWidgetBackground(WWT_PANEL, COLOUR_GREY, WID_BT_TYPE_BUTTON_FIRST + cur_type);
|
||||
auto button = std::make_unique<NWidgetBackground>(WWT_PANEL, COLOUR_GREY, WID_BT_TYPE_BUTTON_FIRST + cur_type);
|
||||
button->SetDataTip(0x0, STR_PLANT_TREE_TOOLTIP);
|
||||
hstack->Add(button);
|
||||
*biggest_index = WID_BT_TYPE_BUTTON_FIRST + cur_type;
|
||||
hstack->Add(std::move(button));
|
||||
cur_type++;
|
||||
}
|
||||
vstack->Add(std::move(hstack));
|
||||
}
|
||||
|
||||
return vstack;
|
||||
|
Reference in New Issue
Block a user