1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-23 07:43:01 +01:00

Remove duplicate functions (#10067)

* Reduce code duplication in src\openrct2\interface\Window.cpp

`window_resize_gui_scenario_editor` was a subset of `window_resize_gui`

* Reduce code duplication in src\openrct2\network\Twitch.cpp

Both `GetFollowers()` and `GetMessage()` were very similar

* Reduce code duplication in src/openrct2/world/SmallScenery.cpp

`map_place_non_scenery_clear_func` and `map_place_scenery_clear_func` did basically the same thing, with a single branch difference

* Reduce code duplication in src/openrct2-ui/windows/TopToolbar.cpp

Make `top_toolbar_tool_update_scenery_clear` call `top_toolbar_tool_update_land_paint` and then do the additional differing calculation it did.
This commit is contained in:
Tulio Leao
2019-10-19 10:38:26 -03:00
committed by Duncan
parent 9ad15e398b
commit dbb66dd028
4 changed files with 41 additions and 178 deletions

View File

@@ -1614,40 +1614,9 @@ void window_relocate_windows(int32_t width, int32_t height)
*/
void window_resize_gui(int32_t width, int32_t height)
{
window_resize_gui_scenario_editor(width, height);
if (gScreenFlags & SCREEN_FLAGS_EDITOR)
{
window_resize_gui_scenario_editor(width, height);
return;
}
rct_window* mainWind = window_get_main();
if (mainWind != nullptr)
{
rct_viewport* viewport = mainWind->viewport;
mainWind->width = width;
mainWind->height = height;
viewport->width = width;
viewport->height = height;
viewport->view_width = width << viewport->zoom;
viewport->view_height = height << viewport->zoom;
if (mainWind->widgets != nullptr && mainWind->widgets[WC_MAIN_WINDOW__0].type == WWT_VIEWPORT)
{
mainWind->widgets[WC_MAIN_WINDOW__0].right = width;
mainWind->widgets[WC_MAIN_WINDOW__0].bottom = height;
}
}
rct_window* topWind = window_find_by_class(WC_TOP_TOOLBAR);
if (topWind != nullptr)
{
topWind->width = std::max(640, width);
}
rct_window* bottomWind = window_find_by_class(WC_BOTTOM_TOOLBAR);
if (bottomWind != nullptr)
{
bottomWind->y = height - 32;
bottomWind->width = std::max(640, width);
}
rct_window* titleWind = window_find_by_class(WC_TITLE_MENU);
if (titleWind != nullptr)