From 3a803e13e21729598728a65293307f23c8b267c3 Mon Sep 17 00:00:00 2001 From: Gymnasiast Date: Wed, 17 Sep 2025 20:10:06 +0200 Subject: [PATCH] Change window functions to use lowerCamelCase --- src/openrct2-ui/WindowManager.cpp | 30 +- src/openrct2-ui/input/MouseInput.cpp | 32 +- src/openrct2-ui/input/Shortcuts.cpp | 32 +- src/openrct2-ui/interface/Widget.cpp | 2 +- src/openrct2-ui/interface/Window.cpp | 84 +- src/openrct2-ui/interface/Window.h | 40 +- src/openrct2-ui/scripting/CustomListView.cpp | 2 +- src/openrct2-ui/scripting/CustomWindow.cpp | 68 +- src/openrct2-ui/scripting/ScViewport.hpp | 2 +- src/openrct2-ui/scripting/ScWindow.hpp | 2 +- src/openrct2-ui/windows/About.cpp | 20 +- src/openrct2-ui/windows/AssetPacks.cpp | 40 +- src/openrct2-ui/windows/Banner.cpp | 40 +- src/openrct2-ui/windows/Changelog.cpp | 16 +- src/openrct2-ui/windows/Cheats.cpp | 214 +-- src/openrct2-ui/windows/ClearScenery.cpp | 50 +- src/openrct2-ui/windows/CustomCurrency.cpp | 18 +- src/openrct2-ui/windows/DebugPaint.cpp | 30 +- .../windows/DemolishRidePrompt.cpp | 10 +- src/openrct2-ui/windows/Dropdown.cpp | 20 +- .../windows/EditorBottomToolbar.cpp | 14 +- .../windows/EditorInventionsList.cpp | 82 +- .../windows/EditorObjectSelection.cpp | 78 +- .../windows/EditorParkEntrance.cpp | 48 +- .../windows/EditorScenarioOptions.cpp | 314 ++-- src/openrct2-ui/windows/Error.cpp | 14 +- src/openrct2-ui/windows/Finances.cpp | 94 +- src/openrct2-ui/windows/Footpath.cpp | 72 +- src/openrct2-ui/windows/GameBottomToolbar.cpp | 30 +- src/openrct2-ui/windows/Guest.cpp | 270 +-- src/openrct2-ui/windows/GuestList.cpp | 68 +- src/openrct2-ui/windows/InstallTrack.cpp | 32 +- src/openrct2-ui/windows/Land.cpp | 60 +- src/openrct2-ui/windows/LandRights.cpp | 68 +- src/openrct2-ui/windows/LoadSave.cpp | 76 +- src/openrct2-ui/windows/Main.cpp | 6 +- src/openrct2-ui/windows/Map.cpp | 76 +- src/openrct2-ui/windows/MapGen.cpp | 228 +-- src/openrct2-ui/windows/MapTooltip.cpp | 12 +- src/openrct2-ui/windows/MazeConstruction.cpp | 34 +- src/openrct2-ui/windows/Multiplayer.cpp | 1535 ++++++++--------- src/openrct2-ui/windows/NetworkStatus.cpp | 38 +- src/openrct2-ui/windows/NewCampaign.cpp | 40 +- src/openrct2-ui/windows/NewRide.cpp | 70 +- src/openrct2-ui/windows/News.cpp | 66 +- src/openrct2-ui/windows/ObjectLoadError.cpp | 34 +- src/openrct2-ui/windows/Options.cpp | 274 +-- src/openrct2-ui/windows/OverwritePrompt.cpp | 16 +- src/openrct2-ui/windows/Park.cpp | 254 +-- src/openrct2-ui/windows/PatrolArea.cpp | 46 +- src/openrct2-ui/windows/Player.cpp | 114 +- src/openrct2-ui/windows/ProgressWindow.cpp | 42 +- .../windows/RefurbishRidePrompt.cpp | 10 +- src/openrct2-ui/windows/Research.cpp | 42 +- src/openrct2-ui/windows/Ride.cpp | 294 ++-- src/openrct2-ui/windows/RideConstruction.cpp | 294 ++-- src/openrct2-ui/windows/RideList.cpp | 54 +- src/openrct2-ui/windows/SavePrompt.cpp | 22 +- src/openrct2-ui/windows/ScenarioSelect.cpp | 56 +- src/openrct2-ui/windows/Scenery.cpp | 142 +- src/openrct2-ui/windows/SceneryScatter.cpp | 24 +- src/openrct2-ui/windows/ServerList.cpp | 48 +- src/openrct2-ui/windows/ServerStart.cpp | 46 +- src/openrct2-ui/windows/ShortcutKeys.cpp | 90 +- src/openrct2-ui/windows/Sign.cpp | 44 +- src/openrct2-ui/windows/Staff.cpp | 106 +- src/openrct2-ui/windows/StaffFirePrompt.cpp | 16 +- src/openrct2-ui/windows/StaffList.cpp | 60 +- src/openrct2-ui/windows/TextInput.cpp | 58 +- src/openrct2-ui/windows/Themes.cpp | 51 +- src/openrct2-ui/windows/TileInspector.cpp | 182 +- src/openrct2-ui/windows/TitleExit.cpp | 12 +- src/openrct2-ui/windows/TitleLogo.cpp | 8 +- src/openrct2-ui/windows/TitleMenu.cpp | 20 +- src/openrct2-ui/windows/TitleOptions.cpp | 10 +- src/openrct2-ui/windows/TitleVersion.cpp | 2 +- src/openrct2-ui/windows/Tooltip.cpp | 12 +- src/openrct2-ui/windows/TopToolbar.cpp | 1076 ++++++------ src/openrct2-ui/windows/TrackDesignManage.cpp | 254 ++- src/openrct2-ui/windows/TrackDesignPlace.cpp | 40 +- src/openrct2-ui/windows/TrackList.cpp | 46 +- src/openrct2-ui/windows/Transparency.cpp | 46 +- src/openrct2-ui/windows/ViewClipping.cpp | 61 +- src/openrct2-ui/windows/Viewport.cpp | 24 +- src/openrct2-ui/windows/Water.cpp | 42 +- src/openrct2/Editor.cpp | 6 +- src/openrct2/entity/Guest.cpp | 4 +- src/openrct2/entity/Peep.cpp | 2 +- src/openrct2/interface/InteractiveConsole.cpp | 2 +- src/openrct2/interface/Viewport.cpp | 20 +- src/openrct2/interface/Window.cpp | 28 +- src/openrct2/interface/WindowBase.cpp | 20 +- src/openrct2/interface/WindowBase.h | 68 +- src/openrct2/ride/Ride.cpp | 2 +- src/openrct2/ride/RideConstruction.cpp | 2 +- .../scenes/title/Command/SetLocation.cpp | 2 +- 96 files changed, 4166 insertions(+), 4239 deletions(-) diff --git a/src/openrct2-ui/WindowManager.cpp b/src/openrct2-ui/WindowManager.cpp index 1105d6ef89..998bd47302 100644 --- a/src/openrct2-ui/WindowManager.cpp +++ b/src/openrct2-ui/WindowManager.cpp @@ -535,7 +535,7 @@ public: WindowBase* w = FindByNumber(WindowClass::Banner, bannerIndex); if (w != nullptr) { - w->Invalidate(); + w->invalidate(); } break; } @@ -640,7 +640,7 @@ public: mainWindow->savedViewPos.x -= viewport->ViewWidth() / 2; mainWindow->savedViewPos.y -= viewport->ViewHeight() / 2; - mainWindow->Invalidate(); + mainWindow->invalidate(); } } @@ -920,8 +920,8 @@ public: wp->focus = std::nullopt; ColourSchemeUpdate(wp.get()); - wp->Invalidate(); - wp->OnOpen(); + wp->invalidate(); + wp->onOpen(); auto itNew = g_window_list.insert(itDestPos, std::move(wp)); return itNew->get(); @@ -933,19 +933,19 @@ public: */ void Close(WindowBase& w) override { - if (!w.CanClose()) + if (!w.canClose()) { // Something's preventing this window from closing -- bail out early return; } - w.OnClose(); + w.onClose(); // Remove viewport - w.RemoveViewport(); + w.removeViewport(); // Invalidate the window (area) - w.Invalidate(); + w.invalidate(); w.flags |= WF_DEAD; } @@ -1188,7 +1188,7 @@ public: WidgetIndex FindWidgetFromPoint(WindowBase& w, const ScreenCoordsXY& screenCoords) override { // Invalidate the window - w.OnPrepareDraw(); + w.onPrepareDraw(); // Find the widget at point x, y WidgetIndex widget_index = kWidgetIndexNull; @@ -1228,7 +1228,7 @@ public: WindowVisitEach([pred](WindowBase* w) { if (pred(w)) { - w->Invalidate(); + w->invalidate(); } }); } @@ -1262,7 +1262,7 @@ public: */ void InvalidateAll() override { - WindowVisitEach([](WindowBase* w) { w->Invalidate(); }); + WindowVisitEach([](WindowBase* w) { w->invalidate(); }); } /** @@ -1350,7 +1350,7 @@ public: { std::iter_swap(itSourcePos, itDestPos); } - w.Invalidate(); + w.invalidate(); if (w.windowPos.x + w.width < 20) { @@ -1358,7 +1358,7 @@ public: w.windowPos.x += i; if (w.viewport != nullptr) w.viewport->pos.x += i; - w.Invalidate(); + w.invalidate(); } } } @@ -1371,7 +1371,7 @@ public: if (w != nullptr) { w->flags |= flags; - w->Invalidate(); + w->invalidate(); w = BringToFront(*w); } @@ -1393,7 +1393,7 @@ public: if (w != nullptr) { w->flags |= WF_WHITE_BORDER_MASK; - w->Invalidate(); + w->invalidate(); w = BringToFront(*w); } diff --git a/src/openrct2-ui/input/MouseInput.cpp b/src/openrct2-ui/input/MouseInput.cpp index 334b907421..b329bad495 100644 --- a/src/openrct2-ui/input/MouseInput.cpp +++ b/src/openrct2-ui/input/MouseInput.cpp @@ -408,7 +408,7 @@ namespace OpenRCT2 break; } - w->OnToolDrag(gCurrentToolWidget.widgetIndex, screenCoords); + w->onToolDrag(gCurrentToolWidget.widgetIndex, screenCoords); break; case MouseState::LeftRelease: _inputState = InputState::Reset; @@ -420,7 +420,7 @@ namespace OpenRCT2 gCurrentToolWidget.windowClassification, gCurrentToolWidget.windowNumber); if (w != nullptr) { - w->OnToolUp(gCurrentToolWidget.widgetIndex, screenCoords); + w->onToolUp(gCurrentToolWidget.widgetIndex, screenCoords); } } else if (!gInputFlags.has(InputFlag::leftMousePressed)) @@ -501,7 +501,7 @@ namespace OpenRCT2 _inputState = InputState::Normal; gTooltipCloseTimeout = 0; gTooltipWidget = _dragWidget; - w.OnMoved(screenCoords); + w.onMoved(screenCoords); } static void InputWindowResizeBegin(WindowBase& w, WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) @@ -661,10 +661,10 @@ namespace OpenRCT2 _currentScrollArea = scroll_area; _currentScrollIndex = scroll_id; - w.OnScrollSelect(scroll_id, scroll_area); + w.onScrollSelect(scroll_id, scroll_area); if (scroll_area == SCROLL_PART_VIEW) { - w.OnScrollMouseDown(scroll_id, scrollCoords); + w.onScrollMouseDown(scroll_id, scrollCoords); return; } @@ -756,7 +756,7 @@ namespace OpenRCT2 switch (scroll_part) { case SCROLL_PART_VIEW: - w.OnScrollMouseDrag(scroll_id, newScreenCoords); + w.onScrollMouseDrag(scroll_id, newScreenCoords); break; case SCROLL_PART_HSCROLLBAR_LEFT: InputScrollPartUpdateHLeft(w, widgetIndex, scroll_id); @@ -982,7 +982,7 @@ namespace OpenRCT2 if (scroll_part == SCROLL_PART_VIEW) { - w->OnScrollMouseOver(scrollId, newScreenCoords); + w->onScrollMouseOver(scrollId, newScreenCoords); } } @@ -1027,7 +1027,7 @@ namespace OpenRCT2 WindowBase* w = windowMgr->FindByNumber(gHoverWidget.windowClassification, gHoverWidget.windowNumber); if (w != nullptr) { - w->OnPrepareDraw(); + w->onPrepareDraw(); if (w->widgets[gHoverWidget.widgetIndex].type == WidgetType::flatBtn) { windowMgr->InvalidateWidgetByNumber( @@ -1091,7 +1091,7 @@ namespace OpenRCT2 if (w != nullptr) { gInputFlags.set(InputFlag::leftMousePressed); - w->OnToolDown(gCurrentToolWidget.widgetIndex, screenCoords); + w->onToolDown(gCurrentToolWidget.widgetIndex, screenCoords); } } break; @@ -1136,7 +1136,7 @@ namespace OpenRCT2 _clickRepeatTicks = gCurrentRealTimeTicks; windowMgr->InvalidateWidgetByNumber(windowClass, windowNumber, widgetIndex); - w->OnMouseDown(widgetIndex); + w->onMouseDown(widgetIndex); } break; } @@ -1202,13 +1202,13 @@ namespace OpenRCT2 break; } // Same as default but with scroll_x/y - cursorId = window->OnCursor(widgetId, scrollCoords, CursorID::Arrow); + cursorId = window->onCursor(widgetId, scrollCoords, CursorID::Arrow); if (cursorId == CursorID::Undefined) cursorId = CursorID::Arrow; break; } default: - cursorId = window->OnCursor(widgetId, screenCoords, CursorID::Arrow); + cursorId = window->onCursor(widgetId, screenCoords, CursorID::Arrow); if (cursorId == CursorID::Undefined) cursorId = CursorID::Arrow; break; @@ -1234,7 +1234,7 @@ namespace OpenRCT2 if (w == nullptr) ToolCancel(); else if (InputGetState() != InputState::ViewportRight) - w->OnToolUpdate(gCurrentToolWidget.widgetIndex, screenCoords); + w->onToolUpdate(gCurrentToolWidget.widgetIndex, screenCoords); } } @@ -1307,7 +1307,7 @@ namespace OpenRCT2 { if (widgetIsHoldable(*w, widgetIndex)) { - w->OnMouseDown(widgetIndex); + w->onMouseDown(widgetIndex); } // Subtract initial delay from here on we want the event each third tick. @@ -1397,7 +1397,7 @@ namespace OpenRCT2 dropdown_index = gDropdown.defaultIndex; } } - cursor_w->OnDropdown(cursor_widgetIndex, dropdown_index); + cursor_w->onDropdown(cursor_widgetIndex, dropdown_index); } } } @@ -1429,7 +1429,7 @@ namespace OpenRCT2 break; windowMgr->InvalidateWidgetByNumber(cursor_w_class, cursor_w_number, widgetIndex); - w->OnMouseUp(widgetIndex); + w->onMouseUp(widgetIndex); return; default: diff --git a/src/openrct2-ui/input/Shortcuts.cpp b/src/openrct2-ui/input/Shortcuts.cpp index 713ebcd5a3..73a1564cd4 100644 --- a/src/openrct2-ui/input/Shortcuts.cpp +++ b/src/openrct2-ui/input/Shortcuts.cpp @@ -77,7 +77,7 @@ static void ToggleViewFlag(int32_t viewportFlag) if (window != nullptr) { window->viewport->flags ^= viewportFlag; - window->Invalidate(); + window->invalidate(); } } } @@ -94,7 +94,7 @@ static void ShortcutRotateConstructionObject() if (w != nullptr && !widgetIsDisabled(*w, WC_SCENERY__WIDX_SCENERY_ROTATE_OBJECTS_BUTTON) && w->widgets[WC_SCENERY__WIDX_SCENERY_ROTATE_OBJECTS_BUTTON].type != WidgetType::empty) { - w->OnMouseUp(WC_SCENERY__WIDX_SCENERY_ROTATE_OBJECTS_BUTTON); + w->onMouseUp(WC_SCENERY__WIDX_SCENERY_ROTATE_OBJECTS_BUTTON); return; } @@ -106,7 +106,7 @@ static void ShortcutRotateConstructionObject() // Check if building a maze... if (w->widgets[WC_RIDE_CONSTRUCTION__WIDX_ROTATE].tooltip != STR_RIDE_CONSTRUCTION_BUILD_MAZE_IN_THIS_DIRECTION_TIP) { - w->OnMouseUp(WC_RIDE_CONSTRUCTION__WIDX_ROTATE); + w->onMouseUp(WC_RIDE_CONSTRUCTION__WIDX_ROTATE); return; } } @@ -116,7 +116,7 @@ static void ShortcutRotateConstructionObject() if (w != nullptr && !widgetIsDisabled(*w, WC_TRACK_DESIGN_LIST__WIDX_ROTATE) && w->widgets[WC_TRACK_DESIGN_LIST__WIDX_ROTATE].type != WidgetType::empty) { - w->OnMouseUp(WC_TRACK_DESIGN_LIST__WIDX_ROTATE); + w->onMouseUp(WC_TRACK_DESIGN_LIST__WIDX_ROTATE); return; } @@ -125,7 +125,7 @@ static void ShortcutRotateConstructionObject() if (w != nullptr && !widgetIsDisabled(*w, WC_TRACK_DESIGN_PLACE__WIDX_ROTATE) && w->widgets[WC_TRACK_DESIGN_PLACE__WIDX_ROTATE].type != WidgetType::empty) { - w->OnMouseUp(WC_TRACK_DESIGN_PLACE__WIDX_ROTATE); + w->onMouseUp(WC_TRACK_DESIGN_PLACE__WIDX_ROTATE); return; } @@ -134,7 +134,7 @@ static void ShortcutRotateConstructionObject() if (w != nullptr && !widgetIsDisabled(*w, WC_EDITOR_PARK_ENTRANCE__WIDX_ROTATE_ENTRANCE_BUTTON) && w->widgets[WC_EDITOR_PARK_ENTRANCE__WIDX_ROTATE_ENTRANCE_BUTTON].type != WidgetType::empty) { - w->OnMouseUp(WC_EDITOR_PARK_ENTRANCE__WIDX_ROTATE_ENTRANCE_BUTTON); + w->onMouseUp(WC_EDITOR_PARK_ENTRANCE__WIDX_ROTATE_ENTRANCE_BUTTON); return; } @@ -143,7 +143,7 @@ static void ShortcutRotateConstructionObject() if (w != nullptr && !widgetIsDisabled(*w, WC_TILE_INSPECTOR__WIDX_BUTTON_ROTATE) && w->widgets[WC_TILE_INSPECTOR__WIDX_BUTTON_ROTATE].type != WidgetType::empty) { - w->OnMouseUp(WC_TILE_INSPECTOR__WIDX_BUTTON_ROTATE); + w->onMouseUp(WC_TILE_INSPECTOR__WIDX_BUTTON_ROTATE); return; } } @@ -442,15 +442,15 @@ static void ShortcutOpenSceneryPicker() return; auto* windowMgr = GetWindowManager(); - WindowBase* window_scenery = windowMgr->FindByClass(WindowClass::Scenery); - if (window_scenery == nullptr) + WindowBase* sceneryWindow = windowMgr->FindByClass(WindowClass::Scenery); + if (sceneryWindow == nullptr) ToggleSceneryWindow(); - window_scenery = windowMgr->FindByClass(WindowClass::Scenery); - if (window_scenery != nullptr && !widgetIsDisabled(*window_scenery, WC_SCENERY__WIDX_SCENERY_EYEDROPPER_BUTTON) + sceneryWindow = windowMgr->FindByClass(WindowClass::Scenery); + if (sceneryWindow != nullptr && !widgetIsDisabled(*sceneryWindow, WC_SCENERY__WIDX_SCENERY_EYEDROPPER_BUTTON) && !gWindowSceneryEyedropperEnabled) { - window_scenery->OnMouseUp(WC_SCENERY__WIDX_SCENERY_EYEDROPPER_BUTTON); + sceneryWindow->onMouseUp(WC_SCENERY__WIDX_SCENERY_EYEDROPPER_BUTTON); return; } } @@ -481,7 +481,7 @@ static void TileInspectorMouseUp(WidgetIndex widgetIndex) auto w = windowMgr->FindByClass(WindowClass::TileInspector); if (w != nullptr && !widgetIsDisabled(*w, widgetIndex) && w->widgets[widgetIndex].type != WidgetType::empty) { - w->OnMouseUp(widgetIndex); + w->onMouseUp(widgetIndex); } } @@ -491,7 +491,7 @@ static void TileInspectorMouseDown(WidgetIndex widgetIndex) auto w = windowMgr->FindByClass(WindowClass::TileInspector); if (w != nullptr && !widgetIsDisabled(*w, widgetIndex) && w->widgets[widgetIndex].type != WidgetType::empty) { - w->OnMouseDown(widgetIndex); + w->onMouseDown(widgetIndex); } } @@ -563,7 +563,7 @@ static void ShortcutIncreaseElementHeight() break; } if (action != -1 && !widgetIsDisabled(*w, action) && w->widgets[action].type != WidgetType::empty) - w->OnMouseDown(action); + w->onMouseDown(action); return; } } @@ -603,7 +603,7 @@ static void ShortcutDecreaseElementHeight() break; } if (action != -1 && !widgetIsDisabled(*w, action) && w->widgets[action].type != WidgetType::empty) - w->OnMouseDown(action); + w->onMouseDown(action); return; } } diff --git a/src/openrct2-ui/interface/Widget.cpp b/src/openrct2-ui/interface/Widget.cpp index 0a204d6748..c0d48f6467 100644 --- a/src/openrct2-ui/interface/Widget.cpp +++ b/src/openrct2-ui/interface/Widget.cpp @@ -737,7 +737,7 @@ namespace OpenRCT2::Ui // Draw the scroll contents if (scrollRT.width > 0 && scrollRT.height > 0) - w.OnScrollDraw(scrollIndex, scrollRT); + w.onScrollDraw(scrollIndex, scrollRT); } static void WidgetHScrollbarDraw( diff --git a/src/openrct2-ui/interface/Window.cpp b/src/openrct2-ui/interface/Window.cpp index 30b1beb9ac..7df12f695a 100644 --- a/src/openrct2-ui/interface/Window.cpp +++ b/src/openrct2-ui/interface/Window.cpp @@ -247,7 +247,7 @@ namespace OpenRCT2::Ui return false; } - w.OnMouseDown(targetWidgetIndex); + w.onMouseDown(targetWidgetIndex); return true; } @@ -317,7 +317,7 @@ namespace OpenRCT2::Ui Config::Get().general.DisableScreensaver ? SDL_DisableScreenSaver() : SDL_EnableScreenSaver(); } - void Window::ScrollToViewport() + void Window::scrollToViewport() { if (viewport == nullptr || !focus.has_value()) return; @@ -329,83 +329,83 @@ namespace OpenRCT2::Ui WindowScrollToLocation(*mainWindow, newCoords); } - void Window::OnDraw(RenderTarget& rt) + void Window::onDraw(RenderTarget& rt) { Windows::WindowDrawWidgets(*this, rt); } - void Window::OnDrawWidget(WidgetIndex widgetIndex, RenderTarget& rt) + void Window::onDrawWidget(WidgetIndex widgetIndex, RenderTarget& rt) { widgetDraw(rt, *this, widgetIndex); } - void Window::InitScrollWidgets() + void Window::initScrollWidgets() { Windows::WindowInitScrollWidgets(*this); } - void Window::InvalidateWidget(WidgetIndex widgetIndex) + void Window::invalidateWidget(WidgetIndex widgetIndex) { auto* windowMgr = Ui::GetWindowManager(); windowMgr->InvalidateWidget(*this, widgetIndex); } - bool Window::IsWidgetDisabled(WidgetIndex widgetIndex) const + bool Window::isWidgetDisabled(WidgetIndex widgetIndex) const { return widgetIsDisabled(*this, widgetIndex); } - bool Window::IsWidgetPressed(WidgetIndex widgetIndex) const + bool Window::isWidgetPressed(WidgetIndex widgetIndex) const { return widgetIsPressed(*this, widgetIndex); } - void Window::SetWidgetEnabled(WidgetIndex widgetIndex, bool value) + void Window::setWidgetEnabled(WidgetIndex widgetIndex, bool value) { widgetSetEnabled(*this, widgetIndex, value); } - void Window::SetWidgetDisabled(WidgetIndex widgetIndex, bool value) + void Window::setWidgetDisabled(WidgetIndex widgetIndex, bool value) { widgetSetDisabled(*this, widgetIndex, value); } - void Window::SetWidgetDisabledAndInvalidate(WidgetIndex widgetIndex, bool value) + void Window::setWidgetDisabledAndInvalidate(WidgetIndex widgetIndex, bool value) { - bool oldState = IsWidgetDisabled(widgetIndex); + bool oldState = isWidgetDisabled(widgetIndex); if (oldState != value) { widgetSetDisabled(*this, widgetIndex, value); - InvalidateWidget(widgetIndex); + invalidateWidget(widgetIndex); } } - void Window::SetWidgetPressed(WidgetIndex widgetIndex, bool value) + void Window::setWidgetPressed(WidgetIndex widgetIndex, bool value) { widgetSetPressed(*this, widgetIndex, value); } - void Window::SetCheckboxValue(WidgetIndex widgetIndex, bool value) + void Window::setCheckboxValue(WidgetIndex widgetIndex, bool value) { - SetWidgetPressed(widgetIndex, value); + setWidgetPressed(widgetIndex, value); } - void Window::DrawWidgets(RenderTarget& rt) + void Window::drawWidgets(RenderTarget& rt) { Windows::WindowDrawWidgets(*this, rt); } - void Window::Close() + void Window::close() { - CloseWindowModifier modifier = GetCloseModifier(); + CloseWindowModifier modifier = getCloseModifier(); if (modifier == CloseWindowModifier::shift) { - CloseOthers(); + closeOthers(); } else if (modifier == CloseWindowModifier::control) { - CloseOthersOfThisClass(); + closeOthersOfThisClass(); } else { @@ -414,19 +414,19 @@ namespace OpenRCT2::Ui } } - void Window::CloseOthers() + void Window::closeOthers() { auto* windowMgr = Ui::GetWindowManager(); windowMgr->CloseAllExceptNumberAndClass(number, classification); } - void Window::CloseOthersOfThisClass() + void Window::closeOthersOfThisClass() { auto* windowMgr = Ui::GetWindowManager(); windowMgr->CloseByClass(classification); } - CloseWindowModifier Window::GetCloseModifier() + CloseWindowModifier Window::getCloseModifier() { CloseWindowModifier lastModifier = CloseWindowModifier::none; @@ -440,7 +440,7 @@ namespace OpenRCT2::Ui return lastModifier; } - void Window::TextInputOpen( + void Window::textInputOpen( WidgetIndex callWidget, StringId title, StringId description, const Formatter& descriptionArgs, StringId existingText, uintptr_t existingArgs, int32_t maxLength) { @@ -448,7 +448,7 @@ namespace OpenRCT2::Ui this, callWidget, title, description, descriptionArgs, existingText, existingArgs, maxLength); } - void Window::ResizeSpinner(WidgetIndex widgetIndex, const ScreenCoordsXY& origin, const ScreenSize& size) + void Window::resizeSpinner(WidgetIndex widgetIndex, const ScreenCoordsXY& origin, const ScreenSize& size) { auto right = origin.x + size.width - 1; auto bottom = origin.y + size.height - 1; @@ -468,7 +468,7 @@ namespace OpenRCT2::Ui widgets[widgetIndex + 2].bottom = bottom - 1; } - void Window::ResizeDropdown(WidgetIndex widgetIndex, const ScreenCoordsXY& origin, const ScreenSize& size) + void Window::resizeDropdown(WidgetIndex widgetIndex, const ScreenCoordsXY& origin, const ScreenSize& size) { auto right = origin.x + size.width - 1; auto bottom = origin.y + size.height - 1; @@ -604,7 +604,7 @@ namespace OpenRCT2::Ui::Windows auto* windowMgr = GetWindowManager(); WindowBase* w = windowMgr->FindByNumber(_currentTextBox.window.classification, _currentTextBox.window.number); windowMgr->InvalidateWidget(*w, _currentTextBox.widgetIndex); - w->OnTextInput(_currentTextBox.widgetIndex, _textBoxInput); + w->onTextInput(_currentTextBox.widgetIndex, _textBoxInput); } } const TextInputSession* GetTextboxSession() @@ -634,15 +634,15 @@ namespace OpenRCT2::Ui::Windows return; // Invalidate old region - w.Invalidate(); + w.invalidate(); // Clamp new size to minimum and maximum w.width = std::clamp(w.width + dw, w.minWidth, w.maxWidth); w.height = std::clamp(w.height + dh, w.minHeight, w.maxHeight); - w.OnResize(); - w.ResizeFrame(); - w.OnPrepareDraw(); + w.onResize(); + w.resizeFrame(); + w.onPrepareDraw(); // Update scroll widgets for (auto& scroll : w.scrolls) @@ -653,7 +653,7 @@ namespace OpenRCT2::Ui::Windows WindowUpdateScrollWidgets(w); // Invalidate new region - w.Invalidate(); + w.invalidate(); } /** @@ -673,7 +673,7 @@ namespace OpenRCT2::Ui::Windows continue; auto& scroll = w.scrolls[scrollIndex]; - ScreenSize scrollSize = w.OnScrollGetSize(scrollIndex); + ScreenSize scrollSize = w.onScrollGetSize(scrollIndex); width = scrollSize.width; height = scrollSize.height; @@ -704,7 +704,7 @@ namespace OpenRCT2::Ui::Windows if (scrollPositionChanged) { widgetScrollUpdateThumbs(w, widgetIndex); - w.Invalidate(); + w.invalidate(); } scrollIndex++; } @@ -726,7 +726,7 @@ namespace OpenRCT2::Ui::Windows auto& scroll = w.scrolls[scroll_index]; scroll.flags = 0; - ScreenSize scrollSize = w.OnScrollGetSize(scroll_index); + ScreenSize scrollSize = w.onScrollGetSize(scroll_index); scroll.contentOffsetX = 0; scroll.contentWidth = scrollSize.width + 1; scroll.contentOffsetY = 0; @@ -894,7 +894,7 @@ namespace OpenRCT2::Ui::Windows return; // Invalidate old region - w.Invalidate(); + w.invalidate(); // Translate window and viewport w.windowPos += deltaCoords; @@ -904,7 +904,7 @@ namespace OpenRCT2::Ui::Windows } // Invalidate new region - w.Invalidate(); + w.invalidate(); } void WindowSetPosition(WindowBase& w, const ScreenCoordsXY& screenCoords) @@ -983,11 +983,11 @@ namespace OpenRCT2::Ui::Windows // Resize window if size has changed if (w.width != width || w.height != height) { - w.Invalidate(); + w.invalidate(); w.width = width; w.height = height; - w.ResizeFrame(); - w.Invalidate(); + w.resizeFrame(); + w.invalidate(); return true; } @@ -1044,7 +1044,7 @@ namespace OpenRCT2::Ui::Windows { if (w.windowPos.y + widget.top < rt.y + rt.height && w.windowPos.y + widget.bottom >= rt.y) { - w.OnDrawWidget(widgetIndex, rt); + w.onDrawWidget(widgetIndex, rt); } } } diff --git a/src/openrct2-ui/interface/Window.h b/src/openrct2-ui/interface/Window.h index 02c4c5a3f9..df16994ae1 100644 --- a/src/openrct2-ui/interface/Window.h +++ b/src/openrct2-ui/interface/Window.h @@ -23,30 +23,30 @@ namespace OpenRCT2::Ui struct Window : WindowBase { - void OnDraw(RenderTarget& rt) override; - void OnDrawWidget(WidgetIndex widgetIndex, RenderTarget& rt) override; + void onDraw(RenderTarget& rt) override; + void onDrawWidget(WidgetIndex widgetIndex, RenderTarget& rt) override; - void ScrollToViewport(); - void InitScrollWidgets(); - void InvalidateWidget(WidgetIndex widgetIndex); - bool IsWidgetDisabled(WidgetIndex widgetIndex) const; - bool IsWidgetPressed(WidgetIndex widgetIndex) const; - void SetWidgetEnabled(WidgetIndex widgetIndex, bool value); - void SetWidgetDisabled(WidgetIndex widgetIndex, bool value); - void SetWidgetDisabledAndInvalidate(WidgetIndex widgetIndex, bool value); - void SetWidgetPressed(WidgetIndex widgetIndex, bool value); - void SetCheckboxValue(WidgetIndex widgetIndex, bool value); - void DrawWidgets(RenderTarget& rt); - void Close(); - void CloseOthers(); - void CloseOthersOfThisClass(); - CloseWindowModifier GetCloseModifier(); - void TextInputOpen( + void scrollToViewport(); + void initScrollWidgets(); + void invalidateWidget(WidgetIndex widgetIndex); + bool isWidgetDisabled(WidgetIndex widgetIndex) const; + bool isWidgetPressed(WidgetIndex widgetIndex) const; + void setWidgetEnabled(WidgetIndex widgetIndex, bool value); + void setWidgetDisabled(WidgetIndex widgetIndex, bool value); + void setWidgetDisabledAndInvalidate(WidgetIndex widgetIndex, bool value); + void setWidgetPressed(WidgetIndex widgetIndex, bool value); + void setCheckboxValue(WidgetIndex widgetIndex, bool value); + void drawWidgets(RenderTarget& rt); + void close(); + void closeOthers(); + void closeOthersOfThisClass(); + CloseWindowModifier getCloseModifier(); + void textInputOpen( WidgetIndex callWidget, StringId title, StringId description, const Formatter& descriptionArgs, StringId existingText, uintptr_t existingArgs, int32_t maxLength); - void ResizeSpinner(WidgetIndex widgetIndex, const ScreenCoordsXY& origin, const ScreenSize& size); - void ResizeDropdown(WidgetIndex widgetIndex, const ScreenCoordsXY& origin, const ScreenSize& size); + void resizeSpinner(WidgetIndex widgetIndex, const ScreenCoordsXY& origin, const ScreenSize& size); + void resizeDropdown(WidgetIndex widgetIndex, const ScreenCoordsXY& origin, const ScreenSize& size); }; void WindowAllWheelInput(); diff --git a/src/openrct2-ui/scripting/CustomListView.cpp b/src/openrct2-ui/scripting/CustomListView.cpp index 33537d0e1c..ee941972aa 100644 --- a/src/openrct2-ui/scripting/CustomListView.cpp +++ b/src/openrct2-ui/scripting/CustomListView.cpp @@ -848,7 +848,7 @@ OpenRCT2::Widget* CustomListView::GetWidget() const void CustomListView::Invalidate() { - ParentWindow->Invalidate(); + ParentWindow->invalidate(); } #endif diff --git a/src/openrct2-ui/scripting/CustomWindow.cpp b/src/openrct2-ui/scripting/CustomWindow.cpp index 4922d909a5..04e7a93714 100644 --- a/src/openrct2-ui/scripting/CustomWindow.cpp +++ b/src/openrct2-ui/scripting/CustomWindow.cpp @@ -404,7 +404,7 @@ namespace OpenRCT2::Ui::Windows { } - void OnOpen() override + void onOpen() override { number = GetNewWindowNumber(); @@ -431,27 +431,27 @@ namespace OpenRCT2::Ui::Windows RefreshWidgets(); } - void OnClose() override + void onClose() override { InvokeEventHandler(_info.Owner, _info.Desc.OnClose); } - void OnResize() override + void onResize() override { if (width < minWidth) { - Invalidate(); + invalidate(); width = minWidth; } if (height < minHeight) { - Invalidate(); + invalidate(); height = minHeight; } UpdateViewport(); } - void OnUpdate() override + void onUpdate() override { if (_info.Desc.Tabs.size() > static_cast(page)) { @@ -464,7 +464,7 @@ namespace OpenRCT2::Ui::Windows currentFrame = 0; } - InvalidateWidget(WIDX_TAB_0 + this->page); + invalidateWidget(WIDX_TAB_0 + this->page); } } @@ -485,7 +485,7 @@ namespace OpenRCT2::Ui::Windows UpdateViewport(); } - void OnPrepareDraw() override + void onPrepareDraw() override { auto& closeButton = widgets[WIDX_CLOSE]; bool translucent = colours[closeButton.colour].hasFlag(ColourFlag::translucent); @@ -535,7 +535,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnDraw(RenderTarget& rt) override + void onDraw(RenderTarget& rt) override { WindowDrawWidgets(*this, rt); DrawTabImages(rt); @@ -549,7 +549,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnDrawWidget(WidgetIndex widgetIndex, RenderTarget& rt) override + void onDrawWidget(WidgetIndex widgetIndex, RenderTarget& rt) override { const auto& widget = widgets[widgetIndex]; const auto widgetDesc = _info.GetCustomWidgetDesc(this, widgetIndex); @@ -573,11 +573,11 @@ namespace OpenRCT2::Ui::Windows } else { - Window::OnDrawWidget(widgetIndex, rt); + Window::onDrawWidget(widgetIndex, rt); } } - void OnMouseUp(WidgetIndex widgetIndex) override + void onMouseUp(WidgetIndex widgetIndex) override { switch (widgetIndex) { @@ -631,7 +631,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnMouseDown(WidgetIndex widgetIndex) override + void onMouseDown(WidgetIndex widgetIndex) override { auto* widget = &widgets[widgetIndex]; const auto widgetDesc = _info.GetCustomWidgetDesc(this, widgetIndex); @@ -676,7 +676,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) override + void onDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) override { if (dropdownIndex == -1) return; @@ -695,7 +695,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnTextInput(WidgetIndex widgetIndex, std::string_view text) override + void onTextInput(WidgetIndex widgetIndex, std::string_view text) override { auto widgetDesc = _info.GetCustomWidgetDesc(this, widgetIndex); if (widgetDesc != nullptr) @@ -713,7 +713,7 @@ namespace OpenRCT2::Ui::Windows } } - ScreenSize OnScrollGetSize(int32_t scrollIndex) override + ScreenSize onScrollGetSize(int32_t scrollIndex) override { if (scrollIndex < static_cast(_info.ListViews.size())) { @@ -723,7 +723,7 @@ namespace OpenRCT2::Ui::Windows return {}; } - void OnScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override + void onScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override { if (scrollIndex < static_cast(_info.ListViews.size())) { @@ -731,7 +731,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnScrollMouseDrag(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override + void onScrollMouseDrag(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override { if (scrollIndex < static_cast(_info.ListViews.size())) { @@ -739,7 +739,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override + void onScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override { if (scrollIndex < static_cast(_info.ListViews.size())) { @@ -747,7 +747,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnScrollDraw(int32_t scrollIndex, RenderTarget& rt) override + void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override { if (scrollIndex < static_cast(_info.ListViews.size())) { @@ -764,20 +764,20 @@ namespace OpenRCT2::Ui::Windows currentFrame = 0; RefreshWidgets(); - Invalidate(); - OnResize(); - OnPrepareDraw(); + invalidate(); + onResize(); + onPrepareDraw(); WindowInitScrollWidgets(*this); - Invalidate(); + invalidate(); InvokeEventHandler(_info.Owner, _info.Desc.OnTabChange); } - const CustomWindowInfo& GetInfo() const + const CustomWindowInfo& getInfo() const { return _info; } - CustomWindowInfo& GetInfo() + CustomWindowInfo& getInfo() { return _info; } @@ -814,7 +814,7 @@ namespace OpenRCT2::Ui::Windows { ViewportCreate(*this, { left, top }, wwidth, wheight, Focus(CoordsXYZ(0, 0, 0))); flags |= WF_NO_SCROLLING; - Invalidate(); + invalidate(); } else { @@ -825,18 +825,18 @@ namespace OpenRCT2::Ui::Windows viewport->pos.y = top; viewport->width = wwidth; viewport->height = wheight; - Invalidate(); + invalidate(); } } } else { - RemoveViewport(); + removeViewport(); } } else { - RemoveViewport(); + removeViewport(); } } @@ -847,9 +847,9 @@ namespace OpenRCT2::Ui::Windows { for (size_t i = 0; i < numTabs; i++) { - SetWidgetPressed(static_cast(WIDX_TAB_0 + i), false); + setWidgetPressed(static_cast(WIDX_TAB_0 + i), false); } - SetWidgetPressed(WIDX_TAB_0 + page, true); + setWidgetPressed(WIDX_TAB_0 + page, true); } } @@ -949,7 +949,7 @@ namespace OpenRCT2::Ui::Windows } } - SetWidgets(widgetList); + setWidgets(widgetList); WindowInitScrollWidgets(*this); UpdateViewport(); @@ -1149,7 +1149,7 @@ namespace OpenRCT2::Ui::Windows static CustomWindowInfo& GetInfo(CustomWindow* w) { - return w->GetInfo(); + return w->getInfo(); } static void InvokeEventHandler(const std::shared_ptr& owner, const DukValue& dukHandler) diff --git a/src/openrct2-ui/scripting/ScViewport.hpp b/src/openrct2-ui/scripting/ScViewport.hpp index a90058050d..a734aa31cc 100644 --- a/src/openrct2-ui/scripting/ScViewport.hpp +++ b/src/openrct2-ui/scripting/ScViewport.hpp @@ -172,7 +172,7 @@ namespace OpenRCT2::Scripting if (viewport->flags != value) { viewport->flags = value; - w->Invalidate(); + w->invalidate(); } } } diff --git a/src/openrct2-ui/scripting/ScWindow.hpp b/src/openrct2-ui/scripting/ScWindow.hpp index 602901289f..229925d222 100644 --- a/src/openrct2-ui/scripting/ScWindow.hpp +++ b/src/openrct2-ui/scripting/ScWindow.hpp @@ -262,7 +262,7 @@ namespace OpenRCT2::Scripting } w->colours[i] = c; } - w->Invalidate(); + w->invalidate(); } } diff --git a/src/openrct2-ui/windows/About.cpp b/src/openrct2-ui/windows/About.cpp index 4a974575fb..1f5e1d2955 100644 --- a/src/openrct2-ui/windows/About.cpp +++ b/src/openrct2-ui/windows/About.cpp @@ -113,21 +113,21 @@ namespace OpenRCT2::Ui::Windows class AboutWindow final : public Window { public: - void OnOpen() override + void onOpen() override { - SetPage(WINDOW_ABOUT_PAGE_OPENRCT2); + setPage(WINDOW_ABOUT_PAGE_OPENRCT2); } - void OnMouseUp(WidgetIndex widgetIndex) override + void onMouseUp(WidgetIndex widgetIndex) override { switch (widgetIndex) { case WIDX_CLOSE: - Close(); + close(); break; case WIDX_TAB_ABOUT_OPENRCT2: case WIDX_TAB_ABOUT_RCT2: - SetPage(widgetIndex - WIDX_TAB_ABOUT_OPENRCT2); + setPage(widgetIndex - WIDX_TAB_ABOUT_OPENRCT2); break; case WIDX_JOIN_DISCORD: OpenRCT2::GetContext()->GetUiContext().OpenURL("https://discord.gg/ZXZd8D8"); @@ -147,9 +147,9 @@ namespace OpenRCT2::Ui::Windows } } - void OnDraw(RenderTarget& rt) override + void onDraw(RenderTarget& rt) override { - DrawWidgets(rt); + drawWidgets(rt); const auto& aboutOpenRCT2 = widgets[WIDX_TAB_ABOUT_OPENRCT2]; const auto& aboutRCT2 = widgets[WIDX_TAB_ABOUT_RCT2]; @@ -187,7 +187,7 @@ namespace OpenRCT2::Ui::Windows if (newHeight != height) { - Invalidate(); + invalidate(); widgets[WIDX_PAGE_BACKGROUND].bottom = newHeight; widgets[WIDX_BACKGROUND].bottom = newHeight; height = newHeight; @@ -195,7 +195,7 @@ namespace OpenRCT2::Ui::Windows } private: - void SetPage(int32_t p) + void setPage(int32_t p) { // Skip setting page if we're already on this page, unless we're initialising the window if (page == p && !widgets.empty()) @@ -206,7 +206,7 @@ namespace OpenRCT2::Ui::Windows pressedWidgets = 0; WindowSetResize(*this, kWindowSize, kWindowSize); - SetWidgets(_windowAboutPageWidgets[p]); + setWidgets(_windowAboutPageWidgets[p]); switch (p) { diff --git a/src/openrct2-ui/windows/AssetPacks.cpp b/src/openrct2-ui/windows/AssetPacks.cpp index b93f321675..8f4d4c1cf7 100644 --- a/src/openrct2-ui/windows/AssetPacks.cpp +++ b/src/openrct2-ui/windows/AssetPacks.cpp @@ -60,23 +60,23 @@ namespace OpenRCT2::Ui::Windows std::optional _selectedIndex; public: - void OnOpen() override + void onOpen() override { - SetWidgets(WindowAssetPacksWidgets); + setWidgets(WindowAssetPacksWidgets); WindowInitScrollWidgets(*this); } - void OnClose() override + void onClose() override { Apply(); } - void OnMouseUp(WidgetIndex widgetIndex) override + void onMouseUp(WidgetIndex widgetIndex) override { switch (widgetIndex) { case WIDX_CLOSE: - Close(); + close(); break; case WIDX_MOVE_UP: ReorderSelectedAssetPack(-1); @@ -90,7 +90,7 @@ namespace OpenRCT2::Ui::Windows } } - ScreenSize OnScrollGetSize(int32_t scrollIndex) override + ScreenSize onScrollGetSize(int32_t scrollIndex) override { ScreenSize result; auto assetPackManager = GetContext()->GetAssetPackManager(); @@ -103,13 +103,13 @@ namespace OpenRCT2::Ui::Windows if (_highlightedIndex) { _highlightedIndex = {}; - Invalidate(); + invalidate(); } return result; } - void OnScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override + void onScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override { auto isCheckBox = false; auto index = GetAssetPackIndexFromPosition(screenCoords, isCheckBox); @@ -124,7 +124,7 @@ namespace OpenRCT2::Ui::Windows if (assetPack != nullptr) { assetPack->SetEnabled(!assetPack->IsEnabled()); - Invalidate(); + invalidate(); } } } @@ -133,22 +133,22 @@ namespace OpenRCT2::Ui::Windows if (_selectedIndex != index) { _selectedIndex = index; - Invalidate(); + invalidate(); } } - void OnScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override + void onScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override { auto isCheckBox = false; auto index = GetAssetPackIndexFromPosition(screenCoords, isCheckBox); if (_highlightedIndex != index) { _highlightedIndex = index; - Invalidate(); + invalidate(); } } - void OnPrepareDraw() override + void onPrepareDraw() override { auto& list = widgets[WIDX_LIST]; list.left = 6; @@ -177,19 +177,19 @@ namespace OpenRCT2::Ui::Windows toolstripY += 24; } - SetWidgetDisabled(WIDX_MOVE_UP, !_selectedIndex || _selectedIndex == 0u); - SetWidgetDisabled(WIDX_MOVE_DOWN, !_selectedIndex || _selectedIndex >= GetNumAssetPacks() - 1); + setWidgetDisabled(WIDX_MOVE_UP, !_selectedIndex || _selectedIndex == 0u); + setWidgetDisabled(WIDX_MOVE_DOWN, !_selectedIndex || _selectedIndex >= GetNumAssetPacks() - 1); widgets[WIDX_APPLY].bottom = widgets[WIDX_LIST].bottom; widgets[WIDX_APPLY].top = widgets[WIDX_APPLY].bottom - 24; } - void OnDraw(RenderTarget& rt) override + void onDraw(RenderTarget& rt) override { - DrawWidgets(rt); + drawWidgets(rt); } - void OnScrollDraw(int32_t scrollIndex, RenderTarget& rt) override + void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override { auto rtCoords = ScreenCoordsXY{ rt.x, rt.y }; GfxFillRect( @@ -315,13 +315,13 @@ namespace OpenRCT2::Ui::Windows { assetPackManager->Swap(*_selectedIndex, *_selectedIndex - 1); (*_selectedIndex)--; - Invalidate(); + invalidate(); } else if (direction > 0 && *_selectedIndex < assetPackManager->GetCount() - 1) { assetPackManager->Swap(*_selectedIndex, *_selectedIndex + 1); (*_selectedIndex)++; - Invalidate(); + invalidate(); } } diff --git a/src/openrct2-ui/windows/Banner.cpp b/src/openrct2-ui/windows/Banner.cpp index 8000e54250..91dd76e9ea 100644 --- a/src/openrct2-ui/windows/Banner.cpp +++ b/src/openrct2-ui/windows/Banner.cpp @@ -83,7 +83,7 @@ namespace OpenRCT2::Ui::Windows private: CoordsXYZ _bannerViewPos; - void CreateViewport() + void createViewport() { const auto& viewportWidget = widgets[WIDX_VIEWPORT]; ViewportCreate( @@ -92,7 +92,7 @@ namespace OpenRCT2::Ui::Windows if (viewport != nullptr) viewport->flags = Config::Get().general.AlwaysShowGridlines ? VIEWPORT_FLAG_GRIDLINES : VIEWPORT_FLAG_NONE; - Invalidate(); + invalidate(); } BannerIndex GetBannerIndex() const @@ -131,13 +131,13 @@ namespace OpenRCT2::Ui::Windows } public: - void OnOpen() override + void onOpen() override { - SetWidgets(window_banner_widgets); + setWidgets(window_banner_widgets); WindowInitScrollWidgets(*this); } - void Initialise(WindowNumber _number) + void initialise(WindowNumber _number) { number = _number; auto* banner = GetBanner(BannerIndex::FromUnderlying(number)); @@ -147,16 +147,16 @@ namespace OpenRCT2::Ui::Windows return; _bannerViewPos = CoordsXYZ{ banner->position.ToCoordsXY().ToTileCentre(), bannerElement->GetBaseZ() }; - CreateViewport(); + createViewport(); } - void OnMouseDown(WidgetIndex widgetIndex) override + void onMouseDown(WidgetIndex widgetIndex) override { Widget* widget = &widgets[widgetIndex]; auto* banner = GetBanner(GetBannerIndex()); if (banner == nullptr) { - Close(); + close(); return; } switch (widgetIndex) @@ -184,12 +184,12 @@ namespace OpenRCT2::Ui::Windows } } - void OnMouseUp(WidgetIndex widgetIndex) override + void onMouseUp(WidgetIndex widgetIndex) override { auto* banner = GetBanner(GetBannerIndex()); if (banner == nullptr) { - Close(); + close(); return; } @@ -198,7 +198,7 @@ namespace OpenRCT2::Ui::Windows switch (widgetIndex) { case WIDX_CLOSE: - Close(); + close(); break; case WIDX_BANNER_DEMOLISH: { @@ -226,7 +226,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) override + void onDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) override { auto& gameState = getGameState(); switch (widgetIndex) @@ -254,7 +254,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnTextInput(WidgetIndex widgetIndex, std::string_view text) override + void onTextInput(WidgetIndex widgetIndex, std::string_view text) override { if (widgetIndex == WIDX_BANNER_TEXT) { @@ -263,15 +263,15 @@ namespace OpenRCT2::Ui::Windows } } - void OnViewportRotate() override + void onViewportRotate() override { - RemoveViewport(); - CreateViewport(); + removeViewport(); + createViewport(); } - void OnDraw(RenderTarget& rt) override + void onDraw(RenderTarget& rt) override { - DrawWidgets(rt); + drawWidgets(rt); if (viewport != nullptr) { @@ -279,7 +279,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnPrepareDraw() override + void onPrepareDraw() override { auto* banner = GetBanner(GetBannerIndex()); if (banner == nullptr) @@ -325,7 +325,7 @@ namespace OpenRCT2::Ui::Windows w = windowMgr->Create(WindowClass::Banner, kWindowSize, 0); if (w != nullptr) - w->Initialise(number); + w->initialise(number); return w; } diff --git a/src/openrct2-ui/windows/Changelog.cpp b/src/openrct2-ui/windows/Changelog.cpp index 8870160251..06ae48fbe5 100644 --- a/src/openrct2-ui/windows/Changelog.cpp +++ b/src/openrct2-ui/windows/Changelog.cpp @@ -130,15 +130,15 @@ namespace OpenRCT2::Ui::Windows *this, { kMinimumWindowWidth, kMinimumWindowHeight }, { (screenWidth * 4) / 5, (screenHeight * 4) / 5 }); } - void OnOpen() override + void onOpen() override { - SetWidgets(_windowChangelogWidgets); + setWidgets(_windowChangelogWidgets); WindowInitScrollWidgets(*this); SetResizeDimensions(); } - void OnResize() override + void onResize() override { SetResizeDimensions(); @@ -147,7 +147,7 @@ namespace OpenRCT2::Ui::Windows widgets[WIDX_OPEN_URL].right = widgets[WIDX_OPEN_URL].left + downloadButtonWidth; } - void OnPrepareDraw() override + void onPrepareDraw() override { widgets[WIDX_SCROLL].right = width - 3; widgets[WIDX_SCROLL].bottom = height - 22; @@ -155,12 +155,12 @@ namespace OpenRCT2::Ui::Windows widgets[WIDX_OPEN_URL].top = height - 19; } - void OnMouseUp(WidgetIndex widgetIndex) override + void onMouseUp(WidgetIndex widgetIndex) override { switch (widgetIndex) { case WIDX_CLOSE: - Close(); + close(); break; case WIDX_OPEN_URL: if (_newVersionInfo != nullptr) @@ -175,7 +175,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnScrollDraw(int32_t scrollIndex, RenderTarget& rt) override + void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override { const int32_t lineHeight = FontGetLineHeight(FontStyle::Medium); @@ -190,7 +190,7 @@ namespace OpenRCT2::Ui::Windows } } - ScreenSize OnScrollGetSize(int32_t scrollIndex) override + ScreenSize onScrollGetSize(int32_t scrollIndex) override { return ScreenSize( _changelogLongestLineWidth + 4, diff --git a/src/openrct2-ui/windows/Cheats.cpp b/src/openrct2-ui/windows/Cheats.cpp index 1aec714985..10fcaa3a92 100644 --- a/src/openrct2-ui/windows/Cheats.cpp +++ b/src/openrct2-ui/windows/Cheats.cpp @@ -406,46 +406,46 @@ static StringId window_cheats_page_titles[] = { int32_t _daySpinnerValue = 1; public: - void OnOpen() override + void onOpen() override { - SetPage(WINDOW_CHEATS_PAGE_MONEY); + setPage(WINDOW_CHEATS_PAGE_MONEY); _parkRatingSpinnerValue = Park::GetForcedRating() >= 0 ? Park::GetForcedRating() : 999; } - void OnUpdate() override + void onUpdate() override { currentFrame++; - InvalidateWidget(WIDX_TAB_1 + page); + invalidateWidget(WIDX_TAB_1 + page); } - void OnMouseDown(WidgetIndex widgetIndex) override + void onMouseDown(WidgetIndex widgetIndex) override { switch (page) { case WINDOW_CHEATS_PAGE_MONEY: - OnMouseDownMoney(widgetIndex); + onMouseDownMoney(widgetIndex); break; case WINDOW_CHEATS_PAGE_DATE: - OnMouseDownDate(widgetIndex); + onMouseDownDate(widgetIndex); break; case WINDOW_CHEATS_PAGE_PARK: - OnMouseDownPark(widgetIndex); + onMouseDownPark(widgetIndex); break; case WINDOW_CHEATS_PAGE_STAFF: - OnMouseDownStaff(widgetIndex); + onMouseDownStaff(widgetIndex); break; case WINDOW_CHEATS_PAGE_WEATHER: - OnMouseDownWeather(widgetIndex); + onMouseDownWeather(widgetIndex); break; } } - void OnMouseUp(WidgetIndex widgetIndex) override + void onMouseUp(WidgetIndex widgetIndex) override { switch (widgetIndex) { case WIDX_CLOSE: - Close(); + close(); break; case WIDX_TAB_1: case WIDX_TAB_2: @@ -454,55 +454,55 @@ static StringId window_cheats_page_titles[] = { case WIDX_TAB_5: case WIDX_TAB_6: case WIDX_TAB_7: - SetPage(widgetIndex - WIDX_TAB_1); + setPage(widgetIndex - WIDX_TAB_1); break; default: switch (page) { case WINDOW_CHEATS_PAGE_MONEY: - OnMouseUpMoney(widgetIndex); + onMouseUpMoney(widgetIndex); break; case WINDOW_CHEATS_PAGE_GUESTS: - OnMouseUpGuests(widgetIndex); + onMouseUpGuests(widgetIndex); break; case WINDOW_CHEATS_PAGE_PARK: - OnMouseUpPark(widgetIndex); + onMouseUpPark(widgetIndex); break; case WINDOW_CHEATS_PAGE_RIDES: - OnMouseUpRides(widgetIndex); + onMouseUpRides(widgetIndex); break; case WINDOW_CHEATS_PAGE_STAFF: - OnMouseUpStaff(widgetIndex); + onMouseUpStaff(widgetIndex); break; case WINDOW_CHEATS_PAGE_WEATHER: - OnMouseUpWeather(widgetIndex); + onMouseUpWeather(widgetIndex); break; } break; } } - void OnDropdown(WidgetIndex widgetIndex, int32_t selectedIndex) override + void onDropdown(WidgetIndex widgetIndex, int32_t selectedIndex) override { if (page == WINDOW_CHEATS_PAGE_STAFF) { - OnDropdownStaff(widgetIndex, selectedIndex); + onDropdownStaff(widgetIndex, selectedIndex); } else if (page == WINDOW_CHEATS_PAGE_WEATHER) { - OnDropdownWeather(widgetIndex, selectedIndex); + onDropdownWeather(widgetIndex, selectedIndex); } } - void OnPrepareDraw() override + void onPrepareDraw() override { pressedWidgets = 0; disabledWidgets = 0; // Set correct active tab for (auto i = 0; i < WINDOW_CHEATS_PAGE_COUNT; i++) - SetWidgetPressed(WIDX_TAB_1 + i, false); - SetWidgetPressed(WIDX_TAB_1 + page, true); + setWidgetPressed(WIDX_TAB_1 + i, false); + setWidgetPressed(WIDX_TAB_1 + page, true); // Set title widgets[WIDX_TITLE].text = window_cheats_page_titles[page]; @@ -514,28 +514,28 @@ static StringId window_cheats_page_titles[] = { { if (isInEditorMode()) { - SetWidgetDisabled(WIDX_NO_MONEY, true); + setWidgetDisabled(WIDX_NO_MONEY, true); } auto moneyDisabled = (gameState.park.flags & PARK_FLAGS_NO_MONEY) != 0; - SetCheckboxValue(WIDX_NO_MONEY, moneyDisabled); - SetWidgetDisabled(WIDX_ADD_SET_MONEY_GROUP, moneyDisabled); - SetWidgetDisabled(WIDX_MONEY_SPINNER, moneyDisabled); - SetWidgetDisabled(WIDX_MONEY_SPINNER_INCREMENT, moneyDisabled); - SetWidgetDisabled(WIDX_MONEY_SPINNER_DECREMENT, moneyDisabled); - SetWidgetDisabled(WIDX_ADD_MONEY, moneyDisabled); - SetWidgetDisabled(WIDX_SET_MONEY, moneyDisabled); - SetWidgetDisabled(WIDX_CLEAR_LOAN, moneyDisabled); + setCheckboxValue(WIDX_NO_MONEY, moneyDisabled); + setWidgetDisabled(WIDX_ADD_SET_MONEY_GROUP, moneyDisabled); + setWidgetDisabled(WIDX_MONEY_SPINNER, moneyDisabled); + setWidgetDisabled(WIDX_MONEY_SPINNER_INCREMENT, moneyDisabled); + setWidgetDisabled(WIDX_MONEY_SPINNER_DECREMENT, moneyDisabled); + setWidgetDisabled(WIDX_ADD_MONEY, moneyDisabled); + setWidgetDisabled(WIDX_SET_MONEY, moneyDisabled); + setWidgetDisabled(WIDX_CLEAR_LOAN, moneyDisabled); break; } case WINDOW_CHEATS_PAGE_GUESTS: { auto ft = Formatter::Common(); ft.Add(1000.00_GBP); - SetCheckboxValue(WIDX_GUEST_IGNORE_RIDE_INTENSITY, gameState.cheats.ignoreRideIntensity); - SetCheckboxValue(WIDX_GUEST_IGNORE_PRICE, gameState.cheats.ignorePrice); - SetCheckboxValue(WIDX_DISABLE_VANDALISM, gameState.cheats.disableVandalism); - SetCheckboxValue(WIDX_DISABLE_LITTERING, gameState.cheats.disableLittering); + setCheckboxValue(WIDX_GUEST_IGNORE_RIDE_INTENSITY, gameState.cheats.ignoreRideIntensity); + setCheckboxValue(WIDX_GUEST_IGNORE_PRICE, gameState.cheats.ignorePrice); + setCheckboxValue(WIDX_DISABLE_VANDALISM, gameState.cheats.disableVandalism); + setCheckboxValue(WIDX_DISABLE_LITTERING, gameState.cheats.disableLittering); break; } case WINDOW_CHEATS_PAGE_PARK: @@ -543,33 +543,33 @@ static StringId window_cheats_page_titles[] = { if (gameState.park.flags & PARK_FLAGS_PARK_OPEN) widgets[WIDX_OPEN_CLOSE_PARK].text = STR_CHEAT_CLOSE_PARK; - SetCheckboxValue(WIDX_FORCE_PARK_RATING, Park::GetForcedRating() >= 0); - SetCheckboxValue(WIDX_NEVERENDING_MARKETING, gameState.cheats.neverendingMarketing); - SetCheckboxValue(WIDX_ALLOW_BUILD_IN_PAUSE_MODE, gameState.cheats.buildInPauseMode); - SetCheckboxValue(WIDX_ALLOW_REGULAR_PATH_AS_QUEUE, gameState.cheats.allowRegularPathAsQueue); - SetCheckboxValue(WIDX_ALLOW_SPECIAL_COLOUR_SCHEMES, gameState.cheats.allowSpecialColourSchemes); + setCheckboxValue(WIDX_FORCE_PARK_RATING, Park::GetForcedRating() >= 0); + setCheckboxValue(WIDX_NEVERENDING_MARKETING, gameState.cheats.neverendingMarketing); + setCheckboxValue(WIDX_ALLOW_BUILD_IN_PAUSE_MODE, gameState.cheats.buildInPauseMode); + setCheckboxValue(WIDX_ALLOW_REGULAR_PATH_AS_QUEUE, gameState.cheats.allowRegularPathAsQueue); + setCheckboxValue(WIDX_ALLOW_SPECIAL_COLOUR_SCHEMES, gameState.cheats.allowSpecialColourSchemes); break; case WINDOW_CHEATS_PAGE_RIDES: - SetCheckboxValue(WIDX_UNLOCK_OPERATING_LIMITS, gameState.cheats.unlockOperatingLimits); - SetCheckboxValue(WIDX_DISABLE_BRAKES_FAILURE, gameState.cheats.disableBrakesFailure); - SetCheckboxValue(WIDX_DISABLE_ALL_BREAKDOWNS, gameState.cheats.disableAllBreakdowns); - SetCheckboxValue(WIDX_SHOW_ALL_OPERATING_MODES, gameState.cheats.showAllOperatingModes); - SetCheckboxValue( + setCheckboxValue(WIDX_UNLOCK_OPERATING_LIMITS, gameState.cheats.unlockOperatingLimits); + setCheckboxValue(WIDX_DISABLE_BRAKES_FAILURE, gameState.cheats.disableBrakesFailure); + setCheckboxValue(WIDX_DISABLE_ALL_BREAKDOWNS, gameState.cheats.disableAllBreakdowns); + setCheckboxValue(WIDX_SHOW_ALL_OPERATING_MODES, gameState.cheats.showAllOperatingModes); + setCheckboxValue( WIDX_SHOW_VEHICLES_FROM_OTHER_TRACK_TYPES, gameState.cheats.showVehiclesFromOtherTrackTypes); - SetCheckboxValue(WIDX_DISABLE_TRAIN_LENGTH_LIMITS, gameState.cheats.disableTrainLengthLimit); - SetCheckboxValue(WIDX_ENABLE_CHAIN_LIFT_ON_ALL_TRACK, gameState.cheats.enableChainLiftOnAllTrack); - SetCheckboxValue(WIDX_ENABLE_ARBITRARY_RIDE_TYPE_CHANGES, gameState.cheats.allowArbitraryRideTypeChanges); - SetCheckboxValue(WIDX_DISABLE_RIDE_VALUE_AGING, gameState.cheats.disableRideValueAging); - SetCheckboxValue(WIDX_IGNORE_RESEARCH_STATUS, gameState.cheats.ignoreResearchStatus); - SetCheckboxValue(WIDX_ENABLE_ALL_DRAWABLE_TRACK_PIECES, gameState.cheats.enableAllDrawableTrackPieces); - SetCheckboxValue(WIDX_ALLOW_TRACK_PLACE_INVALID_HEIGHTS, gameState.cheats.allowTrackPlaceInvalidHeights); - SetCheckboxValue(WIDX_MAKE_DESTRUCTIBLE, gameState.cheats.makeAllDestructible); + setCheckboxValue(WIDX_DISABLE_TRAIN_LENGTH_LIMITS, gameState.cheats.disableTrainLengthLimit); + setCheckboxValue(WIDX_ENABLE_CHAIN_LIFT_ON_ALL_TRACK, gameState.cheats.enableChainLiftOnAllTrack); + setCheckboxValue(WIDX_ENABLE_ARBITRARY_RIDE_TYPE_CHANGES, gameState.cheats.allowArbitraryRideTypeChanges); + setCheckboxValue(WIDX_DISABLE_RIDE_VALUE_AGING, gameState.cheats.disableRideValueAging); + setCheckboxValue(WIDX_IGNORE_RESEARCH_STATUS, gameState.cheats.ignoreResearchStatus); + setCheckboxValue(WIDX_ENABLE_ALL_DRAWABLE_TRACK_PIECES, gameState.cheats.enableAllDrawableTrackPieces); + setCheckboxValue(WIDX_ALLOW_TRACK_PLACE_INVALID_HEIGHTS, gameState.cheats.allowTrackPlaceInvalidHeights); + setCheckboxValue(WIDX_MAKE_DESTRUCTIBLE, gameState.cheats.makeAllDestructible); break; case WINDOW_CHEATS_PAGE_STAFF: - SetCheckboxValue(WIDX_DISABLE_PLANT_AGING, gameState.cheats.disablePlantAging); + setCheckboxValue(WIDX_DISABLE_PLANT_AGING, gameState.cheats.disablePlantAging); break; case WINDOW_CHEATS_PAGE_WEATHER: - SetCheckboxValue(WIDX_FREEZE_WEATHER, gameState.cheats.freezeWeather); + setCheckboxValue(WIDX_FREEZE_WEATHER, gameState.cheats.freezeWeather); break; } @@ -587,15 +587,15 @@ static StringId window_cheats_page_titles[] = { if (isInEditorMode()) { - SetWidgetDisabled(WIDX_TAB_2, true); - SetWidgetDisabled(WIDX_TAB_3, true); + setWidgetDisabled(WIDX_TAB_2, true); + setWidgetDisabled(WIDX_TAB_3, true); UpdateTabPositions(); } } - void OnDraw(RenderTarget& rt) override + void onDraw(RenderTarget& rt) override { - DrawWidgets(rt); + drawWidgets(rt); DrawTabImages(rt); static constexpr int16_t _xLcol = 14; @@ -606,7 +606,7 @@ static StringId window_cheats_page_titles[] = { auto colour = colours[1]; auto ft = Formatter(); ft.Add(_moneySpinnerValue); - if (IsWidgetDisabled(WIDX_MONEY_SPINNER)) + if (isWidgetDisabled(WIDX_MONEY_SPINNER)) { colour.setFlag(ColourFlag::inset, true); } @@ -703,7 +703,7 @@ static StringId window_cheats_page_titles[] = { } } - void OnTextInput(WidgetIndex widgetIndex, std::string_view text) override + void onTextInput(WidgetIndex widgetIndex, std::string_view text) override { if (page == WINDOW_CHEATS_PAGE_MONEY && widgetIndex == WIDX_MONEY_SPINNER) { @@ -712,11 +712,11 @@ static StringId window_cheats_page_titles[] = { { _moneySpinnerValue = val; } - Invalidate(); + invalidate(); } } - OpenRCT2String OnTooltip(WidgetIndex widgetIndex, StringId fallback) override + OpenRCT2String onTooltip(WidgetIndex widgetIndex, StringId fallback) override { if (page == WINDOW_CHEATS_PAGE_RIDES && widgetIndex == WIDX_UNLOCK_OPERATING_LIMITS) { @@ -728,7 +728,7 @@ static StringId window_cheats_page_titles[] = { } private: - void SetPage(int32_t p) + void setPage(int32_t p) { // Skip setting page if we're already on this page, unless we're initialising the window if (page == p && !widgets.empty()) @@ -739,7 +739,7 @@ static StringId window_cheats_page_titles[] = { holdDownWidgets = window_cheats_page_holdDownWidgets[p]; pressedWidgets = 0; - SetWidgets(window_cheats_page_widgets[p]); + setWidgets(window_cheats_page_widgets[p]); auto maxY = 0; for (WidgetIndex widgetIdx = WIDX_TAB_CONTENT; widgetIdx < widgets.size(); widgetIdx++) @@ -751,10 +751,10 @@ static StringId window_cheats_page_titles[] = { if (maxY != height) { - Invalidate(); + invalidate(); height = maxY; - ResizeFrame(); - Invalidate(); + resizeFrame(); + invalidate(); } } @@ -768,7 +768,7 @@ static StringId window_cheats_page_titles[] = { for (auto tab : tabs) { widgets[tab].left = left; - if (!IsWidgetDisabled(tab)) + if (!isWidgetDisabled(tab)) { left += kTabWidth; } @@ -778,7 +778,7 @@ static StringId window_cheats_page_titles[] = { void DrawTabImages(RenderTarget& rt) { // Money tab - if (!IsWidgetDisabled(WIDX_TAB_1)) + if (!isWidgetDisabled(WIDX_TAB_1)) { uint32_t sprite_idx = SPR_TAB_FINANCES_SUMMARY_0; if (page == WINDOW_CHEATS_PAGE_MONEY) @@ -788,7 +788,7 @@ static StringId window_cheats_page_titles[] = { } // Date tab - if (!IsWidgetDisabled(WIDX_TAB_2)) + if (!isWidgetDisabled(WIDX_TAB_2)) { uint32_t sprite_idx = SPR_TAB_TIMER_0; if (page == WINDOW_CHEATS_PAGE_DATE) @@ -798,7 +798,7 @@ static StringId window_cheats_page_titles[] = { } // Guests tab - if (!IsWidgetDisabled(WIDX_TAB_3)) + if (!isWidgetDisabled(WIDX_TAB_3)) { uint32_t sprite_idx = SPR_TAB_GUESTS_0; if (page == WINDOW_CHEATS_PAGE_GUESTS) @@ -808,7 +808,7 @@ static StringId window_cheats_page_titles[] = { } // Staff tab - if (!IsWidgetDisabled(WIDX_TAB_4)) + if (!isWidgetDisabled(WIDX_TAB_4)) { uint32_t sprite_idx = SPR_MECHANIC; GfxDrawSprite( @@ -817,14 +817,14 @@ static StringId window_cheats_page_titles[] = { } // Park tab - if (!IsWidgetDisabled(WIDX_TAB_5)) + if (!isWidgetDisabled(WIDX_TAB_5)) { GfxDrawSprite( rt, ImageId(SPR_TAB_PARK), windowPos + ScreenCoordsXY{ widgets[WIDX_TAB_5].left, widgets[WIDX_TAB_5].top }); } // Rides tab - if (!IsWidgetDisabled(WIDX_TAB_6)) + if (!isWidgetDisabled(WIDX_TAB_6)) { uint32_t sprite_idx = SPR_TAB_RIDE_0; if (page == WINDOW_CHEATS_PAGE_RIDES) @@ -834,7 +834,7 @@ static StringId window_cheats_page_titles[] = { } // Nature/weather tab - if (!IsWidgetDisabled(WIDX_TAB_7)) + if (!isWidgetDisabled(WIDX_TAB_7)) { uint32_t sprite_idx = SPR_WEATHER_SUN_CLOUD; GfxDrawSprite( @@ -843,19 +843,19 @@ static StringId window_cheats_page_titles[] = { } } - void OnMouseDownMoney(WidgetIndex widgetIndex) + void onMouseDownMoney(WidgetIndex widgetIndex) { switch (widgetIndex) { case WIDX_MONEY_SPINNER_INCREMENT: _moneySpinnerValue = AddClamp( kCheatsMoneyIncrement * (_moneySpinnerValue / kCheatsMoneyIncrement), kCheatsMoneyIncrement); - InvalidateWidget(WIDX_MONEY_SPINNER); + invalidateWidget(WIDX_MONEY_SPINNER); break; case WIDX_MONEY_SPINNER_DECREMENT: _moneySpinnerValue = AddClamp( kCheatsMoneyIncrement * (_moneySpinnerValue / kCheatsMoneyIncrement), -kCheatsMoneyIncrement); - InvalidateWidget(WIDX_MONEY_SPINNER); + invalidateWidget(WIDX_MONEY_SPINNER); break; case WIDX_ADD_MONEY: CheatsSet(CheatType::AddMoney, _moneySpinnerValue); @@ -863,7 +863,7 @@ static StringId window_cheats_page_titles[] = { } } - void OnMouseDownDate(WidgetIndex widgetIndex) + void onMouseDownDate(WidgetIndex widgetIndex) { auto* windowMgr = GetWindowManager(); auto& gameState = getGameState(); @@ -873,40 +873,40 @@ static StringId window_cheats_page_titles[] = { case WIDX_YEAR_UP: _yearSpinnerValue++; _yearSpinnerValue = std::clamp(_yearSpinnerValue, 1, kMaxYear); - InvalidateWidget(WIDX_YEAR_BOX); + invalidateWidget(WIDX_YEAR_BOX); break; case WIDX_YEAR_DOWN: _yearSpinnerValue--; _yearSpinnerValue = std::clamp(_yearSpinnerValue, 1, kMaxYear); - InvalidateWidget(WIDX_YEAR_BOX); + invalidateWidget(WIDX_YEAR_BOX); break; case WIDX_MONTH_UP: _monthSpinnerValue++; _monthSpinnerValue = std::clamp(_monthSpinnerValue, 1, static_cast(MONTH_COUNT)); _daySpinnerValue = std::clamp( _daySpinnerValue, 1, static_cast(Date::GetDaysInMonth(_monthSpinnerValue - 1))); - InvalidateWidget(WIDX_MONTH_BOX); - InvalidateWidget(WIDX_DAY_BOX); + invalidateWidget(WIDX_MONTH_BOX); + invalidateWidget(WIDX_DAY_BOX); break; case WIDX_MONTH_DOWN: _monthSpinnerValue--; _monthSpinnerValue = std::clamp(_monthSpinnerValue, 1, static_cast(MONTH_COUNT)); _daySpinnerValue = std::clamp( _daySpinnerValue, 1, static_cast(Date::GetDaysInMonth(_monthSpinnerValue - 1))); - InvalidateWidget(WIDX_MONTH_BOX); - InvalidateWidget(WIDX_DAY_BOX); + invalidateWidget(WIDX_MONTH_BOX); + invalidateWidget(WIDX_DAY_BOX); break; case WIDX_DAY_UP: _daySpinnerValue++; _daySpinnerValue = std::clamp( _daySpinnerValue, 1, static_cast(Date::GetDaysInMonth(_monthSpinnerValue - 1))); - InvalidateWidget(WIDX_DAY_BOX); + invalidateWidget(WIDX_DAY_BOX); break; case WIDX_DAY_DOWN: _daySpinnerValue--; _daySpinnerValue = std::clamp( _daySpinnerValue, 1, static_cast(Date::GetDaysInMonth(_monthSpinnerValue - 1))); - InvalidateWidget(WIDX_DAY_BOX); + invalidateWidget(WIDX_DAY_BOX); break; case WIDX_DATE_SET: { @@ -921,15 +921,15 @@ static StringId window_cheats_page_titles[] = { auto setDateAction = GameActions::ParkSetDateAction(0, 0, 0); GameActions::Execute(&setDateAction, gameState); windowMgr->InvalidateByClass(WindowClass::BottomToolbar); - InvalidateWidget(WIDX_YEAR_BOX); - InvalidateWidget(WIDX_MONTH_BOX); - InvalidateWidget(WIDX_DAY_BOX); + invalidateWidget(WIDX_YEAR_BOX); + invalidateWidget(WIDX_MONTH_BOX); + invalidateWidget(WIDX_DAY_BOX); break; } } } - void OnMouseUpMoney(WidgetIndex widgetIndex) + void onMouseUpMoney(WidgetIndex widgetIndex) { switch (widgetIndex) { @@ -951,13 +951,13 @@ static StringId window_cheats_page_titles[] = { } } - void OnMouseDownPark(WidgetIndex widgetIndex) + void onMouseDownPark(WidgetIndex widgetIndex) { switch (widgetIndex) { case WIDX_INCREASE_PARK_RATING: _parkRatingSpinnerValue = std::min(999, 10 * (_parkRatingSpinnerValue / 10 + 1)); - InvalidateWidget(WIDX_PARK_RATING_SPINNER); + invalidateWidget(WIDX_PARK_RATING_SPINNER); if (Park::GetForcedRating() >= 0) { auto cheatSetAction = GameActions::CheatSetAction( @@ -967,7 +967,7 @@ static StringId window_cheats_page_titles[] = { break; case WIDX_DECREASE_PARK_RATING: _parkRatingSpinnerValue = std::max(0, 10 * (_parkRatingSpinnerValue / 10 - 1)); - InvalidateWidget(WIDX_PARK_RATING_SPINNER); + invalidateWidget(WIDX_PARK_RATING_SPINNER); if (Park::GetForcedRating() >= 0) { CheatsSet(CheatType::SetForcedParkRating, _parkRatingSpinnerValue); @@ -976,7 +976,7 @@ static StringId window_cheats_page_titles[] = { } } - void OnMouseDownStaff(WidgetIndex widgetIndex) + void onMouseDownStaff(WidgetIndex widgetIndex) { auto* widget = &widgets[widgetIndex]; auto& gameState = getGameState(); @@ -1001,7 +1001,7 @@ static StringId window_cheats_page_titles[] = { } } - void OnMouseDownWeather(WidgetIndex widgetIndex) + void onMouseDownWeather(WidgetIndex widgetIndex) { auto* widget = &widgets[widgetIndex]; auto& gameState = getGameState(); @@ -1027,7 +1027,7 @@ static StringId window_cheats_page_titles[] = { } } - void OnMouseUpPark(WidgetIndex widgetIndex) + void onMouseUpPark(WidgetIndex widgetIndex) { auto& gameState = getGameState(); switch (widgetIndex) @@ -1072,7 +1072,7 @@ static StringId window_cheats_page_titles[] = { } } - void OnMouseUpStaff(WidgetIndex widgetIndex) + void onMouseUpStaff(WidgetIndex widgetIndex) { auto& gameState = getGameState(); switch (widgetIndex) @@ -1098,7 +1098,7 @@ static StringId window_cheats_page_titles[] = { } } - void OnMouseUpWeather(WidgetIndex widgetIndex) + void onMouseUpWeather(WidgetIndex widgetIndex) { auto& gameState = getGameState(); switch (widgetIndex) @@ -1115,7 +1115,7 @@ static StringId window_cheats_page_titles[] = { } } - void OnDropdownStaff(WidgetIndex widgetIndex, int32_t dropdownIndex) + void onDropdownStaff(WidgetIndex widgetIndex, int32_t dropdownIndex) { if (dropdownIndex == -1) { @@ -1146,7 +1146,7 @@ static StringId window_cheats_page_titles[] = { } } - void OnDropdownWeather(WidgetIndex widgetIndex, int32_t dropdownIndex) + void onDropdownWeather(WidgetIndex widgetIndex, int32_t dropdownIndex) { if (dropdownIndex == -1) { @@ -1159,7 +1159,7 @@ static StringId window_cheats_page_titles[] = { } } - void OnMouseUpGuests(WidgetIndex widgetIndex) + void onMouseUpGuests(WidgetIndex widgetIndex) { auto& gameState = getGameState(); switch (widgetIndex) @@ -1247,7 +1247,7 @@ static StringId window_cheats_page_titles[] = { } } - void OnMouseUpRides(WidgetIndex widgetIndex) + void onMouseUpRides(WidgetIndex widgetIndex) { auto& gameState = getGameState(); switch (widgetIndex) diff --git a/src/openrct2-ui/windows/ClearScenery.cpp b/src/openrct2-ui/windows/ClearScenery.cpp index 682800ae9f..3b36c374f5 100644 --- a/src/openrct2-ui/windows/ClearScenery.cpp +++ b/src/openrct2-ui/windows/ClearScenery.cpp @@ -64,9 +64,9 @@ namespace OpenRCT2::Ui::Windows money64 _clearSceneryCost = kMoney64Undefined; public: - void OnOpen() override + void onOpen() override { - SetWidgets(window_clear_scenery_widgets); + setWidgets(window_clear_scenery_widgets); holdDownWidgets = (1uLL << WIDX_INCREMENT) | (1uLL << WIDX_DECREMENT); WindowInitScrollWidgets(*this); @@ -74,47 +74,47 @@ namespace OpenRCT2::Ui::Windows gLandToolSize = 2; - Invalidate(); + invalidate(); } - void OnClose() override + void onClose() override { if (isToolActive(WindowClass::ClearScenery, WIDX_BACKGROUND)) ToolCancel(); } - void OnMouseUp(const WidgetIndex widgetIndex) override + void onMouseUp(const WidgetIndex widgetIndex) override { switch (widgetIndex) { case WIDX_CLOSE: - Close(); + close(); break; case WIDX_PREVIEW: { Formatter ft; ft.Add(kLandToolMinimumSize); ft.Add(kLandToolMaximumSize); - TextInputOpen( + textInputOpen( WIDX_PREVIEW, STR_SELECTION_SIZE, STR_ENTER_SELECTION_SIZE, ft, kStringIdNone, kStringIdNone, 3); break; } case WIDX_SMALL_SCENERY: _clearSmallScenery ^= 1; - Invalidate(); + invalidate(); break; case WIDX_LARGE_SCENERY: _clearLargeScenery ^= 1; - Invalidate(); + invalidate(); break; case WIDX_FOOTPATH: _clearFootpath ^= 1; - Invalidate(); + invalidate(); break; } } - void OnMouseDown(const WidgetIndex widgetIndex) override + void onMouseDown(const WidgetIndex widgetIndex) override { switch (widgetIndex) { @@ -123,19 +123,19 @@ namespace OpenRCT2::Ui::Windows gLandToolSize = std::max(kLandToolMinimumSize, gLandToolSize - 1); // Invalidate the window - Invalidate(); + invalidate(); break; case WIDX_INCREMENT: // Increment land tool size, if it stays within the limit gLandToolSize = std::min(kLandToolMaximumSize, gLandToolSize + 1); // Invalidate the window - Invalidate(); + invalidate(); break; } } - void OnTextInput(const WidgetIndex widgetIndex, const std::string_view text) override + void onTextInput(const WidgetIndex widgetIndex, const std::string_view text) override { if (widgetIndex != WIDX_PREVIEW || text.empty()) return; @@ -145,7 +145,7 @@ namespace OpenRCT2::Ui::Windows int32_t size = std::stol(std::string(text)); size = std::clamp(size, kLandToolMinimumSize, kLandToolMaximumSize); gLandToolSize = size; - Invalidate(); + invalidate(); } catch (const std::logic_error&) { @@ -153,15 +153,15 @@ namespace OpenRCT2::Ui::Windows } } - void OnUpdate() override + void onUpdate() override { currentFrame++; // Close window if another tool is open if (!isToolActive(WindowClass::ClearScenery, WIDX_BACKGROUND)) - Close(); + close(); } - void OnPrepareDraw() override + void onPrepareDraw() override { // Set the preview image button to be pressed down pressedWidgets = (1uLL << WIDX_PREVIEW) | (_clearSmallScenery ? (1uLL << WIDX_SMALL_SCENERY) : 0) @@ -171,9 +171,9 @@ namespace OpenRCT2::Ui::Windows widgets[WIDX_PREVIEW].image = ImageId(LandTool::SizeToSpriteIndex(gLandToolSize)); } - void OnDraw(RenderTarget& rt) override + void onDraw(RenderTarget& rt) override { - DrawWidgets(rt); + drawWidgets(rt); // Draw number for tool sizes bigger than 7 ScreenCoordsXY screenCoords = { windowPos.x + widgets[WIDX_PREVIEW].midX(), @@ -299,7 +299,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnToolUpdate(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override + void onToolUpdate(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override { switch (widgetIndex) { @@ -309,7 +309,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override + void onToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override { switch (widgetIndex) { @@ -324,7 +324,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnToolDrag(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override + void onToolDrag(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override { switch (widgetIndex) { @@ -342,7 +342,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnToolUp(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override + void onToolUp(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override { switch (widgetIndex) { @@ -354,7 +354,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnToolAbort(WidgetIndex widgetIndex) override + void onToolAbort(WidgetIndex widgetIndex) override { switch (widgetIndex) { diff --git a/src/openrct2-ui/windows/CustomCurrency.cpp b/src/openrct2-ui/windows/CustomCurrency.cpp index 4d9615d9e1..125dcea4ea 100644 --- a/src/openrct2-ui/windows/CustomCurrency.cpp +++ b/src/openrct2-ui/windows/CustomCurrency.cpp @@ -51,9 +51,9 @@ namespace OpenRCT2::Ui::Windows class CustomCurrencyWindow final : public Window { public: - void OnOpen() override + void onOpen() override { - SetWidgets(window_custom_currency_widgets); + setWidgets(window_custom_currency_widgets); holdDownWidgets = (1uLL << WIDX_RATE_UP) | (1uLL << WIDX_RATE_DOWN); WindowInitScrollWidgets(*this); colours[0] = COLOUR_LIGHT_BROWN; @@ -61,7 +61,7 @@ namespace OpenRCT2::Ui::Windows colours[2] = COLOUR_LIGHT_BROWN; } - void OnMouseDown(WidgetIndex widgetIndex) override + void onMouseDown(WidgetIndex widgetIndex) override { auto* widget = &widgets[widgetIndex - 1]; auto* windowMgr = Ui::GetWindowManager(); @@ -69,7 +69,7 @@ namespace OpenRCT2::Ui::Windows switch (widgetIndex) { case WIDX_CLOSE: - Close(); + close(); break; case WIDX_RATE_UP: CurrencyDescriptors[EnumValue(CurrencyType::Custom)].rate += 1; @@ -112,7 +112,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnMouseUp(WidgetIndex widgetIndex) override + void onMouseUp(WidgetIndex widgetIndex) override { switch (widgetIndex) { @@ -125,7 +125,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) override + void onDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) override { if (dropdownIndex == -1) return; @@ -151,7 +151,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnTextInput(WidgetIndex widgetIndex, std::string_view text) override + void onTextInput(WidgetIndex widgetIndex, std::string_view text) override { if (text.empty()) return; @@ -187,12 +187,12 @@ namespace OpenRCT2::Ui::Windows } } - void OnDraw(RenderTarget& rt) override + void onDraw(RenderTarget& rt) override { auto ft = Formatter::Common(); ft.Add(10.00_GBP); - DrawWidgets(rt); + drawWidgets(rt); auto screenCoords = windowPos + ScreenCoordsXY{ 10, 18 + widgets[WIDX_TITLE].height() }; diff --git a/src/openrct2-ui/windows/DebugPaint.cpp b/src/openrct2-ui/windows/DebugPaint.cpp index fd3f0e19e1..5b968a77bc 100644 --- a/src/openrct2-ui/windows/DebugPaint.cpp +++ b/src/openrct2-ui/windows/DebugPaint.cpp @@ -51,11 +51,11 @@ namespace OpenRCT2::Ui::Windows int32_t ResizeLanguage = LANGUAGE_UNDEFINED; public: - void OnOpen() override + void onOpen() override { - SetWidgets(window_debug_paint_widgets); + setWidgets(window_debug_paint_widgets); - InitScrollWidgets(); + initScrollWidgets(); WindowPushOthersBelow(*this); colours[0] = ColourWithFlags{ COLOUR_BLACK }.withFlag(ColourFlag::translucent, true); @@ -64,7 +64,7 @@ namespace OpenRCT2::Ui::Windows ResizeLanguage = LANGUAGE_UNDEFINED; } - void OnMouseUp(WidgetIndex widgetIndex) override + void onMouseUp(WidgetIndex widgetIndex) override { switch (widgetIndex) { @@ -100,14 +100,14 @@ namespace OpenRCT2::Ui::Windows } } - void OnPrepareDraw() override + void onPrepareDraw() override { const auto& ls = OpenRCT2::GetContext()->GetLocalisationService(); const auto currentLanguage = ls.GetCurrentLanguage(); if (ResizeLanguage != currentLanguage) { ResizeLanguage = currentLanguage; - Invalidate(); + invalidate(); // Find the width of the longest string int16_t newWidth = 0; @@ -134,20 +134,20 @@ namespace OpenRCT2::Ui::Windows widgets[WIDX_TOGGLE_SHOW_BOUND_BOXES].right = newWidth - 8; widgets[WIDX_TOGGLE_SHOW_DIRTY_VISUALS].right = newWidth - 8; - Invalidate(); + invalidate(); } - widgetSetCheckboxValue(*this, WIDX_TOGGLE_SHOW_WIDE_PATHS, gPaintWidePathsAsGhost); - widgetSetCheckboxValue(*this, WIDX_TOGGLE_SHOW_BLOCKED_TILES, gPaintBlockedTiles); - widgetSetCheckboxValue(*this, WIDX_TOGGLE_SHOW_SEGMENT_HEIGHTS, gShowSupportSegmentHeights); - widgetSetCheckboxValue(*this, WIDX_TOGGLE_SHOW_BOUND_BOXES, gPaintBoundingBoxes); - widgetSetCheckboxValue(*this, WIDX_TOGGLE_SHOW_DIRTY_VISUALS, gShowDirtyVisuals); - widgetSetCheckboxValue(*this, WIDX_TOGGLE_STABLE_PAINT_SORT, gPaintStableSort); + setCheckboxValue(WIDX_TOGGLE_SHOW_WIDE_PATHS, gPaintWidePathsAsGhost); + setCheckboxValue(WIDX_TOGGLE_SHOW_BLOCKED_TILES, gPaintBlockedTiles); + setCheckboxValue(WIDX_TOGGLE_SHOW_SEGMENT_HEIGHTS, gShowSupportSegmentHeights); + setCheckboxValue(WIDX_TOGGLE_SHOW_BOUND_BOXES, gPaintBoundingBoxes); + setCheckboxValue(WIDX_TOGGLE_SHOW_DIRTY_VISUALS, gShowDirtyVisuals); + setCheckboxValue(WIDX_TOGGLE_STABLE_PAINT_SORT, gPaintStableSort); } - void OnDraw(RenderTarget& rt) override + void onDraw(RenderTarget& rt) override { - DrawWidgets(rt); + drawWidgets(rt); } }; diff --git a/src/openrct2-ui/windows/DemolishRidePrompt.cpp b/src/openrct2-ui/windows/DemolishRidePrompt.cpp index 71b4c9a7d9..5123158b07 100644 --- a/src/openrct2-ui/windows/DemolishRidePrompt.cpp +++ b/src/openrct2-ui/windows/DemolishRidePrompt.cpp @@ -50,13 +50,13 @@ namespace OpenRCT2::Ui::Windows _demolishRideCost = -RideGetRefundPrice(currentRide); } - void OnOpen() override + void onOpen() override { - SetWidgets(window_ride_demolish_widgets); + setWidgets(window_ride_demolish_widgets); WindowInitScrollWidgets(*this); } - void OnMouseUp(WidgetIndex widgetIndex) override + void onMouseUp(WidgetIndex widgetIndex) override { switch (widgetIndex) { @@ -68,12 +68,12 @@ namespace OpenRCT2::Ui::Windows } case WIDX_CANCEL: case WIDX_CLOSE: - Close(); + close(); break; } } - void OnDraw(RenderTarget& rt) override + void onDraw(RenderTarget& rt) override { WindowDrawWidgets(*this, rt); diff --git a/src/openrct2-ui/windows/Dropdown.cpp b/src/openrct2-ui/windows/Dropdown.cpp index 5efa889e11..1518d95820 100644 --- a/src/openrct2-ui/windows/Dropdown.cpp +++ b/src/openrct2-ui/windows/Dropdown.cpp @@ -62,9 +62,9 @@ namespace OpenRCT2::Ui::Windows bool ListVertically; public: - void OnOpen() override + void onOpen() override { - SetWidgets(kWindowDropdownWidgets); + setWidgets(kWindowDropdownWidgets); // Input state gDropdown.highlightedIndex = -1; @@ -100,9 +100,9 @@ namespace OpenRCT2::Ui::Windows DrawTextEllipsised(rt, { screenCoords.x + 2, screenCoords.y + yOffset }, width - 7, format, ft, { colour }); } - void OnDraw(RenderTarget& rt) override + void onDraw(RenderTarget& rt) override { - DrawWidgets(rt); + drawWidgets(rt); int32_t highlightedIndex = gDropdown.highlightedIndex; for (int32_t i = 0; i < gDropdown.numItems; i++) @@ -200,7 +200,7 @@ namespace OpenRCT2::Ui::Windows return std::max(1, mainWindow->height - (screenPos.y + dropdownButtonHeight + 5)); } - void SetTextItems( + void setTextItems( const ScreenCoordsXY& screenPos, int32_t extraY, ColourWithFlags colour, uint8_t customItemHeight, uint8_t txtFlags, size_t numItems, int32_t itemWidth, int32_t numRowsPerColumn) { @@ -233,7 +233,7 @@ namespace OpenRCT2::Ui::Windows colours[0] = colour; } - void SetImageItems( + void setImageItems( const ScreenCoordsXY& screenPos, int32_t extraY, ColourWithFlags colour, int32_t numItems, int32_t itemWidth, int32_t itemHeight, int32_t numColumns) { @@ -316,11 +316,11 @@ namespace OpenRCT2::Ui::Windows widgets[WIDX_BACKGROUND].right = ddWidth; widgets[WIDX_BACKGROUND].bottom = ddHeight; - Invalidate(); + invalidate(); width = ddWidth + 1; height = ddHeight + 1; windowPos = boundedScreenPos + ScreenCoordsXY{ 0, extraY }; - Invalidate(); + invalidate(); } }; @@ -398,7 +398,7 @@ namespace OpenRCT2::Ui::Windows if (w != nullptr) { auto numRowsPerColumn = prefRowsPerColumn > 0 ? static_cast(prefRowsPerColumn) : Dropdown::kItemsMaxSize; - w->SetTextItems(screenPos, extray, colour, customItemHeight, flags, num_items, width, numRowsPerColumn); + w->setTextItems(screenPos, extray, colour, customItemHeight, flags, num_items, width, numRowsPerColumn); } } @@ -441,7 +441,7 @@ namespace OpenRCT2::Ui::Windows auto* w = windowMgr->Create(WindowClass::Dropdown, { itemWidth, itemHeight }, WF_STICK_TO_FRONT); if (w != nullptr) { - w->SetImageItems({ x, y }, extray, colour, numItems, itemWidth, itemHeight, numColumns); + w->setImageItems({ x, y }, extray, colour, numItems, itemWidth, itemHeight, numColumns); } } diff --git a/src/openrct2-ui/windows/EditorBottomToolbar.cpp b/src/openrct2-ui/windows/EditorBottomToolbar.cpp index fbfc912d5c..c0868ff0f3 100644 --- a/src/openrct2-ui/windows/EditorBottomToolbar.cpp +++ b/src/openrct2-ui/windows/EditorBottomToolbar.cpp @@ -69,11 +69,11 @@ namespace OpenRCT2::Ui::Windows }; public: - void OnOpen() override + void onOpen() override { - SetWidgets(kEditorBottomToolbarWidgets); + setWidgets(kEditorBottomToolbarWidgets); - InitScrollWidgets(); + initScrollWidgets(); SetAllSceneryItemsInvented(); } @@ -84,7 +84,7 @@ namespace OpenRCT2::Ui::Windows || gameState.park.flags & PARK_FLAGS_SPRITES_INITIALISED; } - void OnPrepareDraw() override + void onPrepareDraw() override { ColourSchemeUpdateByClass( this, @@ -122,7 +122,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnDraw(RenderTarget& rt) override + void onDraw(RenderTarget& rt) override { auto drawPreviousButton = widgets[WIDX_PREVIOUS_STEP_BUTTON].type != WidgetType::empty; auto drawNextButton = widgets[WIDX_NEXT_STEP_BUTTON].type != WidgetType::empty; @@ -133,7 +133,7 @@ namespace OpenRCT2::Ui::Windows if (drawNextButton) DrawRightButtonBack(rt); - DrawWidgets(rt); + drawWidgets(rt); if (drawPreviousButton) DrawLeftButton(rt); @@ -144,7 +144,7 @@ namespace OpenRCT2::Ui::Windows DrawStepText(rt); } - void OnMouseUp(WidgetIndex widgetIndex) override + void onMouseUp(WidgetIndex widgetIndex) override { auto& gameState = getGameState(); if (widgetIndex == WIDX_PREVIOUS_STEP_BUTTON) diff --git a/src/openrct2-ui/windows/EditorInventionsList.cpp b/src/openrct2-ui/windows/EditorInventionsList.cpp index 9e37c5c3f7..5e05c5e534 100644 --- a/src/openrct2-ui/windows/EditorInventionsList.cpp +++ b/src/openrct2-ui/windows/EditorInventionsList.cpp @@ -146,19 +146,19 @@ namespace OpenRCT2::Ui::Windows ResearchItem* _selectedResearchItem; public: - void OnOpen() override + void onOpen() override { ResearchRidesSetup(); - SetWidgets(_inventionListWidgets); - InitScrollWidgets(); + setWidgets(_inventionListWidgets); + initScrollWidgets(); selectedTab = 0; _selectedResearchItem = nullptr; WindowSetResize(*this, kWindowSize, { kWindowSize.width * 2, kWindowSize.height * 2 }); } - void OnClose() override + void onClose() override { ResearchRemoveFlags(); @@ -171,56 +171,56 @@ namespace OpenRCT2::Ui::Windows } } - void OnMouseUp(WidgetIndex widx) override + void onMouseUp(WidgetIndex widx) override { switch (widx) { case WIDX_CLOSE: - Close(); + close(); break; case WIDX_RANDOM_SHUFFLE: ResearchItemsShuffle(); - Invalidate(); + invalidate(); break; case WIDX_MOVE_ITEMS_TO_TOP: ResearchItemsMakeAllResearched(); - InitScrollWidgets(); - Invalidate(); + initScrollWidgets(); + invalidate(); break; case WIDX_MOVE_ITEMS_TO_BOTTOM: ResearchItemsMakeAllUnresearched(); - InitScrollWidgets(); - Invalidate(); + initScrollWidgets(); + invalidate(); break; } } - void OnResize() override + void onResize() override { if (width < minWidth) { - Invalidate(); + invalidate(); width = minWidth; } if (height < minHeight) { - Invalidate(); + invalidate(); height = minHeight; } } - void OnUpdate() override + void onUpdate() override { currentFrame++; - OnPrepareDraw(); + onPrepareDraw(); - InvalidateWidget(WIDX_TAB_1); + invalidateWidget(WIDX_TAB_1); if (WindowEditorInventionsListDragGetItem() != nullptr) return; } - ScreenSize OnScrollGetSize(int32_t scrollIndex) override + ScreenSize onScrollGetSize(int32_t scrollIndex) override { const auto& gameState = getGameState(); ScreenSize size{}; @@ -235,13 +235,13 @@ namespace OpenRCT2::Ui::Windows return size; } - void OnScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override + void onScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override { auto* researchItem = GetItemFromScrollY(scrollIndex == 0, screenCoords.y); if (researchItem != _selectedResearchItem) { _selectedResearchItem = researchItem; - Invalidate(); + invalidate(); // Prevent always-researched items from being highlighted when hovered over if (researchItem != nullptr && researchItem->IsAlwaysResearched()) @@ -251,7 +251,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override + void onScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override { auto* researchItem = GetItemFromScrollY(scrollIndex == 0, screenCoords.y); if (researchItem == nullptr) @@ -261,12 +261,12 @@ namespace OpenRCT2::Ui::Windows if (researchItem->IsAlwaysResearched()) return; - Invalidate(); + invalidate(); WindowEditorInventionsListDragOpen(researchItem, windowPos, widgets[WIDX_PRE_RESEARCHED_SCROLL].right); } - void OnScrollDraw(int32_t scrollIndex, RenderTarget& rt) override + void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override { const auto& gameState = getGameState(); @@ -326,7 +326,7 @@ namespace OpenRCT2::Ui::Windows } } - CursorID OnCursor(WidgetIndex widx, const ScreenCoordsXY& screenCoords, CursorID fallback) override + CursorID onCursor(WidgetIndex widx, const ScreenCoordsXY& screenCoords, CursorID fallback) override { bool isInvented = false; @@ -351,9 +351,9 @@ namespace OpenRCT2::Ui::Windows return fallback; } - void OnDraw(RenderTarget& rt) override + void onDraw(RenderTarget& rt) override { - DrawWidgets(rt); + drawWidgets(rt); // Tab image auto screenPos = windowPos + ScreenCoordsXY{ widgets[WIDX_TAB_1].left, widgets[WIDX_TAB_1].top }; @@ -440,7 +440,7 @@ namespace OpenRCT2::Ui::Windows DrawTextBasic(rt, screenPos, STR_INVENTION_RESEARCH_GROUP, ft); } - void OnPrepareDraw() override + void onPrepareDraw() override { pressedWidgets |= 1uLL << WIDX_PREVIEW; pressedWidgets |= 1uLL << WIDX_TAB_1; @@ -509,7 +509,7 @@ namespace OpenRCT2::Ui::Windows return item == _selectedResearchItem; } - // hack to fix #17544: OnScrollMouseOver never gets called while dragging + // hack to fix #17544: onScrollMouseOver never gets called while dragging void SetSelectedResearchItem(ResearchItem* item) { _selectedResearchItem = item; @@ -519,7 +519,7 @@ namespace OpenRCT2::Ui::Windows { auto& gameState = getGameState(); _selectedResearchItem = nullptr; - Invalidate(); + invalidate(); uint32_t beforeItemRawValue = 0; if (beforeItem != nullptr) @@ -599,13 +599,13 @@ namespace OpenRCT2::Ui::Windows ResearchItem _draggedItem; public: - void OnOpen() override + void onOpen() override { - SetWidgets(_inventionListDragWidgets); + setWidgets(_inventionListDragWidgets); colours[1] = COLOUR_WHITE; } - CursorID OnCursor(const WidgetIndex widx, const ScreenCoordsXY& screenCoords, const CursorID defaultCursor) override + CursorID onCursor(const WidgetIndex widx, const ScreenCoordsXY& screenCoords, const CursorID defaultCursor) override { auto* windowMgr = GetWindowManager(); auto* inventionListWindow = static_cast( @@ -617,21 +617,21 @@ namespace OpenRCT2::Ui::Windows if (!inventionListWindow->IsResearchItemSelected(research)) { inventionListWindow->SetSelectedResearchItem(research); - inventionListWindow->Invalidate(); + inventionListWindow->invalidate(); } } return CursorID::HandClosed; } - void OnMoved(const ScreenCoordsXY& screenCoords) override + void onMoved(const ScreenCoordsXY& screenCoords) override { auto* windowMgr = GetWindowManager(); auto* inventionListWindow = static_cast( windowMgr->FindByClass(WindowClass::EditorInventionList)); if (inventionListWindow == nullptr) { - Close(); + close(); return; } std::optional res; @@ -649,10 +649,10 @@ namespace OpenRCT2::Ui::Windows } windowMgr->InvalidateByClass(WindowClass::EditorInventionList); - Close(); + close(); } - void OnDraw(RenderTarget& rt) override + void onDraw(RenderTarget& rt) override { auto screenCoords = windowPos + ScreenCoordsXY{ 0, 2 }; @@ -661,15 +661,15 @@ namespace OpenRCT2::Ui::Windows { ColourWithFlags{ COLOUR_BLACK }.withFlag(ColourFlag::withOutline, true) }); } - void Init(ResearchItem& researchItem, const ScreenCoordsXY& editorPos, int objectSelectionScrollWidth) + void init(ResearchItem& researchItem, const ScreenCoordsXY& editorPos, int objectSelectionScrollWidth) { _draggedItem = researchItem; widgets[0].right = objectSelectionScrollWidth; - Invalidate(); + invalidate(); windowPos = ScreenCoordsXY{ editorPos.x, gTooltipCursor.y - 7 }; width = objectSelectionScrollWidth; - Invalidate(); + invalidate(); InputWindowPositionBegin(*this, 0, gTooltipCursor); } @@ -689,7 +689,7 @@ namespace OpenRCT2::Ui::Windows WindowClass::EditorInventionListDrag, { 10, 14 }, WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_NO_SNAPPING); if (wnd != nullptr) { - wnd->Init(*researchItem, editorPos, objectSelectionScrollWidth); + wnd->init(*researchItem, editorPos, objectSelectionScrollWidth); } } diff --git a/src/openrct2-ui/windows/EditorObjectSelection.cpp b/src/openrct2-ui/windows/EditorObjectSelection.cpp index 4bb7c3c702..d301309470 100644 --- a/src/openrct2-ui/windows/EditorObjectSelection.cpp +++ b/src/openrct2-ui/windows/EditorObjectSelection.cpp @@ -270,9 +270,9 @@ namespace OpenRCT2::Ui::Windows * * rct2: 0x006AA64E */ - void OnOpen() override + void onOpen() override { - InitWidgets(); + initWidgets(); Sub6AB211(); ResetSelectedObjectCountAndSize(); @@ -300,7 +300,7 @@ namespace OpenRCT2::Ui::Windows _overrideChecks = newState; } - bool CanClose() override + bool canClose() override { // Prevent window closure when selection is invalid return _overrideChecks || EditorObjectSelectionWindowCheck(); @@ -310,7 +310,7 @@ namespace OpenRCT2::Ui::Windows * * rct2: 0x006AB199 */ - void OnClose() override + void onClose() override { UnloadUnselectedObjects(); EditorLoadSelectedObjects(); @@ -341,12 +341,12 @@ namespace OpenRCT2::Ui::Windows ContextBroadcastIntent(&intent); } - void OnUpdate() override + void onUpdate() override { if (GetCurrentTextBox().window.classification == classification && GetCurrentTextBox().window.number == number) { WindowUpdateTextboxCaret(); - InvalidateWidget(WIDX_FILTER_TEXT_BOX); + invalidateWidget(WIDX_FILTER_TEXT_BOX); } auto& currentPage = ObjectSelectionPages[selectedTab]; @@ -362,14 +362,14 @@ namespace OpenRCT2::Ui::Windows if (currentFrame >= subTabDef.animationLength) currentFrame = 0; - InvalidateWidget(WIDX_SUB_TAB_0 + _selectedSubTab); + invalidateWidget(WIDX_SUB_TAB_0 + _selectedSubTab); } /** * * rct2: 0x006AAFAB */ - void OnMouseUp(WidgetIndex widgetIndex) override + void onMouseUp(WidgetIndex widgetIndex) override { switch (widgetIndex) { @@ -419,7 +419,7 @@ namespace OpenRCT2::Ui::Windows selectedListItem = -1; scrolls[0].contentOffsetY = 0; currentFrame = 0; - Invalidate(); + invalidate(); break; } @@ -429,7 +429,7 @@ namespace OpenRCT2::Ui::Windows { selectedListItem = -1; } - Invalidate(); + invalidate(); auto intent = Intent(WindowClass::Loadsave); intent.PutEnumExtra(INTENT_EXTRA_LOADSAVE_ACTION, LoadSaveAction::load); @@ -444,7 +444,7 @@ namespace OpenRCT2::Ui::Windows _filter.clear(); scrolls->contentOffsetY = 0; VisibleListRefresh(); - Invalidate(); + invalidate(); break; case WIDX_LIST_SORT_TYPE: if (_listSortType == RIDE_SORT_TYPE) @@ -488,13 +488,13 @@ namespace OpenRCT2::Ui::Windows if (widgetIndex >= WIDX_TAB_1 && static_cast(widgetIndex) < WIDX_TAB_1 + std::size(ObjectSelectionPages)) { - SetPage(widgetIndex - WIDX_TAB_1); + setPage(widgetIndex - WIDX_TAB_1); } break; } } - void OnResize() override + void onResize() override { WindowSetResize(*this, kMinimumWindowSize, kMaximumWindowSize); } @@ -505,7 +505,7 @@ namespace OpenRCT2::Ui::Windows STR_OBJECT_FILTER_OPENRCT2_OFFICIAL, STR_OBJECT_FILTER_CUSTOM, }; - void OnMouseDown(WidgetIndex widgetIndex) override + void onMouseDown(WidgetIndex widgetIndex) override { int32_t numSelectionItems = 0; @@ -550,7 +550,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) override + void onDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) override { if (dropdownIndex == -1) return; @@ -578,7 +578,7 @@ namespace OpenRCT2::Ui::Windows scrolls->contentOffsetY = 0; VisibleListRefresh(); - Invalidate(); + invalidate(); break; } } @@ -587,7 +587,7 @@ namespace OpenRCT2::Ui::Windows * * rct2: 0x006AB031 */ - ScreenSize OnScrollGetSize(int32_t scrollIndex) override + ScreenSize onScrollGetSize(int32_t scrollIndex) override { const auto newHeight = static_cast(_listItems.size() * kScrollableRowHeight); return { 0, newHeight }; @@ -597,7 +597,7 @@ namespace OpenRCT2::Ui::Windows * * rct2: 0x006AB0B6 */ - void OnScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override + void onScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override { // Used for in-game object selection cheat to prevent crashing the game // when windows attempt to draw objects that don't exist any more @@ -613,7 +613,7 @@ namespace OpenRCT2::Ui::Windows if (object_selection_flags & ObjectSelectionFlags::Flag6) return; - Invalidate(); + invalidate(); const CursorState* state = ContextGetCursorState(); Audio::Play(Audio::SoundId::Click1, 0, state->position.x); @@ -662,7 +662,7 @@ namespace OpenRCT2::Ui::Windows if (IsFilterActive(FILTER_SELECTED) || IsFilterActive(FILTER_NONSELECTED)) { VisibleListRefresh(); - Invalidate(); + invalidate(); } if (_gSceneryGroupPartialSelectError.has_value()) @@ -685,7 +685,7 @@ namespace OpenRCT2::Ui::Windows * * rct2: 0x006AB079 */ - void OnScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override + void onScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override { int32_t selectedObject = GetObjectFromObjectSelection(GetSelectedObjectType(), screenCoords.y); if (selectedObject != -1) @@ -718,11 +718,11 @@ namespace OpenRCT2::Ui::Windows } } - Invalidate(); + invalidate(); } } - void OnScrollDraw(int32_t scrollIndex, RenderTarget& rt) override + void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override { // ScrollPaint ScreenCoordsXY screenCoords; @@ -814,7 +814,7 @@ namespace OpenRCT2::Ui::Windows * * rct2: 0x006AB058 */ - OpenRCT2String OnTooltip(const WidgetIndex widgetIndex, const StringId fallback) override + OpenRCT2String onTooltip(const WidgetIndex widgetIndex, const StringId fallback) override { if (widgetIndex >= WIDX_TAB_1 && static_cast(widgetIndex) < WIDX_TAB_1 + std::size(ObjectSelectionPages)) { @@ -825,7 +825,7 @@ namespace OpenRCT2::Ui::Windows return { fallback, {} }; } - void OnTextInput(WidgetIndex widgetIndex, std::string_view text) override + void onTextInput(WidgetIndex widgetIndex, std::string_view text) override { if (widgetIndex != WIDX_FILTER_TEXT_BOX) return; @@ -838,10 +838,10 @@ namespace OpenRCT2::Ui::Windows scrolls->contentOffsetY = 0; VisibleListRefresh(); - Invalidate(); + invalidate(); } - void OnPrepareDraw() override + void onPrepareDraw() override { // Resize widgets widgets[WIDX_LIST].right = width - 309; @@ -852,7 +852,7 @@ namespace OpenRCT2::Ui::Windows widgets[WIDX_RELOAD_OBJECT].right = width - 9; auto& dropdownWidget = widgets[WIDX_FILTER_DROPDOWN]; - ResizeDropdown(WIDX_FILTER_DROPDOWN, { width - kFilterWidth - 10, dropdownWidget.top }, { kFilterWidth, 14 }); + resizeDropdown(WIDX_FILTER_DROPDOWN, { width - kFilterWidth - 10, dropdownWidget.top }, { kFilterWidth, 14 }); auto& installTrackWidget = widgets[WIDX_INSTALL_TRACK]; installTrackWidget.moveToX(dropdownWidget.left - installTrackWidget.width() - 10); @@ -889,7 +889,7 @@ namespace OpenRCT2::Ui::Windows // Set filter dropdown caption if (!IsFilterActive(FILTER_SOURCES_ALL)) { - // Only one source active? + // only one source active? uint32_t sources = _filterFlags & FILTER_SOURCES_ALL; auto numSourcesActive = std::popcount(sources); if (numSourcesActive == 1) @@ -1003,9 +1003,9 @@ namespace OpenRCT2::Ui::Windows widgets[WIDX_PREVIEW].right = widgets[WIDX_PREVIEW].left + kPreviewSize; } - void OnDraw(RenderTarget& rt) override + void onDraw(RenderTarget& rt) override { - DrawWidgets(rt); + drawWidgets(rt); // Draw main tab images for (size_t i = 0; i < std::size(ObjectSelectionPages); i++) @@ -1124,7 +1124,7 @@ namespace OpenRCT2::Ui::Windows { if (ObjectSelectionPages[offset].mainObjectType == objectType) { - SetPage(offset); + setPage(offset); return; } } @@ -1133,9 +1133,9 @@ namespace OpenRCT2::Ui::Windows private: bool tabWidgetsInitialised = false; - void InitWidgets() + void initWidgets() { - SetWidgets(_window_editor_object_selection_widgets); + setWidgets(_window_editor_object_selection_widgets); if (!tabWidgetsInitialised) { // Create a new tab widget based on the initial one @@ -1149,7 +1149,7 @@ namespace OpenRCT2::Ui::Windows } } - void SetPage(int32_t _page) + void setPage(int32_t _page) { // Skip setting page if we're already on this page, unless we're initialising the window if (selectedTab == _page && !widgets.empty()) @@ -1174,7 +1174,7 @@ namespace OpenRCT2::Ui::Windows } VisibleListRefresh(); - Invalidate(); + invalidate(); } void VisibleListRefresh() @@ -1234,7 +1234,7 @@ namespace OpenRCT2::Ui::Windows } } } - Invalidate(); + invalidate(); } void VisibleListClear() @@ -1442,7 +1442,7 @@ namespace OpenRCT2::Ui::Windows bool FilterCompatibilityObject(const ObjectRepositoryItem& item, uint8_t objectFlag) { - // Only show compat objects if they are selected already. + // only show compat objects if they are selected already. return !(item.Flags & ObjectItemFlags::IsCompatibilityObject) || (objectFlag & ObjectSelectionFlags::Selected); } @@ -1644,7 +1644,7 @@ namespace OpenRCT2::Ui::Windows } auto objSelWindow = static_cast(window); objSelWindow->SetOverrideChecks(true); - objSelWindow->Close(); + objSelWindow->close(); } static bool VisibleListSortRideName(const ObjectListItem& a, const ObjectListItem& b) diff --git a/src/openrct2-ui/windows/EditorParkEntrance.cpp b/src/openrct2-ui/windows/EditorParkEntrance.cpp index 3241bca288..7114edd4b3 100644 --- a/src/openrct2-ui/windows/EditorParkEntrance.cpp +++ b/src/openrct2-ui/windows/EditorParkEntrance.cpp @@ -76,7 +76,7 @@ namespace OpenRCT2::Ui::Windows ObjectEntryIndex _highlightedEntranceType = 0; std::vector _entranceTypes{}; - void InitParkEntranceItems() + void initParkEntranceItems() { _entranceTypes.clear(); for (ObjectEntryIndex objectIndex = 0; objectIndex < kMaxParkEntranceObjects; objectIndex++) @@ -246,12 +246,12 @@ namespace OpenRCT2::Ui::Windows } public: - void OnOpen() override + void onOpen() override { - SetWidgets(_widgets); + setWidgets(_widgets); - InitScrollWidgets(); - InitParkEntranceItems(); + initScrollWidgets(); + initParkEntranceItems(); listInformationType = 0; @@ -264,47 +264,47 @@ namespace OpenRCT2::Ui::Windows gInputFlags.set(InputFlag::unk6); } - void OnMouseUp(WidgetIndex widgetIndex) override + void onMouseUp(WidgetIndex widgetIndex) override { switch (widgetIndex) { case WIDX_CLOSE: - Close(); + close(); break; case WIDX_ROTATE_ENTRANCE_BUTTON: gWindowSceneryRotation = DirectionNext(gWindowSceneryRotation); - Invalidate(); + invalidate(); break; } } - void OnClose() override + void onClose() override { if (gCurrentToolWidget.windowClassification == classification) ToolCancel(); } - void OnUpdate() override + void onUpdate() override { if (gCurrentToolWidget.windowClassification != classification) - Close(); + close(); } - void OnPrepareDraw() override + void onPrepareDraw() override { widgets[WIDX_LIST].right = width - 30; widgets[WIDX_LIST].bottom = height - 5; } - void OnDraw(RenderTarget& rt) override + void onDraw(RenderTarget& rt) override { - DrawWidgets(rt); + drawWidgets(rt); GfxDrawSprite( rt, ImageId(SPR_TAB_PARK_ENTRANCE), windowPos + ScreenCoordsXY{ widgets[WIDX_TAB].left, widgets[WIDX_TAB].top }); } - void OnScrollDraw(int32_t scrollIndex, RenderTarget& rt) override + void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override { GfxClear(rt, ColourMapA[colours[1].colour].mid_light); @@ -344,43 +344,43 @@ namespace OpenRCT2::Ui::Windows } } - void OnToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override + void onToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override { PlaceParkEntranceToolDown(screenCoords); } - void OnToolUpdate(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override + void onToolUpdate(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override { PlaceParkEntranceToolUpdate(screenCoords); } - void OnToolAbort(WidgetIndex widgetIndex) override + void onToolAbort(WidgetIndex widgetIndex) override { ParkEntranceRemoveGhost(); - Invalidate(); + invalidate(); HideGridlines(); HideLandRights(); HideConstructionRights(); } - ScreenSize OnScrollGetSize(int32_t scrollIndex) override + ScreenSize onScrollGetSize(int32_t scrollIndex) override { auto scrollHeight = static_cast(GetNumRows() * kImageSize); return ScreenSize(kImageSize * kNumColumns, scrollHeight); } - void OnScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override + void onScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override { auto highlighted = ScrollGetEntranceListItemAt(screenCoords); if (highlighted != kObjectEntryIndexNull) { _highlightedEntranceType = highlighted; - Invalidate(); + invalidate(); } } - void OnScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override + void onScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override { auto selected = ScrollGetEntranceListItemAt(screenCoords); if (selected == kObjectEntryIndexNull) @@ -391,7 +391,7 @@ namespace OpenRCT2::Ui::Windows _selectedEntranceType = selected; Audio::Play(Audio::SoundId::Click1, 0, windowPos.x + (width / 2)); - Invalidate(); + invalidate(); } }; diff --git a/src/openrct2-ui/windows/EditorScenarioOptions.cpp b/src/openrct2-ui/windows/EditorScenarioOptions.cpp index 1c81347d56..ebec013d48 100644 --- a/src/openrct2-ui/windows/EditorScenarioOptions.cpp +++ b/src/openrct2-ui/windows/EditorScenarioOptions.cpp @@ -343,17 +343,17 @@ namespace OpenRCT2::Ui::Windows std::vector _rideableRides; public: - void OnOpen() override + void onOpen() override { - SetPage(WINDOW_EDITOR_SCENARIO_OPTIONS_PAGE_OBJECTIVE); + setPage(WINDOW_EDITOR_SCENARIO_OPTIONS_PAGE_OBJECTIVE); } - void OnMouseUp(WidgetIndex widgetIndex) override + void onMouseUp(WidgetIndex widgetIndex) override { switch (widgetIndex) { case WIDX_CLOSE: - Close(); + close(); return; case WIDX_TAB_1: case WIDX_TAB_2: @@ -361,7 +361,7 @@ namespace OpenRCT2::Ui::Windows case WIDX_TAB_4: case WIDX_TAB_5: case WIDX_TAB_6: - SetPage(widgetIndex - WIDX_TAB_1); + setPage(widgetIndex - WIDX_TAB_1); return; } @@ -378,7 +378,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnResize() override + void onResize() override { switch (page) { @@ -397,7 +397,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnMouseDown(WidgetIndex widgetIndex) override + void onMouseDown(WidgetIndex widgetIndex) override { switch (page) { @@ -414,7 +414,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnUpdate() override + void onUpdate() override { switch (page) { @@ -433,7 +433,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnPrepareDraw() override + void onPrepareDraw() override { HideUnavailableTabs(); @@ -454,7 +454,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnDraw(RenderTarget& rt) override + void onDraw(RenderTarget& rt) override { switch (page) { @@ -473,7 +473,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnDropdown(WidgetIndex widgetIndex, int32_t selectedIndex) override + void onDropdown(WidgetIndex widgetIndex, int32_t selectedIndex) override { switch (page) { @@ -488,7 +488,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnTextInput(WidgetIndex widgetIndex, std::string_view text) override + void onTextInput(WidgetIndex widgetIndex, std::string_view text) override { if (page == WINDOW_EDITOR_SCENARIO_OPTIONS_PAGE_SCENARIO_DETAILS) { @@ -496,7 +496,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override + void onScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override { if (page == WINDOW_EDITOR_SCENARIO_OPTIONS_PAGE_RIDES) { @@ -504,7 +504,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override + void onScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override { if (page == WINDOW_EDITOR_SCENARIO_OPTIONS_PAGE_RIDES) { @@ -512,7 +512,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnScrollDraw(int32_t scrollIndex, RenderTarget& rt) override + void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override { if (page == WINDOW_EDITOR_SCENARIO_OPTIONS_PAGE_RIDES) { @@ -520,7 +520,7 @@ namespace OpenRCT2::Ui::Windows } } - ScreenSize OnScrollGetSize(int32_t scrollIndex) override + ScreenSize onScrollGetSize(int32_t scrollIndex) override { if (page == WINDOW_EDITOR_SCENARIO_OPTIONS_PAGE_RIDES) { @@ -555,12 +555,12 @@ namespace OpenRCT2::Ui::Windows bool isOtherTab = !isObjectiveSelection && !isScenarioDetails; // Disable tabs based on current editor step - SetWidgetDisabled(WIDX_TAB_1, !isObjectiveSelection); - SetWidgetDisabled(WIDX_TAB_2, !isScenarioDetails); + setWidgetDisabled(WIDX_TAB_1, !isObjectiveSelection); + setWidgetDisabled(WIDX_TAB_2, !isScenarioDetails); for (auto i = 2; i < WINDOW_EDITOR_SCENARIO_OPTIONS_PAGE_COUNT; i++) - SetWidgetDisabled(WIDX_TAB_1 + i, !isOtherTab); + setWidgetDisabled(WIDX_TAB_1 + i, !isOtherTab); - SetWidgetDisabled(WIDX_TAB_6, !(isOtherTab && AnyRidesExist())); + setWidgetDisabled(WIDX_TAB_6, !(isOtherTab && AnyRidesExist())); // Reposition tabs based on availability so there are no gaps widgets[WIDX_TAB_1].left = 3; @@ -568,14 +568,14 @@ namespace OpenRCT2::Ui::Windows WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_6); // Switch tabs if our current tab has become unavailable - if (IsWidgetDisabled(WIDX_TAB_1 + page)) + if (isWidgetDisabled(WIDX_TAB_1 + page)) { if (isObjectiveSelection) - SetPage(WINDOW_EDITOR_SCENARIO_OPTIONS_PAGE_OBJECTIVE); + setPage(WINDOW_EDITOR_SCENARIO_OPTIONS_PAGE_OBJECTIVE); else if (isScenarioDetails) - SetPage(WINDOW_EDITOR_SCENARIO_OPTIONS_PAGE_SCENARIO_DETAILS); + setPage(WINDOW_EDITOR_SCENARIO_OPTIONS_PAGE_SCENARIO_DETAILS); else - SetPage(WINDOW_EDITOR_SCENARIO_OPTIONS_PAGE_FINANCIAL); + setPage(WINDOW_EDITOR_SCENARIO_OPTIONS_PAGE_FINANCIAL); } } @@ -583,8 +583,8 @@ namespace OpenRCT2::Ui::Windows { int32_t i; for (i = 0; i < WINDOW_EDITOR_SCENARIO_OPTIONS_PAGE_COUNT; i++) - SetWidgetPressed(WIDX_TAB_1 + i, false); - SetWidgetPressed(WIDX_TAB_1 + page, true); + setWidgetPressed(WIDX_TAB_1 + i, false); + setWidgetPressed(WIDX_TAB_1 + page, true); } void DrawTabImages(RenderTarget& rt) @@ -593,7 +593,7 @@ namespace OpenRCT2::Ui::Windows int32_t spriteIndex; // Tab 1 - if (!IsWidgetDisabled(WIDX_TAB_1)) + if (!isWidgetDisabled(WIDX_TAB_1)) { widget = &widgets[WIDX_TAB_1]; spriteIndex = SPR_TAB_OBJECTIVE_0; @@ -604,7 +604,7 @@ namespace OpenRCT2::Ui::Windows } // Tab 2 - if (!IsWidgetDisabled(WIDX_TAB_2)) + if (!isWidgetDisabled(WIDX_TAB_2)) { widget = &widgets[WIDX_TAB_2]; spriteIndex = SPR_TAB_KIOSKS_AND_FACILITIES_0; @@ -615,7 +615,7 @@ namespace OpenRCT2::Ui::Windows } // Tab 3 - if (!IsWidgetDisabled(WIDX_TAB_3)) + if (!isWidgetDisabled(WIDX_TAB_3)) { widget = &widgets[WIDX_TAB_3]; spriteIndex = SPR_TAB_FINANCES_SUMMARY_0; @@ -626,7 +626,7 @@ namespace OpenRCT2::Ui::Windows } // Tab 4 - if (!IsWidgetDisabled(WIDX_TAB_4)) + if (!isWidgetDisabled(WIDX_TAB_4)) { widget = &widgets[WIDX_TAB_4]; spriteIndex = SPR_TAB_GUESTS_0; @@ -637,7 +637,7 @@ namespace OpenRCT2::Ui::Windows } // Tab 5 - if (!IsWidgetDisabled(WIDX_TAB_5)) + if (!isWidgetDisabled(WIDX_TAB_5)) { widget = &widgets[WIDX_TAB_5]; spriteIndex = SPR_G2_MAP_GEN_TERRAIN_TAB; @@ -645,7 +645,7 @@ namespace OpenRCT2::Ui::Windows } // Tab 6 - if (!IsWidgetDisabled(WIDX_TAB_6)) + if (!isWidgetDisabled(WIDX_TAB_6)) { widget = &widgets[WIDX_TAB_6]; spriteIndex = SPR_TAB_RIDE_0; @@ -656,7 +656,7 @@ namespace OpenRCT2::Ui::Windows } } - void SetPage(int32_t newPage) + void setPage(int32_t newPage) { // Skip setting page if we're already on this page, unless we're initialising the window if (page == newPage && !widgets.empty()) @@ -668,12 +668,12 @@ namespace OpenRCT2::Ui::Windows holdDownWidgets = window_editor_scenario_options_page_holdDownWidgets[page]; pressedWidgets = 0; - SetWidgets(window_editor_scenario_options_widgets[page]); - Invalidate(); - OnResize(); - OnPrepareDraw(); - InitScrollWidgets(); - Invalidate(); + setWidgets(window_editor_scenario_options_widgets[page]); + invalidate(); + onResize(); + onPrepareDraw(); + initScrollWidgets(); + invalidate(); } #pragma region Objective @@ -688,7 +688,7 @@ namespace OpenRCT2::Ui::Windows auto& scenarioOptions = gameState.scenarioOptions; scenarioOptions.objective.Type = objective; - Invalidate(); + invalidate(); // Set default objective arguments switch (objective) @@ -799,7 +799,7 @@ namespace OpenRCT2::Ui::Windows else { scenarioOptions.objective.Currency += kObjectiveCurrencyLoanAndValueAdjustment; - Invalidate(); + invalidate(); } break; case Scenario::ObjectiveType::monthlyFoodIncome: @@ -810,7 +810,7 @@ namespace OpenRCT2::Ui::Windows else { scenarioOptions.objective.Currency += kObjectiveCurrencyFoodAdjustment; - Invalidate(); + invalidate(); } break; case Scenario::ObjectiveType::tenRollercoastersLength: @@ -821,7 +821,7 @@ namespace OpenRCT2::Ui::Windows else { scenarioOptions.objective.MinimumLength += kObjectiveLengthAdjustment; - Invalidate(); + invalidate(); } break; case Scenario::ObjectiveType::finishFiveRollercoasters: @@ -832,7 +832,7 @@ namespace OpenRCT2::Ui::Windows else { scenarioOptions.objective.MinimumExcitement += kObjectiveExcitementAdjustment; - Invalidate(); + invalidate(); } break; default: @@ -843,7 +843,7 @@ namespace OpenRCT2::Ui::Windows else { scenarioOptions.objective.NumGuests += kObjectiveGuestsAdjustment; - Invalidate(); + invalidate(); } break; } @@ -866,7 +866,7 @@ namespace OpenRCT2::Ui::Windows else { scenarioOptions.objective.Currency -= kObjectiveCurrencyLoanAndValueAdjustment; - Invalidate(); + invalidate(); } break; case Scenario::ObjectiveType::monthlyFoodIncome: @@ -877,7 +877,7 @@ namespace OpenRCT2::Ui::Windows else { scenarioOptions.objective.Currency -= kObjectiveCurrencyFoodAdjustment; - Invalidate(); + invalidate(); } break; case Scenario::ObjectiveType::tenRollercoastersLength: @@ -888,7 +888,7 @@ namespace OpenRCT2::Ui::Windows else { scenarioOptions.objective.MinimumLength -= kObjectiveLengthAdjustment; - Invalidate(); + invalidate(); } break; case Scenario::ObjectiveType::finishFiveRollercoasters: @@ -899,7 +899,7 @@ namespace OpenRCT2::Ui::Windows else { scenarioOptions.objective.MinimumExcitement -= kObjectiveExcitementAdjustment; - Invalidate(); + invalidate(); } break; default: @@ -910,7 +910,7 @@ namespace OpenRCT2::Ui::Windows else { scenarioOptions.objective.NumGuests -= kObjectiveGuestsAdjustment; - Invalidate(); + invalidate(); } break; } @@ -928,7 +928,7 @@ namespace OpenRCT2::Ui::Windows else { scenarioOptions.objective.Year += kObjectiveYearAdjustment; - Invalidate(); + invalidate(); } } @@ -944,7 +944,7 @@ namespace OpenRCT2::Ui::Windows else { scenarioOptions.objective.Year -= kObjectiveYearAdjustment; - Invalidate(); + invalidate(); } } @@ -968,7 +968,7 @@ namespace OpenRCT2::Ui::Windows GameActions::ScenarioSetSetting::ParkRatingHigherDifficultyLevel, gameState.park.flags & PARK_FLAGS_DIFFICULT_PARK_RATING ? 0 : 1); GameActions::Execute(&scenarioSetSetting, gameState); - Invalidate(); + invalidate(); break; } } @@ -1028,8 +1028,8 @@ namespace OpenRCT2::Ui::Windows void ObjectiveOnUpdate() { currentFrame++; - OnPrepareDraw(); - InvalidateWidget(WIDX_TAB_1); + onPrepareDraw(); + invalidateWidget(WIDX_TAB_1); auto objectiveType = getGameState().scenarioOptions.objective.Type; @@ -1131,7 +1131,7 @@ namespace OpenRCT2::Ui::Windows widgets[WIDX_CLOSE].type = gLegacyScene == LegacyScene::scenarioEditor ? WidgetType::empty : WidgetType::closeBox; - SetWidgetPressed(WIDX_HARD_PARK_RATING, gameState.park.flags & PARK_FLAGS_DIFFICULT_PARK_RATING); + setWidgetPressed(WIDX_HARD_PARK_RATING, gameState.park.flags & PARK_FLAGS_DIFFICULT_PARK_RATING); } /** @@ -1143,7 +1143,7 @@ namespace OpenRCT2::Ui::Windows const auto& gameState = getGameState(); const auto& scenarioOptions = gameState.scenarioOptions; - DrawWidgets(rt); + drawWidgets(rt); DrawTabImages(rt); // Objective value @@ -1258,7 +1258,7 @@ namespace OpenRCT2::Ui::Windows if (gameState.scenarioOptions.category != static_cast(dropdownIndex)) { gameState.scenarioOptions.category = static_cast(dropdownIndex); - Invalidate(); + invalidate(); } break; } @@ -1271,7 +1271,7 @@ namespace OpenRCT2::Ui::Windows void ScenarioDetailsOnDraw(RenderTarget& rt) { - DrawWidgets(rt); + drawWidgets(rt); DrawTabImages(rt); const auto& gameState = getGameState(); @@ -1349,11 +1349,11 @@ namespace OpenRCT2::Ui::Windows } case WIDX_SCENARIO_NAME: scenarioOptions.name = text; - Invalidate(); + invalidate(); break; case WIDX_DETAILS: scenarioOptions.details = text; - Invalidate(); + invalidate(); break; } } @@ -1361,7 +1361,7 @@ namespace OpenRCT2::Ui::Windows void ScenarioDetailsOnUpdate() { currentFrame++; - InvalidateWidget(WIDX_TAB_1); + invalidateWidget(WIDX_TAB_1); } void ScenarioDetailsOnResize() @@ -1384,7 +1384,7 @@ namespace OpenRCT2::Ui::Windows auto scenarioSetSetting = GameActions::ScenarioSetSettingAction( GameActions::ScenarioSetSetting::NoMoney, newMoneySetting); GameActions::Execute(&scenarioSetSetting, gameState); - Invalidate(); + invalidate(); break; } case WIDX_FORBID_MARKETING: @@ -1393,7 +1393,7 @@ namespace OpenRCT2::Ui::Windows GameActions::ScenarioSetSetting::ForbidMarketingCampaigns, gameState.park.flags & PARK_FLAGS_FORBID_MARKETING_CAMPAIGN ? 0 : 1); GameActions::Execute(&scenarioSetSetting, gameState); - Invalidate(); + invalidate(); break; } case WIDX_RCT1_INTEREST: @@ -1402,7 +1402,7 @@ namespace OpenRCT2::Ui::Windows GameActions::ScenarioSetSetting::UseRCT1Interest, gameState.park.flags & PARK_FLAGS_RCT1_INTEREST ? 0 : 1); GameActions::Execute(&scenarioSetSetting, gameState); - Invalidate(); + invalidate(); break; } } @@ -1429,7 +1429,7 @@ namespace OpenRCT2::Ui::Windows { ContextShowError(STR_CANT_INCREASE_CASH, kStringIdNone, {}); } - Invalidate(); + invalidate(); break; case WIDX_INITIAL_CASH_DECREASE: if (gameState.scenarioOptions.initialCash > 0.00_GBP) @@ -1442,7 +1442,7 @@ namespace OpenRCT2::Ui::Windows { ContextShowError(STR_CANT_REDUCE_CASH, kStringIdNone, {}); } - Invalidate(); + invalidate(); break; case WIDX_INITIAL_LOAN_INCREASE: if (gameState.park.bankLoan < 5000000.00_GBP) @@ -1455,7 +1455,7 @@ namespace OpenRCT2::Ui::Windows { ContextShowError(STR_CANT_INCREASE_INIT_LOAN, kStringIdNone, {}); } - Invalidate(); + invalidate(); break; case WIDX_INITIAL_LOAN_DECREASE: if (gameState.park.bankLoan > 0.00_GBP) @@ -1468,7 +1468,7 @@ namespace OpenRCT2::Ui::Windows { ContextShowError(STR_CANT_REDUCE_INIT_LOAN, kStringIdNone, {}); } - Invalidate(); + invalidate(); break; case WIDX_MAXIMUM_LOAN_INCREASE: if (gameState.park.maxBankLoan < 5000000.00_GBP) @@ -1481,7 +1481,7 @@ namespace OpenRCT2::Ui::Windows { ContextShowError(STR_CANT_INCREASE_MAX_LOAN, kStringIdNone, {}); } - Invalidate(); + invalidate(); break; case WIDX_MAXIMUM_LOAN_DECREASE: if (gameState.park.maxBankLoan > 0.00_GBP) @@ -1494,7 +1494,7 @@ namespace OpenRCT2::Ui::Windows { ContextShowError(STR_CANT_REDUCE_MAX_LOAN, kStringIdNone, {}); } - Invalidate(); + invalidate(); break; case WIDX_INTEREST_RATE_INCREASE: if (gameState.park.bankLoanInterestRate < kMaxBankLoanInterestRate) @@ -1507,7 +1507,7 @@ namespace OpenRCT2::Ui::Windows { ContextShowError(STR_CANT_INCREASE_INTEREST_RATE, kStringIdNone, {}); } - Invalidate(); + invalidate(); break; case WIDX_INTEREST_RATE_DECREASE: if (gameState.park.bankLoanInterestRate > 0) @@ -1521,7 +1521,7 @@ namespace OpenRCT2::Ui::Windows { ContextShowError(STR_CANT_REDUCE_INTEREST_RATE, kStringIdNone, {}); } - Invalidate(); + invalidate(); break; case WIDX_ENTRY_PRICE_INCREASE: if (gameState.park.entranceFee < kMaxEntranceFee) @@ -1534,7 +1534,7 @@ namespace OpenRCT2::Ui::Windows { ContextShowError(STR_CANT_INCREASE_FURTHER, kStringIdNone, {}); } - Invalidate(); + invalidate(); break; case WIDX_ENTRY_PRICE_DECREASE: if (gameState.park.entranceFee > 0.00_GBP) @@ -1547,7 +1547,7 @@ namespace OpenRCT2::Ui::Windows { ContextShowError(STR_CANT_REDUCE_FURTHER, kStringIdNone, {}); } - Invalidate(); + invalidate(); break; case WIDX_PAY_FOR_PARK_OR_RIDES_DROPDOWN: { @@ -1594,7 +1594,7 @@ namespace OpenRCT2::Ui::Windows auto scenarioSetSetting = GameActions::ScenarioSetSettingAction( GameActions::ScenarioSetSetting::ParkChargeMethod, dropdownIndex); GameActions::Execute(&scenarioSetSetting, getGameState()); - Invalidate(); + invalidate(); break; } } @@ -1603,7 +1603,7 @@ namespace OpenRCT2::Ui::Windows void FinancialUpdate() { currentFrame++; - InvalidateWidget(WIDX_TAB_1); + invalidateWidget(WIDX_TAB_1); } void FinancialPrepareDraw() @@ -1612,17 +1612,17 @@ namespace OpenRCT2::Ui::Windows auto& gameState = getGameState(); bool noMoney = gameState.park.flags & PARK_FLAGS_NO_MONEY; - SetWidgetPressed(WIDX_NO_MONEY, noMoney); + setWidgetPressed(WIDX_NO_MONEY, noMoney); - SetWidgetDisabled(WIDX_GROUP_LOAN, noMoney); - SetWidgetDisabled(WIDX_INITIAL_LOAN_LABEL, noMoney); - SetWidgetDisabled(WIDX_INITIAL_LOAN, noMoney); - SetWidgetDisabled(WIDX_INITIAL_LOAN_INCREASE, noMoney); - SetWidgetDisabled(WIDX_INITIAL_LOAN_DECREASE, noMoney); - SetWidgetDisabled(WIDX_MAXIMUM_LOAN_LABEL, noMoney); - SetWidgetDisabled(WIDX_MAXIMUM_LOAN, noMoney); - SetWidgetDisabled(WIDX_MAXIMUM_LOAN_INCREASE, noMoney); - SetWidgetDisabled(WIDX_MAXIMUM_LOAN_DECREASE, noMoney); + setWidgetDisabled(WIDX_GROUP_LOAN, noMoney); + setWidgetDisabled(WIDX_INITIAL_LOAN_LABEL, noMoney); + setWidgetDisabled(WIDX_INITIAL_LOAN, noMoney); + setWidgetDisabled(WIDX_INITIAL_LOAN_INCREASE, noMoney); + setWidgetDisabled(WIDX_INITIAL_LOAN_DECREASE, noMoney); + setWidgetDisabled(WIDX_MAXIMUM_LOAN_LABEL, noMoney); + setWidgetDisabled(WIDX_MAXIMUM_LOAN, noMoney); + setWidgetDisabled(WIDX_MAXIMUM_LOAN_INCREASE, noMoney); + setWidgetDisabled(WIDX_MAXIMUM_LOAN_DECREASE, noMoney); if (gameState.park.flags & PARK_FLAGS_RCT1_INTEREST) { @@ -1631,8 +1631,8 @@ namespace OpenRCT2::Ui::Windows widgets[WIDX_INTEREST_RATE_INCREASE].type = WidgetType::empty; widgets[WIDX_INTEREST_RATE_DECREASE].type = WidgetType::empty; widgets[WIDX_RCT1_INTEREST].type = WidgetType::checkbox; - SetWidgetPressed(WIDX_RCT1_INTEREST, true); - SetWidgetDisabled(WIDX_RCT1_INTEREST, noMoney); + setWidgetPressed(WIDX_RCT1_INTEREST, true); + setWidgetDisabled(WIDX_RCT1_INTEREST, noMoney); } else { @@ -1641,21 +1641,21 @@ namespace OpenRCT2::Ui::Windows widgets[WIDX_INTEREST_RATE_INCREASE].type = WidgetType::button; widgets[WIDX_INTEREST_RATE_DECREASE].type = WidgetType::button; widgets[WIDX_RCT1_INTEREST].type = WidgetType::empty; - SetWidgetDisabled(WIDX_INTEREST_RATE_LABEL, noMoney); - SetWidgetDisabled(WIDX_INTEREST_RATE, noMoney); - SetWidgetDisabled(WIDX_INTEREST_RATE_INCREASE, noMoney); - SetWidgetDisabled(WIDX_INTEREST_RATE_DECREASE, noMoney); + setWidgetDisabled(WIDX_INTEREST_RATE_LABEL, noMoney); + setWidgetDisabled(WIDX_INTEREST_RATE, noMoney); + setWidgetDisabled(WIDX_INTEREST_RATE_INCREASE, noMoney); + setWidgetDisabled(WIDX_INTEREST_RATE_DECREASE, noMoney); } - SetWidgetDisabled(WIDX_GROUP_BUSINESS_MODEL, noMoney); - SetWidgetDisabled(WIDX_INITIAL_CASH_LABEL, noMoney); - SetWidgetDisabled(WIDX_INITIAL_CASH, noMoney); - SetWidgetDisabled(WIDX_INITIAL_CASH_INCREASE, noMoney); - SetWidgetDisabled(WIDX_INITIAL_CASH_DECREASE, noMoney); - SetWidgetDisabled(WIDX_PAY_FOR_PARK_OR_RIDES_LABEL, noMoney); - SetWidgetDisabled(WIDX_PAY_FOR_PARK_OR_RIDES, noMoney); - SetWidgetDisabled(WIDX_PAY_FOR_PARK_OR_RIDES_DROPDOWN, noMoney); - SetWidgetDisabled(WIDX_FORBID_MARKETING, noMoney); + setWidgetDisabled(WIDX_GROUP_BUSINESS_MODEL, noMoney); + setWidgetDisabled(WIDX_INITIAL_CASH_LABEL, noMoney); + setWidgetDisabled(WIDX_INITIAL_CASH, noMoney); + setWidgetDisabled(WIDX_INITIAL_CASH_INCREASE, noMoney); + setWidgetDisabled(WIDX_INITIAL_CASH_DECREASE, noMoney); + setWidgetDisabled(WIDX_PAY_FOR_PARK_OR_RIDES_LABEL, noMoney); + setWidgetDisabled(WIDX_PAY_FOR_PARK_OR_RIDES, noMoney); + setWidgetDisabled(WIDX_PAY_FOR_PARK_OR_RIDES_DROPDOWN, noMoney); + setWidgetDisabled(WIDX_FORBID_MARKETING, noMoney); if (!Park::EntranceFeeUnlocked()) { @@ -1670,13 +1670,13 @@ namespace OpenRCT2::Ui::Windows widgets[WIDX_ENTRY_PRICE].type = WidgetType::spinner; widgets[WIDX_ENTRY_PRICE_INCREASE].type = WidgetType::button; widgets[WIDX_ENTRY_PRICE_DECREASE].type = WidgetType::button; - SetWidgetDisabled(WIDX_ENTRY_PRICE_LABEL, noMoney); - SetWidgetDisabled(WIDX_ENTRY_PRICE, noMoney); - SetWidgetDisabled(WIDX_ENTRY_PRICE_INCREASE, noMoney); - SetWidgetDisabled(WIDX_ENTRY_PRICE_DECREASE, noMoney); + setWidgetDisabled(WIDX_ENTRY_PRICE_LABEL, noMoney); + setWidgetDisabled(WIDX_ENTRY_PRICE, noMoney); + setWidgetDisabled(WIDX_ENTRY_PRICE_INCREASE, noMoney); + setWidgetDisabled(WIDX_ENTRY_PRICE_DECREASE, noMoney); } - SetWidgetPressed(WIDX_FORBID_MARKETING, gameState.park.flags & PARK_FLAGS_FORBID_MARKETING_CAMPAIGN); + setWidgetPressed(WIDX_FORBID_MARKETING, gameState.park.flags & PARK_FLAGS_FORBID_MARKETING_CAMPAIGN); widgets[WIDX_CLOSE].type = gLegacyScene == LegacyScene::scenarioEditor ? WidgetType::empty : WidgetType::closeBox; } @@ -1697,7 +1697,7 @@ namespace OpenRCT2::Ui::Windows screenCoords = windowPos + ScreenCoordsXY{ initialCashWidget.left + 1, initialCashWidget.top }; auto ft = Formatter(); ft.Add(getGameState().scenarioOptions.initialCash); - auto colour = !IsWidgetDisabled(WIDX_INITIAL_CASH) ? wColour2 : wColour2.withFlag(ColourFlag::inset, true); + auto colour = !isWidgetDisabled(WIDX_INITIAL_CASH) ? wColour2 : wColour2.withFlag(ColourFlag::inset, true); DrawTextBasic(rt, screenCoords, STR_CURRENCY_FORMAT_LABEL, ft, colour); } @@ -1707,7 +1707,7 @@ namespace OpenRCT2::Ui::Windows screenCoords = windowPos + ScreenCoordsXY{ initialLoanWidget.left + 1, initialLoanWidget.top }; auto ft = Formatter(); ft.Add(gameState.park.bankLoan); - auto colour = !IsWidgetDisabled(WIDX_INITIAL_LOAN) ? wColour2 : wColour2.withFlag(ColourFlag::inset, true); + auto colour = !isWidgetDisabled(WIDX_INITIAL_LOAN) ? wColour2 : wColour2.withFlag(ColourFlag::inset, true); DrawTextBasic(rt, screenCoords, STR_CURRENCY_FORMAT_LABEL, ft, colour); } @@ -1717,7 +1717,7 @@ namespace OpenRCT2::Ui::Windows screenCoords = windowPos + ScreenCoordsXY{ maximumLoanWidget.left + 1, maximumLoanWidget.top }; auto ft = Formatter(); ft.Add(getGameState().park.maxBankLoan); - auto colour = !IsWidgetDisabled(WIDX_MAXIMUM_LOAN) ? wColour2 : wColour2.withFlag(ColourFlag::inset, true); + auto colour = !isWidgetDisabled(WIDX_MAXIMUM_LOAN) ? wColour2 : wColour2.withFlag(ColourFlag::inset, true); DrawTextBasic(rt, screenCoords, STR_CURRENCY_FORMAT_LABEL, ft, colour); } @@ -1729,7 +1729,7 @@ namespace OpenRCT2::Ui::Windows auto ft = Formatter(); ft.Add( std::clamp(static_cast(gameState.park.bankLoanInterestRate), INT16_MIN, INT16_MAX)); - auto colour = !IsWidgetDisabled(WIDX_INTEREST_RATE) ? wColour2 : wColour2.withFlag(ColourFlag::inset, true); + auto colour = !isWidgetDisabled(WIDX_INTEREST_RATE) ? wColour2 : wColour2.withFlag(ColourFlag::inset, true); DrawTextBasic(rt, screenCoords, STR_PERCENT_FORMAT_LABEL, ft, colour); } @@ -1748,7 +1748,7 @@ namespace OpenRCT2::Ui::Windows else ft.Add(STR_PAY_PARK_ENTER); - auto colour = !IsWidgetDisabled(WIDX_PAY_FOR_PARK_OR_RIDES) ? wColour2 + auto colour = !isWidgetDisabled(WIDX_PAY_FOR_PARK_OR_RIDES) ? wColour2 : wColour2.withFlag(ColourFlag::inset, true); DrawTextBasic(rt, screenCoords, STR_STRINGID, ft, colour); } @@ -1760,7 +1760,7 @@ namespace OpenRCT2::Ui::Windows screenCoords = windowPos + ScreenCoordsXY{ entryPriceWidget.left + 1, entryPriceWidget.top }; auto ft = Formatter(); ft.Add(gameState.park.entranceFee); - auto colour = !IsWidgetDisabled(WIDX_INITIAL_CASH) ? wColour2 : wColour2.withFlag(ColourFlag::inset, true); + auto colour = !isWidgetDisabled(WIDX_INITIAL_CASH) ? wColour2 : wColour2.withFlag(ColourFlag::inset, true); DrawTextBasic(rt, screenCoords, STR_CURRENCY_FORMAT_LABEL, ft, colour); } } @@ -1792,7 +1792,7 @@ namespace OpenRCT2::Ui::Windows { ContextShowError(STR_CANT_INCREASE_FURTHER, kStringIdNone, {}); } - Invalidate(); + invalidate(); break; case WIDX_CASH_PER_GUEST_DECREASE: if (scenarioOptions.guestInitialCash > 0.00_GBP) @@ -1805,7 +1805,7 @@ namespace OpenRCT2::Ui::Windows { ContextShowError(STR_CANT_REDUCE_FURTHER, kStringIdNone, {}); } - Invalidate(); + invalidate(); break; case WIDX_GUEST_INITIAL_HAPPINESS_INCREASE: if (scenarioOptions.guestInitialHappiness < 250) @@ -1818,7 +1818,7 @@ namespace OpenRCT2::Ui::Windows { ContextShowError(STR_CANT_INCREASE_FURTHER, kStringIdNone, {}); } - Invalidate(); + invalidate(); break; case WIDX_GUEST_INITIAL_HAPPINESS_DECREASE: if (scenarioOptions.guestInitialHappiness > 40) @@ -1831,7 +1831,7 @@ namespace OpenRCT2::Ui::Windows { ContextShowError(STR_CANT_REDUCE_FURTHER, kStringIdNone, {}); } - Invalidate(); + invalidate(); break; case WIDX_GUEST_INITIAL_HUNGER_INCREASE: if (scenarioOptions.guestInitialHunger > 40) @@ -1844,7 +1844,7 @@ namespace OpenRCT2::Ui::Windows { ContextShowError(STR_CANT_INCREASE_FURTHER, kStringIdNone, {}); } - Invalidate(); + invalidate(); break; case WIDX_GUEST_INITIAL_HUNGER_DECREASE: if (scenarioOptions.guestInitialHunger < 250) @@ -1857,7 +1857,7 @@ namespace OpenRCT2::Ui::Windows { ContextShowError(STR_CANT_REDUCE_FURTHER, kStringIdNone, {}); } - Invalidate(); + invalidate(); break; case WIDX_GUEST_INITIAL_THIRST_INCREASE: if (scenarioOptions.guestInitialThirst > 40) @@ -1870,7 +1870,7 @@ namespace OpenRCT2::Ui::Windows { ContextShowError(STR_CANT_INCREASE_FURTHER, kStringIdNone, {}); } - Invalidate(); + invalidate(); break; case WIDX_GUEST_INITIAL_THIRST_DECREASE: if (scenarioOptions.guestInitialThirst < 250) @@ -1883,7 +1883,7 @@ namespace OpenRCT2::Ui::Windows { ContextShowError(STR_CANT_REDUCE_FURTHER, kStringIdNone, {}); } - Invalidate(); + invalidate(); break; case WIDX_GUESTS_INTENSITY_PREFERENCE_DROPDOWN: @@ -1919,7 +1919,7 @@ namespace OpenRCT2::Ui::Windows GameActions::ScenarioSetSetting::GuestGenerationHigherDifficultyLevel, gameState.park.flags & PARK_FLAGS_DIFFICULT_GUEST_GENERATION ? 0 : 1); GameActions::Execute(&scenarioSetSetting, gameState); - Invalidate(); + invalidate(); break; } } @@ -1947,7 +1947,7 @@ namespace OpenRCT2::Ui::Windows void GuestsUpdate() { currentFrame++; - InvalidateWidget(WIDX_TAB_2); + invalidateWidget(WIDX_TAB_2); } void GuestsPrepareDraw() @@ -1957,14 +1957,14 @@ namespace OpenRCT2::Ui::Windows auto& gameState = getGameState(); bool noMoney = gameState.park.flags & PARK_FLAGS_NO_MONEY; - SetWidgetDisabled(WIDX_CASH_PER_GUEST_LABEL, noMoney); - SetWidgetDisabled(WIDX_CASH_PER_GUEST, noMoney); - SetWidgetDisabled(WIDX_CASH_PER_GUEST_INCREASE, noMoney); - SetWidgetDisabled(WIDX_CASH_PER_GUEST_DECREASE, noMoney); + setWidgetDisabled(WIDX_CASH_PER_GUEST_LABEL, noMoney); + setWidgetDisabled(WIDX_CASH_PER_GUEST, noMoney); + setWidgetDisabled(WIDX_CASH_PER_GUEST_INCREASE, noMoney); + setWidgetDisabled(WIDX_CASH_PER_GUEST_DECREASE, noMoney); widgets[WIDX_CLOSE].type = gLegacyScene == LegacyScene::scenarioEditor ? WidgetType::empty : WidgetType::closeBox; - SetWidgetPressed(WIDX_HARD_GUEST_GENERATION, gameState.park.flags & PARK_FLAGS_DIFFICULT_GUEST_GENERATION); + setWidgetPressed(WIDX_HARD_GUEST_GENERATION, gameState.park.flags & PARK_FLAGS_DIFFICULT_GUEST_GENERATION); } void GuestsDraw(RenderTarget& rt) @@ -1984,7 +1984,7 @@ namespace OpenRCT2::Ui::Windows screenCoords = windowPos + ScreenCoordsXY{ cashPerGuestWidget.left + 1, cashPerGuestWidget.top }; auto ft = Formatter(); ft.Add(gameState.scenarioOptions.guestInitialCash); - auto colour = !IsWidgetDisabled(WIDX_CASH_PER_GUEST) ? wColour2 : wColour2.withFlag(ColourFlag::inset, true); + auto colour = !isWidgetDisabled(WIDX_CASH_PER_GUEST) ? wColour2 : wColour2.withFlag(ColourFlag::inset, true); DrawTextBasic(rt, screenCoords, STR_CURRENCY_FORMAT_LABEL, ft, colour); } @@ -2048,7 +2048,7 @@ namespace OpenRCT2::Ui::Windows GameActions::ScenarioSetSetting::ForbidTreeRemoval, gameState.park.flags & PARK_FLAGS_FORBID_TREE_REMOVAL ? 0 : 1); GameActions::Execute(&scenarioSetSetting, gameState); - Invalidate(); + invalidate(); break; } case WIDX_FORBID_LANDSCAPE_CHANGES: @@ -2057,7 +2057,7 @@ namespace OpenRCT2::Ui::Windows GameActions::ScenarioSetSetting::ForbidLandscapeChanges, gameState.park.flags & PARK_FLAGS_FORBID_LANDSCAPE_CHANGES ? 0 : 1); GameActions::Execute(&scenarioSetSetting, gameState); - Invalidate(); + invalidate(); break; } case WIDX_FORBID_HIGH_CONSTRUCTION: @@ -2066,7 +2066,7 @@ namespace OpenRCT2::Ui::Windows GameActions::ScenarioSetSetting::ForbidHighConstruction, gameState.park.flags & PARK_FLAGS_FORBID_HIGH_CONSTRUCTION ? 0 : 1); GameActions::Execute(&scenarioSetSetting, gameState); - Invalidate(); + invalidate(); break; } } @@ -2095,7 +2095,7 @@ namespace OpenRCT2::Ui::Windows { ContextShowError(STR_CANT_INCREASE_FURTHER, kStringIdNone, {}); } - Invalidate(); + invalidate(); break; case WIDX_LAND_COST_DECREASE: if (scenarioOptions.landPrice > 5.00_GBP) @@ -2108,7 +2108,7 @@ namespace OpenRCT2::Ui::Windows { ContextShowError(STR_CANT_REDUCE_FURTHER, kStringIdNone, {}); } - Invalidate(); + invalidate(); break; case WIDX_CONSTRUCTION_RIGHTS_COST_INCREASE: if (scenarioOptions.constructionRightsPrice < 200.00_GBP) @@ -2122,7 +2122,7 @@ namespace OpenRCT2::Ui::Windows { ContextShowError(STR_CANT_INCREASE_FURTHER, kStringIdNone, {}); } - Invalidate(); + invalidate(); break; case WIDX_CONSTRUCTION_RIGHTS_COST_DECREASE: if (scenarioOptions.constructionRightsPrice > 5.00_GBP) @@ -2136,7 +2136,7 @@ namespace OpenRCT2::Ui::Windows { ContextShowError(STR_CANT_REDUCE_FURTHER, kStringIdNone, {}); } - Invalidate(); + invalidate(); break; } } @@ -2144,7 +2144,7 @@ namespace OpenRCT2::Ui::Windows void LandUpdate() { currentFrame++; - InvalidateWidget(WIDX_TAB_3); + invalidateWidget(WIDX_TAB_3); } void LandPrepareDraw() @@ -2154,18 +2154,18 @@ namespace OpenRCT2::Ui::Windows auto& gameState = getGameState(); bool noMoney = gameState.park.flags & PARK_FLAGS_NO_MONEY; - SetWidgetDisabled(WIDX_LAND_COST_LABEL, noMoney); - SetWidgetDisabled(WIDX_LAND_COST, noMoney); - SetWidgetDisabled(WIDX_LAND_COST_INCREASE, noMoney); - SetWidgetDisabled(WIDX_LAND_COST_DECREASE, noMoney); - SetWidgetDisabled(WIDX_CONSTRUCTION_RIGHTS_COST_LABEL, noMoney); - SetWidgetDisabled(WIDX_CONSTRUCTION_RIGHTS_COST, noMoney); - SetWidgetDisabled(WIDX_CONSTRUCTION_RIGHTS_COST_INCREASE, noMoney); - SetWidgetDisabled(WIDX_CONSTRUCTION_RIGHTS_COST_DECREASE, noMoney); + setWidgetDisabled(WIDX_LAND_COST_LABEL, noMoney); + setWidgetDisabled(WIDX_LAND_COST, noMoney); + setWidgetDisabled(WIDX_LAND_COST_INCREASE, noMoney); + setWidgetDisabled(WIDX_LAND_COST_DECREASE, noMoney); + setWidgetDisabled(WIDX_CONSTRUCTION_RIGHTS_COST_LABEL, noMoney); + setWidgetDisabled(WIDX_CONSTRUCTION_RIGHTS_COST, noMoney); + setWidgetDisabled(WIDX_CONSTRUCTION_RIGHTS_COST_INCREASE, noMoney); + setWidgetDisabled(WIDX_CONSTRUCTION_RIGHTS_COST_DECREASE, noMoney); - SetWidgetPressed(WIDX_FORBID_TREE_REMOVAL, gameState.park.flags & PARK_FLAGS_FORBID_TREE_REMOVAL); - SetWidgetPressed(WIDX_FORBID_LANDSCAPE_CHANGES, gameState.park.flags & PARK_FLAGS_FORBID_LANDSCAPE_CHANGES); - SetWidgetPressed(WIDX_FORBID_HIGH_CONSTRUCTION, gameState.park.flags & PARK_FLAGS_FORBID_HIGH_CONSTRUCTION); + setWidgetPressed(WIDX_FORBID_TREE_REMOVAL, gameState.park.flags & PARK_FLAGS_FORBID_TREE_REMOVAL); + setWidgetPressed(WIDX_FORBID_LANDSCAPE_CHANGES, gameState.park.flags & PARK_FLAGS_FORBID_LANDSCAPE_CHANGES); + setWidgetPressed(WIDX_FORBID_HIGH_CONSTRUCTION, gameState.park.flags & PARK_FLAGS_FORBID_HIGH_CONSTRUCTION); widgets[WIDX_CLOSE].type = gLegacyScene == LegacyScene::scenarioEditor ? WidgetType::empty : WidgetType::closeBox; } @@ -2187,7 +2187,7 @@ namespace OpenRCT2::Ui::Windows screenCoords = windowPos + ScreenCoordsXY{ landCostWidget.left + 1, landCostWidget.top }; auto ft = Formatter(); ft.Add(gameState.scenarioOptions.landPrice); - auto colour = !IsWidgetDisabled(WIDX_LAND_COST) ? wColour2 : wColour2.withFlag(ColourFlag::inset, true); + auto colour = !isWidgetDisabled(WIDX_LAND_COST) ? wColour2 : wColour2.withFlag(ColourFlag::inset, true); DrawTextBasic(rt, screenCoords, STR_CURRENCY_FORMAT_LABEL, ft, colour); } @@ -2199,7 +2199,7 @@ namespace OpenRCT2::Ui::Windows + ScreenCoordsXY{ constructionRightsCostWidget.left + 1, constructionRightsCostWidget.top }; auto ft = Formatter(); ft.Add(gameState.scenarioOptions.constructionRightsPrice); - auto colour = !IsWidgetDisabled(WIDX_CONSTRUCTION_RIGHTS_COST) ? wColour2 + auto colour = !isWidgetDisabled(WIDX_CONSTRUCTION_RIGHTS_COST) ? wColour2 : wColour2.withFlag(ColourFlag::inset, true); DrawTextBasic(rt, screenCoords, STR_CURRENCY_FORMAT_LABEL, ft, colour); } @@ -2233,9 +2233,9 @@ namespace OpenRCT2::Ui::Windows void RidesOnUpdate() { currentFrame++; - OnPrepareDraw(); - OnResize(); - InvalidateWidget(WIDX_TAB_2); + onPrepareDraw(); + onResize(); + invalidateWidget(WIDX_TAB_2); const auto oldSize = _rideableRides.size(); _rideableRides.clear(); @@ -2256,7 +2256,7 @@ namespace OpenRCT2::Ui::Windows if (oldSize != _rideableRides.size()) { - Invalidate(); + invalidate(); } } @@ -2287,7 +2287,7 @@ namespace OpenRCT2::Ui::Windows { currentRide->lifecycleFlags ^= RIDE_LIFECYCLE_INDESTRUCTIBLE; } - Invalidate(); + invalidate(); } /** @@ -2305,7 +2305,7 @@ namespace OpenRCT2::Ui::Windows if (selectedListItem != i) { selectedListItem = i; - Invalidate(); + invalidate(); } } @@ -2326,7 +2326,7 @@ namespace OpenRCT2::Ui::Windows */ void RidesOnDraw(RenderTarget& rt) { - DrawWidgets(rt); + drawWidgets(rt); DrawTabImages(rt); } diff --git a/src/openrct2-ui/windows/Error.cpp b/src/openrct2-ui/windows/Error.cpp index ecded9bc6b..c88305e424 100644 --- a/src/openrct2-ui/windows/Error.cpp +++ b/src/openrct2-ui/windows/Error.cpp @@ -52,9 +52,9 @@ namespace OpenRCT2::Ui::Windows { } - void OnOpen() override + void onOpen() override { - SetWidgets(window_error_widgets); + setWidgets(window_error_widgets); widgets[WIDX_BACKGROUND].right = width - 1; widgets[WIDX_BACKGROUND].bottom = height - 1; @@ -67,7 +67,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnDraw(RenderTarget& rt) override + void onDraw(RenderTarget& rt) override { WindowDrawWidgets(*this, rt); @@ -75,22 +75,22 @@ namespace OpenRCT2::Ui::Windows DrawStringCentredRaw(rt, screenCoords, _numLines, _text.data(), FontStyle::Medium); } - void OnPeriodicUpdate() override + void onPeriodicUpdate() override { // Close the window after 8 seconds of showing _staleCount++; if (_staleCount >= 8) { - Close(); + close(); } } - void OnUpdate() override + void onUpdate() override { // Automatically close previous screenshot messages before new screenshot is taken if (_autoClose && gScreenshotCountdown > 0) { - Close(); + close(); } } }; diff --git a/src/openrct2-ui/windows/Finances.cpp b/src/openrct2-ui/windows/Finances.cpp index 6662850632..1ef116feed 100644 --- a/src/openrct2-ui/windows/Finances.cpp +++ b/src/openrct2-ui/windows/Finances.cpp @@ -229,35 +229,35 @@ namespace OpenRCT2::Ui::Windows } public: - void OnOpen() override + void onOpen() override { - SetPage(WINDOW_FINANCES_PAGE_SUMMARY); + setPage(WINDOW_FINANCES_PAGE_SUMMARY); _lastPaintedMonth = std::numeric_limits::max(); ResearchUpdateUncompletedTypes(); _graphProps.hoverIdx = -1; } - void OnUpdate() override + void onUpdate() override { currentFrame++; - InvalidateWidget(WIDX_TAB_1 + page); + invalidateWidget(WIDX_TAB_1 + page); if (page == WINDOW_FINANCES_PAGE_VALUE_GRAPH || page == WINDOW_FINANCES_PAGE_PROFIT_GRAPH || page == WINDOW_FINANCES_PAGE_FINANCIAL_GRAPH) { if (_graphProps.UpdateHoverIndex()) { - InvalidateWidget(WIDX_BACKGROUND); + invalidateWidget(WIDX_BACKGROUND); } } } - void OnMouseDown(WidgetIndex widgetIndex) override + void onMouseDown(WidgetIndex widgetIndex) override { switch (page) { case WINDOW_FINANCES_PAGE_SUMMARY: - OnMouseDownSummary(widgetIndex); + onMouseDownSummary(widgetIndex); break; case WINDOW_FINANCES_PAGE_RESEARCH: WindowResearchFundingMouseDown(this, widgetIndex, WIDX_RESEARCH_FUNDING); @@ -265,12 +265,12 @@ namespace OpenRCT2::Ui::Windows } } - void OnMouseUp(WidgetIndex widgetIndex) override + void onMouseUp(WidgetIndex widgetIndex) override { switch (widgetIndex) { case WIDX_CLOSE: - Close(); + close(); break; case WIDX_TAB_1: case WIDX_TAB_2: @@ -278,13 +278,13 @@ namespace OpenRCT2::Ui::Windows case WIDX_TAB_4: case WIDX_TAB_5: case WIDX_TAB_6: - SetPage(widgetIndex - WIDX_TAB_1); + setPage(widgetIndex - WIDX_TAB_1); break; default: switch (page) { case WINDOW_FINANCES_PAGE_MARKETING: - OnMouseUpMarketing(widgetIndex); + onMouseUpMarketing(widgetIndex); break; case WINDOW_FINANCES_PAGE_RESEARCH: WindowResearchFundingMouseUp(widgetIndex, WIDX_RESEARCH_FUNDING); @@ -293,7 +293,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnDropdown(WidgetIndex widgetIndex, int32_t selectedIndex) override + void onDropdown(WidgetIndex widgetIndex, int32_t selectedIndex) override { if (page == WINDOW_FINANCES_PAGE_RESEARCH) { @@ -301,23 +301,23 @@ namespace OpenRCT2::Ui::Windows } } - void OnPrepareDraw() override + void onPrepareDraw() override { WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_6); for (auto i = 0; i < WINDOW_FINANCES_PAGE_COUNT; i++) - SetWidgetPressed(WIDX_TAB_1 + i, false); - SetWidgetPressed(WIDX_TAB_1 + page, true); + setWidgetPressed(WIDX_TAB_1 + i, false); + setWidgetPressed(WIDX_TAB_1 + page, true); Widget* graphPageWidget; bool centredGraph; switch (page) { case WINDOW_FINANCES_PAGE_SUMMARY: - OnPrepareDrawSummary(); + onPrepareDrawSummary(); return; case WINDOW_FINANCES_PAGE_MARKETING: - OnPrepareDrawMarketing(); + onPrepareDrawMarketing(); return; case WINDOW_FINANCES_PAGE_RESEARCH: WindowResearchFundingPrepareDraw(this, WIDX_RESEARCH_FUNDING); @@ -340,18 +340,18 @@ namespace OpenRCT2::Ui::Windows default: return; } - OnPrepareDrawGraph(graphPageWidget, centredGraph); + onPrepareDrawGraph(graphPageWidget, centredGraph); } - void OnDraw(RenderTarget& rt) override + void onDraw(RenderTarget& rt) override { - DrawWidgets(rt); + drawWidgets(rt); DrawTabImages(rt); switch (page) { case WINDOW_FINANCES_PAGE_SUMMARY: - OnDrawSummary(rt); + onDrawSummary(rt); break; case WINDOW_FINANCES_PAGE_FINANCIAL_GRAPH: { @@ -359,22 +359,22 @@ namespace OpenRCT2::Ui::Windows const auto cashLessLoan = gameState.park.cash - gameState.park.bankLoan; const auto fmt = cashLessLoan >= 0 ? STR_FINANCES_FINANCIAL_GRAPH_CASH_LESS_LOAN_POSITIVE : STR_FINANCES_FINANCIAL_GRAPH_CASH_LESS_LOAN_NEGATIVE; - OnDrawGraph(rt, cashLessLoan, fmt); + onDrawGraph(rt, cashLessLoan, fmt); break; } case WINDOW_FINANCES_PAGE_VALUE_GRAPH: - OnDrawGraph(rt, getGameState().park.value, STR_FINANCES_PARK_VALUE); + onDrawGraph(rt, getGameState().park.value, STR_FINANCES_PARK_VALUE); break; case WINDOW_FINANCES_PAGE_PROFIT_GRAPH: { auto& gameState = getGameState(); const auto fmt = gameState.park.currentProfit >= 0 ? STR_FINANCES_WEEKLY_PROFIT_POSITIVE : STR_FINANCES_WEEKLY_PROFIT_LOSS; - OnDrawGraph(rt, gameState.park.currentProfit, fmt); + onDrawGraph(rt, gameState.park.currentProfit, fmt); break; } case WINDOW_FINANCES_PAGE_MARKETING: - OnDrawMarketing(rt); + onDrawMarketing(rt); break; case WINDOW_FINANCES_PAGE_RESEARCH: WindowResearchFundingDraw(this, rt); @@ -382,7 +382,7 @@ namespace OpenRCT2::Ui::Windows } } - ScreenSize OnScrollGetSize(int32_t scrollIndex) override + ScreenSize onScrollGetSize(int32_t scrollIndex) override { if (page == WINDOW_FINANCES_PAGE_SUMMARY) { @@ -392,7 +392,7 @@ namespace OpenRCT2::Ui::Windows return {}; } - void OnScrollDraw(int32_t scrollIndex, RenderTarget& rt) override + void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override { if (page != WINDOW_FINANCES_PAGE_SUMMARY) return; @@ -473,7 +473,7 @@ namespace OpenRCT2::Ui::Windows _lastPaintedMonth = currentMonthYear; } - void SetPage(int32_t p) + void setPage(int32_t p) { // Skip setting page if we're already on this page, unless we're initialising the window if (page == p && !widgets.empty()) @@ -482,7 +482,7 @@ namespace OpenRCT2::Ui::Windows page = p; currentFrame = 0; - Invalidate(); + invalidate(); if (p == WINDOW_FINANCES_PAGE_RESEARCH) { width = kWindowSizeResearch.width; @@ -514,26 +514,26 @@ namespace OpenRCT2::Ui::Windows flags &= ~WF_RESIZABLE; } - SetWidgets(_windowFinancesPageWidgets[p]); + setWidgets(_windowFinancesPageWidgets[p]); SetDisabledTabs(); holdDownWidgets = _windowFinancesPageHoldDownWidgets[p]; pressedWidgets = 0; - ResizeFrame(); - OnPrepareDraw(); - InitScrollWidgets(); + resizeFrame(); + onPrepareDraw(); + initScrollWidgets(); // Scroll summary all the way to the right, initially. if (p == WINDOW_FINANCES_PAGE_SUMMARY) - InitialiseScrollPosition(WIDX_SUMMARY_SCROLL, 0); + initialiseScrollPosition(WIDX_SUMMARY_SCROLL, 0); - Invalidate(); + invalidate(); } #pragma region Summary Events - void OnMouseDownSummary(WidgetIndex widgetIndex) + void onMouseDownSummary(WidgetIndex widgetIndex) { auto& gameState = getGameState(); switch (widgetIndex) @@ -571,7 +571,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnPrepareDrawSummary() + void onPrepareDrawSummary() { // Setting loan widget's format arguments here. // Nothing else should use the global formatter until @@ -582,10 +582,10 @@ namespace OpenRCT2::Ui::Windows // Keep up with new months being added in the first two years. if (GetDate().GetMonthsElapsed() != _lastPaintedMonth) - InitialiseScrollPosition(WIDX_SUMMARY_SCROLL, 0); + initialiseScrollPosition(WIDX_SUMMARY_SCROLL, 0); } - void OnDrawSummary(RenderTarget& rt) + void onDrawSummary(RenderTarget& rt) { auto titleBarBottom = widgets[WIDX_TITLE].bottom; auto screenCoords = windowPos + ScreenCoordsXY{ 8, titleBarBottom + 37 }; @@ -665,7 +665,7 @@ namespace OpenRCT2::Ui::Windows #pragma region Marketing Events - void OnMouseUpMarketing(WidgetIndex widgetIndex) + void onMouseUpMarketing(WidgetIndex widgetIndex) { if (widgetIndex >= WIDX_CAMPAIGN_1 && widgetIndex <= WIDX_CAMPAIGN_6) { @@ -673,7 +673,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnPrepareDrawMarketing() + void onPrepareDrawMarketing() { // Count number of active campaigns int32_t numActiveCampaigns = static_cast(getGameState().park.marketingCampaigns.size()); @@ -703,7 +703,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnDrawMarketing(RenderTarget& rt) + void onDrawMarketing(RenderTarget& rt) { auto screenCoords = windowPos + ScreenCoordsXY{ 8, widgets[WIDX_TAB_1].top + 45 }; int32_t noCampaignsActive = 1; @@ -782,7 +782,7 @@ namespace OpenRCT2::Ui::Windows #pragma region Graph Events - void OnDrawGraph(RenderTarget& rt, const money64 currentValue, const StringId fmt) const + void onDrawGraph(RenderTarget& rt, const money64 currentValue, const StringId fmt) const { Formatter ft; ft.Add(currentValue); @@ -800,7 +800,7 @@ namespace OpenRCT2::Ui::Windows Graph::DrawFinanceGraph(rt, _graphProps); } - void OnPrepareDrawGraph(const Widget* graphPageWidget, const bool centredGraph) + void onPrepareDrawGraph(const Widget* graphPageWidget, const bool centredGraph) { // Calculate Y axis max and min. money64 maxVal = 0; @@ -839,7 +839,7 @@ namespace OpenRCT2::Ui::Windows #pragma endregion - void InitialiseScrollPosition(WidgetIndex widgetIndex, int32_t scrollId) + void initialiseScrollPosition(WidgetIndex widgetIndex, int32_t scrollId) { const auto& widget = this->widgets[widgetIndex]; scrolls[scrollId].contentOffsetX = std::max(0, scrolls[scrollId].contentWidth - (widget.width() - 2)); @@ -851,7 +851,7 @@ namespace OpenRCT2::Ui::Windows { WidgetIndex widgetIndex = WIDX_TAB_1 + tabPage; - if (!IsWidgetDisabled(widgetIndex)) + if (!isWidgetDisabled(widgetIndex)) { if (this->page == tabPage) { @@ -882,7 +882,7 @@ namespace OpenRCT2::Ui::Windows auto* window = windowMgr->FocusOrCreate(WindowClass::Finances, kWindowSizeSummary, WF_10); if (window != nullptr && page != WINDOW_FINANCES_PAGE_SUMMARY) - window->SetPage(page); + window->setPage(page); return window; } diff --git a/src/openrct2-ui/windows/Footpath.cpp b/src/openrct2-ui/windows/Footpath.cpp index ce14c42758..630414dba5 100644 --- a/src/openrct2-ui/windows/Footpath.cpp +++ b/src/openrct2-ui/windows/Footpath.cpp @@ -200,9 +200,9 @@ namespace OpenRCT2::Ui::Windows public: #pragma region Window Override Events - void OnOpen() override + void onOpen() override { - SetWidgets(window_footpath_widgets); + setWidgets(window_footpath_widgets); WindowInitScrollWidgets(*this); WindowPushOthersRight(*this); @@ -221,7 +221,7 @@ namespace OpenRCT2::Ui::Windows holdDownWidgets = (1u << WIDX_CONSTRUCT) | (1u << WIDX_REMOVE); } - void OnClose() override + void onClose() override { FootpathUpdateProvisional(); ViewportSetVisibility(ViewportVisibility::standard); @@ -233,7 +233,7 @@ namespace OpenRCT2::Ui::Windows HideGridlines(); } - void OnUpdate() override + void onUpdate() override { WindowFootpathUpdateProvisionalPathForBridgeMode(); @@ -249,16 +249,16 @@ namespace OpenRCT2::Ui::Windows if (_footpathConstructionMode == PathConstructionMode::land) { if (!isToolActive(WindowClass::Footpath, WIDX_CONSTRUCT_ON_LAND)) - Close(); + close(); } else if (_footpathConstructionMode == PathConstructionMode::bridgeOrTunnelPick) { if (!isToolActive(WindowClass::Footpath, WIDX_CONSTRUCT_BRIDGE_OR_TUNNEL)) - Close(); + close(); } } - void OnMouseDown(WidgetIndex widgetIndex) override + void onMouseDown(WidgetIndex widgetIndex) override { switch (widgetIndex) { @@ -301,12 +301,12 @@ namespace OpenRCT2::Ui::Windows } } - void OnMouseUp(WidgetIndex widgetIndex) override + void onMouseUp(WidgetIndex widgetIndex) override { switch (widgetIndex) { case WIDX_CLOSE: - Close(); + close(); break; case WIDX_CONSTRUCT_ON_LAND: if (_footpathConstructionMode == PathConstructionMode::land) @@ -345,7 +345,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnDropdown(WidgetIndex widgetIndex, int32_t selectedIndex) override + void onDropdown(WidgetIndex widgetIndex, int32_t selectedIndex) override { if (selectedIndex < 0 || static_cast(selectedIndex) >= _dropdownEntries.size()) return; @@ -388,10 +388,10 @@ namespace OpenRCT2::Ui::Windows FootpathUpdateProvisional(); _windowFootpathCost = kMoney64Undefined; - Invalidate(); + invalidate(); } - void OnToolUpdate(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override + void onToolUpdate(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override { if (widgetIndex == WIDX_CONSTRUCT_ON_LAND) { @@ -403,7 +403,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnToolUp(WidgetIndex widgetIndex, const ScreenCoordsXY&) override + void onToolUp(WidgetIndex widgetIndex, const ScreenCoordsXY&) override { if (widgetIndex == WIDX_CONSTRUCT_ON_LAND) { @@ -411,7 +411,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override + void onToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override { if (widgetIndex == WIDX_CONSTRUCT_ON_LAND) { @@ -423,7 +423,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnToolDrag(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override + void onToolDrag(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override { if (widgetIndex == WIDX_CONSTRUCT_ON_LAND) { @@ -431,7 +431,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnPrepareDraw() override + void onPrepareDraw() override { // Press / unpress footpath and queue type buttons pressedWidgets &= ~(1uLL << WIDX_FOOTPATH_TYPE); @@ -453,13 +453,13 @@ namespace OpenRCT2::Ui::Windows } } - void OnDraw(RenderTarget& rt) override + void onDraw(RenderTarget& rt) override { ScreenCoordsXY screenCoords; WindowDrawWidgets(*this, rt); WindowFootpathDrawDropdownButtons(rt); - if (!IsWidgetDisabled(WIDX_CONSTRUCT)) + if (!isWidgetDisabled(WIDX_CONSTRUCT)) { // Get construction image uint8_t direction = (_footpathConstructDirection + GetCurrentRotation()) % 4; @@ -571,7 +571,7 @@ namespace OpenRCT2::Ui::Windows auto pathConstructFlags = FootpathCreateConstructFlags(type); _windowFootpathCost = FootpathProvisionalSet(type, railings, footpathLoc, slope, pathConstructFlags); - InvalidateWidget(WIDX_CONSTRUCT); + invalidateWidget(WIDX_CONSTRUCT); } auto curTime = Platform::GetTicks(); @@ -1006,7 +1006,7 @@ namespace OpenRCT2::Ui::Windows if (_windowFootpathCost != footpathCost) { _windowFootpathCost = footpathCost; - InvalidateWidget(WIDX_CONSTRUCT); + invalidateWidget(WIDX_CONSTRUCT); } } @@ -1405,7 +1405,7 @@ namespace OpenRCT2::Ui::Windows pressedWidgets = newPressedWidgets; disabledWidgets = newDisabledWidgets; - Invalidate(); + invalidate(); } /** @@ -1451,8 +1451,8 @@ namespace OpenRCT2::Ui::Windows public: void KeyboardShortcutTurnLeft() { - if (IsWidgetDisabled(WIDX_DIRECTION_NW) || IsWidgetDisabled(WIDX_DIRECTION_NE) - || IsWidgetDisabled(WIDX_DIRECTION_SW) || IsWidgetDisabled(WIDX_DIRECTION_SE) + if (isWidgetDisabled(WIDX_DIRECTION_NW) || isWidgetDisabled(WIDX_DIRECTION_NE) + || isWidgetDisabled(WIDX_DIRECTION_SW) || isWidgetDisabled(WIDX_DIRECTION_SE) || _footpathConstructionMode != PathConstructionMode::bridgeOrTunnel) { return; @@ -1464,8 +1464,8 @@ namespace OpenRCT2::Ui::Windows void KeyboardShortcutTurnRight() { - if (IsWidgetDisabled(WIDX_DIRECTION_NW) || IsWidgetDisabled(WIDX_DIRECTION_NE) - || IsWidgetDisabled(WIDX_DIRECTION_SW) || IsWidgetDisabled(WIDX_DIRECTION_SE) + if (isWidgetDisabled(WIDX_DIRECTION_NW) || isWidgetDisabled(WIDX_DIRECTION_NE) + || isWidgetDisabled(WIDX_DIRECTION_SW) || isWidgetDisabled(WIDX_DIRECTION_SE) || _footpathConstructionMode != PathConstructionMode::bridgeOrTunnel) { return; @@ -1477,7 +1477,7 @@ namespace OpenRCT2::Ui::Windows void KeyboardShortcutShortcutSlopeDown() { - if (IsWidgetDisabled(WIDX_SLOPEDOWN) || IsWidgetDisabled(WIDX_LEVEL) || IsWidgetDisabled(WIDX_SLOPEUP) + if (isWidgetDisabled(WIDX_SLOPEDOWN) || isWidgetDisabled(WIDX_LEVEL) || isWidgetDisabled(WIDX_SLOPEUP) || widgets[WIDX_LEVEL].type == WidgetType::empty) { return; @@ -1486,10 +1486,10 @@ namespace OpenRCT2::Ui::Windows switch (_footpathConstructSlope) { case 0: - OnMouseDown(WIDX_SLOPEDOWN); + onMouseDown(WIDX_SLOPEDOWN); break; case 2: - OnMouseDown(WIDX_LEVEL); + onMouseDown(WIDX_LEVEL); break; default: case 6: @@ -1499,7 +1499,7 @@ namespace OpenRCT2::Ui::Windows void KeyboardShortcutSlopeUp() { - if (IsWidgetDisabled(WIDX_SLOPEDOWN) || IsWidgetDisabled(WIDX_LEVEL) || IsWidgetDisabled(WIDX_SLOPEUP) + if (isWidgetDisabled(WIDX_SLOPEDOWN) || isWidgetDisabled(WIDX_LEVEL) || isWidgetDisabled(WIDX_SLOPEUP) || widgets[WIDX_LEVEL].type == WidgetType::empty) { return; @@ -1508,10 +1508,10 @@ namespace OpenRCT2::Ui::Windows switch (_footpathConstructSlope) { case 6: - OnMouseDown(WIDX_LEVEL); + onMouseDown(WIDX_LEVEL); break; case 0: - OnMouseDown(WIDX_SLOPEUP); + onMouseDown(WIDX_SLOPEUP); break; default: case 2: @@ -1521,18 +1521,18 @@ namespace OpenRCT2::Ui::Windows void KeyboardShortcutSlopeLevel() { - if (IsWidgetDisabled(WIDX_SLOPEDOWN) || IsWidgetDisabled(WIDX_LEVEL) || IsWidgetDisabled(WIDX_SLOPEUP) + if (isWidgetDisabled(WIDX_SLOPEDOWN) || isWidgetDisabled(WIDX_LEVEL) || isWidgetDisabled(WIDX_SLOPEUP) || widgets[WIDX_LEVEL].type == WidgetType::empty || _footpathConstructSlope == 0) { return; } - OnMouseDown(WIDX_LEVEL); + onMouseDown(WIDX_LEVEL); } void KeyboardShortcutDemolishCurrent() { - if (IsWidgetDisabled(WIDX_REMOVE) || widgets[WIDX_REMOVE].type == WidgetType::empty + if (isWidgetDisabled(WIDX_REMOVE) || widgets[WIDX_REMOVE].type == WidgetType::empty || (!getGameState().cheats.buildInPauseMode && GameIsPaused())) { return; @@ -1543,12 +1543,12 @@ namespace OpenRCT2::Ui::Windows void KeyboardShortcutBuildCurrent() { - if (IsWidgetDisabled(WIDX_CONSTRUCT) || widgets[WIDX_CONSTRUCT].type == WidgetType::empty) + if (isWidgetDisabled(WIDX_CONSTRUCT) || widgets[WIDX_CONSTRUCT].type == WidgetType::empty) { return; } - OnMouseDown(WIDX_CONSTRUCT); + onMouseDown(WIDX_CONSTRUCT); } #pragma endregion diff --git a/src/openrct2-ui/windows/GameBottomToolbar.cpp b/src/openrct2-ui/windows/GameBottomToolbar.cpp index 2a0003ddab..c5410d4e01 100644 --- a/src/openrct2-ui/windows/GameBottomToolbar.cpp +++ b/src/openrct2-ui/windows/GameBottomToolbar.cpp @@ -383,48 +383,48 @@ namespace OpenRCT2::Ui::Windows if (gToolbarDirtyFlags & BTM_TB_DIRTY_FLAG_MONEY) { gToolbarDirtyFlags &= ~BTM_TB_DIRTY_FLAG_MONEY; - InvalidateWidget(WIDX_LEFT_INSET); + invalidateWidget(WIDX_LEFT_INSET); } if (gToolbarDirtyFlags & BTM_TB_DIRTY_FLAG_DATE) { gToolbarDirtyFlags &= ~BTM_TB_DIRTY_FLAG_DATE; - InvalidateWidget(WIDX_RIGHT_INSET); + invalidateWidget(WIDX_RIGHT_INSET); } if (gToolbarDirtyFlags & BTM_TB_DIRTY_FLAG_PEEP_COUNT) { gToolbarDirtyFlags &= ~BTM_TB_DIRTY_FLAG_PEEP_COUNT; - InvalidateWidget(WIDX_LEFT_INSET); + invalidateWidget(WIDX_LEFT_INSET); } if (gToolbarDirtyFlags & BTM_TB_DIRTY_FLAG_CLIMATE) { gToolbarDirtyFlags &= ~BTM_TB_DIRTY_FLAG_CLIMATE; - InvalidateWidget(WIDX_RIGHT_INSET); + invalidateWidget(WIDX_RIGHT_INSET); } if (gToolbarDirtyFlags & BTM_TB_DIRTY_FLAG_PARK_RATING) { gToolbarDirtyFlags &= ~BTM_TB_DIRTY_FLAG_PARK_RATING; - InvalidateWidget(WIDX_LEFT_INSET); + invalidateWidget(WIDX_LEFT_INSET); } } public: GameBottomToolbar() { - SetWidgets(window_game_bottom_toolbar_widgets); + setWidgets(window_game_bottom_toolbar_widgets); currentFrame = 0; - InitScrollWidgets(); + initScrollWidgets(); // Reset the middle widget to not show by default. // If it is required to be shown news_update will reshow it. widgets[WIDX_MIDDLE_OUTSET].type = WidgetType::empty; } - void OnMouseUp(WidgetIndex widgetIndex) override + void onMouseUp(WidgetIndex widgetIndex) override { News::Item* newsItem; @@ -479,7 +479,7 @@ namespace OpenRCT2::Ui::Windows } } - OpenRCT2String OnTooltip(WidgetIndex widgetIndex, StringId fallback) override + OpenRCT2String onTooltip(WidgetIndex widgetIndex, StringId fallback) override { const auto& gameState = getGameState(); auto ft = Formatter(); @@ -497,7 +497,7 @@ namespace OpenRCT2::Ui::Windows return { fallback, ft }; } - void OnPrepareDraw() override + void onPrepareDraw() override { // Figure out how much line height we have to work with. uint32_t line_height = FontGetLineHeight(FontStyle::Medium); @@ -611,7 +611,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnDraw(RenderTarget& rt) override + void onDraw(RenderTarget& rt) override { const auto& leftWidget = widgets[WIDX_LEFT_OUTSET]; const auto& rightWidget = widgets[WIDX_RIGHT_OUTSET]; @@ -634,7 +634,7 @@ namespace OpenRCT2::Ui::Windows GfxFilterRect(rt, { leftTop, rightBottom }, FilterPaletteID::Palette51); } - DrawWidgets(rt); + drawWidgets(rt); DrawLeftPanel(rt); DrawRightPanel(rt); @@ -649,7 +649,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnUpdate() override + void onUpdate() override { currentFrame++; if (currentFrame >= 24) @@ -658,7 +658,7 @@ namespace OpenRCT2::Ui::Windows InvalidateDirtyWidgets(); } - CursorID OnCursor(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords, CursorID cursorId) override + CursorID onCursor(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords, CursorID cursorId) override { switch (widgetIndex) { @@ -672,7 +672,7 @@ namespace OpenRCT2::Ui::Windows return cursorId; } - void OnPeriodicUpdate() override + void onPeriodicUpdate() override { InvalidateDirtyWidgets(); } diff --git a/src/openrct2-ui/windows/Guest.cpp b/src/openrct2-ui/windows/Guest.cpp index a79995c126..7601297909 100644 --- a/src/openrct2-ui/windows/Guest.cpp +++ b/src/openrct2-ui/windows/Guest.cpp @@ -209,9 +209,9 @@ namespace OpenRCT2::Ui::Windows std::vector _riddenRides; public: - void OnOpen() override + void onOpen() override { - SetWidgets(_guestWindowWidgetsOverview); + setWidgets(_guestWindowWidgetsOverview); page = WINDOW_GUEST_OVERVIEW; currentFrame = 0; _marqueePosition = 0; @@ -222,25 +222,25 @@ namespace OpenRCT2::Ui::Windows selectedListItem = -1; } - void Init(EntityId id) + void init(EntityId id) { number = id.ToUnderlying(); page = -1; // Set Page to something invalid so that SetPage doesn't set audio on viewport - SetPage(WINDOW_GUEST_OVERVIEW); + setPage(WINDOW_GUEST_OVERVIEW); } - void OnClose() override + void onClose() override { if (isToolActive(classification, number)) ToolCancel(); } - void OnMouseUp(WidgetIndex widx) override + void onMouseUp(WidgetIndex widx) override { switch (widx) { case WIDX_CLOSE: - Close(); + close(); return; case WIDX_TAB_1: case WIDX_TAB_2: @@ -249,37 +249,37 @@ namespace OpenRCT2::Ui::Windows case WIDX_TAB_5: case WIDX_TAB_6: case WIDX_TAB_7: - SetPage(widx - WIDX_TAB_1); + setPage(widx - WIDX_TAB_1); return; } switch (page) { case WINDOW_GUEST_OVERVIEW: - OnMouseUpOverview(widx); + onMouseUpOverview(widx); break; } } - void OnMouseDown(WidgetIndex widx) override + void onMouseDown(WidgetIndex widx) override { if (page == WINDOW_GUEST_OVERVIEW) { - OnMouseDownOverview(widx); + onMouseDownOverview(widx); } } - void OnDropdown(WidgetIndex widgetIndex, int32_t selectedIndex) override + void onDropdown(WidgetIndex widgetIndex, int32_t selectedIndex) override { if (page == WINDOW_GUEST_OVERVIEW) { - OnDropdownOverview(widgetIndex, selectedIndex); + onDropdownOverview(widgetIndex, selectedIndex); } } - void OnResize() override + void onResize() override { switch (page) { case WINDOW_GUEST_OVERVIEW: - OnResizeOverview(); + onResizeOverview(); break; case WINDOW_GUEST_STATS: case WINDOW_GUEST_RIDES: @@ -287,140 +287,140 @@ namespace OpenRCT2::Ui::Windows case WINDOW_GUEST_THOUGHTS: case WINDOW_GUEST_INVENTORY: case WINDOW_GUEST_DEBUG: - OnResizeCommon(); + onResizeCommon(); break; } } - void OnUpdate() override + void onUpdate() override { switch (page) { case WINDOW_GUEST_OVERVIEW: - OnUpdateOverview(); + onUpdateOverview(); break; case WINDOW_GUEST_STATS: - OnUpdateStats(); + onUpdateStats(); break; case WINDOW_GUEST_RIDES: - OnUpdateRides(); + onUpdateRides(); break; case WINDOW_GUEST_FINANCE: - OnUpdateFinance(); + onUpdateFinance(); break; case WINDOW_GUEST_THOUGHTS: - OnUpdateThoughts(); + onUpdateThoughts(); break; case WINDOW_GUEST_INVENTORY: - OnUpdateInventory(); + onUpdateInventory(); break; case WINDOW_GUEST_DEBUG: - OnUpdateDebug(); + onUpdateDebug(); break; } } - void OnToolUpdate(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override + void onToolUpdate(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override { if (page == WINDOW_GUEST_OVERVIEW) { - OnToolUpdateOverview(widgetIndex, screenCoords); + onToolUpdateOverview(widgetIndex, screenCoords); } } - void OnToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override + void onToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override { if (page == WINDOW_GUEST_OVERVIEW) { - OnToolDownOverview(widgetIndex, screenCoords); + onToolDownOverview(widgetIndex, screenCoords); } } - void OnToolAbort(WidgetIndex widgetIndex) override + void onToolAbort(WidgetIndex widgetIndex) override { if (page == WINDOW_GUEST_OVERVIEW) { - OnToolAbortOverview(widgetIndex); + onToolAbortOverview(widgetIndex); } } - void OnTextInput(WidgetIndex widgetIndex, std::string_view text) override + void onTextInput(WidgetIndex widgetIndex, std::string_view text) override { if (page == WINDOW_GUEST_OVERVIEW) { - OnTextInputOverview(widgetIndex, text); + onTextInputOverview(widgetIndex, text); } } - void OnViewportRotate() override + void onViewportRotate() override { if (page == WINDOW_GUEST_OVERVIEW) { - OnViewportRotateOverview(); + onViewportRotateOverview(); } } - void OnDraw(RenderTarget& rt) override + void onDraw(RenderTarget& rt) override { switch (page) { case WINDOW_GUEST_OVERVIEW: - OnDrawOverview(rt); + onDrawOverview(rt); break; case WINDOW_GUEST_STATS: - OnDrawStats(rt); + onDrawStats(rt); break; case WINDOW_GUEST_RIDES: - OnDrawRides(rt); + onDrawRides(rt); break; case WINDOW_GUEST_FINANCE: - OnDrawFinance(rt); + onDrawFinance(rt); break; case WINDOW_GUEST_THOUGHTS: - OnDrawThoughts(rt); + onDrawThoughts(rt); break; case WINDOW_GUEST_INVENTORY: - OnDrawInventory(rt); + onDrawInventory(rt); break; case WINDOW_GUEST_DEBUG: - OnDrawDebug(rt); + onDrawDebug(rt); break; } } - void OnPrepareDraw() override + void onPrepareDraw() override { - OnPrepareDrawCommon(); + onPrepareDrawCommon(); switch (page) { case WINDOW_GUEST_OVERVIEW: - OnPrepareDrawOverview(); + onPrepareDrawOverview(); break; case WINDOW_GUEST_RIDES: - OnPrepareDrawRides(); + onPrepareDrawRides(); break; } } - ScreenSize OnScrollGetSize(int32_t scrollIndex) override + ScreenSize onScrollGetSize(int32_t scrollIndex) override { if (page == WINDOW_GUEST_RIDES) { - return OnScrollGetSizeRides(scrollIndex); + return onScrollGetSizeRides(scrollIndex); } return {}; } - void OnScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override + void onScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override { if (page == WINDOW_GUEST_RIDES) { - OnScrollMouseOverRides(scrollIndex, screenCoords); + onScrollMouseOverRides(scrollIndex, screenCoords); } } - void OnScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override + void onScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override { if (page == WINDOW_GUEST_RIDES) { - OnScrollMouseDownRides(scrollIndex, screenCoords); + onScrollMouseDownRides(scrollIndex, screenCoords); } } - void OnScrollDraw(int32_t scrollIndex, RenderTarget& rt) override + void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override { if (page == WINDOW_GUEST_RIDES) { - OnScrollDrawRides(scrollIndex, rt); + onScrollDrawRides(scrollIndex, rt); } } @@ -430,13 +430,13 @@ namespace OpenRCT2::Ui::Windows auto guest = getGameState().entities.GetEntity(EntityId::FromUnderlying(number)); if (guest == nullptr) { - Close(); + close(); return nullptr; } return guest; } - void OnResizeCommon() + void onResizeCommon() { // Get page specific min and max size auto minSize = _guestWindowPageSizes[page][0]; @@ -455,7 +455,7 @@ namespace OpenRCT2::Ui::Windows WindowSetResize(*this, minSize, maxSize); } - void OnPrepareDrawCommon() + void onPrepareDrawCommon() { pressedWidgets |= 1uLL << (page + WIDX_TAB_1); @@ -482,13 +482,13 @@ namespace OpenRCT2::Ui::Windows if (peep->CanBePickedUp()) { if (widgetIsDisabled(*this, WIDX_PICKUP)) - Invalidate(); + invalidate(); } else { newDisabledWidgets = (1uLL << WIDX_PICKUP); if (!widgetIsDisabled(*this, WIDX_PICKUP)) - Invalidate(); + invalidate(); } if (getGameState().park.flags & PARK_FLAGS_NO_MONEY) { @@ -501,7 +501,7 @@ namespace OpenRCT2::Ui::Windows disabledWidgets = newDisabledWidgets; } - void SetPage(int32_t newPage) + void setPage(int32_t newPage) { if (isToolActive(classification, number)) ToolCancel(); @@ -522,17 +522,17 @@ namespace OpenRCT2::Ui::Windows _riddenRides.clear(); selectedListItem = -1; - RemoveViewport(); + removeViewport(); holdDownWidgets = 0; pressedWidgets = 0; - SetWidgets(_guestWindowPageWidgets[page]); + setWidgets(_guestWindowPageWidgets[page]); DisableWidgets(); - Invalidate(); - OnResize(); - OnPrepareDraw(); - InitScrollWidgets(); - Invalidate(); + invalidate(); + onResize(); + onPrepareDraw(); + initScrollWidgets(); + invalidate(); if (listen && viewport != nullptr) viewport->flags |= VIEWPORT_FLAG_SOUND_ON; @@ -611,12 +611,12 @@ namespace OpenRCT2::Ui::Windows } } - void OnResizeOverview() + void onResizeOverview() { DisableWidgets(); - OnPrepareDraw(); - InvalidateWidget(WIDX_MARQUEE); - OnResizeCommon(); + onPrepareDraw(); + invalidateWidget(WIDX_MARQUEE); + onResizeCommon(); if (viewport != nullptr) { @@ -630,10 +630,10 @@ namespace OpenRCT2::Ui::Windows viewport->height = reqViewportHeight; } } - OnViewportRotate(); + onViewportRotate(); } - void OnMouseUpOverview(WidgetIndex widgetIndex) + void onMouseUpOverview(WidgetIndex widgetIndex) { const auto peep = GetGuest(); if (peep == nullptr) @@ -688,7 +688,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnMouseDownOverview(WidgetIndex widgetIndex) + void onMouseDownOverview(WidgetIndex widgetIndex) { switch (widgetIndex) { @@ -698,7 +698,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnDropdownOverview(WidgetIndex widgetIndex, int32_t dropdownIndex) + void onDropdownOverview(WidgetIndex widgetIndex, int32_t dropdownIndex) { switch (widgetIndex) { @@ -706,7 +706,7 @@ namespace OpenRCT2::Ui::Windows { if (dropdownIndex == 0) { - ScrollToViewport(); + scrollToViewport(); } else if (dropdownIndex == 1) { @@ -735,7 +735,7 @@ namespace OpenRCT2::Ui::Windows WindowFollowSprite(*main, EntityId::FromUnderlying(number)); } - void OnViewportRotateOverview() + void onViewportRotateOverview() { const auto peep = GetGuest(); if (peep == nullptr) @@ -754,10 +754,10 @@ namespace OpenRCT2::Ui::Windows origViewportFlags = viewport->flags; reCreateViewport = true; - RemoveViewport(); + removeViewport(); } - OnPrepareDraw(); + onPrepareDraw(); if (peep->State != PeepState::Picked && viewport == nullptr) { @@ -772,14 +772,14 @@ namespace OpenRCT2::Ui::Windows viewport->flags = origViewportFlags; } flags |= WF_NO_SCROLLING; - Invalidate(); + invalidate(); } - Invalidate(); + invalidate(); } - void OnDrawOverview(RenderTarget& rt) + void onDrawOverview(RenderTarget& rt) { - DrawWidgets(rt); + drawWidgets(rt); OverviewTabDraw(rt); StatsTabDraw(rt); RidesTabDraw(rt); @@ -854,7 +854,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnPrepareDrawOverview() + void onPrepareDrawOverview() { const auto peep = GetGuest(); if (peep == nullptr) @@ -887,7 +887,7 @@ namespace OpenRCT2::Ui::Windows widgets[WIDX_TRACK].left = width - 25; } - void OnUpdateOverview() + void onUpdateOverview() { const auto peep = GetGuest(); if (peep == nullptr) @@ -910,13 +910,13 @@ namespace OpenRCT2::Ui::Windows pickedPeepFrame++; pickedPeepFrame %= pickAnimLength * 4; - InvalidateWidget(WIDX_TAB_1); - InvalidateWidget(WIDX_TAB_2); + invalidateWidget(WIDX_TAB_1); + invalidateWidget(WIDX_TAB_2); if (peep->WindowInvalidateFlags & PEEP_INVALIDATE_PEEP_ACTION) { peep->WindowInvalidateFlags &= ~PEEP_INVALIDATE_PEEP_ACTION; - InvalidateWidget(WIDX_ACTION_LBL); + invalidateWidget(WIDX_ACTION_LBL); } _marqueePosition += 2; @@ -944,20 +944,20 @@ namespace OpenRCT2::Ui::Windows : std::nullopt; if (focus != currentFocus) { - OnViewportRotate(); + onViewportRotate(); } for (const auto& thought : peep->Thoughts) { if (thought.freshness == 1 || thought.freshness == 2) { - InvalidateWidget(WIDX_MARQUEE); + invalidateWidget(WIDX_MARQUEE); break; } } } - void OnTextInputOverview(WidgetIndex widgetIndex, std::string_view text) + void onTextInputOverview(WidgetIndex widgetIndex, std::string_view text) { if (widgetIndex != WIDX_RENAME) return; @@ -969,7 +969,7 @@ namespace OpenRCT2::Ui::Windows GameActions::Execute(&gameAction, getGameState()); } - void OnToolUpdateOverview(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) + void onToolUpdateOverview(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) { if (widgetIndex != WIDX_PICKUP) return; @@ -1011,7 +1011,7 @@ namespace OpenRCT2::Ui::Windows gPickupPeepImage = ImageId(baseImageId, peep->TshirtColour, peep->TrousersColour); } - void OnToolDownOverview(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) + void onToolDownOverview(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) { if (widgetIndex != WIDX_PICKUP) return; @@ -1035,7 +1035,7 @@ namespace OpenRCT2::Ui::Windows GameActions::Execute(&pickupAction, getGameState()); } - void OnToolAbortOverview(WidgetIndex widgetIndex) + void onToolAbortOverview(WidgetIndex widgetIndex) { if (widgetIndex != WIDX_PICKUP) return; @@ -1084,7 +1084,7 @@ namespace OpenRCT2::Ui::Windows GfxDrawSprite(rt, ImageId(imageId), screenCoords); } - void OnUpdateStats() + void onUpdateStats() { currentFrame++; auto peep = GetGuest(); @@ -1094,7 +1094,7 @@ namespace OpenRCT2::Ui::Windows } peep->WindowInvalidateFlags &= ~PEEP_INVALIDATE_PEEP_STATS; - Invalidate(); + invalidate(); } /** @@ -1107,7 +1107,7 @@ namespace OpenRCT2::Ui::Windows return std::clamp(newValue, newMin, 100); } - void OnDrawStats(RenderTarget& rt) + void onDrawStats(RenderTarget& rt) { // ebx const auto peep = GetGuest(); @@ -1137,7 +1137,7 @@ namespace OpenRCT2::Ui::Windows int32_t toiletPercentage = NormalizeGuestStatValue(peep->Toilet - 64, 178, 0); widgetProgressBarSetNewPercentage(widgets[WIDX_TOILET_BAR], toiletPercentage); - DrawWidgets(rt); + drawWidgets(rt); OverviewTabDraw(rt); StatsTabDraw(rt); RidesTabDraw(rt); @@ -1224,12 +1224,12 @@ namespace OpenRCT2::Ui::Windows GfxDrawSprite(rt, ImageId(imageId), screenCoords); } - void OnUpdateRides() + void onUpdateRides() { currentFrame++; - InvalidateWidget(WIDX_TAB_2); - InvalidateWidget(WIDX_TAB_3); + invalidateWidget(WIDX_TAB_2); + invalidateWidget(WIDX_TAB_3); const auto guest = GetGuest(); if (guest == nullptr) @@ -1240,7 +1240,7 @@ namespace OpenRCT2::Ui::Windows // Every 2048 ticks do a full window_invalidate int32_t numTicks = getGameState().currentTicks - guest->GetParkEntryTime(); if (!(numTicks & 0x7FF)) - Invalidate(); + invalidate(); const auto oldSize = _riddenRides.size(); _riddenRides.clear(); @@ -1257,11 +1257,11 @@ namespace OpenRCT2::Ui::Windows // If there are new items if (oldSize != _riddenRides.size()) { - Invalidate(); + invalidate(); } } - ScreenSize OnScrollGetSizeRides(int32_t scrollIndex) + ScreenSize onScrollGetSizeRides(int32_t scrollIndex) { ScreenSize newSize; newSize.height = static_cast(_riddenRides.size()) * 10; @@ -1269,7 +1269,7 @@ namespace OpenRCT2::Ui::Windows if (selectedListItem != -1) { selectedListItem = -1; - Invalidate(); + invalidate(); } int32_t visableHeight = newSize.height - widgets[WIDX_RIDE_SCROLL].bottom + widgets[WIDX_RIDE_SCROLL].top + 21; @@ -1280,12 +1280,12 @@ namespace OpenRCT2::Ui::Windows if (visableHeight < scrolls[0].contentOffsetY) { scrolls[0].contentOffsetY = visableHeight; - Invalidate(); + invalidate(); } return newSize; } - void OnScrollMouseDownRides(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) + void onScrollMouseDownRides(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) { auto index = screenCoords.y / 10; if (index >= static_cast(_riddenRides.size())) @@ -1296,7 +1296,7 @@ namespace OpenRCT2::Ui::Windows ContextOpenIntent(&intent); } - void OnScrollMouseOverRides(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) + void onScrollMouseOverRides(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) { auto index = screenCoords.y / 10; if (index >= static_cast(_riddenRides.size())) @@ -1306,18 +1306,18 @@ namespace OpenRCT2::Ui::Windows return; selectedListItem = index; - Invalidate(); + invalidate(); } - void OnPrepareDrawRides() + void onPrepareDrawRides() { widgets[WIDX_RIDE_SCROLL].right = width - 4; widgets[WIDX_RIDE_SCROLL].bottom = height - 15; } - void OnDrawRides(RenderTarget& rt) + void onDrawRides(RenderTarget& rt) { - DrawWidgets(rt); + drawWidgets(rt); OverviewTabDraw(rt); StatsTabDraw(rt); RidesTabDraw(rt); @@ -1352,7 +1352,7 @@ namespace OpenRCT2::Ui::Windows DrawTextEllipsised(rt, screenCoords, width - 14, STR_FAVOURITE_RIDE, ft); } - void OnScrollDrawRides(int32_t scrollIndex, RenderTarget& rt) + void onScrollDrawRides(int32_t scrollIndex, RenderTarget& rt) { auto colour = ColourMapA[colours[1].colour].mid_light; GfxFillRect(rt, { { rt.x, rt.y }, { rt.x + rt.width - 1, rt.y + rt.height - 1 } }, colour); @@ -1397,17 +1397,17 @@ namespace OpenRCT2::Ui::Windows GfxDrawSprite(rt, ImageId(imageId), screenCoords); } - void OnUpdateFinance() + void onUpdateFinance() { currentFrame++; - InvalidateWidget(WIDX_TAB_2); - InvalidateWidget(WIDX_TAB_4); + invalidateWidget(WIDX_TAB_2); + invalidateWidget(WIDX_TAB_4); } - void OnDrawFinance(RenderTarget& rt) + void onDrawFinance(RenderTarget& rt) { - DrawWidgets(rt); + drawWidgets(rt); OverviewTabDraw(rt); StatsTabDraw(rt); RidesTabDraw(rt); @@ -1535,12 +1535,12 @@ namespace OpenRCT2::Ui::Windows GfxDrawSprite(rt, ImageId(imageId), screenCoords); } - void OnUpdateThoughts() + void onUpdateThoughts() { currentFrame++; - InvalidateWidget(WIDX_TAB_2); - InvalidateWidget(WIDX_TAB_5); + invalidateWidget(WIDX_TAB_2); + invalidateWidget(WIDX_TAB_5); auto peep = GetGuest(); if (peep == nullptr) @@ -1550,13 +1550,13 @@ namespace OpenRCT2::Ui::Windows if (peep->WindowInvalidateFlags & PEEP_INVALIDATE_PEEP_THOUGHTS) { peep->WindowInvalidateFlags &= ~PEEP_INVALIDATE_PEEP_THOUGHTS; - Invalidate(); + invalidate(); } } - void OnDrawThoughts(RenderTarget& rt) + void onDrawThoughts(RenderTarget& rt) { - DrawWidgets(rt); + drawWidgets(rt); OverviewTabDraw(rt); StatsTabDraw(rt); RidesTabDraw(rt); @@ -1606,12 +1606,12 @@ namespace OpenRCT2::Ui::Windows GfxDrawSprite(rt, ImageId(SPR_TAB_GUEST_INVENTORY), screenCoords); } - void OnUpdateInventory() + void onUpdateInventory() { currentFrame++; - InvalidateWidget(WIDX_TAB_2); - InvalidateWidget(WIDX_TAB_6); + invalidateWidget(WIDX_TAB_2); + invalidateWidget(WIDX_TAB_6); auto peep = GetGuest(); if (peep == nullptr) @@ -1621,7 +1621,7 @@ namespace OpenRCT2::Ui::Windows if (peep->WindowInvalidateFlags & PEEP_INVALIDATE_PEEP_INVENTORY) { peep->WindowInvalidateFlags &= ~PEEP_INVALIDATE_PEEP_INVENTORY; - Invalidate(); + invalidate(); } } @@ -1735,9 +1735,9 @@ namespace OpenRCT2::Ui::Windows return std::make_pair(itemImage, ft); } - void OnDrawInventory(RenderTarget& rt) + void onDrawInventory(RenderTarget& rt) { - DrawWidgets(rt); + drawWidgets(rt); OverviewTabDraw(rt); StatsTabDraw(rt); RidesTabDraw(rt); @@ -1802,18 +1802,18 @@ namespace OpenRCT2::Ui::Windows GfxDrawSprite(rt, ImageId(imageId), screenCoords); } - void OnUpdateDebug() + void onUpdateDebug() { currentFrame++; - Invalidate(); + invalidate(); } - void OnDrawDebug(RenderTarget& rt) + void onDrawDebug(RenderTarget& rt) { char buffer[512]{}; char buffer2[512]{}; - DrawWidgets(rt); + drawWidgets(rt); OverviewTabDraw(rt); StatsTabDraw(rt); RidesTabDraw(rt); @@ -1931,7 +1931,7 @@ namespace OpenRCT2::Ui::Windows } } - window->Init(peep->Id); + window->init(peep->Id); return window; } diff --git a/src/openrct2-ui/windows/GuestList.cpp b/src/openrct2-ui/windows/GuestList.cpp index cc675e837b..5ee56ad0e4 100644 --- a/src/openrct2-ui/windows/GuestList.cpp +++ b/src/openrct2-ui/windows/GuestList.cpp @@ -156,9 +156,9 @@ namespace OpenRCT2::Ui::Windows uint32_t _tabAnimationIndex{}; public: - void OnOpen() override + void onOpen() override { - SetWidgets(window_guest_list_widgets); + setWidgets(window_guest_list_widgets); WindowInitScrollWidgets(*this); _selectedTab = TabId::Summarised; @@ -174,7 +174,7 @@ namespace OpenRCT2::Ui::Windows RefreshList(); } - void SetFilter(GuestListFilterType type, int32_t index) + void setFilter(GuestListFilterType type, int32_t index) { _selectedPage = 0; _numPages = 1; @@ -246,7 +246,7 @@ namespace OpenRCT2::Ui::Windows RefreshList(); } - void OnUpdate() override + void onUpdate() override { if (_lastFindGroupsWait != 0) { @@ -257,23 +257,23 @@ namespace OpenRCT2::Ui::Windows _tabAnimationIndex++; if (_tabAnimationIndex >= (_selectedTab == TabId::Individual ? 24uL : 32uL)) _tabAnimationIndex = 0; - InvalidateWidget(WIDX_TAB_1 + static_cast(_selectedTab)); + invalidateWidget(WIDX_TAB_1 + static_cast(_selectedTab)); } - void OnMouseUp(WidgetIndex widgetIndex) override + void onMouseUp(WidgetIndex widgetIndex) override { switch (widgetIndex) { case WIDX_CLOSE: - Close(); + close(); break; case WIDX_MAP: ContextOpenWindow(WindowClass::Map); break; case WIDX_TRACKING: _trackingOnly = !_trackingOnly; - SetWidgetPressed(WIDX_TRACKING, _trackingOnly); - Invalidate(); + setWidgetPressed(WIDX_TRACKING, _trackingOnly); + invalidate(); scrolls[0].contentOffsetY = 0; RefreshList(); break; @@ -282,7 +282,7 @@ namespace OpenRCT2::Ui::Windows { // Unset the search filter. _filterName.clear(); - SetWidgetPressed(WIDX_FILTER_BY_NAME, false); + setWidgetPressed(WIDX_FILTER_BY_NAME, false); RefreshList(); } else @@ -295,7 +295,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnMouseDown(WidgetIndex widgetIndex) override + void onMouseDown(WidgetIndex widgetIndex) override { switch (widgetIndex) { @@ -311,7 +311,7 @@ namespace OpenRCT2::Ui::Windows if (_selectedTab == TabId::Summarised) { widgets[WIDX_FILTER_BY_NAME].type = WidgetType::empty; - SetWidgetPressed(WIDX_FILTER_BY_NAME, false); + setWidgetPressed(WIDX_FILTER_BY_NAME, false); _filterName.clear(); } else if (_selectedTab == TabId::Individual) @@ -323,7 +323,7 @@ namespace OpenRCT2::Ui::Windows widgets[WIDX_PAGE_DROPDOWN_BUTTON].type = WidgetType::empty; _tabAnimationIndex = 0; _selectedFilter = {}; - Invalidate(); + invalidate(); scrolls[0].contentOffsetY = 0; RefreshList(); break; @@ -361,7 +361,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) override + void onDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) override { if (dropdownIndex == -1) { @@ -371,30 +371,30 @@ namespace OpenRCT2::Ui::Windows { case WIDX_PAGE_DROPDOWN_BUTTON: _selectedPage = dropdownIndex; - Invalidate(); + invalidate(); break; case WIDX_INFO_TYPE_DROPDOWN_BUTTON: _selectedView = static_cast(dropdownIndex); - Invalidate(); + invalidate(); break; } } - void OnTextInput(WidgetIndex widgetIndex, std::string_view text) override + void onTextInput(WidgetIndex widgetIndex, std::string_view text) override { if (!text.empty()) { _filterName = text; - SetWidgetPressed(WIDX_FILTER_BY_NAME, true); + setWidgetPressed(WIDX_FILTER_BY_NAME, true); RefreshList(); } } - void OnPrepareDraw() override + void onPrepareDraw() override { - SetWidgetPressed(WIDX_TAB_1, false); - SetWidgetPressed(WIDX_TAB_2, false); - SetWidgetPressed(WIDX_TAB_1 + static_cast(_selectedTab), true); + setWidgetPressed(WIDX_TAB_1, false); + setWidgetPressed(WIDX_TAB_2, false); + setWidgetPressed(WIDX_TAB_1 + static_cast(_selectedTab), true); widgets[WIDX_INFO_TYPE_DROPDOWN].text = GetViewName(_selectedView); widgets[WIDX_MAP].type = WidgetType::empty; @@ -425,9 +425,9 @@ namespace OpenRCT2::Ui::Windows } } - void OnDraw(RenderTarget& rt) override + void onDraw(RenderTarget& rt) override { - DrawWidgets(rt); + drawWidgets(rt); DrawTabImages(rt); // Filter description @@ -473,7 +473,7 @@ namespace OpenRCT2::Ui::Windows } } - ScreenSize OnScrollGetSize(int32_t scrollIndex) override + ScreenSize onScrollGetSize(int32_t scrollIndex) override { int32_t y = 0; switch (_selectedTab) @@ -504,31 +504,31 @@ namespace OpenRCT2::Ui::Windows if (_highlightedIndex) { _highlightedIndex = {}; - Invalidate(); + invalidate(); } auto i = std::max(0, y - widgets[WIDX_GUEST_LIST].bottom + widgets[WIDX_GUEST_LIST].top + 21); if (i < scrolls[0].contentOffsetY) { scrolls[0].contentOffsetY = i; - Invalidate(); + invalidate(); } return { 447, y }; } - void OnScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override + void onScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override { auto i = screenCoords.y / (_selectedTab == TabId::Individual ? kScrollableRowHeight : kSummarisedGuestsRowHeight); i += static_cast(_selectedPage * kGuestsPerPage); if (static_cast(i) != _highlightedIndex) { _highlightedIndex = i; - Invalidate(); + invalidate(); } } - void OnScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override + void onScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override { switch (_selectedTab) { @@ -561,7 +561,7 @@ namespace OpenRCT2::Ui::Windows : GuestFilterType::GuestsThinking; _selectedTab = TabId::Individual; widgets[WIDX_TRACKING].type = WidgetType::flatBtn; - Invalidate(); + invalidate(); widgets[WIDX_FILTER_BY_NAME].type = WidgetType::flatBtn; scrolls[0].contentOffsetY = 0; RefreshList(); @@ -571,7 +571,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnScrollDraw(int32_t scrollIndex, RenderTarget& rt) override + void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override { GfxFillRect( rt, { { rt.x, rt.y }, { rt.x + rt.width - 1, rt.y + rt.height - 1 } }, ColourMapA[colours[1].colour].mid_light); @@ -588,7 +588,7 @@ namespace OpenRCT2::Ui::Windows void RefreshList() { - // Only the individual tab uses the GuestList so no point calculating it + // only the individual tab uses the GuestList so no point calculating it if (_selectedTab != TabId::Individual) { RefreshGroups(); @@ -964,7 +964,7 @@ namespace OpenRCT2::Ui::Windows auto* w = static_cast(GuestListOpen()); if (w != nullptr) { - w->SetFilter(type, index); + w->setFilter(type, index); } return w; } diff --git a/src/openrct2-ui/windows/InstallTrack.cpp b/src/openrct2-ui/windows/InstallTrack.cpp index 67a8422e21..cf69c2c104 100644 --- a/src/openrct2-ui/windows/InstallTrack.cpp +++ b/src/openrct2-ui/windows/InstallTrack.cpp @@ -69,7 +69,7 @@ namespace OpenRCT2::Ui::Windows std::vector _trackDesignPreviewPixels; public: - void SetupTrack(const utf8* path, std::unique_ptr trackDesign) + void setupTrack(const utf8* path, std::unique_ptr trackDesign) { _trackDesign = std::move(trackDesign); _trackPath = path; @@ -77,18 +77,18 @@ namespace OpenRCT2::Ui::Windows _trackDesignPreviewPixels.resize(4 * kTrackPreviewImageSize); UpdatePreview(); - Invalidate(); + invalidate(); } - void OnOpen() override + void onOpen() override { - SetWidgets(window_install_track_widgets); + setWidgets(window_install_track_widgets); WindowInitScrollWidgets(*this); WindowPushOthersRight(*this); } - void OnClose() override + void onClose() override { _trackPath.clear(); _trackName.clear(); @@ -97,23 +97,23 @@ namespace OpenRCT2::Ui::Windows _trackDesign = nullptr; } - void OnMouseUp(WidgetIndex widgetIndex) override + void onMouseUp(WidgetIndex widgetIndex) override { switch (widgetIndex) { case WIDX_CLOSE: case WIDX_CANCEL: - Close(); + close(); break; case WIDX_ROTATE: _currentTrackPieceDirection++; _currentTrackPieceDirection %= 4; - Invalidate(); + invalidate(); break; case WIDX_TOGGLE_SCENERY: gTrackDesignSceneryToggle = !gTrackDesignSceneryToggle; UpdatePreview(); - Invalidate(); + invalidate(); break; case WIDX_INSTALL: InstallTrackDesign(); @@ -121,7 +121,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnTextInput(WidgetIndex widgetIndex, std::string_view text) override + void onTextInput(WidgetIndex widgetIndex, std::string_view text) override { if (widgetIndex != WIDX_INSTALL || text.empty()) { @@ -130,10 +130,10 @@ namespace OpenRCT2::Ui::Windows _trackName = std::string(text); - OnMouseUp(WIDX_INSTALL); + onMouseUp(WIDX_INSTALL); } - void OnPrepareDraw() override + void onPrepareDraw() override { pressedWidgets |= 1uLL << WIDX_TRACK_PREVIEW; if (!gTrackDesignSceneryToggle) @@ -146,9 +146,9 @@ namespace OpenRCT2::Ui::Windows } } - void OnDraw(RenderTarget& rt) override + void onDraw(RenderTarget& rt) override { - DrawWidgets(rt); + drawWidgets(rt); // Track preview Widget* widget = &widgets[WIDX_TRACK_PREVIEW]; @@ -384,7 +384,7 @@ namespace OpenRCT2::Ui::Windows { if (TrackRepositoryInstall(_trackPath.c_str(), _trackName.c_str())) { - Close(); + close(); } else { @@ -424,7 +424,7 @@ namespace OpenRCT2::Ui::Windows auto* window = windowMgr->FocusOrCreate( WindowClass::InstallTrack, kWindowSize, WF_AUTO_POSITION | WF_CENTRE_SCREEN); - window->SetupTrack(path, std::move(trackDesign)); + window->setupTrack(path, std::move(trackDesign)); return window; } diff --git a/src/openrct2-ui/windows/Land.cpp b/src/openrct2-ui/windows/Land.cpp index 82ffd98e04..4eabe0e055 100644 --- a/src/openrct2-ui/windows/Land.cpp +++ b/src/openrct2-ui/windows/Land.cpp @@ -87,9 +87,9 @@ namespace OpenRCT2::Ui::Windows } public: - void OnOpen() override + void onOpen() override { - SetWidgets(window_land_widgets); + setWidgets(window_land_widgets); holdDownWidgets = (1uLL << WIDX_DECREMENT) | (1uLL << WIDX_INCREMENT); WindowInitScrollWidgets(*this); @@ -103,29 +103,29 @@ namespace OpenRCT2::Ui::Windows _selectedWallTexture = LandTool::GetEdgeStyleFromDropdownIndex(0); } - void OnClose() override + void onClose() override { // If the tool wasn't changed, turn tool off if (isToolActive(WindowClass::Land, WIDX_BACKGROUND)) ToolCancel(); } - void OnMouseUp(WidgetIndex widgetIndex) override + void onMouseUp(WidgetIndex widgetIndex) override { switch (widgetIndex) { case WIDX_CLOSE: - Close(); + close(); break; case WIDX_MOUNTAINMODE: _landToolMountainMode ^= 1; _landToolPaintMode = 0; - Invalidate(); + invalidate(); break; case WIDX_PAINTMODE: _landToolMountainMode = 0; _landToolPaintMode ^= 1; - Invalidate(); + invalidate(); break; case WIDX_PREVIEW: InputSize(); @@ -133,7 +133,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnMouseDown(WidgetIndex widgetIndex) override + void onMouseDown(WidgetIndex widgetIndex) override { Widget* widget = &widgets[widgetIndex]; switch (widgetIndex) @@ -152,19 +152,19 @@ namespace OpenRCT2::Ui::Windows gLandToolSize = std::max(kLandToolMinimumSize, gLandToolSize - 1); // Invalidate the window - Invalidate(); + invalidate(); break; case WIDX_INCREMENT: // Increment land tool size gLandToolSize = std::min(kLandToolMaximumSize, gLandToolSize + 1); // Invalidate the window - Invalidate(); + invalidate(); break; } } - void OnDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) override + void onDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) override { int32_t type; @@ -187,7 +187,7 @@ namespace OpenRCT2::Ui::Windows gLandToolTerrainSurface = type; _selectedFloorTexture = type; } - Invalidate(); + invalidate(); break; case WIDX_WALL: if (dropdownIndex == -1) @@ -205,12 +205,12 @@ namespace OpenRCT2::Ui::Windows gLandToolTerrainEdge = type; _selectedWallTexture = type; } - Invalidate(); + invalidate(); break; } } - void OnTextInput(WidgetIndex widgetIndex, std::string_view text) override + void onTextInput(WidgetIndex widgetIndex, std::string_view text) override { if (widgetIndex != WIDX_PREVIEW) return; @@ -224,41 +224,41 @@ namespace OpenRCT2::Ui::Windows size = std::min(kLandToolMaximumSize, size); gLandToolSize = size; - Invalidate(); + invalidate(); } } - void OnUpdate() override + void onUpdate() override { if (!isToolActive(WindowClass::Land, WIDX_BACKGROUND)) - Close(); + close(); } - void OnPrepareDraw() override + void onPrepareDraw() override { pressedWidgets = 0; - SetWidgetPressed(WIDX_PREVIEW, true); + setWidgetPressed(WIDX_PREVIEW, true); if (gLandToolTerrainSurface != kObjectEntryIndexNull) - SetWidgetPressed(WIDX_FLOOR, true); + setWidgetPressed(WIDX_FLOOR, true); if (gLandToolTerrainEdge != kObjectEntryIndexNull) - SetWidgetPressed(WIDX_WALL, true); + setWidgetPressed(WIDX_WALL, true); if (_landToolMountainMode) - SetWidgetPressed(WIDX_MOUNTAINMODE, true); + setWidgetPressed(WIDX_MOUNTAINMODE, true); if (_landToolPaintMode) - SetWidgetPressed(WIDX_PAINTMODE, true); + setWidgetPressed(WIDX_PAINTMODE, true); // Update the preview image (for tool sizes up to 7) widgets[WIDX_PREVIEW].image = ImageId(LandTool::SizeToSpriteIndex(gLandToolSize)); } - void OnDraw(RenderTarget& rt) override + void onDraw(RenderTarget& rt) override { ScreenCoordsXY screenCoords; int32_t numTiles; money64 price; Widget* previewWidget = &widgets[WIDX_PREVIEW]; - DrawWidgets(rt); + drawWidgets(rt); DrawDropdownButtons(rt); // Draw number for tool sizes bigger than 7 @@ -506,7 +506,7 @@ namespace OpenRCT2::Ui::Windows } public: - void OnToolUpdate(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override + void onToolUpdate(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override { switch (widgetIndex) { @@ -519,7 +519,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override + void onToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override { switch (widgetIndex) { @@ -542,7 +542,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnToolDrag(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override + void onToolDrag(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override { switch (widgetIndex) { @@ -576,7 +576,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnToolUp(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override + void onToolUp(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override { _landToolBlocked = false; switch (widgetIndex) @@ -589,7 +589,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnToolAbort(WidgetIndex widgetIndex) override + void onToolAbort(WidgetIndex widgetIndex) override { switch (widgetIndex) { diff --git a/src/openrct2-ui/windows/LandRights.cpp b/src/openrct2-ui/windows/LandRights.cpp index dd846599f7..4791023f5d 100644 --- a/src/openrct2-ui/windows/LandRights.cpp +++ b/src/openrct2-ui/windows/LandRights.cpp @@ -121,13 +121,13 @@ namespace OpenRCT2::Ui::Windows else HideConstructionRights(); - Invalidate(); + invalidate(); } public: - void OnOpen() override + void onOpen() override { - SetWidgets(window_land_rights_widgets); + setWidgets(window_land_rights_widgets); holdDownWidgets = (1uLL << WIDX_INCREMENT) | (1uLL << WIDX_DECREMENT); WindowInitScrollWidgets(*this); @@ -149,7 +149,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnClose() override + void onClose() override { HideGridlines(); HideConstructionRights(); @@ -158,12 +158,12 @@ namespace OpenRCT2::Ui::Windows ToolCancel(); } - void OnMouseUp(WidgetIndex widgetIndex) override + void onMouseUp(WidgetIndex widgetIndex) override { switch (widgetIndex) { case WIDX_CLOSE: - Close(); + close(); break; case WIDX_PREVIEW: InputSize(); @@ -207,7 +207,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnMouseDown(WidgetIndex widgetIndex) override + void onMouseDown(WidgetIndex widgetIndex) override { switch (widgetIndex) { @@ -216,19 +216,19 @@ namespace OpenRCT2::Ui::Windows gLandToolSize = std::max(kLandToolMinimumSize, gLandToolSize - 1); // Invalidate the window - Invalidate(); + invalidate(); break; case WIDX_INCREMENT: // Decrement land rights tool size gLandToolSize = std::min(kLandToolMaximumSize, gLandToolSize + 1); // Invalidate the window - Invalidate(); + invalidate(); break; } } - void OnTextInput(WidgetIndex widgetIndex, std::string_view text) override + void onTextInput(WidgetIndex widgetIndex, std::string_view text) override { if (text.empty()) return; @@ -244,18 +244,18 @@ namespace OpenRCT2::Ui::Windows size = std::max(kLandToolMinimumSize, size); size = std::min(kLandToolMaximumSize, size); gLandToolSize = size; - Invalidate(); + invalidate(); } } - void OnUpdate() override + void onUpdate() override { currentFrame++; // Close window if another tool is open if (!isToolActive(WindowClass::LandRights)) { - Close(); + close(); return; } @@ -277,34 +277,34 @@ namespace OpenRCT2::Ui::Windows { if (_landRightsMode == LandRightsMode::BuyLand) { - SetWidgetPressed(WIDX_BUY_LAND_RIGHTS, true); - SetWidgetPressed(WIDX_BUY_CONSTRUCTION_RIGHTS, false); + setWidgetPressed(WIDX_BUY_LAND_RIGHTS, true); + setWidgetPressed(WIDX_BUY_CONSTRUCTION_RIGHTS, false); } else if (_landRightsMode == LandRightsMode::BuyConstructionRights) { - SetWidgetPressed(WIDX_BUY_LAND_RIGHTS, false); - SetWidgetPressed(WIDX_BUY_CONSTRUCTION_RIGHTS, true); + setWidgetPressed(WIDX_BUY_LAND_RIGHTS, false); + setWidgetPressed(WIDX_BUY_CONSTRUCTION_RIGHTS, true); } if (gLandRemainingOwnershipSales == 0) { - SetWidgetDisabled(WIDX_BUY_LAND_RIGHTS, true); + setWidgetDisabled(WIDX_BUY_LAND_RIGHTS, true); widgets[WIDX_BUY_LAND_RIGHTS].tooltip = STR_NO_LAND_RIGHTS_FOR_SALE_TIP; } else { - SetWidgetDisabled(WIDX_BUY_LAND_RIGHTS, false); + setWidgetDisabled(WIDX_BUY_LAND_RIGHTS, false); widgets[WIDX_BUY_LAND_RIGHTS].tooltip = STR_BUY_LAND_RIGHTS_TIP; } if (gLandRemainingConstructionSales == 0) { - SetWidgetDisabled(WIDX_BUY_CONSTRUCTION_RIGHTS, true); + setWidgetDisabled(WIDX_BUY_CONSTRUCTION_RIGHTS, true); widgets[WIDX_BUY_CONSTRUCTION_RIGHTS].tooltip = STR_NO_CONSTRUCTION_RIGHTS_FOR_SALE_TIP; } else { - SetWidgetDisabled(WIDX_BUY_CONSTRUCTION_RIGHTS, false); + setWidgetDisabled(WIDX_BUY_CONSTRUCTION_RIGHTS, false); widgets[WIDX_BUY_CONSTRUCTION_RIGHTS].tooltip = STR_BUY_CONSTRUCTION_RIGHTS_TIP; } @@ -360,13 +360,13 @@ namespace OpenRCT2::Ui::Windows return kInGameSize; } - void OnPrepareDraw() override + void onPrepareDraw() override { - SetWidgetPressed(WIDX_PREVIEW, true); + setWidgetPressed(WIDX_PREVIEW, true); widgets[WIDX_PREVIEW].image = ImageId(LandTool::SizeToSpriteIndex(gLandToolSize)); if (width != GetModeDimensions().width) - OnResize(); + onResize(); if (IsOwnershipMode()) { @@ -380,9 +380,9 @@ namespace OpenRCT2::Ui::Windows } } - void OnResize() override + void onResize() override { - Invalidate(); + invalidate(); auto dimensions = GetModeDimensions(); WindowSetResize(*this, dimensions, dimensions); @@ -390,15 +390,15 @@ namespace OpenRCT2::Ui::Windows if (windowPos.x + width > ContextGetWidth()) windowPos.x = ContextGetWidth() - width; - Invalidate(); + invalidate(); } - void OnDraw(RenderTarget& rt) override + void onDraw(RenderTarget& rt) override { auto screenCoords = ScreenCoordsXY{ windowPos.x + widgets[WIDX_PREVIEW].midX(), windowPos.y + widgets[WIDX_PREVIEW].midY() }; - DrawWidgets(rt); + drawWidgets(rt); // Draw number for tool sizes bigger than 7 if (gLandToolSize > kLandToolMaximumSizeWithSprite) { @@ -457,7 +457,7 @@ namespace OpenRCT2::Ui::Windows GameActions::LandSetRightSetting::SetOwnershipWithChecks, GetDesiredOwnership()); } - void OnToolUpdate(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override + void onToolUpdate(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override { MapInvalidateSelectionRect(); gMapSelectFlags.unset(MapSelectFlag::enable); @@ -548,7 +548,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnToolAbort(WidgetIndex widgetIndex) override + void onToolAbort(WidgetIndex widgetIndex) override { if (kLandRightsVisibleByMode[EnumValue(_landRightsMode)]) HideLandRights(); @@ -557,7 +557,7 @@ namespace OpenRCT2::Ui::Windows HideConstructionRights(); } - void OnToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override + void onToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override { if (screenCoords.x == kLocationNull) return; @@ -575,9 +575,9 @@ namespace OpenRCT2::Ui::Windows } } - void OnToolDrag(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override + void onToolDrag(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override { - OnToolDown(widgetIndex, screenCoords); + onToolDown(widgetIndex, screenCoords); } private: diff --git a/src/openrct2-ui/windows/LoadSave.cpp b/src/openrct2-ui/windows/LoadSave.cpp index c575605185..da980abda4 100644 --- a/src/openrct2-ui/windows/LoadSave.cpp +++ b/src/openrct2-ui/windows/LoadSave.cpp @@ -296,7 +296,7 @@ namespace OpenRCT2::Ui::Windows SortList(); } - Invalidate(); + invalidate(); } void ComputeMaxDateWidth() @@ -397,7 +397,7 @@ namespace OpenRCT2::Ui::Windows _preview = preview; if (ShowPreviews()) { - Invalidate(); + invalidate(); } } @@ -532,9 +532,9 @@ namespace OpenRCT2::Ui::Windows #pragma region Events public: - void OnOpen() override + void onOpen() override { - SetWidgets(window_loadsave_widgets); + setWidgets(window_loadsave_widgets); const auto& uiContext = OpenRCT2::GetContext()->GetUiContext(); if (!uiContext.HasFilePicker()) @@ -578,13 +578,13 @@ namespace OpenRCT2::Ui::Windows selectedListItem = -1; // Reset window dimensions - InitScrollWidgets(); + initScrollWidgets(); ComputeMaxDateWidth(); WindowSetResize(*this, GetMinimumWindowSize(), kWindowSizeMax); } - void OnClose() override + void onClose() override { _listItems.clear(); @@ -601,7 +601,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnResize() override + void onResize() override { WindowSetResize(*this, GetMinimumWindowSize(), kWindowSizeMax); @@ -610,16 +610,16 @@ namespace OpenRCT2::Ui::Windows config.FileBrowserHeight = height - getTitleBarDiffNormal(); } - void OnUpdate() override + void onUpdate() override { if (GetCurrentTextBox().window.classification == classification && GetCurrentTextBox().window.number == number) { WindowUpdateTextboxCaret(); - InvalidateWidget(WIDX_FILENAME_TEXTBOX); + invalidateWidget(WIDX_FILENAME_TEXTBOX); } } - void OnPrepareDraw() override + void onPrepareDraw() override { auto toolbarXPos = width - 5; for (auto widgetIndex = 3; widgetIndex >= 0; widgetIndex--) @@ -727,9 +727,9 @@ namespace OpenRCT2::Ui::Windows } } - void OnDraw(RenderTarget& rt) override + void onDraw(RenderTarget& rt) override { - DrawWidgets(rt); + drawWidgets(rt); if (ShowPreviews()) DrawPreview(rt); @@ -793,19 +793,19 @@ namespace OpenRCT2::Ui::Windows } } - void OnMouseUp(WidgetIndex widgetIndex) override + void onMouseUp(WidgetIndex widgetIndex) override { bool isSave = action == LoadSaveAction::save; switch (widgetIndex) { case WIDX_CLOSE: InvokeCallback(ModalResult::cancel, ""); - Close(); + close(); break; case WIDX_PARENT_FOLDER: PopulateList(_parentDirectory, _extensionPattern); - InitScrollWidgets(); + initScrollWidgets(); numListItems = static_cast(_listItems.size()); break; @@ -826,7 +826,7 @@ namespace OpenRCT2::Ui::Windows { // If user cancels file dialog, refresh list PopulateList(_directory, _extensionPattern); - InitScrollWidgets(); + initScrollWidgets(); numListItems = static_cast(_listItems.size()); } } @@ -843,7 +843,7 @@ namespace OpenRCT2::Ui::Windows } Config::Save(); SortList(); - Invalidate(); + invalidate(); break; case WIDX_SORT_SIZE: @@ -857,7 +857,7 @@ namespace OpenRCT2::Ui::Windows } Config::Save(); SortList(); - Invalidate(); + invalidate(); break; case WIDX_SORT_DATE: @@ -871,12 +871,12 @@ namespace OpenRCT2::Ui::Windows } Config::Save(); SortList(); - Invalidate(); + invalidate(); break; case WIDX_DEFAULT_FOLDER: PopulateList(GetInitialDirectoryByType(type).c_str(), _extensionPattern); - InitScrollWidgets(); + initScrollWidgets(); numListItems = static_cast(_listItems.size()); break; @@ -897,7 +897,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnMouseDown(WidgetIndex widgetIndex) override + void onMouseDown(WidgetIndex widgetIndex) override { if (widgetIndex != WIDX_SORT_CUSTOMISE) return; @@ -928,7 +928,7 @@ namespace OpenRCT2::Ui::Windows gDropdown.items[6].setChecked(config.FileBrowserPreviewType == ParkPreviewPref::screenshot); } - void OnDropdown(WidgetIndex widgetIndex, int32_t selectedIndex) override + void onDropdown(WidgetIndex widgetIndex, int32_t selectedIndex) override { if (widgetIndex != WIDX_SORT_CUSTOMISE) return; @@ -950,7 +950,7 @@ namespace OpenRCT2::Ui::Windows auto newPref = ParkPreviewPref(selectedIndex - 4); if (config.FileBrowserPreviewType != newPref) { - Invalidate(); + invalidate(); width -= GetPreviewSize().width; config.FileBrowserPreviewType = newPref; @@ -963,13 +963,13 @@ namespace OpenRCT2::Ui::Windows if (changed) { Config::Save(); - Invalidate(); - ResizeFrame(); - OnResize(); + invalidate(); + resizeFrame(); + onResize(); } } - void OnTextInput(WidgetIndex widgetIndex, std::string_view text) override + void onTextInput(WidgetIndex widgetIndex, std::string_view text) override { if (text.empty()) return; @@ -995,10 +995,10 @@ namespace OpenRCT2::Ui::Windows selectedListItem = -1; PopulateList(path, _extensionPattern); - InitScrollWidgets(); + initScrollWidgets(); numListItems = static_cast(_listItems.size()); - Invalidate(); + invalidate(); break; } @@ -1014,12 +1014,12 @@ namespace OpenRCT2::Ui::Windows } } - ScreenSize OnScrollGetSize(int32_t scrollIndex) override + ScreenSize onScrollGetSize(int32_t scrollIndex) override { return { 0, numListItems * kScrollableRowHeight }; } - void OnScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override + void onScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override { int32_t selectedItem = screenCoords.y / kScrollableRowHeight; if (selectedItem >= numListItems) @@ -1029,11 +1029,11 @@ namespace OpenRCT2::Ui::Windows { selectedListItem = selectedItem; LoadPreview(); - Invalidate(); + invalidate(); } } - void OnScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override + void onScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override { int32_t selectedItem; @@ -1051,7 +1051,7 @@ namespace OpenRCT2::Ui::Windows String::safeUtf8Copy(directory, _listItems[selectedItem].path.c_str(), sizeof(directory)); PopulateList(directory, _extensionPattern); - InitScrollWidgets(); + initScrollWidgets(); numListItems = static_cast(_listItems.size()); } @@ -1059,7 +1059,7 @@ namespace OpenRCT2::Ui::Windows { // Load or overwrite String::set(_currentFilename, std::size(_currentFilename), _listItems[selectedItem].name.c_str()); - InvalidateWidget(WIDX_FILENAME_TEXTBOX); + invalidateWidget(WIDX_FILENAME_TEXTBOX); if (action == LoadSaveAction::save) { @@ -1073,7 +1073,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnScrollDraw(int32_t scrollIndex, RenderTarget& rt) override + void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override { GfxFillRect( rt, { { rt.x, rt.y }, { rt.x + rt.width - 1, rt.y + rt.height - 1 } }, ColourMapA[colours[1].colour].mid_light); @@ -1210,11 +1210,11 @@ namespace OpenRCT2::Ui::Windows if (keycode == SDLK_RETURN || keycode == SDLK_KP_ENTER) { - loadSaveWindow->OnMouseUp(WIDX_SAVE); + loadSaveWindow->onMouseUp(WIDX_SAVE); } else if (keycode == SDLK_ESCAPE) { - loadSaveWindow->Close(); + loadSaveWindow->close(); } } } // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/Main.cpp b/src/openrct2-ui/windows/Main.cpp index aa42105533..ed38978a41 100644 --- a/src/openrct2-ui/windows/Main.cpp +++ b/src/openrct2-ui/windows/Main.cpp @@ -28,9 +28,9 @@ namespace OpenRCT2::Ui::Windows class MainWindow final : public Window { public: - void OnOpen() override + void onOpen() override { - SetWidgets(_mainWidgets); + setWidgets(_mainWidgets); widgets[0].right = width; widgets[0].bottom = height; @@ -46,7 +46,7 @@ namespace OpenRCT2::Ui::Windows WindowFootpathResetSelectedPath(); } - void OnDraw(RenderTarget& rt) override + void onDraw(RenderTarget& rt) override { ViewportRender(rt, viewport); } diff --git a/src/openrct2-ui/windows/Map.cpp b/src/openrct2-ui/windows/Map.cpp index e760b004eb..da3479c630 100644 --- a/src/openrct2-ui/windows/Map.cpp +++ b/src/openrct2-ui/windows/Map.cpp @@ -232,9 +232,9 @@ namespace OpenRCT2::Ui::Windows uint16_t _flashingFlags = 0; public: - void OnOpen() override + void onOpen() override { - SetWidgets(window_map_widgets); + setWidgets(window_map_widgets); holdDownWidgets = (1uLL << WIDX_MAP_SIZE_SPINNER_Y_UP) | (1uLL << WIDX_MAP_SIZE_SPINNER_Y_DOWN) | (1uLL << WIDX_MAP_SIZE_SPINNER_X_UP) | (1uLL << WIDX_MAP_SIZE_SPINNER_X_DOWN); @@ -244,12 +244,12 @@ namespace OpenRCT2::Ui::Windows SetInitialWindowDimensions(); ResetMaxWindowDimensions(); ResizeMiniMap(); - InitScrollWidgets(); + initScrollWidgets(); CalculateTextLayout(); _rotation = GetCurrentRotation(); - InitMap(); + initMap(); gWindowSceneryRotation = 0; CentreMapOnViewPoint(); WindowFootpathSelectDefault(); @@ -261,7 +261,7 @@ namespace OpenRCT2::Ui::Windows _landRightsToolSize = 1; } - void OnClose() override + void onClose() override { _mapImageData.clear(); _mapImageData.shrink_to_fit(); @@ -272,13 +272,13 @@ namespace OpenRCT2::Ui::Windows } } - void OnMouseUp(WidgetIndex widgetIndex) override + void onMouseUp(WidgetIndex widgetIndex) override { auto* windowMgr = GetWindowManager(); switch (widgetIndex) { case WIDX_CLOSE: - Close(); + close(); break; case WIDX_SET_LAND_RIGHTS: { @@ -329,7 +329,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnMouseDown(WidgetIndex widgetIndex) override + void onMouseDown(WidgetIndex widgetIndex) override { switch (widgetIndex) { @@ -352,7 +352,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnUpdate() override + void onUpdate() override { auto* windowMgr = GetWindowManager(); @@ -375,14 +375,14 @@ namespace OpenRCT2::Ui::Windows if (GetCurrentRotation() != _rotation) { _rotation = GetCurrentRotation(); - InitMap(); + initMap(); CentreMapOnViewPoint(); } for (int32_t i = 0; i < 16; i++) SetMapPixels(); - Invalidate(); + invalidate(); if (_adjustedForSandboxMode != isEditorOrSandbox()) { @@ -409,7 +409,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnToolUpdate(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override + void onToolUpdate(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override { switch (widgetIndex) { @@ -419,7 +419,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override + void onToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override { switch (widgetIndex) { @@ -429,12 +429,12 @@ namespace OpenRCT2::Ui::Windows } } - void OnToolAbort(WidgetIndex widgetIndex) override + void onToolAbort(WidgetIndex widgetIndex) override { switch (widgetIndex) { case WIDX_PEOPLE_STARTING_POSITION: - Invalidate(); + invalidate(); HideGridlines(); HideLandRights(); HideConstructionRights(); @@ -489,7 +489,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnTextInput(WidgetIndex widgetIndex, std::string_view text) override + void onTextInput(WidgetIndex widgetIndex, std::string_view text) override { if (text.empty()) return; @@ -517,14 +517,14 @@ namespace OpenRCT2::Ui::Windows auto mapChangeSizeAction = GameActions::MapChangeSizeAction(newMapSize); GameActions::Execute(&mapChangeSizeAction, getGameState()); - Invalidate(); + invalidate(); } break; } } } - ScreenSize OnScrollGetSize(int32_t scrollIndex) override + ScreenSize onScrollGetSize(int32_t scrollIndex) override { auto size = ScreenSize(getMiniMapWidth(), getMiniMapWidth()); @@ -538,7 +538,7 @@ namespace OpenRCT2::Ui::Windows return size; } - void OnScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override + void onScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override { // Adjust coordinates for any map offset to centre auto adjCoords = screenCoords; @@ -560,12 +560,12 @@ namespace OpenRCT2::Ui::Windows } } - void OnScrollMouseDrag(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override + void onScrollMouseDrag(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override { - OnScrollMouseDown(scrollIndex, screenCoords); + onScrollMouseDown(scrollIndex, screenCoords); } - void OnScrollDraw(int32_t scrollIndex, RenderTarget& rt) override + void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override { GfxClear(rt, PaletteIndex::pi10); @@ -594,13 +594,13 @@ namespace OpenRCT2::Ui::Windows PaintHudRectangle(rt, screenOffset); } - void OnPrepareDraw() override + void onPrepareDraw() override { auto* windowMgr = GetWindowManager(); // Set the pressed widgets pressedWidgets = 0; - SetWidgetPressed(WIDX_MAP_SIZE_LINK, _mapWidthAndHeightLinked); + setWidgetPressed(WIDX_MAP_SIZE_LINK, _mapWidthAndHeightLinked); pressedWidgets |= (1uLL << (WIDX_PEOPLE_TAB + selectedTab)); if (windowMgr->FindByClass(WindowClass::EditorParkEntrance)) @@ -614,7 +614,7 @@ namespace OpenRCT2::Ui::Windows // Set disabled widgets auto& gameState = getGameState(); - SetWidgetDisabled(WIDX_MAP_SIZE_LINK, gameState.mapSize.x != gameState.mapSize.y); + setWidgetDisabled(WIDX_MAP_SIZE_LINK, gameState.mapSize.x != gameState.mapSize.y); // Resize widgets to window size ResizeMiniMap(); @@ -660,9 +660,9 @@ namespace OpenRCT2::Ui::Windows } } - void OnDraw(RenderTarget& rt) override + void onDraw(RenderTarget& rt) override { - DrawWidgets(rt); + drawWidgets(rt); DrawTabImages(rt); if (!isEditorOrSandbox()) @@ -696,19 +696,19 @@ namespace OpenRCT2::Ui::Windows } } - void OnLanguageChange() override + void onLanguageChange() override { CalculateTextLayout(); } void ResetMap() { - InitMap(); + initMap(); CentreMapOnViewPoint(); } private: - void InitMap() + void initMap() { _mapImageData.resize(getMiniMapWidth() * getMiniMapWidth()); std::fill(_mapImageData.begin(), _mapImageData.end(), PaletteIndex::pi10); @@ -758,9 +758,9 @@ namespace OpenRCT2::Ui::Windows void IncreaseMapSize() { auto newMapSize = getGameState().mapSize; - if (IsWidgetPressed(WIDX_MAP_SIZE_LINK) || _resizeDirection == ResizeDirection::Y) + if (isWidgetPressed(WIDX_MAP_SIZE_LINK) || _resizeDirection == ResizeDirection::Y) newMapSize.y++; - if (IsWidgetPressed(WIDX_MAP_SIZE_LINK) || _resizeDirection == ResizeDirection::X) + if (isWidgetPressed(WIDX_MAP_SIZE_LINK) || _resizeDirection == ResizeDirection::X) newMapSize.x++; auto increaseMapSizeAction = GameActions::MapChangeSizeAction(newMapSize); @@ -770,9 +770,9 @@ namespace OpenRCT2::Ui::Windows void DecreaseMapSize() { auto newMapSize = getGameState().mapSize; - if (IsWidgetPressed(WIDX_MAP_SIZE_LINK) || _resizeDirection == ResizeDirection::Y) + if (isWidgetPressed(WIDX_MAP_SIZE_LINK) || _resizeDirection == ResizeDirection::Y) newMapSize.y--; - if (IsWidgetPressed(WIDX_MAP_SIZE_LINK) || _resizeDirection == ResizeDirection::X) + if (isWidgetPressed(WIDX_MAP_SIZE_LINK) || _resizeDirection == ResizeDirection::X) newMapSize.x--; auto decreaseMapSizeAction = GameActions::MapChangeSizeAction(newMapSize); @@ -1093,7 +1093,7 @@ namespace OpenRCT2::Ui::Windows widgets[WIDX_BUILD_PARK_ENTRANCE].type = WidgetType::flatBtn; widgets[WIDX_PEOPLE_STARTING_POSITION].type = WidgetType::flatBtn; - // Only show this in the scenario editor, even when in sandbox mode. + // only show this in the scenario editor, even when in sandbox mode. if (gLegacyScene == LegacyScene::scenarioEditor) widgets[WIDX_MAP_GENERATOR].type = WidgetType::flatBtn; @@ -1114,7 +1114,7 @@ namespace OpenRCT2::Ui::Windows void InputMapSize(WidgetIndex callingWidget) { - if (IsWidgetPressed(WIDX_MAP_SIZE_LINK)) + if (isWidgetPressed(WIDX_MAP_SIZE_LINK)) _resizeDirection = ResizeDirection::Both; else _resizeDirection = (callingWidget == WIDX_MAP_SIZE_SPINNER_Y) ? ResizeDirection::Y : ResizeDirection::X; @@ -1122,7 +1122,7 @@ namespace OpenRCT2::Ui::Windows Formatter ft; ft.Add(kMinimumMapSizePractical); ft.Add(kMaximumMapSizePractical); - TextInputOpen(callingWidget, STR_MAP_SIZE_2, STR_ENTER_MAP_SIZE, ft, kStringIdNone, kStringIdNone, 4); + textInputOpen(callingWidget, STR_MAP_SIZE_2, STR_ENTER_MAP_SIZE, ft, kStringIdNone, kStringIdNone, 4); } CoordsXY ScreenToMap(ScreenCoordsXY screenCoords) @@ -1201,7 +1201,7 @@ namespace OpenRCT2::Ui::Windows _adjustedForSandboxMode = isEditorOrSandbox(); - ResizeFrame(); + resizeFrame(); } void ResetMaxWindowDimensions() diff --git a/src/openrct2-ui/windows/MapGen.cpp b/src/openrct2-ui/windows/MapGen.cpp index 6260208c11..5902b62ac8 100644 --- a/src/openrct2-ui/windows/MapGen.cpp +++ b/src/openrct2-ui/windows/MapGen.cpp @@ -273,7 +273,7 @@ namespace OpenRCT2::Ui::Windows bool _heightmapLoaded = false; std::string _heightmapFilename{}; - void SetPage(int32_t newPage) + void setPage(int32_t newPage) { // Skip setting page if we're already on this page, unless we're initialising the window if (page == newPage && !widgets.empty()) @@ -281,15 +281,15 @@ namespace OpenRCT2::Ui::Windows page = newPage; currentFrame = 0; - RemoveViewport(); + removeViewport(); - SetWidgets(PageWidgets[newPage]); + setWidgets(PageWidgets[newPage]); holdDownWidgets = HoldDownWidgets[newPage]; disabledWidgets = PageDisabledWidgets[newPage]; pressedWidgets = PressedWidgets[newPage]; - InitScrollWidgets(); - Invalidate(); + initScrollWidgets(); + invalidate(); } void SetPressedTab() @@ -360,13 +360,13 @@ namespace OpenRCT2::Ui::Windows switch (widgetIndex) { case WIDX_CLOSE: - Close(); + close(); break; case WIDX_TAB_1: case WIDX_TAB_2: case WIDX_TAB_3: case WIDX_TAB_4: - SetPage(widgetIndex - WIDX_TAB_1); + setPage(widgetIndex - WIDX_TAB_1); break; case WIDX_MAP_GENERATE: GenerateMap(); @@ -430,22 +430,22 @@ namespace OpenRCT2::Ui::Windows case WIDX_MAP_SIZE_Y_UP: _resizeDirection = ResizeDirection::Y; ChangeMapSize(+1); - Invalidate(); + invalidate(); break; case WIDX_MAP_SIZE_Y_DOWN: _resizeDirection = ResizeDirection::Y; ChangeMapSize(-1); - Invalidate(); + invalidate(); break; case WIDX_MAP_SIZE_X_UP: _resizeDirection = ResizeDirection::X; ChangeMapSize(+1); - Invalidate(); + invalidate(); break; case WIDX_MAP_SIZE_X_DOWN: _resizeDirection = ResizeDirection::X; ChangeMapSize(-1); - Invalidate(); + invalidate(); break; case WIDX_HEIGHTMAP_SOURCE_DROPDOWN: { @@ -475,7 +475,7 @@ namespace OpenRCT2::Ui::Windows // Tab animation if (++currentFrame >= TabAnimationLoops[page]) currentFrame = 0; - InvalidateWidget(WIDX_TAB_1); + invalidateWidget(WIDX_TAB_1); } void BaseDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) @@ -487,7 +487,7 @@ namespace OpenRCT2::Ui::Windows { case WIDX_HEIGHTMAP_SOURCE_DROPDOWN: _settings.algorithm = MapGenerator::Algorithm(dropdownIndex); - Invalidate(); + invalidate(); break; } } @@ -512,32 +512,32 @@ namespace OpenRCT2::Ui::Windows break; } - Invalidate(); + invalidate(); } void BasePrepareDraw() { - // Only allow linking the map size when X and Y are the same - SetWidgetPressed(WIDX_MAP_SIZE_LINK, _mapWidthAndHeightLinked); - SetWidgetDisabled(WIDX_MAP_SIZE_LINK, _settings.mapSize.x != _settings.mapSize.y); + // only allow linking the map size when X and Y are the same + setWidgetPressed(WIDX_MAP_SIZE_LINK, _mapWidthAndHeightLinked); + setWidgetDisabled(WIDX_MAP_SIZE_LINK, _settings.mapSize.x != _settings.mapSize.y); bool isHeightMapImage = _settings.algorithm == MapGenerator::Algorithm::heightmapImage; - SetWidgetDisabled(WIDX_MAP_SIZE_Y, isHeightMapImage); - SetWidgetDisabled(WIDX_MAP_SIZE_Y_UP, isHeightMapImage); - SetWidgetDisabled(WIDX_MAP_SIZE_Y_DOWN, isHeightMapImage); - SetWidgetDisabled(WIDX_MAP_SIZE_LINK, isHeightMapImage); - SetWidgetDisabled(WIDX_MAP_SIZE_X, isHeightMapImage); - SetWidgetDisabled(WIDX_MAP_SIZE_X_UP, isHeightMapImage); - SetWidgetDisabled(WIDX_MAP_SIZE_X_DOWN, isHeightMapImage); + setWidgetDisabled(WIDX_MAP_SIZE_Y, isHeightMapImage); + setWidgetDisabled(WIDX_MAP_SIZE_Y_UP, isHeightMapImage); + setWidgetDisabled(WIDX_MAP_SIZE_Y_DOWN, isHeightMapImage); + setWidgetDisabled(WIDX_MAP_SIZE_LINK, isHeightMapImage); + setWidgetDisabled(WIDX_MAP_SIZE_X, isHeightMapImage); + setWidgetDisabled(WIDX_MAP_SIZE_X_UP, isHeightMapImage); + setWidgetDisabled(WIDX_MAP_SIZE_X_DOWN, isHeightMapImage); // Enable heightmap widgets if one is loaded if (isHeightMapImage) { - SetWidgetEnabled(WIDX_HEIGHTMAP_NORMALIZE, _heightmapLoaded); - SetWidgetEnabled(WIDX_HEIGHTMAP_SMOOTH_HEIGHTMAP, _heightmapLoaded); - SetWidgetEnabled(WIDX_HEIGHTMAP_STRENGTH, _heightmapLoaded && _settings.smooth_height_map); - SetWidgetEnabled(WIDX_HEIGHTMAP_STRENGTH_UP, _heightmapLoaded && _settings.smooth_height_map); - SetWidgetEnabled(WIDX_HEIGHTMAP_STRENGTH_DOWN, _heightmapLoaded && _settings.smooth_height_map); + setWidgetEnabled(WIDX_HEIGHTMAP_NORMALIZE, _heightmapLoaded); + setWidgetEnabled(WIDX_HEIGHTMAP_SMOOTH_HEIGHTMAP, _heightmapLoaded); + setWidgetEnabled(WIDX_HEIGHTMAP_STRENGTH, _heightmapLoaded && _settings.smooth_height_map); + setWidgetEnabled(WIDX_HEIGHTMAP_STRENGTH_UP, _heightmapLoaded && _settings.smooth_height_map); + setWidgetEnabled(WIDX_HEIGHTMAP_STRENGTH_DOWN, _heightmapLoaded && _settings.smooth_height_map); } SetPressedTab(); @@ -599,7 +599,7 @@ namespace OpenRCT2::Ui::Windows void BaseDraw(RenderTarget& rt) { - DrawWidgets(rt); + drawWidgets(rt); DrawTabImages(rt); if (_settings.algorithm == MapGenerator::Algorithm::simplexNoise) @@ -612,7 +612,7 @@ namespace OpenRCT2::Ui::Windows const auto disabledColour = enabledColour.withFlag(ColourFlag::inset, true); { - auto textColour = IsWidgetDisabled(WIDX_MAP_SIZE_Y) ? disabledColour : enabledColour; + auto textColour = isWidgetDisabled(WIDX_MAP_SIZE_Y) ? disabledColour : enabledColour; DrawTextBasic( rt, windowPos + ScreenCoordsXY{ 10, widgets[WIDX_MAP_SIZE_Y].top + 1 }, STR_MAP_SIZE, {}, { textColour }); } @@ -637,7 +637,7 @@ namespace OpenRCT2::Ui::Windows { case WIDX_FORESTS_PLACE_TREES: _settings.trees ^= true; - Invalidate(); + invalidate(); break; case WIDX_TREE_LAND_RATIO: @@ -681,29 +681,29 @@ namespace OpenRCT2::Ui::Windows { case WIDX_TREE_LAND_RATIO_UP: _settings.treeToLandRatio = std::min(_settings.treeToLandRatio + 1, 50); - InvalidateWidget(WIDX_TREE_LAND_RATIO); + invalidateWidget(WIDX_TREE_LAND_RATIO); break; case WIDX_TREE_LAND_RATIO_DOWN: _settings.treeToLandRatio = std::max(_settings.treeToLandRatio - 1, 1); - InvalidateWidget(WIDX_TREE_LAND_RATIO); + invalidateWidget(WIDX_TREE_LAND_RATIO); break; case WIDX_TREE_ALTITUDE_MIN_UP: _settings.minTreeAltitude = std::min(_settings.minTreeAltitude + 2, kMaximumLandHeight / 2 - 1); _settings.maxTreeAltitude = std::max(_settings.maxTreeAltitude, _settings.minTreeAltitude + 2); - InvalidateWidget(WIDX_TREE_ALTITUDE_MIN); + invalidateWidget(WIDX_TREE_ALTITUDE_MIN); break; case WIDX_TREE_ALTITUDE_MIN_DOWN: _settings.minTreeAltitude = std::max(_settings.minTreeAltitude - 2, kMinimumLandHeight); - InvalidateWidget(WIDX_TREE_ALTITUDE_MIN); + invalidateWidget(WIDX_TREE_ALTITUDE_MIN); break; case WIDX_TREE_ALTITUDE_MAX_UP: _settings.maxTreeAltitude = std::min(_settings.maxTreeAltitude + 2, kMaximumLandHeight - 1); - InvalidateWidget(WIDX_TREE_ALTITUDE_MAX); + invalidateWidget(WIDX_TREE_ALTITUDE_MAX); break; case WIDX_TREE_ALTITUDE_MAX_DOWN: _settings.maxTreeAltitude = std::max(_settings.maxTreeAltitude - 2, kMinimumLandHeight - 1); _settings.minTreeAltitude = std::min(_settings.minTreeAltitude, _settings.maxTreeAltitude - 2); - InvalidateWidget(WIDX_TREE_ALTITUDE_MAX); + invalidateWidget(WIDX_TREE_ALTITUDE_MAX); break; } } @@ -713,7 +713,7 @@ namespace OpenRCT2::Ui::Windows // Tab animation if (++currentFrame >= TabAnimationLoops[page]) currentFrame = 0; - InvalidateWidget(WIDX_TAB_2); + invalidateWidget(WIDX_TAB_2); } void ForestsTextInput(WidgetIndex widgetIndex, int32_t rawValue, int32_t value) @@ -735,7 +735,7 @@ namespace OpenRCT2::Ui::Windows break; } - Invalidate(); + invalidate(); } void ForestsPrepareDraw() @@ -748,20 +748,20 @@ namespace OpenRCT2::Ui::Windows const bool isFlatland = _settings.algorithm == MapGenerator::Algorithm::blank; - SetWidgetDisabled(WIDX_TREE_LAND_RATIO, !_settings.trees); - SetWidgetDisabled(WIDX_TREE_LAND_RATIO_UP, !_settings.trees); - SetWidgetDisabled(WIDX_TREE_LAND_RATIO_DOWN, !_settings.trees); - SetWidgetDisabled(WIDX_TREE_ALTITUDE_MIN, !_settings.trees); - SetWidgetDisabled(WIDX_TREE_ALTITUDE_MIN_UP, !_settings.trees); - SetWidgetDisabled(WIDX_TREE_ALTITUDE_MIN_DOWN, !_settings.trees); - SetWidgetDisabled(WIDX_TREE_ALTITUDE_MAX, !_settings.trees || isFlatland); - SetWidgetDisabled(WIDX_TREE_ALTITUDE_MAX_UP, !_settings.trees || isFlatland); - SetWidgetDisabled(WIDX_TREE_ALTITUDE_MAX_DOWN, !_settings.trees || isFlatland); + setWidgetDisabled(WIDX_TREE_LAND_RATIO, !_settings.trees); + setWidgetDisabled(WIDX_TREE_LAND_RATIO_UP, !_settings.trees); + setWidgetDisabled(WIDX_TREE_LAND_RATIO_DOWN, !_settings.trees); + setWidgetDisabled(WIDX_TREE_ALTITUDE_MIN, !_settings.trees); + setWidgetDisabled(WIDX_TREE_ALTITUDE_MIN_UP, !_settings.trees); + setWidgetDisabled(WIDX_TREE_ALTITUDE_MIN_DOWN, !_settings.trees); + setWidgetDisabled(WIDX_TREE_ALTITUDE_MAX, !_settings.trees || isFlatland); + setWidgetDisabled(WIDX_TREE_ALTITUDE_MAX_UP, !_settings.trees || isFlatland); + setWidgetDisabled(WIDX_TREE_ALTITUDE_MAX_DOWN, !_settings.trees || isFlatland); } void ForestsDraw(RenderTarget& rt) { - DrawWidgets(rt); + drawWidgets(rt); DrawTabImages(rt); const auto enabledColour = colours[1]; @@ -846,26 +846,26 @@ namespace OpenRCT2::Ui::Windows { case WIDX_SIMPLEX_BASE_FREQ_UP: _settings.simplex_base_freq = std::min(_settings.simplex_base_freq + 5, 1000); - Invalidate(); + invalidate(); break; case WIDX_SIMPLEX_BASE_FREQ_DOWN: _settings.simplex_base_freq = std::max(_settings.simplex_base_freq - 5, 0); - Invalidate(); + invalidate(); break; case WIDX_SIMPLEX_OCTAVES_UP: _settings.simplex_octaves = std::min(_settings.simplex_octaves + 1, 10); - Invalidate(); + invalidate(); break; case WIDX_SIMPLEX_OCTAVES_DOWN: _settings.simplex_octaves = std::max(_settings.simplex_octaves - 1, 1); - Invalidate(); + invalidate(); break; } } void SimplexDraw(RenderTarget& rt) { - DrawWidgets(rt); + drawWidgets(rt); DrawTabImages(rt); const auto textColour = colours[1]; @@ -915,11 +915,11 @@ namespace OpenRCT2::Ui::Windows { case WIDX_HEIGHTMAP_STRENGTH_UP: _settings.smooth_strength = std::min(_settings.smooth_strength + 1, 20); - InvalidateWidget(WIDX_HEIGHTMAP_STRENGTH); + invalidateWidget(WIDX_HEIGHTMAP_STRENGTH); break; case WIDX_HEIGHTMAP_STRENGTH_DOWN: _settings.smooth_strength = std::max(_settings.smooth_strength - 1, 1); - InvalidateWidget(WIDX_HEIGHTMAP_STRENGTH); + invalidateWidget(WIDX_HEIGHTMAP_STRENGTH); break; } } @@ -940,18 +940,18 @@ namespace OpenRCT2::Ui::Windows } case WIDX_HEIGHTMAP_SMOOTH_HEIGHTMAP: _settings.smooth_height_map = !_settings.smooth_height_map; - SetCheckboxValue(WIDX_HEIGHTMAP_SMOOTH_HEIGHTMAP, _settings.smooth_height_map); - SetWidgetEnabled(WIDX_HEIGHTMAP_STRENGTH, _settings.smooth_height_map); - SetWidgetEnabled(WIDX_HEIGHTMAP_STRENGTH_UP, _settings.smooth_height_map); - SetWidgetEnabled(WIDX_HEIGHTMAP_STRENGTH_DOWN, _settings.smooth_height_map); - InvalidateWidget(WIDX_HEIGHTMAP_SMOOTH_HEIGHTMAP); - InvalidateWidget(WIDX_HEIGHTMAP_STRENGTH); + setCheckboxValue(WIDX_HEIGHTMAP_SMOOTH_HEIGHTMAP, _settings.smooth_height_map); + setWidgetEnabled(WIDX_HEIGHTMAP_STRENGTH, _settings.smooth_height_map); + setWidgetEnabled(WIDX_HEIGHTMAP_STRENGTH_UP, _settings.smooth_height_map); + setWidgetEnabled(WIDX_HEIGHTMAP_STRENGTH_DOWN, _settings.smooth_height_map); + invalidateWidget(WIDX_HEIGHTMAP_SMOOTH_HEIGHTMAP); + invalidateWidget(WIDX_HEIGHTMAP_STRENGTH); break; case WIDX_HEIGHTMAP_NORMALIZE: _settings.normalize_height = !_settings.normalize_height; - SetCheckboxValue(WIDX_HEIGHTMAP_NORMALIZE, _settings.normalize_height); - InvalidateWidget(WIDX_HEIGHTMAP_NORMALIZE); + setCheckboxValue(WIDX_HEIGHTMAP_NORMALIZE, _settings.normalize_height); + invalidateWidget(WIDX_HEIGHTMAP_NORMALIZE); break; case WIDX_HEIGHTMAP_STRENGTH: @@ -969,8 +969,8 @@ namespace OpenRCT2::Ui::Windows void HeightmapPrepareDraw() { - SetCheckboxValue(WIDX_HEIGHTMAP_SMOOTH_HEIGHTMAP, _settings.smooth_height_map); - SetCheckboxValue(WIDX_HEIGHTMAP_NORMALIZE, _settings.normalize_height); + setCheckboxValue(WIDX_HEIGHTMAP_SMOOTH_HEIGHTMAP, _settings.smooth_height_map); + setCheckboxValue(WIDX_HEIGHTMAP_NORMALIZE, _settings.normalize_height); } void HeightmapDraw(RenderTarget& rt) @@ -979,7 +979,7 @@ namespace OpenRCT2::Ui::Windows const auto disabledColour = enabledColour.withFlag(ColourFlag::inset, true); // Smooth strength label and value - const bool strengthDisabled = IsWidgetDisabled(WIDX_HEIGHTMAP_STRENGTH) || !_settings.smooth_height_map; + const bool strengthDisabled = isWidgetDisabled(WIDX_HEIGHTMAP_STRENGTH) || !_settings.smooth_height_map; const auto strengthColour = strengthDisabled ? disabledColour : enabledColour; // Smooth strength label @@ -1049,8 +1049,8 @@ namespace OpenRCT2::Ui::Windows case WIDX_HEIGHTMAP_SMOOTH_TILE_EDGES: _settings.smoothTileEdges = !_settings.smoothTileEdges; - SetCheckboxValue(WIDX_HEIGHTMAP_SMOOTH_TILE_EDGES, _settings.smoothTileEdges); - InvalidateWidget(WIDX_HEIGHTMAP_SMOOTH_TILE_EDGES); + setCheckboxValue(WIDX_HEIGHTMAP_SMOOTH_TILE_EDGES, _settings.smoothTileEdges); + invalidateWidget(WIDX_HEIGHTMAP_SMOOTH_TILE_EDGES); break; } } @@ -1061,7 +1061,7 @@ namespace OpenRCT2::Ui::Windows { case WIDX_RANDOM_TERRAIN: _randomTerrain = !_randomTerrain; - Invalidate(); + invalidate(); break; case WIDX_FLOOR_TEXTURE: LandTool::ShowSurfaceStyleDropdown(this, widget, _settings.landTexture); @@ -1072,20 +1072,20 @@ namespace OpenRCT2::Ui::Windows case WIDX_HEIGHTMAP_LOW_UP: _settings.heightmapLow = std::min(_settings.heightmapLow + 2, kMaximumLandHeight / 2 - 1); _settings.heightmapHigh = std::max(_settings.heightmapHigh, _settings.heightmapLow + 2); - InvalidateWidget(WIDX_HEIGHTMAP_LOW); + invalidateWidget(WIDX_HEIGHTMAP_LOW); break; case WIDX_HEIGHTMAP_LOW_DOWN: _settings.heightmapLow = std::max(_settings.heightmapLow - 2, kMinimumLandHeight); - InvalidateWidget(WIDX_HEIGHTMAP_LOW); + invalidateWidget(WIDX_HEIGHTMAP_LOW); break; case WIDX_HEIGHTMAP_HIGH_UP: _settings.heightmapHigh = std::min(_settings.heightmapHigh + 2, kMaximumLandHeight - 1); - InvalidateWidget(WIDX_HEIGHTMAP_HIGH); + invalidateWidget(WIDX_HEIGHTMAP_HIGH); break; case WIDX_HEIGHTMAP_HIGH_DOWN: _settings.heightmapHigh = std::max(_settings.heightmapHigh - 2, kMinimumLandHeight); _settings.heightmapLow = std::min(_settings.heightmapLow, _settings.heightmapHigh - 2); - InvalidateWidget(WIDX_HEIGHTMAP_HIGH); + invalidateWidget(WIDX_HEIGHTMAP_HIGH); break; } } @@ -1095,7 +1095,7 @@ namespace OpenRCT2::Ui::Windows // Tab animation if (++currentFrame >= TabAnimationLoops[page]) currentFrame = 0; - InvalidateWidget(WIDX_TAB_3); + invalidateWidget(WIDX_TAB_3); } void TerrainTextInput(WidgetIndex widgetIndex, int32_t value) @@ -1113,7 +1113,7 @@ namespace OpenRCT2::Ui::Windows break; } - Invalidate(); + invalidate(); } void TerrainDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) @@ -1137,7 +1137,7 @@ namespace OpenRCT2::Ui::Windows gLandToolTerrainSurface = type; _settings.landTexture = type; } - Invalidate(); + invalidate(); break; case WIDX_WALL_TEXTURE: if (dropdownIndex == -1) @@ -1154,7 +1154,7 @@ namespace OpenRCT2::Ui::Windows gLandToolTerrainEdge = type; _settings.edgeTexture = type; } - Invalidate(); + invalidate(); break; } } @@ -1163,7 +1163,7 @@ namespace OpenRCT2::Ui::Windows { const auto& widget = widgets[widgetIndex]; ScreenCoordsXY pos = { windowPos.x + widget.left, windowPos.y + widget.top }; - if (IsWidgetDisabled(widgetIndex)) + if (isWidgetDisabled(widgetIndex)) { // Draw greyed out (light border bottom right shadow) auto colour = colours[widget.colour].colour; @@ -1208,24 +1208,24 @@ namespace OpenRCT2::Ui::Windows void TerrainPrepareDraw() { - SetCheckboxValue(WIDX_RANDOM_TERRAIN, _randomTerrain != 0); - SetCheckboxValue(WIDX_HEIGHTMAP_SMOOTH_TILE_EDGES, _settings.smoothTileEdges); + setCheckboxValue(WIDX_RANDOM_TERRAIN, _randomTerrain != 0); + setCheckboxValue(WIDX_HEIGHTMAP_SMOOTH_TILE_EDGES, _settings.smoothTileEdges); - // Only allow floor and wall texture options if random terrain is disabled - SetWidgetEnabled(WIDX_FLOOR_TEXTURE, !_randomTerrain); - SetWidgetEnabled(WIDX_WALL_TEXTURE, !_randomTerrain); + // only allow floor and wall texture options if random terrain is disabled + setWidgetEnabled(WIDX_FLOOR_TEXTURE, !_randomTerrain); + setWidgetEnabled(WIDX_WALL_TEXTURE, !_randomTerrain); // Max land height option is irrelevant for flatland - SetWidgetEnabled(WIDX_HEIGHTMAP_HIGH, _settings.algorithm != MapGenerator::Algorithm::blank); + setWidgetEnabled(WIDX_HEIGHTMAP_HIGH, _settings.algorithm != MapGenerator::Algorithm::blank); - // Only offer terrain edge smoothing if we don't use flatland terrain - SetWidgetEnabled(WIDX_HEIGHTMAP_SMOOTH_TILE_EDGES, _settings.algorithm != MapGenerator::Algorithm::blank); + // only offer terrain edge smoothing if we don't use flatland terrain + setWidgetEnabled(WIDX_HEIGHTMAP_SMOOTH_TILE_EDGES, _settings.algorithm != MapGenerator::Algorithm::blank); SetPressedTab(); } void TerrainDraw(RenderTarget& rt) { - DrawWidgets(rt); + drawWidgets(rt); DrawTabImages(rt); DrawDropdownButtons(rt, WIDX_FLOOR_TEXTURE, WIDX_WALL_TEXTURE); @@ -1248,7 +1248,7 @@ namespace OpenRCT2::Ui::Windows rt, windowPos + ScreenCoordsXY{ widgets[WIDX_HEIGHTMAP_LOW].left + 1, widgets[WIDX_HEIGHTMAP_LOW].top + 1 }, STR_RIDE_LENGTH_ENTRY, ft, { enabledColour }); - const auto maxLandColour = IsWidgetDisabled(WIDX_HEIGHTMAP_HIGH) ? disabledColour : enabledColour; + const auto maxLandColour = isWidgetDisabled(WIDX_HEIGHTMAP_HIGH) ? disabledColour : enabledColour; // Maximum land height label and value DrawTextBasic( @@ -1286,7 +1286,7 @@ namespace OpenRCT2::Ui::Windows case WIDX_ADD_BEACHES: { _settings.beaches ^= true; - Invalidate(); + invalidate(); break; } } @@ -1298,11 +1298,11 @@ namespace OpenRCT2::Ui::Windows { case WIDX_WATER_LEVEL_UP: _settings.waterLevel = std::min(_settings.waterLevel + 2, kMaximumWaterHeight); - Invalidate(); + invalidate(); break; case WIDX_WATER_LEVEL_DOWN: _settings.waterLevel = std::max(_settings.waterLevel - 2, kMinimumWaterHeight); - Invalidate(); + invalidate(); break; } } @@ -1312,7 +1312,7 @@ namespace OpenRCT2::Ui::Windows // Tab animation if (++currentFrame >= TabAnimationLoops[page]) currentFrame = 0; - InvalidateWidget(WIDX_TAB_4); + invalidateWidget(WIDX_TAB_4); } void WaterTextInput(WidgetIndex widgetIndex, int32_t value) @@ -1324,19 +1324,19 @@ namespace OpenRCT2::Ui::Windows break; } - Invalidate(); + invalidate(); } void WaterPrepareDraw() { - SetCheckboxValue(WIDX_ADD_BEACHES, _settings.beaches != 0); + setCheckboxValue(WIDX_ADD_BEACHES, _settings.beaches != 0); SetPressedTab(); } void WaterDraw(RenderTarget& rt) { - DrawWidgets(rt); + drawWidgets(rt); DrawTabImages(rt); const auto textColour = colours[1]; @@ -1355,26 +1355,26 @@ namespace OpenRCT2::Ui::Windows #pragma endregion public: - void OnOpen() override + void onOpen() override { number = 0; - SetPage(WINDOW_MAPGEN_PAGE_BASE); - Invalidate(); + setPage(WINDOW_MAPGEN_PAGE_BASE); + invalidate(); holdDownWidgets = HoldDownWidgets[WINDOW_MAPGEN_PAGE_BASE]; pressedWidgets = PressedWidgets[WINDOW_MAPGEN_PAGE_BASE]; disabledWidgets = PageDisabledWidgets[WINDOW_MAPGEN_PAGE_BASE]; - InitScrollWidgets(); + initScrollWidgets(); _heightmapLoaded = false; } - void OnClose() override + void onClose() override { MapGenerator::UnloadHeightmapImage(); } - void OnMouseUp(WidgetIndex widgetIndex) override + void onMouseUp(WidgetIndex widgetIndex) override { switch (page) { @@ -1389,7 +1389,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnMouseDown(WidgetIndex widgetIndex) override + void onMouseDown(WidgetIndex widgetIndex) override { switch (page) { @@ -1404,7 +1404,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnDropdown(WidgetIndex widgetIndex, int32_t selectedIndex) override + void onDropdown(WidgetIndex widgetIndex, int32_t selectedIndex) override { switch (page) { @@ -1415,7 +1415,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnUpdate() override + void onUpdate() override { switch (page) { @@ -1428,10 +1428,10 @@ namespace OpenRCT2::Ui::Windows } } - void OnPrepareDraw() override + void onPrepareDraw() override { bool isHeightMapImage = _settings.algorithm == MapGenerator::Algorithm::heightmapImage; - SetWidgetDisabled(WIDX_MAP_GENERATE, isHeightMapImage && !_heightmapLoaded); + setWidgetDisabled(WIDX_MAP_GENERATE, isHeightMapImage && !_heightmapLoaded); switch (page) { @@ -1446,7 +1446,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnDraw(RenderTarget& rt) override + void onDraw(RenderTarget& rt) override { switch (page) { @@ -1461,7 +1461,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnTextInput(WidgetIndex widgetIndex, std::string_view text) override + void onTextInput(WidgetIndex widgetIndex, std::string_view text) override { auto strText = std::string(text); char* end; @@ -1506,7 +1506,7 @@ namespace OpenRCT2::Ui::Windows } } - void AfterLoadingHeightMap(ModalResult result, const utf8* path) + void afterLoadingHeightMap(ModalResult result, const utf8* path) { if (result == ModalResult::ok) { @@ -1520,11 +1520,11 @@ namespace OpenRCT2::Ui::Windows _heightmapLoaded = true; _heightmapFilename = fs::u8path(path).filename().string(); _settings.algorithm = MapGenerator::Algorithm::heightmapImage; - SetPage(WINDOW_MAPGEN_PAGE_BASE); + setPage(WINDOW_MAPGEN_PAGE_BASE); } } - void OnResize() override + void onResize() override { WindowSetResize(*this, kWindowSize, kWindowSize); } @@ -1540,6 +1540,6 @@ namespace OpenRCT2::Ui::Windows static void HeightmapLoadsaveCallback(ModalResult result, const utf8* path) { auto* w = static_cast(MapgenOpen()); - w->AfterLoadingHeightMap(result, path); + w->afterLoadingHeightMap(result, path); } } // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/MapTooltip.cpp b/src/openrct2-ui/windows/MapTooltip.cpp index eece1695fe..d9521411be 100644 --- a/src/openrct2-ui/windows/MapTooltip.cpp +++ b/src/openrct2-ui/windows/MapTooltip.cpp @@ -36,17 +36,17 @@ namespace OpenRCT2::Ui::Windows class MapTooltip final : public Window { public: - void OnOpen() override + void onOpen() override { - SetWidgets(window_map_tooltip_widgets); + setWidgets(window_map_tooltip_widgets); } - void OnUpdate() override + void onUpdate() override { - Invalidate(); + invalidate(); } - void OnDraw(RenderTarget& rt) override + void onDraw(RenderTarget& rt) override { StringId stringId; std::memcpy(&stringId, _mapTooltipArgs.Data(), sizeof(StringId)); @@ -120,7 +120,7 @@ namespace OpenRCT2::Ui::Windows auto* windowMgr = GetWindowManager(); if (auto w = windowMgr->FindByClass(WindowClass::MapTooltip)) { - w->Invalidate(); + w->invalidate(); w->windowPos = pos; w->width = width; w->height = height; diff --git a/src/openrct2-ui/windows/MazeConstruction.cpp b/src/openrct2-ui/windows/MazeConstruction.cpp index 3e5bd2086e..bdc097f2cb 100644 --- a/src/openrct2-ui/windows/MazeConstruction.cpp +++ b/src/openrct2-ui/windows/MazeConstruction.cpp @@ -105,15 +105,15 @@ namespace OpenRCT2::Ui::Windows class MazeConstructionWindow final : public Window { public: - void OnOpen() override + void onOpen() override { - SetWidgets(window_maze_construction_widgets); + setWidgets(window_maze_construction_widgets); WindowInitScrollWidgets(*this); rideId = _currentRideIndex; ShowGridlines(); } - void OnClose() override + void onClose() override { RideConstructionInvalidateCurrentTrack(); ViewportSetVisibility(ViewportVisibility::standard); @@ -146,12 +146,12 @@ namespace OpenRCT2::Ui::Windows } } - void OnMouseUp(WidgetIndex widgetIndex) override + void onMouseUp(WidgetIndex widgetIndex) override { switch (widgetIndex) { case WIDX_CLOSE: - Close(); + close(); break; case WIDX_MAZE_ENTRANCE: case WIDX_MAZE_EXIT: @@ -166,7 +166,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnResize() override + void onResize() override { uint64_t newDisabledWidgets = 0; if (_rideConstructionState == RideConstructionState::Place) @@ -191,13 +191,13 @@ namespace OpenRCT2::Ui::Windows { if ((newDisabledWidgets & (1uLL << i)) != (currentDisabledWidgets & (1uLL << i))) { - InvalidateWidget(i); + invalidateWidget(i); } } disabledWidgets = newDisabledWidgets; } - void OnMouseDown(WidgetIndex widgetIndex) override + void onMouseDown(WidgetIndex widgetIndex) override { switch (widgetIndex) { @@ -213,12 +213,12 @@ namespace OpenRCT2::Ui::Windows } } - void OnUpdate() override + void onUpdate() override { auto currentRide = GetRide(_currentRideIndex); if (currentRide == nullptr || currentRide->status != RideStatus::closed) { - Close(); + close(); return; } @@ -227,7 +227,7 @@ namespace OpenRCT2::Ui::Windows case RideConstructionState::Place: if (!isToolActive(*this, WIDX_MAZE_DIRECTION_GROUPBOX)) { - Close(); + close(); return; } break; @@ -258,7 +258,7 @@ namespace OpenRCT2::Ui::Windows UpdateGhostTrackAndArrow(); } - void OnToolUpdate(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override + void onToolUpdate(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override { switch (widgetIndex) { @@ -272,7 +272,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override + void onToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override { switch (widgetIndex) { @@ -286,7 +286,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnPrepareDraw() override + void onPrepareDraw() override { auto currentRide = GetRide(_currentRideIndex); auto ft = Formatter::Common(); @@ -302,9 +302,9 @@ namespace OpenRCT2::Ui::Windows } } - void OnDraw(RenderTarget& rt) override + void onDraw(RenderTarget& rt) override { - DrawWidgets(rt); + drawWidgets(rt); } private: @@ -491,6 +491,6 @@ namespace OpenRCT2::Ui::Windows } w->pressedWidgets = newPressedWidgets; - w->Invalidate(); + w->invalidate(); } } // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/Multiplayer.cpp b/src/openrct2-ui/windows/Multiplayer.cpp index a8bc6e9826..3bb21208ff 100644 --- a/src/openrct2-ui/windows/Multiplayer.cpp +++ b/src/openrct2-ui/windows/Multiplayer.cpp @@ -147,40 +147,768 @@ namespace OpenRCT2::Ui::Windows uint8_t _selectedGroup{ 0 }; private: - void ResetPressedWidgets(); + void resetPressedWidgets() + { + for (int32_t i = WIDX_TAB1; i <= WIDX_TAB4; i++) + { + setWidgetPressed(i, false); + } + } - void InformationPaint(RenderTarget& rt); - void PlayersPaint(RenderTarget& rt); - void GroupsPaint(RenderTarget& rt); + void showGroupDropdown(WidgetIndex widgetIndex) + { + auto widget = &widgets[widgetIndex]; + Widget* dropdownWidget = widget - 1; + auto numItems = Network::GetNumGroups(); - void DrawTabImage(RenderTarget& rt, int32_t page_number, int32_t spriteIndex); - void DrawTabImages(RenderTarget& rt); + WindowDropdownShowTextCustomWidth( + windowPos + ScreenCoordsXY{ dropdownWidget->left, dropdownWidget->top }, dropdownWidget->height() + 1, + colours[1], 0, 0, numItems, widget->right - dropdownWidget->left); - void PlayersScrollPaint(int32_t scrollIndex, RenderTarget& rt) const; - void GroupsScrollPaint(int32_t scrollIndex, RenderTarget& rt) const; + for (auto i = 0; i < Network::GetNumGroups(); i++) + { + gDropdown.items[i] = Dropdown::MenuLabel(Network::GetGroupName(i)); + } + if (widget == &widgets[WIDX_DEFAULT_GROUP_DROPDOWN]) + { + gDropdown.items[Network::GetGroupIndex(Network::GetDefaultGroup())].setChecked(true); + } + else if (widget == &widgets[WIDX_SELECTED_GROUP_DROPDOWN]) + { + gDropdown.items[Network::GetGroupIndex(_selectedGroup)].setChecked(true); + } + } - void ShowGroupDropdown(WidgetIndex widgetIndex); - ScreenSize InformationGetSize(); + void informationPaint(RenderTarget& rt) + { + RenderTarget clippedDPI; + if (ClipDrawPixelInfo(clippedDPI, rt, windowPos, width, height)) + { + auto screenCoords = ScreenCoordsXY{ 3, widgets[WIDX_CONTENT_PANEL].top + 7 }; + int32_t newWidth = width - 6; + + const auto& name = Network::GetServerName(); + { + auto ft = Formatter(); + ft.Add(name.c_str()); + screenCoords.y += DrawTextWrapped(clippedDPI, screenCoords, newWidth, STR_STRING, ft, { colours[1] }); + screenCoords.y += kListRowHeight / 2; + } + + const auto& description = Network::GetServerDescription(); + if (!description.empty()) + { + auto ft = Formatter(); + ft.Add(description.c_str()); + screenCoords.y += DrawTextWrapped(clippedDPI, screenCoords, newWidth, STR_STRING, ft, { colours[1] }); + screenCoords.y += kListRowHeight / 2; + } + + const auto& providerName = Network::GetServerProviderName(); + if (!providerName.empty()) + { + auto ft = Formatter(); + ft.Add(providerName.c_str()); + DrawTextBasic(clippedDPI, screenCoords, STR_PROVIDER_NAME, ft); + screenCoords.y += kListRowHeight; + } + + const auto& providerEmail = Network::GetServerProviderEmail(); + if (!providerEmail.empty()) + { + auto ft = Formatter(); + ft.Add(providerEmail.c_str()); + DrawTextBasic(clippedDPI, screenCoords, STR_PROVIDER_EMAIL, ft); + screenCoords.y += kListRowHeight; + } + + const auto& providerWebsite = Network::GetServerProviderWebsite(); + if (!providerWebsite.empty()) + { + auto ft = Formatter(); + ft.Add(providerWebsite.c_str()); + DrawTextBasic(clippedDPI, screenCoords, STR_PROVIDER_WEBSITE, ft); + } + } + } + + void playersPaint(RenderTarget& rt) + { + // Number of players + StringId stringId = numListItems == 1 ? STR_MULTIPLAYER_PLAYER_COUNT : STR_MULTIPLAYER_PLAYER_COUNT_PLURAL; + auto screenCoords = windowPos + ScreenCoordsXY{ 4, widgets[WIDX_LIST].bottom + 2 }; + auto ft = Formatter(); + ft.Add(numListItems); + DrawTextBasic(rt, screenCoords, stringId, ft, { colours[2] }); + } + + void playersScrollPaint(int32_t scrollIndex, RenderTarget& rt) const + { + ScreenCoordsXY screenCoords; + screenCoords.y = 0; + + const int32_t firstPlayerInList = (IsServerPlayerInvisible() ? 1 : 0); + int32_t listPosition = 0; + + for (int32_t player = firstPlayerInList; player < Network::GetNumPlayers(); player++) + { + if (screenCoords.y > rt.y + rt.height) + { + break; + } + + if (screenCoords.y + kScrollableRowHeight + 1 >= rt.y) + { + thread_local std::string _buffer; + _buffer.reserve(512); + _buffer.clear(); + + // Draw player name + auto colour = ColourWithFlags{ COLOUR_BLACK }; + if (listPosition == selectedListItem) + { + GfxFilterRect( + rt, { 0, screenCoords.y, 800, screenCoords.y + kScrollableRowHeight - 1 }, + FilterPaletteID::PaletteDarken1); + _buffer += Network::GetPlayerName(player); + colour = colours[2]; + } + else + { + if (Network::GetPlayerFlags(player) & Network::PlayerFlags::kIsServer) + { + _buffer += "{BABYBLUE}"; + } + else + { + _buffer += "{BLACK}"; + } + _buffer += Network::GetPlayerName(player); + } + screenCoords.x = 0; + GfxClipString(_buffer.data(), 230, FontStyle::Medium); + DrawText(rt, screenCoords, { colour }, _buffer.c_str()); + + // Draw group name + _buffer.resize(0); + int32_t group = Network::GetGroupIndex(Network::GetPlayerGroup(player)); + if (group != -1) + { + _buffer += "{BLACK}"; + screenCoords.x = 173; + _buffer += Network::GetGroupName(group); + GfxClipString(_buffer.data(), 80, FontStyle::Medium); + DrawText(rt, screenCoords, { colour }, _buffer.c_str()); + } + + // Draw last action + int32_t action = Network::GetPlayerLastAction(player, 2000); + auto ft = Formatter(); + if (action != -999) + { + ft.Add(Network::GetActionNameStringID(action)); + } + else + { + ft.Add(STR_ACTION_NA); + } + DrawTextEllipsised(rt, { 256, screenCoords.y }, 100, STR_BLACK_STRING, ft); + + // Draw ping + _buffer.resize(0); + int32_t ping = Network::GetPlayerPing(player); + if (ping <= 100) + { + _buffer += "{GREEN}"; + } + else if (ping <= 250) + { + _buffer += "{YELLOW}"; + } + else + { + _buffer += "{RED}"; + } + + char pingBuffer[64]{}; + snprintf(pingBuffer, sizeof(pingBuffer), "%d ms", ping); + _buffer += pingBuffer; + + screenCoords.x = 356; + DrawText(rt, screenCoords, { colour }, _buffer.c_str()); + } + screenCoords.y += kScrollableRowHeight; + listPosition++; + } + } + + void groupsPaint(RenderTarget& rt) + { + thread_local std::string _buffer; + + Widget* widget = &widgets[WIDX_DEFAULT_GROUP]; + int32_t group = Network::GetGroupIndex(Network::GetDefaultGroup()); + if (group != -1) + { + _buffer.assign("{WINDOW_COLOUR_2}"); + _buffer += Network::GetGroupName(group); + + auto ft = Formatter(); + ft.Add(_buffer.c_str()); + DrawTextEllipsised( + rt, windowPos + ScreenCoordsXY{ widget->midX() - 5, widget->top }, widget->width() - 8, STR_STRING, ft, + { TextAlignment::CENTRE }); + } + + auto screenPos = windowPos + + ScreenCoordsXY{ widgets[WIDX_CONTENT_PANEL].left + 4, widgets[WIDX_CONTENT_PANEL].top + 4 }; + + DrawTextBasic(rt, screenPos, STR_DEFAULT_GROUP, {}, { colours[2] }); + + screenPos.y += 20; + + GfxFillRectInset( + rt, { screenPos - ScreenCoordsXY{ 0, 6 }, screenPos + ScreenCoordsXY{ 310, -5 } }, colours[1], + INSET_RECT_FLAG_BORDER_INSET); + + widget = &widgets[WIDX_SELECTED_GROUP]; + group = Network::GetGroupIndex(_selectedGroup); + if (group != -1) + { + _buffer.assign("{WINDOW_COLOUR_2}"); + _buffer += Network::GetGroupName(group); + auto ft = Formatter(); + ft.Add(_buffer.c_str()); + DrawTextEllipsised( + rt, windowPos + ScreenCoordsXY{ widget->midX() - 5, widget->top }, widget->width() - 8, STR_STRING, ft, + { TextAlignment::CENTRE }); + } + } + + void groupsScrollPaint(int32_t scrollIndex, RenderTarget& rt) const + { + auto screenCoords = ScreenCoordsXY{ 0, 0 }; + + auto rtCoords = ScreenCoordsXY{ rt.x, rt.y }; + GfxFillRect( + rt, { rtCoords, rtCoords + ScreenCoordsXY{ rt.width - 1, rt.height - 1 } }, + ColourMapA[colours[1].colour].mid_light); + + for (int32_t i = 0; i < Network::GetNumActions(); i++) + { + if (i == selectedListItem) + { + GfxFilterRect( + rt, { 0, screenCoords.y, 800, screenCoords.y + kScrollableRowHeight - 1 }, + FilterPaletteID::PaletteDarken1); + } + if (screenCoords.y > rt.y + rt.height) + { + break; + } + + if (screenCoords.y + kScrollableRowHeight + 1 >= rt.y) + { + int32_t groupindex = Network::GetGroupIndex(_selectedGroup); + if (groupindex != -1) + { + if (Network::CanPerformAction(groupindex, static_cast(i))) + { + screenCoords.x = 0; + DrawText(rt, screenCoords, {}, u8"{WINDOW_COLOUR_2}✓"); + } + } + + // Draw action name + auto ft = Formatter(); + ft.Add(Network::GetActionNameStringID(i)); + DrawTextBasic(rt, { 10, screenCoords.y }, STR_WINDOW_COLOUR_2_STRINGID, ft); + } + screenCoords.y += kScrollableRowHeight; + } + } + + void drawTabImage(RenderTarget& rt, int32_t page_number, int32_t spriteIndex) + { + WidgetIndex widgetIndex = WIDX_TAB1 + page_number; + + if (!isWidgetDisabled(widgetIndex)) + { + if (page == page_number) + { + int32_t numFrames = window_multiplayer_animation_frames[page]; + if (numFrames > 1) + { + int32_t frame = currentFrame / window_multiplayer_animation_divisor[page]; + spriteIndex += (frame % numFrames); + } + } + + GfxDrawSprite( + rt, ImageId(spriteIndex), + windowPos + ScreenCoordsXY{ widgets[widgetIndex].left, widgets[widgetIndex].top }); + } + } + + void drawTabImages(RenderTarget& rt) + { + drawTabImage(rt, WINDOW_MULTIPLAYER_PAGE_INFORMATION, SPR_TAB_KIOSKS_AND_FACILITIES_0); + drawTabImage(rt, WINDOW_MULTIPLAYER_PAGE_PLAYERS, SPR_TAB_GUESTS_0); + drawTabImage(rt, WINDOW_MULTIPLAYER_PAGE_GROUPS, SPR_TAB_STAFF_OPTIONS_0); + drawTabImage(rt, WINDOW_MULTIPLAYER_PAGE_OPTIONS, SPR_TAB_GEARS_0); + } + + ScreenSize informationGetSize() + { + assert(!_windowInformationSize.has_value()); + + int32_t lineHeight = FontGetLineHeight(FontStyle::Medium); + + // Base dimensions. + const int32_t baseWidth = 450; + int32_t baseHeight = 55; + + // Server name is displayed word-wrapped, so figure out how high it will be. + { + int32_t numLines; + GfxWrapString(Network::GetServerName(), baseWidth, FontStyle::Medium, nullptr, &numLines); + baseHeight += (numLines + 1) * lineHeight + (kListRowHeight / 2); + } + + // Likewise, for the optional server description -- which can be a little longer. + const auto& descString = Network::GetServerDescription(); + if (!descString.empty()) + { + int32_t numLines; + GfxWrapString(descString, baseWidth, FontStyle::Medium, nullptr, &numLines); + baseHeight += (numLines + 1) * lineHeight + (kListRowHeight / 2); + } + + // Finally, account for provider info, if present. + { + const auto& providerName = Network::GetServerProviderName(); + if (!providerName.empty()) + baseHeight += kListRowHeight; + + const auto& providerEmail = Network::GetServerProviderEmail(); + if (!providerEmail.empty()) + baseHeight += kListRowHeight; + + const auto& providerWebsite = Network::GetServerProviderWebsite(); + if (!providerWebsite.empty()) + baseHeight += kListRowHeight; + } + + // TODO: Are these casts still neccessary? + _windowInformationSize = { static_cast(baseWidth), static_cast(baseHeight) }; + return _windowInformationSize.value(); + } public: - void OnOpen() override; + void onOpen() override + { + setPage(WINDOW_MULTIPLAYER_PAGE_INFORMATION); + } - void SetPage(int32_t page_number); + void setPage(int32_t page_number) + { + // Skip setting page if we're already on this page, unless we're initialising the window + if (page == page_number && !widgets.empty()) + return; - void OnMouseUp(WidgetIndex widgetIndex) override; - void OnResize() override; - void OnUpdate() override; - void OnPrepareDraw() override; - void OnDraw(RenderTarget& rt) override; + _windowInformationSize.reset(); - void OnDropdown(WidgetIndex widgetIndex, int32_t selectedIndex) override; - void OnTextInput(WidgetIndex widgetIndex, std::string_view text) override; - void OnMouseDown(WidgetIndex widgetIndex) override; + page = page_number; + currentFrame = 0; + numListItems = 0; + selectedListItem = -1; - ScreenSize OnScrollGetSize(int32_t scrollIndex) override; - void OnScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override; - void OnScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override; - void OnScrollDraw(int32_t scrollIndex, RenderTarget& rt) override; + holdDownWidgets = 0; + pressedWidgets = 0; + setWidgets(window_multiplayer_page_widgets[page]); + widgets[WIDX_TITLE].text = WindowMultiplayerPageTitles[page]; + + onResize(); + onPrepareDraw(); + initScrollWidgets(); + invalidate(); + } + + void onMouseUp(WidgetIndex widgetIndex) override + { + switch (widgetIndex) + { + case WIDX_CLOSE: + close(); + break; + case WIDX_TAB1: + case WIDX_TAB2: + case WIDX_TAB3: + case WIDX_TAB4: + if (page != widgetIndex - WIDX_TAB1) + { + setPage(widgetIndex - WIDX_TAB1); + } + break; + } + + auto& gameState = getGameState(); + switch (page) + { + case WINDOW_MULTIPLAYER_PAGE_GROUPS: + { + switch (widgetIndex) + { + case WIDX_ADD_GROUP: + { + auto networkModifyGroup = GameActions::NetworkModifyGroupAction( + GameActions::ModifyGroupType::AddGroup); + GameActions::Execute(&networkModifyGroup, gameState); + break; + } + case WIDX_REMOVE_GROUP: + { + auto networkModifyGroup = GameActions::NetworkModifyGroupAction( + GameActions::ModifyGroupType::RemoveGroup, _selectedGroup); + GameActions::Execute(&networkModifyGroup, gameState); + break; + } + case WIDX_RENAME_GROUP: + { + int32_t groupIndex = Network::GetGroupIndex(_selectedGroup); + const utf8* groupName = Network::GetGroupName(groupIndex); + WindowTextInputRawOpen( + this, widgetIndex, STR_GROUP_NAME, STR_ENTER_NEW_NAME_FOR_THIS_GROUP, {}, groupName, 32); + break; + } + } + break; + } + case WINDOW_MULTIPLAYER_PAGE_OPTIONS: + { + switch (widgetIndex) + { + case WIDX_LOG_CHAT_CHECKBOX: + Config::Get().network.LogChat = !Config::Get().network.LogChat; + Config::Save(); + break; + case WIDX_LOG_SERVER_ACTIONS_CHECKBOX: + Config::Get().network.LogServerActions = !Config::Get().network.LogServerActions; + Config::Save(); + break; + case WIDX_KNOWN_KEYS_ONLY_CHECKBOX: + Config::Get().network.KnownKeysOnly = !Config::Get().network.KnownKeysOnly; + Config::Save(); + break; + } + break; + } + } + } + + void onResize() override + { + switch (page) + { + case WINDOW_MULTIPLAYER_PAGE_INFORMATION: + { + auto size = _windowInformationSize ? _windowInformationSize.value() : informationGetSize(); + WindowSetResize(*this, size, size); + break; + } + case WINDOW_MULTIPLAYER_PAGE_PLAYERS: + { + WindowSetResize(*this, { 420, 124 }, { 500, 450 }); + + numListItems = (IsServerPlayerInvisible() ? Network::GetNumVisiblePlayers() : Network::GetNumPlayers()); + + widgets[WIDX_HEADER_PING].right = width - 5; + + selectedListItem = -1; + invalidate(); + break; + } + case WINDOW_MULTIPLAYER_PAGE_GROUPS: + { + WindowSetResize(*this, { 320, 200 }, { 320, 500 }); + + numListItems = Network::GetNumActions(); + + selectedListItem = -1; + invalidate(); + break; + } + case WINDOW_MULTIPLAYER_PAGE_OPTIONS: + { + WindowSetResize(*this, { 300, 100 }, { 300, 100 }); + break; + } + } + } + + void onUpdate() override + { + currentFrame++; + invalidateWidget(WIDX_TAB1 + page); + } + + void onPrepareDraw() override + { + resetPressedWidgets(); + setWidgetPressed(WIDX_TAB1 + page, true); + switch (page) + { + case WINDOW_MULTIPLAYER_PAGE_INFORMATION: + { + WindowAlignTabs(this, WIDX_TAB1, WIDX_TAB4); + break; + } + case WINDOW_MULTIPLAYER_PAGE_PLAYERS: + { + widgets[WIDX_LIST].right = width - 4; + widgets[WIDX_LIST].bottom = height - 0x0F; + WindowAlignTabs(this, WIDX_TAB1, WIDX_TAB4); + break; + } + case WINDOW_MULTIPLAYER_PAGE_GROUPS: + { + widgets[WIDX_PERMISSIONS_LIST].right = width - 4; + widgets[WIDX_PERMISSIONS_LIST].bottom = height - 0x0F; + WindowAlignTabs(this, WIDX_TAB1, WIDX_TAB4); + + // select other group if one is removed + while (Network::GetGroupIndex(_selectedGroup) == -1 && _selectedGroup > 0) + { + _selectedGroup--; + } + break; + } + case WINDOW_MULTIPLAYER_PAGE_OPTIONS: + { + WindowAlignTabs(this, WIDX_TAB1, WIDX_TAB4); + + if (Network::GetMode() == Network::Mode::client) + { + widgets[WIDX_KNOWN_KEYS_ONLY_CHECKBOX].type = WidgetType::empty; + } + + setCheckboxValue(WIDX_LOG_CHAT_CHECKBOX, Config::Get().network.LogChat); + setCheckboxValue(WIDX_LOG_SERVER_ACTIONS_CHECKBOX, Config::Get().network.LogServerActions); + setCheckboxValue(WIDX_KNOWN_KEYS_ONLY_CHECKBOX, Config::Get().network.KnownKeysOnly); + break; + } + } + } + + void onDraw(RenderTarget& rt) override + { + drawWidgets(rt); + drawTabImages(rt); + switch (page) + { + case WINDOW_MULTIPLAYER_PAGE_INFORMATION: + { + informationPaint(rt); + break; + } + case WINDOW_MULTIPLAYER_PAGE_PLAYERS: + { + playersPaint(rt); + break; + } + case WINDOW_MULTIPLAYER_PAGE_GROUPS: + { + groupsPaint(rt); + break; + } + } + } + + void onDropdown(WidgetIndex widgetIndex, int32_t selectedIndex) override + { + switch (page) + { + case WINDOW_MULTIPLAYER_PAGE_GROUPS: + { + if (selectedIndex == -1) + { + return; + } + + switch (widgetIndex) + { + case WIDX_DEFAULT_GROUP_DROPDOWN: + { + auto networkModifyGroup = GameActions::NetworkModifyGroupAction( + GameActions::ModifyGroupType::SetDefault, Network::GetGroupID(selectedIndex)); + GameActions::Execute(&networkModifyGroup, getGameState()); + break; + } + case WIDX_SELECTED_GROUP_DROPDOWN: + { + _selectedGroup = Network::GetGroupID(selectedIndex); + break; + } + } + invalidate(); + break; + } + } + } + + void onTextInput(WidgetIndex widgetIndex, std::string_view text) override + { + switch (page) + { + case WINDOW_MULTIPLAYER_PAGE_GROUPS: + { + if (widgetIndex != WIDX_RENAME_GROUP) + return; + + if (text.empty()) + return; + + auto networkModifyGroup = GameActions::NetworkModifyGroupAction( + GameActions::ModifyGroupType::SetName, _selectedGroup, std::string(text)); + GameActions::Execute(&networkModifyGroup, getGameState()); + break; + } + } + } + + void onMouseDown(WidgetIndex widgetIndex) override + { + switch (page) + { + case WINDOW_MULTIPLAYER_PAGE_GROUPS: + { + switch (widgetIndex) + { + case WIDX_DEFAULT_GROUP_DROPDOWN: + case WIDX_SELECTED_GROUP_DROPDOWN: + showGroupDropdown(widgetIndex); + break; + } + break; + } + } + } + + ScreenSize onScrollGetSize(int32_t scrollIndex) override + { + ScreenSize screenSize{}; + switch (page) + { + case WINDOW_MULTIPLAYER_PAGE_PLAYERS: + { + if (selectedListItem != -1) + { + selectedListItem = -1; + invalidate(); + } + + screenSize = { 0, Network::GetNumPlayers() * kScrollableRowHeight }; + int32_t i = screenSize.height - widgets[WIDX_LIST].bottom + widgets[WIDX_LIST].top + 21; + if (i < 0) + i = 0; + if (i < scrolls[0].contentOffsetY) + { + scrolls[0].contentOffsetY = i; + invalidate(); + } + break; + } + + case WINDOW_MULTIPLAYER_PAGE_GROUPS: + { + if (selectedListItem != -1) + { + selectedListItem = -1; + invalidate(); + } + + screenSize = { 0, Network::GetNumActions() * kScrollableRowHeight }; + int32_t i = screenSize.height - widgets[WIDX_LIST].bottom + widgets[WIDX_LIST].top + 21; + if (i < 0) + i = 0; + if (i < scrolls[0].contentOffsetY) + { + scrolls[0].contentOffsetY = i; + invalidate(); + } + break; + } + } + return screenSize; + } + + void onScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override + { + switch (page) + { + case WINDOW_MULTIPLAYER_PAGE_PLAYERS: + { + int32_t index = screenCoords.y / kScrollableRowHeight; + if (index >= numListItems) + return; + + selectedListItem = index; + invalidate(); + + int32_t player = (IsServerPlayerInvisible() ? index + 1 : index); + PlayerOpen(Network::GetPlayerID(player)); + break; + } + + case WINDOW_MULTIPLAYER_PAGE_GROUPS: + { + int32_t index = screenCoords.y / kScrollableRowHeight; + if (index >= numListItems) + return; + + selectedListItem = index; + invalidate(); + + auto networkModifyGroup = GameActions::NetworkModifyGroupAction( + GameActions::ModifyGroupType::SetPermissions, _selectedGroup, "", index, + GameActions::PermissionState::Toggle); + GameActions::Execute(&networkModifyGroup, getGameState()); + break; + } + } + } + + void onScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override + { + switch (page) + { + case WINDOW_MULTIPLAYER_PAGE_PLAYERS: + case WINDOW_MULTIPLAYER_PAGE_GROUPS: + { + int32_t index = screenCoords.y / kScrollableRowHeight; + if (index >= numListItems) + return; + + selectedListItem = index; + invalidate(); + break; + } + } + } + + void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override + { + switch (page) + { + case WINDOW_MULTIPLAYER_PAGE_PLAYERS: + playersScrollPaint(scrollIndex, rt); + break; + + case WINDOW_MULTIPLAYER_PAGE_GROUPS: + groupsScrollPaint(scrollIndex, rt); + break; + } + } }; WindowBase* MultiplayerOpen() @@ -196,763 +924,4 @@ namespace OpenRCT2::Ui::Windows return window; } - - void MultiplayerWindow::OnOpen() - { - SetPage(WINDOW_MULTIPLAYER_PAGE_INFORMATION); - } - - void MultiplayerWindow::SetPage(int32_t page_number) - { - // Skip setting page if we're already on this page, unless we're initialising the window - if (page == page_number && !widgets.empty()) - return; - - _windowInformationSize.reset(); - - page = page_number; - currentFrame = 0; - numListItems = 0; - selectedListItem = -1; - - holdDownWidgets = 0; - pressedWidgets = 0; - SetWidgets(window_multiplayer_page_widgets[page]); - widgets[WIDX_TITLE].text = WindowMultiplayerPageTitles[page]; - - OnResize(); - OnPrepareDraw(); - InitScrollWidgets(); - Invalidate(); - } - - void MultiplayerWindow::OnMouseUp(WidgetIndex widgetIndex) - { - switch (widgetIndex) - { - case WIDX_CLOSE: - Close(); - break; - case WIDX_TAB1: - case WIDX_TAB2: - case WIDX_TAB3: - case WIDX_TAB4: - if (page != widgetIndex - WIDX_TAB1) - { - SetPage(widgetIndex - WIDX_TAB1); - } - break; - } - - auto& gameState = getGameState(); - switch (page) - { - case WINDOW_MULTIPLAYER_PAGE_GROUPS: - { - switch (widgetIndex) - { - case WIDX_ADD_GROUP: - { - auto networkModifyGroup = GameActions::NetworkModifyGroupAction(GameActions::ModifyGroupType::AddGroup); - GameActions::Execute(&networkModifyGroup, gameState); - break; - } - case WIDX_REMOVE_GROUP: - { - auto networkModifyGroup = GameActions::NetworkModifyGroupAction( - GameActions::ModifyGroupType::RemoveGroup, _selectedGroup); - GameActions::Execute(&networkModifyGroup, gameState); - break; - } - case WIDX_RENAME_GROUP: - { - int32_t groupIndex = Network::GetGroupIndex(_selectedGroup); - const utf8* groupName = Network::GetGroupName(groupIndex); - WindowTextInputRawOpen( - this, widgetIndex, STR_GROUP_NAME, STR_ENTER_NEW_NAME_FOR_THIS_GROUP, {}, groupName, 32); - break; - } - } - break; - } - case WINDOW_MULTIPLAYER_PAGE_OPTIONS: - { - switch (widgetIndex) - { - case WIDX_LOG_CHAT_CHECKBOX: - Config::Get().network.LogChat = !Config::Get().network.LogChat; - Config::Save(); - break; - case WIDX_LOG_SERVER_ACTIONS_CHECKBOX: - Config::Get().network.LogServerActions = !Config::Get().network.LogServerActions; - Config::Save(); - break; - case WIDX_KNOWN_KEYS_ONLY_CHECKBOX: - Config::Get().network.KnownKeysOnly = !Config::Get().network.KnownKeysOnly; - Config::Save(); - break; - } - break; - } - } - } - - ScreenSize MultiplayerWindow::InformationGetSize() - { - assert(!_windowInformationSize.has_value()); - - int32_t lineHeight = FontGetLineHeight(FontStyle::Medium); - - // Base dimensions. - const int32_t baseWidth = 450; - int32_t baseHeight = 55; - - // Server name is displayed word-wrapped, so figure out how high it will be. - { - int32_t numLines; - GfxWrapString(Network::GetServerName(), baseWidth, FontStyle::Medium, nullptr, &numLines); - baseHeight += (numLines + 1) * lineHeight + (kListRowHeight / 2); - } - - // Likewise, for the optional server description -- which can be a little longer. - const auto& descString = Network::GetServerDescription(); - if (!descString.empty()) - { - int32_t numLines; - GfxWrapString(descString, baseWidth, FontStyle::Medium, nullptr, &numLines); - baseHeight += (numLines + 1) * lineHeight + (kListRowHeight / 2); - } - - // Finally, account for provider info, if present. - { - const auto& providerName = Network::GetServerProviderName(); - if (!providerName.empty()) - baseHeight += kListRowHeight; - - const auto& providerEmail = Network::GetServerProviderEmail(); - if (!providerEmail.empty()) - baseHeight += kListRowHeight; - - const auto& providerWebsite = Network::GetServerProviderWebsite(); - if (!providerWebsite.empty()) - baseHeight += kListRowHeight; - } - - // TODO: Are these casts still neccessary? - _windowInformationSize = { static_cast(baseWidth), static_cast(baseHeight) }; - return _windowInformationSize.value(); - } - - void MultiplayerWindow::OnResize() - { - switch (page) - { - case WINDOW_MULTIPLAYER_PAGE_INFORMATION: - { - auto size = _windowInformationSize ? _windowInformationSize.value() : InformationGetSize(); - WindowSetResize(*this, size, size); - break; - } - case WINDOW_MULTIPLAYER_PAGE_PLAYERS: - { - WindowSetResize(*this, { 420, 124 }, { 500, 450 }); - - numListItems = (IsServerPlayerInvisible() ? Network::GetNumVisiblePlayers() : Network::GetNumPlayers()); - - widgets[WIDX_HEADER_PING].right = width - 5; - - selectedListItem = -1; - Invalidate(); - break; - } - case WINDOW_MULTIPLAYER_PAGE_GROUPS: - { - WindowSetResize(*this, { 320, 200 }, { 320, 500 }); - - numListItems = Network::GetNumActions(); - - selectedListItem = -1; - Invalidate(); - break; - } - case WINDOW_MULTIPLAYER_PAGE_OPTIONS: - { - WindowSetResize(*this, { 300, 100 }, { 300, 100 }); - break; - } - } - } - - void MultiplayerWindow::OnUpdate() - { - currentFrame++; - InvalidateWidget(WIDX_TAB1 + page); - } - - void MultiplayerWindow::ResetPressedWidgets() - { - for (int32_t i = WIDX_TAB1; i <= WIDX_TAB4; i++) - { - SetWidgetPressed(i, false); - } - } - - void MultiplayerWindow::OnPrepareDraw() - { - ResetPressedWidgets(); - SetWidgetPressed(WIDX_TAB1 + page, true); - switch (page) - { - case WINDOW_MULTIPLAYER_PAGE_INFORMATION: - { - WindowAlignTabs(this, WIDX_TAB1, WIDX_TAB4); - break; - } - case WINDOW_MULTIPLAYER_PAGE_PLAYERS: - { - widgets[WIDX_LIST].right = width - 4; - widgets[WIDX_LIST].bottom = height - 0x0F; - WindowAlignTabs(this, WIDX_TAB1, WIDX_TAB4); - break; - } - case WINDOW_MULTIPLAYER_PAGE_GROUPS: - { - widgets[WIDX_PERMISSIONS_LIST].right = width - 4; - widgets[WIDX_PERMISSIONS_LIST].bottom = height - 0x0F; - WindowAlignTabs(this, WIDX_TAB1, WIDX_TAB4); - - // select other group if one is removed - while (Network::GetGroupIndex(_selectedGroup) == -1 && _selectedGroup > 0) - { - _selectedGroup--; - } - break; - } - case WINDOW_MULTIPLAYER_PAGE_OPTIONS: - { - WindowAlignTabs(this, WIDX_TAB1, WIDX_TAB4); - - if (Network::GetMode() == Network::Mode::client) - { - widgets[WIDX_KNOWN_KEYS_ONLY_CHECKBOX].type = WidgetType::empty; - } - - SetCheckboxValue(WIDX_LOG_CHAT_CHECKBOX, Config::Get().network.LogChat); - SetCheckboxValue(WIDX_LOG_SERVER_ACTIONS_CHECKBOX, Config::Get().network.LogServerActions); - SetCheckboxValue(WIDX_KNOWN_KEYS_ONLY_CHECKBOX, Config::Get().network.KnownKeysOnly); - break; - } - } - } - - void MultiplayerWindow::OnDraw(RenderTarget& rt) - { - DrawWidgets(rt); - DrawTabImages(rt); - switch (page) - { - case WINDOW_MULTIPLAYER_PAGE_INFORMATION: - { - InformationPaint(rt); - break; - } - case WINDOW_MULTIPLAYER_PAGE_PLAYERS: - { - PlayersPaint(rt); - break; - } - case WINDOW_MULTIPLAYER_PAGE_GROUPS: - { - GroupsPaint(rt); - break; - } - } - } - - void MultiplayerWindow::OnDropdown(WidgetIndex widgetIndex, int32_t selectedIndex) - { - switch (page) - { - case WINDOW_MULTIPLAYER_PAGE_GROUPS: - { - if (selectedIndex == -1) - { - return; - } - - switch (widgetIndex) - { - case WIDX_DEFAULT_GROUP_DROPDOWN: - { - auto networkModifyGroup = GameActions::NetworkModifyGroupAction( - GameActions::ModifyGroupType::SetDefault, Network::GetGroupID(selectedIndex)); - GameActions::Execute(&networkModifyGroup, getGameState()); - break; - } - case WIDX_SELECTED_GROUP_DROPDOWN: - { - _selectedGroup = Network::GetGroupID(selectedIndex); - break; - } - } - Invalidate(); - break; - } - } - } - - void MultiplayerWindow::OnTextInput(WidgetIndex widgetIndex, std::string_view text) - { - switch (page) - { - case WINDOW_MULTIPLAYER_PAGE_GROUPS: - { - if (widgetIndex != WIDX_RENAME_GROUP) - return; - - if (text.empty()) - return; - - auto networkModifyGroup = GameActions::NetworkModifyGroupAction( - GameActions::ModifyGroupType::SetName, _selectedGroup, std::string(text)); - GameActions::Execute(&networkModifyGroup, getGameState()); - break; - } - } - } - - void MultiplayerWindow::ShowGroupDropdown(WidgetIndex widgetIndex) - { - auto widget = &widgets[widgetIndex]; - Widget* dropdownWidget = widget - 1; - auto numItems = Network::GetNumGroups(); - - WindowDropdownShowTextCustomWidth( - windowPos + ScreenCoordsXY{ dropdownWidget->left, dropdownWidget->top }, dropdownWidget->height() + 1, colours[1], - 0, 0, numItems, widget->right - dropdownWidget->left); - - for (auto i = 0; i < Network::GetNumGroups(); i++) - { - gDropdown.items[i] = Dropdown::MenuLabel(Network::GetGroupName(i)); - } - if (widget == &widgets[WIDX_DEFAULT_GROUP_DROPDOWN]) - { - gDropdown.items[Network::GetGroupIndex(Network::GetDefaultGroup())].setChecked(true); - } - else if (widget == &widgets[WIDX_SELECTED_GROUP_DROPDOWN]) - { - gDropdown.items[Network::GetGroupIndex(_selectedGroup)].setChecked(true); - } - } - - void MultiplayerWindow::OnMouseDown(WidgetIndex widgetIndex) - { - switch (page) - { - case WINDOW_MULTIPLAYER_PAGE_GROUPS: - { - switch (widgetIndex) - { - case WIDX_DEFAULT_GROUP_DROPDOWN: - case WIDX_SELECTED_GROUP_DROPDOWN: - ShowGroupDropdown(widgetIndex); - break; - } - break; - } - } - } - - ScreenSize MultiplayerWindow::OnScrollGetSize(int32_t scrollIndex) - { - ScreenSize screenSize{}; - switch (page) - { - case WINDOW_MULTIPLAYER_PAGE_PLAYERS: - { - if (selectedListItem != -1) - { - selectedListItem = -1; - Invalidate(); - } - - screenSize = { 0, Network::GetNumPlayers() * kScrollableRowHeight }; - int32_t i = screenSize.height - widgets[WIDX_LIST].bottom + widgets[WIDX_LIST].top + 21; - if (i < 0) - i = 0; - if (i < scrolls[0].contentOffsetY) - { - scrolls[0].contentOffsetY = i; - Invalidate(); - } - break; - } - - case WINDOW_MULTIPLAYER_PAGE_GROUPS: - { - if (selectedListItem != -1) - { - selectedListItem = -1; - Invalidate(); - } - - screenSize = { 0, Network::GetNumActions() * kScrollableRowHeight }; - int32_t i = screenSize.height - widgets[WIDX_LIST].bottom + widgets[WIDX_LIST].top + 21; - if (i < 0) - i = 0; - if (i < scrolls[0].contentOffsetY) - { - scrolls[0].contentOffsetY = i; - Invalidate(); - } - break; - } - } - return screenSize; - } - - void MultiplayerWindow::OnScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) - { - switch (page) - { - case WINDOW_MULTIPLAYER_PAGE_PLAYERS: - { - int32_t index = screenCoords.y / kScrollableRowHeight; - if (index >= numListItems) - return; - - selectedListItem = index; - Invalidate(); - - int32_t player = (IsServerPlayerInvisible() ? index + 1 : index); - PlayerOpen(Network::GetPlayerID(player)); - break; - } - - case WINDOW_MULTIPLAYER_PAGE_GROUPS: - { - int32_t index = screenCoords.y / kScrollableRowHeight; - if (index >= numListItems) - return; - - selectedListItem = index; - Invalidate(); - - auto networkModifyGroup = GameActions::NetworkModifyGroupAction( - GameActions::ModifyGroupType::SetPermissions, _selectedGroup, "", index, - GameActions::PermissionState::Toggle); - GameActions::Execute(&networkModifyGroup, getGameState()); - break; - } - } - } - - void MultiplayerWindow::OnScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) - { - switch (page) - { - case WINDOW_MULTIPLAYER_PAGE_PLAYERS: - case WINDOW_MULTIPLAYER_PAGE_GROUPS: - { - int32_t index = screenCoords.y / kScrollableRowHeight; - if (index >= numListItems) - return; - - selectedListItem = index; - Invalidate(); - break; - } - } - } - - void MultiplayerWindow::OnScrollDraw(int32_t scrollIndex, RenderTarget& rt) - { - switch (page) - { - case WINDOW_MULTIPLAYER_PAGE_PLAYERS: - PlayersScrollPaint(scrollIndex, rt); - break; - - case WINDOW_MULTIPLAYER_PAGE_GROUPS: - GroupsScrollPaint(scrollIndex, rt); - break; - } - } - - void MultiplayerWindow::InformationPaint(RenderTarget& rt) - { - RenderTarget clippedDPI; - if (ClipDrawPixelInfo(clippedDPI, rt, windowPos, width, height)) - { - auto screenCoords = ScreenCoordsXY{ 3, widgets[WIDX_CONTENT_PANEL].top + 7 }; - int32_t newWidth = width - 6; - - const auto& name = Network::GetServerName(); - { - auto ft = Formatter(); - ft.Add(name.c_str()); - screenCoords.y += DrawTextWrapped(clippedDPI, screenCoords, newWidth, STR_STRING, ft, { colours[1] }); - screenCoords.y += kListRowHeight / 2; - } - - const auto& description = Network::GetServerDescription(); - if (!description.empty()) - { - auto ft = Formatter(); - ft.Add(description.c_str()); - screenCoords.y += DrawTextWrapped(clippedDPI, screenCoords, newWidth, STR_STRING, ft, { colours[1] }); - screenCoords.y += kListRowHeight / 2; - } - - const auto& providerName = Network::GetServerProviderName(); - if (!providerName.empty()) - { - auto ft = Formatter(); - ft.Add(providerName.c_str()); - DrawTextBasic(clippedDPI, screenCoords, STR_PROVIDER_NAME, ft); - screenCoords.y += kListRowHeight; - } - - const auto& providerEmail = Network::GetServerProviderEmail(); - if (!providerEmail.empty()) - { - auto ft = Formatter(); - ft.Add(providerEmail.c_str()); - DrawTextBasic(clippedDPI, screenCoords, STR_PROVIDER_EMAIL, ft); - screenCoords.y += kListRowHeight; - } - - const auto& providerWebsite = Network::GetServerProviderWebsite(); - if (!providerWebsite.empty()) - { - auto ft = Formatter(); - ft.Add(providerWebsite.c_str()); - DrawTextBasic(clippedDPI, screenCoords, STR_PROVIDER_WEBSITE, ft); - } - } - } - - void MultiplayerWindow::PlayersPaint(RenderTarget& rt) - { - // Number of players - StringId stringId = numListItems == 1 ? STR_MULTIPLAYER_PLAYER_COUNT : STR_MULTIPLAYER_PLAYER_COUNT_PLURAL; - auto screenCoords = windowPos + ScreenCoordsXY{ 4, widgets[WIDX_LIST].bottom + 2 }; - auto ft = Formatter(); - ft.Add(numListItems); - DrawTextBasic(rt, screenCoords, stringId, ft, { colours[2] }); - } - - void MultiplayerWindow::PlayersScrollPaint(int32_t scrollIndex, RenderTarget& rt) const - { - ScreenCoordsXY screenCoords; - screenCoords.y = 0; - - const int32_t firstPlayerInList = (IsServerPlayerInvisible() ? 1 : 0); - int32_t listPosition = 0; - - for (int32_t player = firstPlayerInList; player < Network::GetNumPlayers(); player++) - { - if (screenCoords.y > rt.y + rt.height) - { - break; - } - - if (screenCoords.y + kScrollableRowHeight + 1 >= rt.y) - { - thread_local std::string _buffer; - _buffer.reserve(512); - _buffer.clear(); - - // Draw player name - auto colour = ColourWithFlags{ COLOUR_BLACK }; - if (listPosition == selectedListItem) - { - GfxFilterRect( - rt, { 0, screenCoords.y, 800, screenCoords.y + kScrollableRowHeight - 1 }, - FilterPaletteID::PaletteDarken1); - _buffer += Network::GetPlayerName(player); - colour = colours[2]; - } - else - { - if (Network::GetPlayerFlags(player) & Network::PlayerFlags::kIsServer) - { - _buffer += "{BABYBLUE}"; - } - else - { - _buffer += "{BLACK}"; - } - _buffer += Network::GetPlayerName(player); - } - screenCoords.x = 0; - GfxClipString(_buffer.data(), 230, FontStyle::Medium); - DrawText(rt, screenCoords, { colour }, _buffer.c_str()); - - // Draw group name - _buffer.resize(0); - int32_t group = Network::GetGroupIndex(Network::GetPlayerGroup(player)); - if (group != -1) - { - _buffer += "{BLACK}"; - screenCoords.x = 173; - _buffer += Network::GetGroupName(group); - GfxClipString(_buffer.data(), 80, FontStyle::Medium); - DrawText(rt, screenCoords, { colour }, _buffer.c_str()); - } - - // Draw last action - int32_t action = Network::GetPlayerLastAction(player, 2000); - auto ft = Formatter(); - if (action != -999) - { - ft.Add(Network::GetActionNameStringID(action)); - } - else - { - ft.Add(STR_ACTION_NA); - } - DrawTextEllipsised(rt, { 256, screenCoords.y }, 100, STR_BLACK_STRING, ft); - - // Draw ping - _buffer.resize(0); - int32_t ping = Network::GetPlayerPing(player); - if (ping <= 100) - { - _buffer += "{GREEN}"; - } - else if (ping <= 250) - { - _buffer += "{YELLOW}"; - } - else - { - _buffer += "{RED}"; - } - - char pingBuffer[64]{}; - snprintf(pingBuffer, sizeof(pingBuffer), "%d ms", ping); - _buffer += pingBuffer; - - screenCoords.x = 356; - DrawText(rt, screenCoords, { colour }, _buffer.c_str()); - } - screenCoords.y += kScrollableRowHeight; - listPosition++; - } - } - - void MultiplayerWindow::GroupsPaint(RenderTarget& rt) - { - thread_local std::string _buffer; - - Widget* widget = &widgets[WIDX_DEFAULT_GROUP]; - int32_t group = Network::GetGroupIndex(Network::GetDefaultGroup()); - if (group != -1) - { - _buffer.assign("{WINDOW_COLOUR_2}"); - _buffer += Network::GetGroupName(group); - - auto ft = Formatter(); - ft.Add(_buffer.c_str()); - DrawTextEllipsised( - rt, windowPos + ScreenCoordsXY{ widget->midX() - 5, widget->top }, widget->width() - 8, STR_STRING, ft, - { TextAlignment::CENTRE }); - } - - auto screenPos = windowPos - + ScreenCoordsXY{ widgets[WIDX_CONTENT_PANEL].left + 4, widgets[WIDX_CONTENT_PANEL].top + 4 }; - - DrawTextBasic(rt, screenPos, STR_DEFAULT_GROUP, {}, { colours[2] }); - - screenPos.y += 20; - - GfxFillRectInset( - rt, { screenPos - ScreenCoordsXY{ 0, 6 }, screenPos + ScreenCoordsXY{ 310, -5 } }, colours[1], - INSET_RECT_FLAG_BORDER_INSET); - - widget = &widgets[WIDX_SELECTED_GROUP]; - group = Network::GetGroupIndex(_selectedGroup); - if (group != -1) - { - _buffer.assign("{WINDOW_COLOUR_2}"); - _buffer += Network::GetGroupName(group); - auto ft = Formatter(); - ft.Add(_buffer.c_str()); - DrawTextEllipsised( - rt, windowPos + ScreenCoordsXY{ widget->midX() - 5, widget->top }, widget->width() - 8, STR_STRING, ft, - { TextAlignment::CENTRE }); - } - } - - void MultiplayerWindow::GroupsScrollPaint(int32_t scrollIndex, RenderTarget& rt) const - { - auto screenCoords = ScreenCoordsXY{ 0, 0 }; - - auto rtCoords = ScreenCoordsXY{ rt.x, rt.y }; - GfxFillRect( - rt, { rtCoords, rtCoords + ScreenCoordsXY{ rt.width - 1, rt.height - 1 } }, - ColourMapA[colours[1].colour].mid_light); - - for (int32_t i = 0; i < Network::GetNumActions(); i++) - { - if (i == selectedListItem) - { - GfxFilterRect( - rt, { 0, screenCoords.y, 800, screenCoords.y + kScrollableRowHeight - 1 }, FilterPaletteID::PaletteDarken1); - } - if (screenCoords.y > rt.y + rt.height) - { - break; - } - - if (screenCoords.y + kScrollableRowHeight + 1 >= rt.y) - { - int32_t groupindex = Network::GetGroupIndex(_selectedGroup); - if (groupindex != -1) - { - if (Network::CanPerformAction(groupindex, static_cast(i))) - { - screenCoords.x = 0; - DrawText(rt, screenCoords, {}, u8"{WINDOW_COLOUR_2}✓"); - } - } - - // Draw action name - auto ft = Formatter(); - ft.Add(Network::GetActionNameStringID(i)); - DrawTextBasic(rt, { 10, screenCoords.y }, STR_WINDOW_COLOUR_2_STRINGID, ft); - } - screenCoords.y += kScrollableRowHeight; - } - } - - void MultiplayerWindow::DrawTabImage(RenderTarget& rt, int32_t page_number, int32_t spriteIndex) - { - WidgetIndex widgetIndex = WIDX_TAB1 + page_number; - - if (!IsWidgetDisabled(widgetIndex)) - { - if (page == page_number) - { - int32_t numFrames = window_multiplayer_animation_frames[page]; - if (numFrames > 1) - { - int32_t frame = currentFrame / window_multiplayer_animation_divisor[page]; - spriteIndex += (frame % numFrames); - } - } - - GfxDrawSprite( - rt, ImageId(spriteIndex), windowPos + ScreenCoordsXY{ widgets[widgetIndex].left, widgets[widgetIndex].top }); - } - } - - void MultiplayerWindow::DrawTabImages(RenderTarget& rt) - { - DrawTabImage(rt, WINDOW_MULTIPLAYER_PAGE_INFORMATION, SPR_TAB_KIOSKS_AND_FACILITIES_0); - DrawTabImage(rt, WINDOW_MULTIPLAYER_PAGE_PLAYERS, SPR_TAB_GUESTS_0); - DrawTabImage(rt, WINDOW_MULTIPLAYER_PAGE_GROUPS, SPR_TAB_STAFF_OPTIONS_0); - DrawTabImage(rt, WINDOW_MULTIPLAYER_PAGE_OPTIONS, SPR_TAB_GEARS_0); - } } // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/NetworkStatus.cpp b/src/openrct2-ui/windows/NetworkStatus.cpp index b4b337102d..71ec7fdbfe 100644 --- a/src/openrct2-ui/windows/NetworkStatus.cpp +++ b/src/openrct2-ui/windows/NetworkStatus.cpp @@ -34,17 +34,17 @@ namespace OpenRCT2::Ui::Windows class NetworkStatusWindow final : public Window { public: - void OnOpen() override + void onOpen() override { WindowSetResize(*this, kWindowSize, kWindowSize); - SetWidgets(window_network_status_widgets); + setWidgets(window_network_status_widgets); currentFrame = 0; page = 0; listInformationType = 0; } - void OnClose() override + void onClose() override { if (_onClose != nullptr) { @@ -52,22 +52,22 @@ namespace OpenRCT2::Ui::Windows } } - void OnMouseUp(WidgetIndex widgetIndex) override + void onMouseUp(WidgetIndex widgetIndex) override { switch (widgetIndex) { case WIDX_CLOSE: - Close(); + close(); break; } } - void OnUpdate() override + void onUpdate() override { - InvalidateWidget(WIDX_BACKGROUND); + invalidateWidget(WIDX_BACKGROUND); } - void OnTextInput(WidgetIndex widgetIndex, std::string_view text) override + void onTextInput(WidgetIndex widgetIndex, std::string_view text) override { _password.clear(); switch (widgetIndex) @@ -86,7 +86,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnDraw(RenderTarget& rt) override + void onDraw(RenderTarget& rt) override { WindowDrawWidgets(*this, rt); thread_local std::string _buffer; @@ -100,18 +100,18 @@ namespace OpenRCT2::Ui::Windows DrawText(rt, screenCoords, { COLOUR_BLACK }, _buffer.c_str()); } - void SetCloseCallBack(CloseCallback onClose) + void setCloseCallBack(CloseCallback callback) { - _onClose = onClose; + _onClose = callback; } - void SetWindowNetworkStatusText(const std::string& text) + void setWindowNetworkStatusText(const std::string& text) { _windowNetworkStatusText = text; - Invalidate(); + invalidate(); } - void SetPassword(char* password) + void setPassword(char* password) { _password = password; } @@ -139,8 +139,8 @@ namespace OpenRCT2::Ui::Windows WindowClass::NetworkStatus, kWindowSize, WF_10 | WF_TRANSPARENT | WF_CENTRE_SCREEN | WF_STICK_TO_FRONT); } - window->SetCloseCallBack(onClose); - window->SetWindowNetworkStatusText(text); + window->setCloseCallBack(onClose); + window->setWindowNetworkStatusText(text); return window; } @@ -154,8 +154,8 @@ namespace OpenRCT2::Ui::Windows return; } auto networkWindow = static_cast(window); - networkWindow->SetCloseCallBack(nullptr); - networkWindow->Close(); + networkWindow->setCloseCallBack(nullptr); + networkWindow->close(); } WindowBase* NetworkStatusOpenPassword() @@ -168,7 +168,7 @@ namespace OpenRCT2::Ui::Windows char password[33]{}; WindowTextInputRawOpen(window, WIDX_PASSWORD, STR_PASSWORD_REQUIRED, STR_PASSWORD_REQUIRED_DESC, {}, password, 32); - window->SetPassword(password); + window->setPassword(password); return window; } } // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/NewCampaign.cpp b/src/openrct2-ui/windows/NewCampaign.cpp index 3705c4d617..6b09645a6c 100644 --- a/src/openrct2-ui/windows/NewCampaign.cpp +++ b/src/openrct2-ui/windows/NewCampaign.cpp @@ -139,7 +139,7 @@ namespace OpenRCT2::Ui::Windows } public: - void RefreshRides() + void refreshRides() { // Get all applicable rides RideList.clear(); @@ -172,14 +172,14 @@ namespace OpenRCT2::Ui::Windows std::sort(RideList.begin(), RideList.end(), RideNameCompare); } - void OnOpen() override + void onOpen() override { - SetWidgets(window_new_campaign_widgets); + setWidgets(window_new_campaign_widgets); holdDownWidgets = (1uLL << WIDX_WEEKS_INCREASE_BUTTON) | (1uLL << WIDX_WEEKS_DECREASE_BUTTON); WindowInitScrollWidgets(*this); } - void SetCampaign(int16_t campaignType) + void setCampaign(int16_t campaignType) { widgets[WIDX_TITLE].text = kMarketingCampaignNames[campaignType][0]; @@ -192,10 +192,10 @@ namespace OpenRCT2::Ui::Windows // Currently selected ride Campaign.RideId = RideId::GetNull(); - RefreshRides(); + refreshRides(); } - void OnMouseDown(WidgetIndex widgetIndex) override + void onMouseDown(WidgetIndex widgetIndex) override { Widget* widget = &widgets[widgetIndex]; Widget* dropdownWidget; @@ -248,21 +248,21 @@ namespace OpenRCT2::Ui::Windows // In RCT2, the maximum was 6 weeks case WIDX_WEEKS_INCREASE_BUTTON: Campaign.no_weeks = std::min(Campaign.no_weeks + 1, 12); - Invalidate(); + invalidate(); break; case WIDX_WEEKS_DECREASE_BUTTON: Campaign.no_weeks = std::max(Campaign.no_weeks - 1, 2); - Invalidate(); + invalidate(); break; } } - void OnMouseUp(WidgetIndex widgetIndex) override + void onMouseUp(WidgetIndex widgetIndex) override { switch (widgetIndex) { case WIDX_CLOSE: - Close(); + close(); break; case WIDX_START_BUTTON: { @@ -281,7 +281,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) override + void onDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) override { if (widgetIndex != WIDX_RIDE_DROPDOWN_BUTTON) return; @@ -304,10 +304,10 @@ namespace OpenRCT2::Ui::Windows Campaign.RideId = RideList[dropdownIndex]; } - Invalidate(); + invalidate(); } - void OnPrepareDraw() override + void onPrepareDraw() override { widgets[WIDX_RIDE_LABEL].type = WidgetType::empty; widgets[WIDX_RIDE_DROPDOWN].type = WidgetType::empty; @@ -354,11 +354,11 @@ namespace OpenRCT2::Ui::Windows widgetSetDisabled(*this, WIDX_START_BUTTON, true); } - void OnDraw(RenderTarget& rt) override + void onDraw(RenderTarget& rt) override { ScreenCoordsXY screenCoords{}; - DrawWidgets(rt); + drawWidgets(rt); // Number of weeks Widget* spinnerWidget = &widgets[WIDX_WEEKS_SPINNER]; @@ -382,7 +382,7 @@ namespace OpenRCT2::Ui::Windows DrawTextBasic(rt, screenCoords, STR_MARKETING_TOTAL_COST, ft); } - int16_t GetCampaignType() const + int16_t getCampaignType() const { return Campaign.campaign_type; } @@ -394,16 +394,16 @@ namespace OpenRCT2::Ui::Windows auto* w = static_cast(windowMgr->BringToFrontByClass(WindowClass::NewCampaign)); if (w != nullptr) { - if (w->GetCampaignType() == campaignType) + if (w->getCampaignType() == campaignType) return w; - w->Close(); + w->close(); } w = windowMgr->Create(WindowClass::NewCampaign, kWindowSize, 0); if (w != nullptr) { - w->SetCampaign(campaignType); + w->setCampaign(campaignType); } return w; } @@ -414,7 +414,7 @@ namespace OpenRCT2::Ui::Windows auto w = static_cast(windowMgr->FindByClass(WindowClass::NewCampaign)); if (w != nullptr) { - w->RefreshRides(); + w->refreshRides(); } } } // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/NewRide.cpp b/src/openrct2-ui/windows/NewRide.cpp index afdabf8f0c..20ad0321cd 100644 --- a/src/openrct2-ui/windows/NewRide.cpp +++ b/src/openrct2-ui/windows/NewRide.cpp @@ -296,11 +296,11 @@ namespace OpenRCT2::Ui::Windows std::fill_n(NewRideWindow::_windowNewRideTabScroll, RideTabCount, 0); } - void OnOpen() override + void onOpen() override { - SetWidgets(window_new_ride_widgets); + setWidgets(window_new_ride_widgets); PopulateRideList(); - InitScrollWidgets(); + initScrollWidgets(); _filter.clear(); currentFrame = 0; @@ -313,23 +313,23 @@ namespace OpenRCT2::Ui::Windows if (_currentTab < RESEARCH_TAB) { - SetPage(_currentTab); + setPage(_currentTab); RestoreScrollPositionForCurrentTab(); } } - void OnUpdate() override + void onUpdate() override { currentFrame++; if (currentFrame >= TabAnimationLoops[_currentTab]) currentFrame = 0; - InvalidateWidget(WIDX_TAB_1 + static_cast(_currentTab)); + invalidateWidget(WIDX_TAB_1 + static_cast(_currentTab)); if (GetCurrentTextBox().window.classification == classification && GetCurrentTextBox().window.number == number) { WindowUpdateTextboxCaret(); - InvalidateWidget(WIDX_FILTER_TEXT_BOX); + invalidateWidget(WIDX_FILTER_TEXT_BOX); } if (_newRideVars.SelectedRide.Type != kRideTypeNull && _newRideVars.SelectedRideCountdown-- == 0) @@ -347,17 +347,17 @@ namespace OpenRCT2::Ui::Windows if (!widgetIsHighlighted(*this, WIDX_RIDE_LIST) && _newRideVars.HighlightedRide.Type != kRideTypeNull) { _newRideVars.HighlightedRide = { kRideTypeNull, kObjectEntryIndexNull }; - InvalidateWidget(WIDX_RIDE_LIST); + invalidateWidget(WIDX_RIDE_LIST); } } } - void OnMouseUp(WidgetIndex widgetIndex) override + void onMouseUp(WidgetIndex widgetIndex) override { switch (widgetIndex) { case WIDX_CLOSE: - Close(); + close(); break; case WIDX_LAST_DEVELOPMENT_BUTTON: WindowResearchDevelopmentMouseUp(widgetIndex, WIDX_CURRENTLY_IN_DEVELOPMENT_GROUP); @@ -369,7 +369,7 @@ namespace OpenRCT2::Ui::Windows Config::Get().interface.ListRideVehiclesSeparately = !Config::Get().interface.ListRideVehiclesSeparately; Config::Save(); PopulateRideList(); - Invalidate(); + invalidate(); break; case WIDX_FILTER_TEXT_BOX: WindowStartTextbox(*this, widgetIndex, _filter, kTextInputSize); @@ -377,20 +377,20 @@ namespace OpenRCT2::Ui::Windows case WIDX_FILTER_CLEAR_BUTTON: _filter.clear(); scrolls->contentOffsetY = 0; - Invalidate(); + invalidate(); break; } } - void OnMouseDown(WidgetIndex widgetIndex) override + void onMouseDown(WidgetIndex widgetIndex) override { if (widgetIndex >= WIDX_TAB_1 && widgetIndex <= WIDX_TAB_7) { - SetPage(widgetIndex - WIDX_TAB_1); + setPage(widgetIndex - WIDX_TAB_1); } } - void OnPrepareDraw() override + void onPrepareDraw() override { SetPressedTab(); @@ -418,9 +418,9 @@ namespace OpenRCT2::Ui::Windows widgets[WIDX_GROUP_BY_TRACK_TYPE].left = width - 8 - localizedGroupByTrackTypeWidth; } - void OnDraw(RenderTarget& rt) override + void onDraw(RenderTarget& rt) override { - DrawWidgets(rt); + drawWidgets(rt); DrawTabImages(rt); if (_currentTab != RESEARCH_TAB) @@ -435,7 +435,7 @@ namespace OpenRCT2::Ui::Windows } } - ScreenSize OnScrollGetSize(int32_t scrollIndex) override + ScreenSize onScrollGetSize(int32_t scrollIndex) override { RideSelection* listItem = _windowNewRideListItems; @@ -448,7 +448,7 @@ namespace OpenRCT2::Ui::Windows return { widgets[WIDX_RIDE_LIST].width(), ((count + 4) / 5) * 116 }; } - void OnScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override + void onScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override { RideSelection item = ScrollGetRideListItemAt(screenCoords); if (_newRideVars.HighlightedRide == item) @@ -457,10 +457,10 @@ namespace OpenRCT2::Ui::Windows } _newRideVars.HighlightedRide = item; - Invalidate(); + invalidate(); } - void OnScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override + void onScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override { RideSelection item = ScrollGetRideListItemAt(screenCoords); if (item.Type == kRideTypeNull && item.EntryIndex == kObjectEntryIndexNull) @@ -472,10 +472,10 @@ namespace OpenRCT2::Ui::Windows OpenRCT2::Audio::Play(OpenRCT2::Audio::SoundId::Click1, 0, windowPos.x + (width / 2)); _newRideVars.SelectedRideCountdown = 8; - Invalidate(); + invalidate(); } - void OnScrollDraw(int32_t scrollIndex, RenderTarget& rt) override + void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override { if (_currentTab == RESEARCH_TAB) { @@ -515,7 +515,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnTextInput(WidgetIndex widgetIndex, std::string_view text) override + void onTextInput(WidgetIndex widgetIndex, std::string_view text) override { if (widgetIndex != WIDX_FILTER_TEXT_BOX) return; @@ -527,18 +527,18 @@ namespace OpenRCT2::Ui::Windows scrolls->contentOffsetY = 0; PopulateRideList(); - Invalidate(); + invalidate(); } - void SetPage(int tab) + void setPage(int tab) { if (tab >= TRANSPORT_TAB && tab < TAB_COUNT) { - SetPage(static_cast(tab)); + setPage(static_cast(tab)); } } - void SetPage(NewRideTabId tab) + void setPage(NewRideTabId tab) { // Skip setting page if we're already on this page, unless we're initialising the window if (_currentTab == tab && !widgets.empty()) @@ -550,7 +550,7 @@ namespace OpenRCT2::Ui::Windows _newRideVars.SelectedRideCountdown = std::numeric_limits::max(); PopulateRideList(); RefreshWidgetSizing(); - Invalidate(); + invalidate(); if (tab < RESEARCH_TAB) { @@ -567,7 +567,7 @@ namespace OpenRCT2::Ui::Windows return; } - Close(); + close(); auto* windowMgr = Ui::GetWindowManager(); windowMgr->CloseConstructionWindows(); @@ -861,13 +861,13 @@ namespace OpenRCT2::Ui::Windows { ScreenSize newSize = { newWidth, newHeight }; WindowSetResize(*this, newSize, newSize); - OnResize(); + onResize(); widgets[WIDX_GROUP_BY_TRACK_TYPE].left = newWidth - 8 - GroupByTrackTypeWidth; widgets[WIDX_GROUP_BY_TRACK_TYPE].right = newWidth - 8; } - InitScrollWidgets(); + initScrollWidgets(); } RideSelection ScrollGetRideListItemAt(const ScreenCoordsXY& screenCoords) @@ -905,7 +905,7 @@ namespace OpenRCT2::Ui::Windows auto& currentTabScroll = _windowNewRideTabScroll[_currentTab]; // Get maximum scroll height - ScreenSize scrollSize = OnScrollGetSize(0); + ScreenSize scrollSize = onScrollGetSize(0); const Widget& listWidget = widgets[WIDX_RIDE_LIST]; const int32_t listWidgetHeight = listWidget.bottom - listWidget.top - 1; @@ -1086,7 +1086,7 @@ namespace OpenRCT2::Ui::Windows WindowBase* NewRideOpenResearch() { auto w = static_cast(NewRideOpen()); - w->SetPage(RESEARCH_TAB); + w->setPage(RESEARCH_TAB); return w; } @@ -1108,6 +1108,6 @@ namespace OpenRCT2::Ui::Windows return; auto rideTypeIndex = rideEntry->GetFirstNonNullRideType(); - w->SetPage(EnumValue(GetRideTypeDescriptor(rideTypeIndex).Category)); + w->setPage(EnumValue(GetRideTypeDescriptor(rideTypeIndex).Category)); } } // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/News.cpp b/src/openrct2-ui/windows/News.cpp index a7af97a263..0ec326ebb1 100644 --- a/src/openrct2-ui/windows/News.cpp +++ b/src/openrct2-ui/windows/News.cpp @@ -112,25 +112,25 @@ namespace OpenRCT2::Ui::Windows return 4 * FontGetLineHeight(FontStyle::Small) + 2; } - void InitNewsWidgets() + void initNewsWidgets() { - Invalidate(); + invalidate(); page = newsTab; height = kWindowSize.height; - SetWidgets(kNewsTabWidgets); + setWidgets(kNewsTabWidgets); WindowInitScrollWidgets(*this); _pressedNewsItemIndex = -1; auto& widget = widgets[WIDX_SCROLL]; - ScreenSize scrollSize = OnScrollGetSize(0); + ScreenSize scrollSize = onScrollGetSize(0); scrolls[0].contentOffsetY = std::max(0, scrollSize.height - (widget.height() - 1)); widgetScrollUpdateThumbs(*this, WIDX_SCROLL); } - void InitOptionsWidgets() + void initOptionsWidgets() { - Invalidate(); + invalidate(); page = optionsTab; widgets.clear(); @@ -218,15 +218,15 @@ namespace OpenRCT2::Ui::Windows if (height != y) { - Invalidate(); + invalidate(); height = y; widgets[WIDX_BACKGROUND].bottom = y - 1; widgets[WIDX_TAB_BACKGROUND].bottom = y - 1; - Invalidate(); + invalidate(); } // We're not using SetWidgets, so invoke ResizeFrame manually - ResizeFrame(); + resizeFrame(); } bool& GetNotificationValueRef(const NewsOption& def) @@ -236,7 +236,7 @@ namespace OpenRCT2::Ui::Windows return configValue; } - void SetPage(NewsWindowTab newPage) + void setPage(NewsWindowTab newPage) { if (page == newPage && !widgets.empty()) return; @@ -244,28 +244,28 @@ namespace OpenRCT2::Ui::Windows switch (newPage) { case newsTab: - InitNewsWidgets(); + initNewsWidgets(); break; case optionsTab: - InitOptionsWidgets(); + initOptionsWidgets(); break; } - SetWidgetPressed(WIDX_TAB_NEWS, page == newsTab); - SetWidgetPressed(WIDX_TAB_OPTIONS, page == optionsTab); + setWidgetPressed(WIDX_TAB_NEWS, page == newsTab); + setWidgetPressed(WIDX_TAB_OPTIONS, page == optionsTab); } void DrawTabImages(RenderTarget& rt) { - if (!IsWidgetDisabled(WIDX_TAB_NEWS)) + if (!isWidgetDisabled(WIDX_TAB_NEWS)) { auto imageId = ImageId(SPR_G2_TAB_NEWS); auto& widget = widgets[WIDX_TAB_NEWS]; GfxDrawSprite(rt, imageId, windowPos + ScreenCoordsXY{ widget.left + 3, widget.top }); } - if (!IsWidgetDisabled(WIDX_TAB_OPTIONS)) + if (!isWidgetDisabled(WIDX_TAB_OPTIONS)) { auto imageId = ImageId(SPR_TAB_GEARS_0); if (page == optionsTab) @@ -277,12 +277,12 @@ namespace OpenRCT2::Ui::Windows } public: - void OnOpen() override + void onOpen() override { - SetPage(newsTab); + setPage(newsTab); } - void OnPrepareDraw() override + void onPrepareDraw() override { if (page != optionsTab) return; @@ -299,29 +299,29 @@ namespace OpenRCT2::Ui::Windows } const bool& configValue = GetNotificationValueRef(def); - SetCheckboxValue(checkboxWidgetIndex, configValue); + setCheckboxValue(checkboxWidgetIndex, configValue); checkboxWidgetIndex++; } } - void OnDraw(RenderTarget& rt) override + void onDraw(RenderTarget& rt) override { - DrawWidgets(rt); + drawWidgets(rt); DrawTabImages(rt); } - void OnMouseUp(WidgetIndex widgetIndex) override + void onMouseUp(WidgetIndex widgetIndex) override { switch (widgetIndex) { case WIDX_CLOSE: - Close(); + close(); break; case WIDX_TAB_NEWS: - SetPage(newsTab); + setPage(newsTab); break; case WIDX_TAB_OPTIONS: - SetPage(optionsTab); + setPage(optionsTab); break; default: { @@ -337,13 +337,13 @@ namespace OpenRCT2::Ui::Windows configValue = !configValue; Config::Save(); - InvalidateWidget(widgetIndex); + invalidateWidget(widgetIndex); break; } } } - void OnUpdate() override + void onUpdate() override { currentFrame++; @@ -355,7 +355,7 @@ namespace OpenRCT2::Ui::Windows return; } - Invalidate(); + invalidate(); Audio::Play(Audio::SoundId::Click2, 0, windowPos.x + (width / 2)); size_t j = _pressedNewsItemIndex; @@ -388,14 +388,14 @@ namespace OpenRCT2::Ui::Windows } } - ScreenSize OnScrollGetSize(int32_t scrollIndex) override + ScreenSize onScrollGetSize(int32_t scrollIndex) override { int32_t scrollHeight = static_cast(getGameState().newsItems.GetArchived().size()) * CalculateNewsItemHeight(); return { kWindowSize.width, scrollHeight }; } - void OnScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override + void onScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override { int32_t itemHeight = CalculateNewsItemHeight(); int32_t i = 0; @@ -431,12 +431,12 @@ namespace OpenRCT2::Ui::Windows _pressedNewsItemIndex = i; _pressedButtonIndex = buttonIndex; _suspendUpdateTicks = 4; - Invalidate(); + invalidate(); Audio::Play(Audio::SoundId::Click1, 0, windowPos.x + (width / 2)); } } - void OnScrollDraw(int32_t scrollIndex, RenderTarget& rt) override + void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override { int32_t lineHeight = FontGetLineHeight(FontStyle::Small); int32_t itemHeight = CalculateNewsItemHeight(); diff --git a/src/openrct2-ui/windows/ObjectLoadError.cpp b/src/openrct2-ui/windows/ObjectLoadError.cpp index 8d2563ad03..28f4181ca9 100644 --- a/src/openrct2-ui/windows/ObjectLoadError.cpp +++ b/src/openrct2-ui/windows/ObjectLoadError.cpp @@ -390,13 +390,13 @@ namespace OpenRCT2::Ui::Windows { selectedListItem = index; } - InvalidateWidget(WIDX_SCROLL); + invalidateWidget(WIDX_SCROLL); } public: - void OnOpen() override + void onOpen() override { - SetWidgets(window_object_load_error_widgets); + setWidgets(window_object_load_error_widgets); WindowInitScrollWidgets(*this); colours[0] = COLOUR_LIGHT_BLUE; @@ -404,18 +404,18 @@ namespace OpenRCT2::Ui::Windows colours[2] = COLOUR_LIGHT_BLUE; } - void OnClose() override + void onClose() override { _invalidEntries.clear(); _invalidEntries.shrink_to_fit(); } - void OnMouseUp(const WidgetIndex widgetIndex) override + void onMouseUp(const WidgetIndex widgetIndex) override { switch (widgetIndex) { case WIDX_CLOSE: - Close(); + close(); return; case WIDX_COPY_CURRENT: if (selectedListItem > -1 && selectedListItem < numListItems) @@ -435,7 +435,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnUpdate() override + void onUpdate() override { currentFrame++; @@ -443,7 +443,7 @@ namespace OpenRCT2::Ui::Windows if (!widgetIsHighlighted(*this, WIDX_SCROLL)) { _highlightedIndex = -1; - InvalidateWidget(WIDX_SCROLL); + invalidateWidget(WIDX_SCROLL); } #ifndef DISABLE_HTTP @@ -466,18 +466,18 @@ namespace OpenRCT2::Ui::Windows #endif } - ScreenSize OnScrollGetSize(const int32_t scrollIndex) override + ScreenSize onScrollGetSize(const int32_t scrollIndex) override { return ScreenSize(0, numListItems * kScrollableRowHeight); } - void OnScrollMouseDown(const int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override + void onScrollMouseDown(const int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override { const auto selectedItem = screenCoords.y / kScrollableRowHeight; SelectObjectFromList(selectedItem); } - void OnScrollMouseOver(const int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override + void onScrollMouseOver(const int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override { // Highlight item that the cursor is over, or remove highlighting if none const auto selectedItem = screenCoords.y / kScrollableRowHeight; @@ -486,10 +486,10 @@ namespace OpenRCT2::Ui::Windows else _highlightedIndex = selectedItem; - InvalidateWidget(WIDX_SCROLL); + invalidateWidget(WIDX_SCROLL); } - void OnDraw(RenderTarget& rt) override + void onDraw(RenderTarget& rt) override { WindowDrawWidgets(*this, rt); @@ -507,7 +507,7 @@ namespace OpenRCT2::Ui::Windows DrawTextEllipsised(rt, screenPos + ScreenCoordsXY{ 0, 29 }, kWindowSize.width - 5, STR_BLACK_STRING, ft); } - void OnScrollDraw(const int32_t scrollIndex, RenderTarget& rt) override + void onScrollDraw(const int32_t scrollIndex, RenderTarget& rt) override { auto rtCoords = ScreenCoordsXY{ rt.x, rt.y }; GfxFillRect( @@ -558,7 +558,7 @@ namespace OpenRCT2::Ui::Windows } } - void Initialise(utf8* path, const size_t numMissingObjects, const ObjectEntryDescriptor* missingObjects) + void initialise(utf8* path, const size_t numMissingObjects, const ObjectEntryDescriptor* missingObjects) { _invalidEntries = std::vector(missingObjects, missingObjects + numMissingObjects); @@ -566,7 +566,7 @@ namespace OpenRCT2::Ui::Windows numListItems = static_cast(numMissingObjects); _filePath = path; - Invalidate(); + invalidate(); } }; @@ -580,7 +580,7 @@ namespace OpenRCT2::Ui::Windows window = windowMgr->Create(WindowClass::ObjectLoadError, kWindowSize, 0); } - static_cast(window)->Initialise(path, numMissingObjects, missingObjects); + static_cast(window)->initialise(path, numMissingObjects, missingObjects); return window; } diff --git a/src/openrct2-ui/windows/Options.cpp b/src/openrct2-ui/windows/Options.cpp index 223a2822cd..921f3d8ba1 100644 --- a/src/openrct2-ui/windows/Options.cpp +++ b/src/openrct2-ui/windows/Options.cpp @@ -486,12 +486,12 @@ namespace OpenRCT2::Ui::Windows class OptionsWindow final : public Window { public: - void OnOpen() override + void onOpen() override { - SetPage(WINDOW_OPTIONS_PAGE_DISPLAY); + setPage(WINDOW_OPTIONS_PAGE_DISPLAY); } - void OnMouseUp(WidgetIndex widgetIndex) override + void onMouseUp(WidgetIndex widgetIndex) override { if (widgetIndex < WIDX_PAGE_START) CommonMouseUp(widgetIndex); @@ -527,7 +527,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnMouseDown(WidgetIndex widgetIndex) override + void onMouseDown(WidgetIndex widgetIndex) override { switch (page) { @@ -557,7 +557,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) override + void onDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) override { if (dropdownIndex == -1) return; @@ -590,7 +590,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnPrepareDraw() override + void onPrepareDraw() override { CommonPrepareDrawBefore(); @@ -627,9 +627,9 @@ namespace OpenRCT2::Ui::Windows CommonPrepareDrawAfter(); } - void OnDraw(RenderTarget& rt) override + void onDraw(RenderTarget& rt) override { - DrawWidgets(rt); + drawWidgets(rt); DrawTabImages(rt); switch (page) @@ -645,7 +645,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnUpdate() override + void onUpdate() override { CommonUpdate(); @@ -667,7 +667,7 @@ namespace OpenRCT2::Ui::Windows } } - ScreenSize OnScrollGetSize(int32_t scrollIndex) override + ScreenSize onScrollGetSize(int32_t scrollIndex) override { switch (page) { @@ -685,7 +685,7 @@ namespace OpenRCT2::Ui::Windows } } - OpenRCT2String OnTooltip(WidgetIndex widgetIndex, StringId fallback) override + OpenRCT2String onTooltip(WidgetIndex widgetIndex, StringId fallback) override { if (page == WINDOW_OPTIONS_PAGE_ADVANCED) return AdvancedTooltip(widgetIndex, fallback); @@ -712,7 +712,7 @@ namespace OpenRCT2::Ui::Windows } } - return WindowBase::OnTooltip(widgetIndex, fallback); + return WindowBase::onTooltip(widgetIndex, fallback); } private: @@ -722,7 +722,7 @@ namespace OpenRCT2::Ui::Windows switch (widgetIndex) { case WIDX_CLOSE: - Close(); + close(); break; case WIDX_TAB_DISPLAY: case WIDX_TAB_RENDERING: @@ -732,7 +732,7 @@ namespace OpenRCT2::Ui::Windows case WIDX_TAB_INTERFACE: case WIDX_TAB_MISC: case WIDX_TAB_ADVANCED: - SetPage(widgetIndex - WIDX_FIRST_TAB); + setPage(widgetIndex - WIDX_FIRST_TAB); break; } } @@ -764,10 +764,10 @@ namespace OpenRCT2::Ui::Windows if (height != y) { - Invalidate(); + invalidate(); height = y; - ResizeFrame(); - Invalidate(); + resizeFrame(); + invalidate(); } } @@ -775,7 +775,7 @@ namespace OpenRCT2::Ui::Windows { // Tab animation currentFrame++; - InvalidateWidget(WIDX_FIRST_TAB + page); + invalidateWidget(WIDX_FIRST_TAB + page); } #pragma endregion @@ -787,23 +787,23 @@ namespace OpenRCT2::Ui::Windows case WIDX_SHOW_FPS_CHECKBOX: Config::Get().general.ShowFPS ^= 1; Config::Save(); - Invalidate(); + invalidate(); break; case WIDX_MULTITHREADING_CHECKBOX: Config::Get().general.MultiThreading ^= 1; Config::Save(); - Invalidate(); + invalidate(); break; case WIDX_MINIMIZE_FOCUS_LOSS: Config::Get().general.MinimizeFullscreenFocusLoss ^= 1; Config::Save(); - Invalidate(); + invalidate(); break; case WIDX_DISABLE_SCREENSAVER_LOCK: Config::Get().general.DisableScreensaver ^= 1; ApplyScreenSaverLockSetting(); Config::Save(); - Invalidate(); + invalidate(); break; } } @@ -942,7 +942,7 @@ namespace OpenRCT2::Ui::Windows Config::Get().general.DrawingEngine = dstEngine; RefreshVideo(); Config::Save(); - Invalidate(); + invalidate(); } break; case WIDX_FRAME_RATE_LIMIT_DROPDOWN: @@ -966,7 +966,7 @@ namespace OpenRCT2::Ui::Windows DrawingEngineSetVSync(config.UseVSync); Config::Save(); - Invalidate(); + invalidate(); break; } } @@ -994,10 +994,10 @@ namespace OpenRCT2::Ui::Windows disabledWidgets &= ~(1uLL << WIDX_RESOLUTION_LABEL); } - SetCheckboxValue(WIDX_SHOW_FPS_CHECKBOX, Config::Get().general.ShowFPS); - SetCheckboxValue(WIDX_MULTITHREADING_CHECKBOX, Config::Get().general.MultiThreading); - SetCheckboxValue(WIDX_MINIMIZE_FOCUS_LOSS, Config::Get().general.MinimizeFullscreenFocusLoss); - SetCheckboxValue(WIDX_DISABLE_SCREENSAVER_LOCK, Config::Get().general.DisableScreensaver); + setCheckboxValue(WIDX_SHOW_FPS_CHECKBOX, Config::Get().general.ShowFPS); + setCheckboxValue(WIDX_MULTITHREADING_CHECKBOX, Config::Get().general.MultiThreading); + setCheckboxValue(WIDX_MINIMIZE_FOCUS_LOSS, Config::Get().general.MinimizeFullscreenFocusLoss); + setCheckboxValue(WIDX_DISABLE_SCREENSAVER_LOCK, Config::Get().general.DisableScreensaver); // Dropdown captions for straightforward strings. widgets[WIDX_FULLSCREEN].text = FullscreenModeNames[Config::Get().general.FullscreenMode]; @@ -1056,45 +1056,45 @@ namespace OpenRCT2::Ui::Windows case WIDX_DAY_NIGHT_CHECKBOX: Config::Get().general.DayNightCycle ^= 1; Config::Save(); - Invalidate(); + invalidate(); break; case WIDX_ENABLE_LIGHT_FX_CHECKBOX: Config::Get().general.EnableLightFx ^= 1; Config::Save(); - Invalidate(); + invalidate(); break; case WIDX_ENABLE_LIGHT_FX_FOR_VEHICLES_CHECKBOX: Config::Get().general.EnableLightFxForVehicles ^= 1; Config::Save(); - Invalidate(); + invalidate(); break; case WIDX_UPPER_CASE_BANNERS_CHECKBOX: Config::Get().general.UpperCaseBanners ^= 1; Config::Save(); - Invalidate(); + invalidate(); ScrollingTextInvalidate(); break; case WIDX_DISABLE_LIGHTNING_EFFECT_CHECKBOX: Config::Get().general.DisableLightningEffect ^= 1; Config::Save(); - Invalidate(); + invalidate(); break; case WIDX_RENDER_WEATHER_EFFECTS_CHECKBOX: Config::Get().general.RenderWeatherEffects ^= 1; Config::Get().general.RenderWeatherGloom = Config::Get().general.RenderWeatherEffects; Config::Save(); - Invalidate(); + invalidate(); GfxInvalidateScreen(); break; case WIDX_SHOW_GUEST_PURCHASES_CHECKBOX: Config::Get().general.ShowGuestPurchases ^= 1; Config::Save(); - Invalidate(); + invalidate(); break; case WIDX_TRANSPARENT_SCREENSHOTS_CHECKBOX: Config::Get().general.TransparentScreenshot ^= 1; Config::Save(); - Invalidate(); + invalidate(); break; } } @@ -1129,12 +1129,12 @@ namespace OpenRCT2::Ui::Windows void RenderingPrepareDraw() { - SetCheckboxValue(WIDX_TILE_SMOOTHING_CHECKBOX, Config::Get().general.LandscapeSmoothing); - SetCheckboxValue(WIDX_GRIDLINES_CHECKBOX, Config::Get().general.AlwaysShowGridlines); - SetCheckboxValue(WIDX_DAY_NIGHT_CHECKBOX, Config::Get().general.DayNightCycle); - SetCheckboxValue(WIDX_SHOW_GUEST_PURCHASES_CHECKBOX, Config::Get().general.ShowGuestPurchases); - SetCheckboxValue(WIDX_TRANSPARENT_SCREENSHOTS_CHECKBOX, Config::Get().general.TransparentScreenshot); - SetCheckboxValue(WIDX_UPPER_CASE_BANNERS_CHECKBOX, Config::Get().general.UpperCaseBanners); + setCheckboxValue(WIDX_TILE_SMOOTHING_CHECKBOX, Config::Get().general.LandscapeSmoothing); + setCheckboxValue(WIDX_GRIDLINES_CHECKBOX, Config::Get().general.AlwaysShowGridlines); + setCheckboxValue(WIDX_DAY_NIGHT_CHECKBOX, Config::Get().general.DayNightCycle); + setCheckboxValue(WIDX_SHOW_GUEST_PURCHASES_CHECKBOX, Config::Get().general.ShowGuestPurchases); + setCheckboxValue(WIDX_TRANSPARENT_SCREENSHOTS_CHECKBOX, Config::Get().general.TransparentScreenshot); + setCheckboxValue(WIDX_UPPER_CASE_BANNERS_CHECKBOX, Config::Get().general.UpperCaseBanners); static constexpr StringId _virtualFloorStyleStrings[] = { STR_VIRTUAL_FLOOR_STYLE_DISABLED, @@ -1144,7 +1144,7 @@ namespace OpenRCT2::Ui::Windows widgets[WIDX_VIRTUAL_FLOOR].text = _virtualFloorStyleStrings[EnumValue(Config::Get().general.VirtualFloorStyle)]; - SetCheckboxValue(WIDX_ENABLE_LIGHT_FX_CHECKBOX, Config::Get().general.EnableLightFx); + setCheckboxValue(WIDX_ENABLE_LIGHT_FX_CHECKBOX, Config::Get().general.EnableLightFx); if (Config::Get().general.DayNightCycle && Config::Get().general.DrawingEngine == DrawingEngine::SoftwareWithHardwareDisplay) { @@ -1156,7 +1156,7 @@ namespace OpenRCT2::Ui::Windows Config::Get().general.EnableLightFx = false; } - SetCheckboxValue(WIDX_ENABLE_LIGHT_FX_FOR_VEHICLES_CHECKBOX, Config::Get().general.EnableLightFxForVehicles); + setCheckboxValue(WIDX_ENABLE_LIGHT_FX_FOR_VEHICLES_CHECKBOX, Config::Get().general.EnableLightFxForVehicles); if (Config::Get().general.DayNightCycle && Config::Get().general.DrawingEngine == DrawingEngine::SoftwareWithHardwareDisplay && Config::Get().general.EnableLightFx) @@ -1169,13 +1169,13 @@ namespace OpenRCT2::Ui::Windows Config::Get().general.EnableLightFxForVehicles = false; } - widgetSetCheckboxValue( - *this, WIDX_RENDER_WEATHER_EFFECTS_CHECKBOX, + setCheckboxValue( + WIDX_RENDER_WEATHER_EFFECTS_CHECKBOX, Config::Get().general.RenderWeatherEffects || Config::Get().general.RenderWeatherGloom); - SetCheckboxValue(WIDX_DISABLE_LIGHTNING_EFFECT_CHECKBOX, Config::Get().general.DisableLightningEffect); + setCheckboxValue(WIDX_DISABLE_LIGHTNING_EFFECT_CHECKBOX, Config::Get().general.DisableLightningEffect); if (!Config::Get().general.RenderWeatherEffects && !Config::Get().general.RenderWeatherGloom) { - SetCheckboxValue(WIDX_DISABLE_LIGHTNING_EFFECT_CHECKBOX, true); + setCheckboxValue(WIDX_DISABLE_LIGHTNING_EFFECT_CHECKBOX, true); disabledWidgets |= (1uLL << WIDX_DISABLE_LIGHTNING_EFFECT_CHECKBOX); } else @@ -1394,7 +1394,7 @@ namespace OpenRCT2::Ui::Windows case WIDX_SOUND_CHECKBOX: Config::Get().sound.SoundEnabled = !Config::Get().sound.SoundEnabled; Config::Save(); - Invalidate(); + invalidate(); break; case WIDX_MASTER_SOUND_CHECKBOX: @@ -1408,7 +1408,7 @@ namespace OpenRCT2::Ui::Windows auto* windowMgr = Ui::GetWindowManager(); windowMgr->InvalidateByClass(WindowClass::TopToolbar); Config::Save(); - Invalidate(); + invalidate(); break; } @@ -1419,13 +1419,13 @@ namespace OpenRCT2::Ui::Windows OpenRCT2::RideAudio::StopAllChannels(); } Config::Save(); - Invalidate(); + invalidate(); break; case WIDX_AUDIO_FOCUS_CHECKBOX: Config::Get().sound.audio_focus = !Config::Get().sound.audio_focus; Config::Save(); - Invalidate(); + invalidate(); break; } } @@ -1451,7 +1451,7 @@ namespace OpenRCT2::Ui::Windows break; case WIDX_TITLE_MUSIC_DROPDOWN: { - const bool rct1MusicThemeIsAvailable = IsRCT1TitleMusicAvailable(); + const bool rct1MusicThemeIsAvailable = isRCT1TitleMusicAvailable(); int32_t numItems{}; int32_t checkedIndex{}; for (auto theme : TitleThemeOptions) @@ -1494,13 +1494,13 @@ namespace OpenRCT2::Ui::Windows Config::Save(); OpenRCT2::Audio::PlayTitleMusic(); } - Invalidate(); + invalidate(); break; case WIDX_TITLE_MUSIC_DROPDOWN: { // HACK: When RCT1 is not available, it's not in the dropdown, so indices higher than it should be // incremented - const bool rct1MusicThemeIsAvailable = IsRCT1TitleMusicAvailable(); + const bool rct1MusicThemeIsAvailable = isRCT1TitleMusicAvailable(); for (size_t i = 0; i < std::size(TitleThemeOptions) && static_cast(i) <= dropdownIndex; i++) { if (TitleThemeOptions[i].Kind == TitleMusicKind::RCT1 && !rct1MusicThemeIsAvailable) @@ -1509,7 +1509,7 @@ namespace OpenRCT2::Ui::Windows Config::Get().sound.TitleMusic = TitleThemeOptions[dropdownIndex].Kind; Config::Save(); - Invalidate(); + invalidate(); OpenRCT2::Audio::StopTitleMusic(); if (Config::Get().sound.TitleMusic != TitleMusicKind::None) @@ -1530,7 +1530,7 @@ namespace OpenRCT2::Ui::Windows { Config::Get().sound.MasterVolume = masterVolume; Config::Save(); - InvalidateWidget(WIDX_MASTER_VOLUME); + invalidateWidget(WIDX_MASTER_VOLUME); } const auto& soundVolumeWidget = widgets[WIDX_MASTER_VOLUME]; @@ -1540,7 +1540,7 @@ namespace OpenRCT2::Ui::Windows { Config::Get().sound.SoundVolume = soundVolume; Config::Save(); - InvalidateWidget(WIDX_SOUND_VOLUME); + invalidateWidget(WIDX_SOUND_VOLUME); } const auto& musicVolumeWidget = widgets[WIDX_MASTER_VOLUME]; @@ -1550,7 +1550,7 @@ namespace OpenRCT2::Ui::Windows { Config::Get().sound.AudioFocus = rideMusicVolume; Config::Save(); - InvalidateWidget(WIDX_MUSIC_VOLUME); + invalidateWidget(WIDX_MUSIC_VOLUME); } } @@ -1636,19 +1636,19 @@ namespace OpenRCT2::Ui::Windows widgets[WIDX_TITLE_MUSIC].text = GetTitleMusicName(); - SetCheckboxValue(WIDX_SOUND_CHECKBOX, Config::Get().sound.SoundEnabled); - SetCheckboxValue(WIDX_MASTER_SOUND_CHECKBOX, Config::Get().sound.MasterSoundEnabled); - SetCheckboxValue(WIDX_MUSIC_CHECKBOX, Config::Get().sound.RideMusicEnabled); - SetCheckboxValue(WIDX_AUDIO_FOCUS_CHECKBOX, Config::Get().sound.audio_focus); + setCheckboxValue(WIDX_SOUND_CHECKBOX, Config::Get().sound.SoundEnabled); + setCheckboxValue(WIDX_MASTER_SOUND_CHECKBOX, Config::Get().sound.MasterSoundEnabled); + setCheckboxValue(WIDX_MUSIC_CHECKBOX, Config::Get().sound.RideMusicEnabled); + setCheckboxValue(WIDX_AUDIO_FOCUS_CHECKBOX, Config::Get().sound.audio_focus); widgetSetEnabled(*this, WIDX_SOUND_CHECKBOX, Config::Get().sound.MasterSoundEnabled); widgetSetEnabled(*this, WIDX_MUSIC_CHECKBOX, Config::Get().sound.MasterSoundEnabled); // Initialize only on first frame, otherwise the scrollbars won't be able to be modified if (currentFrame == 0) { - InitializeScrollPosition(WIDX_MASTER_VOLUME, 0, Config::Get().sound.MasterVolume); - InitializeScrollPosition(WIDX_SOUND_VOLUME, 1, Config::Get().sound.SoundVolume); - InitializeScrollPosition(WIDX_MUSIC_VOLUME, 2, Config::Get().sound.AudioFocus); + initialiseScrollPosition(WIDX_MASTER_VOLUME, 0, Config::Get().sound.MasterVolume); + initialiseScrollPosition(WIDX_SOUND_VOLUME, 1, Config::Get().sound.SoundVolume); + initialiseScrollPosition(WIDX_MUSIC_VOLUME, 2, Config::Get().sound.AudioFocus); } } @@ -1667,58 +1667,58 @@ namespace OpenRCT2::Ui::Windows case WIDX_SCREEN_EDGE_SCROLLING: Config::Get().general.EdgeScrolling ^= 1; Config::Save(); - Invalidate(); + invalidate(); break; case WIDX_TRAP_CURSOR: Config::Get().general.TrapCursor ^= 1; Config::Save(); ContextSetCursorTrap(Config::Get().general.TrapCursor); - Invalidate(); + invalidate(); break; case WIDX_ZOOM_TO_CURSOR: Config::Get().general.ZoomToCursor ^= 1; Config::Save(); - Invalidate(); + invalidate(); break; case WIDX_WINDOW_BUTTONS_ON_THE_LEFT: Config::Get().interface.WindowButtonsOnTheLeft ^= 1; Config::Save(); - Invalidate(); + invalidate(); windowMgr->InvalidateAll(); - WindowVisitEach([](WindowBase* w) { w->ResizeFrame(); }); + WindowVisitEach([](WindowBase* w) { w->resizeFrame(); }); break; case WIDX_ENLARGED_UI: Config::Get().interface.EnlargedUi ^= 1; if (Config::Get().interface.EnlargedUi == false) Config::Get().interface.TouchEnhancements = false; Config::Save(); - Invalidate(); + invalidate(); windowMgr->InvalidateAll(); - WindowVisitEach([](WindowBase* w) { w->ResizeFrame(); }); + WindowVisitEach([](WindowBase* w) { w->resizeFrame(); }); break; case WIDX_TOUCH_ENHANCEMENTS: Config::Get().interface.TouchEnhancements ^= 1; Config::Save(); - Invalidate(); + invalidate(); windowMgr->InvalidateAll(); break; case WIDX_INVERT_DRAG: Config::Get().general.InvertViewportDrag ^= 1; Config::Save(); - Invalidate(); + invalidate(); break; } } void ControlsPrepareDraw() { - SetCheckboxValue(WIDX_SCREEN_EDGE_SCROLLING, Config::Get().general.EdgeScrolling); - SetCheckboxValue(WIDX_TRAP_CURSOR, Config::Get().general.TrapCursor); - SetCheckboxValue(WIDX_INVERT_DRAG, Config::Get().general.InvertViewportDrag); - SetCheckboxValue(WIDX_ZOOM_TO_CURSOR, Config::Get().general.ZoomToCursor); - SetCheckboxValue(WIDX_WINDOW_BUTTONS_ON_THE_LEFT, Config::Get().interface.WindowButtonsOnTheLeft); - SetCheckboxValue(WIDX_ENLARGED_UI, Config::Get().interface.EnlargedUi); - SetCheckboxValue(WIDX_TOUCH_ENHANCEMENTS, Config::Get().interface.TouchEnhancements); + setCheckboxValue(WIDX_SCREEN_EDGE_SCROLLING, Config::Get().general.EdgeScrolling); + setCheckboxValue(WIDX_TRAP_CURSOR, Config::Get().general.TrapCursor); + setCheckboxValue(WIDX_INVERT_DRAG, Config::Get().general.InvertViewportDrag); + setCheckboxValue(WIDX_ZOOM_TO_CURSOR, Config::Get().general.ZoomToCursor); + setCheckboxValue(WIDX_WINDOW_BUTTONS_ON_THE_LEFT, Config::Get().interface.WindowButtonsOnTheLeft); + setCheckboxValue(WIDX_ENLARGED_UI, Config::Get().interface.EnlargedUi); + setCheckboxValue(WIDX_TOUCH_ENHANCEMENTS, Config::Get().interface.TouchEnhancements); widgetSetEnabled(*this, WIDX_TOUCH_ENHANCEMENTS, Config::Get().interface.EnlargedUi); @@ -1727,12 +1727,12 @@ namespace OpenRCT2::Ui::Windows { // Convert deadzone (0-32767) to percentage (0-100), then to scroll position (0-500) uint8_t deadzonePercent = static_cast((Config::Get().general.gamepadDeadzone / 32767.0f) * 100); - InitializeScrollPosition(WIDX_GAMEPAD_DEADZONE, 0, deadzonePercent); + initialiseScrollPosition(WIDX_GAMEPAD_DEADZONE, 0, deadzonePercent); // Convert sensitivity (0.5-3.0) to percentage (0-100), then to scroll position (0-500) uint8_t sensitivityPercent = static_cast( ((Config::Get().general.gamepadSensitivity - 0.5f) / 2.5f) * 100); - InitializeScrollPosition(WIDX_GAMEPAD_SENSITIVITY, 1, sensitivityPercent); + initialiseScrollPosition(WIDX_GAMEPAD_SENSITIVITY, 1, sensitivityPercent); } } @@ -1743,7 +1743,7 @@ namespace OpenRCT2::Ui::Windows { setting ^= true; Config::Save(); - Invalidate(); + invalidate(); auto* windowMgr = Ui::GetWindowManager(); windowMgr->InvalidateByClass(WindowClass::TopToolbar); @@ -1782,7 +1782,7 @@ namespace OpenRCT2::Ui::Windows break; case WIDX_THEMES_BUTTON: ContextOpenWindow(WindowClass::Themes); - Invalidate(); + invalidate(); break; } } @@ -1806,7 +1806,7 @@ namespace OpenRCT2::Ui::Windows Dropdown::Flag::StayOpen, numItems, widget->width() - 3); gDropdown.items[static_cast(ThemeManagerGetAvailableThemeIndex())].setChecked(true); - InvalidateWidget(WIDX_THEMES_DROPDOWN); + invalidateWidget(WIDX_THEMES_DROPDOWN); break; } } @@ -1827,15 +1827,15 @@ namespace OpenRCT2::Ui::Windows void InterfacePrepareDraw() { - SetCheckboxValue(WIDX_TOOLBAR_BUTTONS_CENTRED, Config::Get().interface.ToolbarButtonsCentred); - SetCheckboxValue(WIDX_TOOLBAR_SHOW_FINANCES, Config::Get().interface.ToolbarShowFinances); - SetCheckboxValue(WIDX_TOOLBAR_SHOW_RESEARCH, Config::Get().interface.ToolbarShowResearch); - SetCheckboxValue(WIDX_TOOLBAR_SHOW_CHEATS, Config::Get().interface.ToolbarShowCheats); - SetCheckboxValue(WIDX_TOOLBAR_SHOW_NEWS, Config::Get().interface.ToolbarShowNews); - SetCheckboxValue(WIDX_TOOLBAR_SHOW_MUTE, Config::Get().interface.ToolbarShowMute); - SetCheckboxValue(WIDX_TOOLBAR_SHOW_CHAT, Config::Get().interface.ToolbarShowChat); - SetCheckboxValue(WIDX_TOOLBAR_SHOW_ZOOM, Config::Get().interface.ToolbarShowZoom); - SetCheckboxValue(WIDX_TOOLBAR_SHOW_ROTATE_ANTI_CLOCKWISE, Config::Get().interface.ToolbarShowRotateAnticlockwise); + setCheckboxValue(WIDX_TOOLBAR_BUTTONS_CENTRED, Config::Get().interface.ToolbarButtonsCentred); + setCheckboxValue(WIDX_TOOLBAR_SHOW_FINANCES, Config::Get().interface.ToolbarShowFinances); + setCheckboxValue(WIDX_TOOLBAR_SHOW_RESEARCH, Config::Get().interface.ToolbarShowResearch); + setCheckboxValue(WIDX_TOOLBAR_SHOW_CHEATS, Config::Get().interface.ToolbarShowCheats); + setCheckboxValue(WIDX_TOOLBAR_SHOW_NEWS, Config::Get().interface.ToolbarShowNews); + setCheckboxValue(WIDX_TOOLBAR_SHOW_MUTE, Config::Get().interface.ToolbarShowMute); + setCheckboxValue(WIDX_TOOLBAR_SHOW_CHAT, Config::Get().interface.ToolbarShowChat); + setCheckboxValue(WIDX_TOOLBAR_SHOW_ZOOM, Config::Get().interface.ToolbarShowZoom); + setCheckboxValue(WIDX_TOOLBAR_SHOW_ROTATE_ANTI_CLOCKWISE, Config::Get().interface.ToolbarShowRotateAnticlockwise); size_t activeAvailableThemeIndex = ThemeManagerGetAvailableThemeIndex(); const utf8* activeThemeName = ThemeManagerGetAvailableThemeName(activeAvailableThemeIndex); @@ -1853,19 +1853,19 @@ namespace OpenRCT2::Ui::Windows case WIDX_REAL_NAMES_GUESTS_CHECKBOX: Config::Get().general.ShowRealNamesOfGuests ^= 1; Config::Save(); - Invalidate(); + invalidate(); PeepUpdateNames(); break; case WIDX_REAL_NAMES_STAFF_CHECKBOX: Config::Get().general.ShowRealNamesOfStaff ^= 1; Config::Save(); - Invalidate(); + invalidate(); PeepUpdateNames(); break; case WIDX_AUTO_STAFF_PLACEMENT: Config::Get().general.AutoStaffPlacement ^= 1; Config::Save(); - Invalidate(); + invalidate(); break; case WIDX_SCENARIO_UNLOCKING: { @@ -1878,11 +1878,11 @@ namespace OpenRCT2::Ui::Windows case WIDX_AUTO_OPEN_SHOPS: Config::Get().general.AutoOpenShops = !Config::Get().general.AutoOpenShops; Config::Save(); - Invalidate(); + invalidate(); break; case WIDX_ALLOW_EARLY_COMPLETION: Config::Get().general.AllowEarlyCompletion ^= 1; - // Only the server can control this setting and needs to send the + // only the server can control this setting and needs to send the // current value of allow_early_completion to all clients if (Network::GetMode() == Network::Mode::server) { @@ -1891,7 +1891,7 @@ namespace OpenRCT2::Ui::Windows GameActions::Execute(&setAllowEarlyCompletionAction, getGameState()); } Config::Save(); - Invalidate(); + invalidate(); break; } } @@ -1963,13 +1963,13 @@ namespace OpenRCT2::Ui::Windows Config::Get().interface.RandomTitleSequence = false; TitleSequenceChangePreset(static_cast(dropdownIndex)); Config::Save(); - Invalidate(); + invalidate(); } else if (dropdownIndex == numItems + 1) { Config::Get().interface.RandomTitleSequence = true; Config::Save(); - Invalidate(); + invalidate(); } break; } @@ -1978,7 +1978,7 @@ namespace OpenRCT2::Ui::Windows { Config::Get().general.DefaultInspectionInterval = static_cast(dropdownIndex); Config::Save(); - Invalidate(); + invalidate(); } break; case WIDX_SCENARIO_PREVIEWS_DROPDOWN: @@ -1986,7 +1986,7 @@ namespace OpenRCT2::Ui::Windows { Config::Get().interface.scenarioPreviewScreenshots = dropdownIndex; Config::Save(); - Invalidate(); + invalidate(); auto* windowMgr = Ui::GetWindowManager(); windowMgr->InvalidateByClass(WindowClass::ScenarioSelect); } @@ -2026,18 +2026,18 @@ namespace OpenRCT2::Ui::Windows } } - SetCheckboxValue(WIDX_REAL_NAMES_GUESTS_CHECKBOX, Config::Get().general.ShowRealNamesOfGuests); - SetCheckboxValue(WIDX_REAL_NAMES_STAFF_CHECKBOX, Config::Get().general.ShowRealNamesOfStaff); - SetCheckboxValue(WIDX_AUTO_STAFF_PLACEMENT, Config::Get().general.AutoStaffPlacement); - SetCheckboxValue(WIDX_AUTO_OPEN_SHOPS, Config::Get().general.AutoOpenShops); - SetCheckboxValue(WIDX_ALLOW_EARLY_COMPLETION, Config::Get().general.AllowEarlyCompletion); + setCheckboxValue(WIDX_REAL_NAMES_GUESTS_CHECKBOX, Config::Get().general.ShowRealNamesOfGuests); + setCheckboxValue(WIDX_REAL_NAMES_STAFF_CHECKBOX, Config::Get().general.ShowRealNamesOfStaff); + setCheckboxValue(WIDX_AUTO_STAFF_PLACEMENT, Config::Get().general.AutoStaffPlacement); + setCheckboxValue(WIDX_AUTO_OPEN_SHOPS, Config::Get().general.AutoOpenShops); + setCheckboxValue(WIDX_ALLOW_EARLY_COMPLETION, Config::Get().general.AllowEarlyCompletion); if (Config::Get().interface.scenarioPreviewScreenshots) widgets[WIDX_SCENARIO_PREVIEWS].text = STR_SCENARIO_PREVIEWS_SCREENSHOTS; else widgets[WIDX_SCENARIO_PREVIEWS].text = STR_SCENARIO_PREVIEWS_MINIMAPS; - SetCheckboxValue(WIDX_SCENARIO_UNLOCKING, Config::Get().general.ScenarioUnlockingEnabled); + setCheckboxValue(WIDX_SCENARIO_UNLOCKING, Config::Get().general.ScenarioUnlockingEnabled); widgets[WIDX_DEFAULT_INSPECTION_INTERVAL].text = kRideInspectionIntervalNames [Config::Get().general.DefaultInspectionInterval]; @@ -2058,17 +2058,17 @@ namespace OpenRCT2::Ui::Windows case WIDX_EXPORT_CUSTOM_OBJECTS_CHECKBOX: Config::Get().general.SavePluginData ^= 1; Config::Save(); - Invalidate(); + invalidate(); break; case WIDX_STAY_CONNECTED_AFTER_DESYNC: Config::Get().network.StayConnected = !Config::Get().network.StayConnected; Config::Save(); - Invalidate(); + invalidate(); break; case WIDX_ALWAYS_NATIVE_LOADSAVE: Config::Get().general.UseNativeBrowseDialog = !Config::Get().general.UseNativeBrowseDialog; Config::Save(); - Invalidate(); + invalidate(); break; case WIDX_PATH_TO_RCT1_BROWSE: { @@ -2103,7 +2103,7 @@ namespace OpenRCT2::Ui::Windows ContextShowError(STR_PATH_TO_RCT1_WRONG_ERROR, kStringIdNone, {}); } } - Invalidate(); + invalidate(); break; } case WIDX_PATH_TO_RCT1_CLEAR: @@ -2112,7 +2112,7 @@ namespace OpenRCT2::Ui::Windows Config::Get().general.RCT1Path.clear(); Config::Save(); } - Invalidate(); + invalidate(); break; case WIDX_ASSET_PACKS: ContextOpenWindow(WindowClass::AssetPacks); @@ -2146,18 +2146,18 @@ namespace OpenRCT2::Ui::Windows case WIDX_AUTOSAVE_AMOUNT_UP: Config::Get().general.AutosaveAmount += 1; Config::Save(); - InvalidateWidget(WIDX_AUTOSAVE_FREQUENCY); - InvalidateWidget(WIDX_AUTOSAVE_FREQUENCY_DROPDOWN); - InvalidateWidget(WIDX_AUTOSAVE_AMOUNT); + invalidateWidget(WIDX_AUTOSAVE_FREQUENCY); + invalidateWidget(WIDX_AUTOSAVE_FREQUENCY_DROPDOWN); + invalidateWidget(WIDX_AUTOSAVE_AMOUNT); break; case WIDX_AUTOSAVE_AMOUNT_DOWN: if (Config::Get().general.AutosaveAmount > 1) { Config::Get().general.AutosaveAmount -= 1; Config::Save(); - InvalidateWidget(WIDX_AUTOSAVE_FREQUENCY); - InvalidateWidget(WIDX_AUTOSAVE_FREQUENCY_DROPDOWN); - InvalidateWidget(WIDX_AUTOSAVE_AMOUNT); + invalidateWidget(WIDX_AUTOSAVE_FREQUENCY); + invalidateWidget(WIDX_AUTOSAVE_FREQUENCY_DROPDOWN); + invalidateWidget(WIDX_AUTOSAVE_AMOUNT); } } } @@ -2171,7 +2171,7 @@ namespace OpenRCT2::Ui::Windows { Config::Get().general.AutosaveFrequency = static_cast(dropdownIndex); Config::Save(); - Invalidate(); + invalidate(); } break; } @@ -2206,12 +2206,12 @@ namespace OpenRCT2::Ui::Windows widgets[WIDX_PATH_TO_RCT1_BROWSE].left = widgets[WIDX_PATH_TO_RCT1_BROWSE].right - browseLabelWidth; } - SetCheckboxValue(WIDX_EXPORT_CUSTOM_OBJECTS_CHECKBOX, Config::Get().general.SavePluginData); - SetCheckboxValue(WIDX_ALWAYS_NATIVE_LOADSAVE, Config::Get().general.UseNativeBrowseDialog); + setCheckboxValue(WIDX_EXPORT_CUSTOM_OBJECTS_CHECKBOX, Config::Get().general.SavePluginData); + setCheckboxValue(WIDX_ALWAYS_NATIVE_LOADSAVE, Config::Get().general.UseNativeBrowseDialog); widgets[WIDX_AUTOSAVE_FREQUENCY].text = AutosaveNames[Config::Get().general.AutosaveFrequency]; - SetCheckboxValue(WIDX_DEBUGGING_TOOLS, Config::Get().general.DebuggingTools); - SetCheckboxValue(WIDX_STAY_CONNECTED_AFTER_DESYNC, Config::Get().network.StayConnected); + setCheckboxValue(WIDX_DEBUGGING_TOOLS, Config::Get().general.DebuggingTools); + setCheckboxValue(WIDX_STAY_CONNECTED_AFTER_DESYNC, Config::Get().network.StayConnected); #ifdef __EMSCRIPTEN__ widgets[WIDX_GROUP_ADVANCED].bottom = kAdvancedStart + 84 + getTitleBarDiffNormal(); @@ -2267,7 +2267,7 @@ namespace OpenRCT2::Ui::Windows #pragma endregion - void SetPage(int32_t p) + void setPage(int32_t p) { // Skip setting page if we're already on this page, unless we're initialising the window if (page == p && !widgets.empty()) @@ -2276,13 +2276,13 @@ namespace OpenRCT2::Ui::Windows page = p; currentFrame = 0; pressedWidgets = 0; - SetWidgets(window_options_page_widgets[page]); + setWidgets(window_options_page_widgets[page]); - Invalidate(); - OnPrepareDraw(); - OnResize(); - InitScrollWidgets(); - Invalidate(); + invalidate(); + onPrepareDraw(); + onResize(); + initScrollWidgets(); + invalidate(); } void SetPressedTab() @@ -2356,7 +2356,7 @@ namespace OpenRCT2::Ui::Windows return static_cast(scroll.contentOffsetX) / (scroll.contentWidth - w) * 100; } - void InitializeScrollPosition(WidgetIndex widgetIndex, int32_t scrollId, uint8_t volume) + void initialiseScrollPosition(WidgetIndex widgetIndex, int32_t scrollId, uint8_t volume) { const auto& widget = widgets[widgetIndex]; auto& scroll = scrolls[scrollId]; @@ -2367,7 +2367,7 @@ namespace OpenRCT2::Ui::Windows widgetScrollUpdateThumbs(*this, widgetIndex); } - static bool IsRCT1TitleMusicAvailable() + static bool isRCT1TitleMusicAvailable() { auto& env = GetContext()->GetPlatformEnvironment(); auto rct1path = env.GetDirectoryPath(DirBase::rct1); diff --git a/src/openrct2-ui/windows/OverwritePrompt.cpp b/src/openrct2-ui/windows/OverwritePrompt.cpp index 69f0bf5718..777beae40f 100644 --- a/src/openrct2-ui/windows/OverwritePrompt.cpp +++ b/src/openrct2-ui/windows/OverwritePrompt.cpp @@ -58,12 +58,12 @@ namespace OpenRCT2::Ui::Windows { } - void OnOpen() override + void onOpen() override { - SetWidgets(window_overwrite_prompt_widgets); + setWidgets(window_overwrite_prompt_widgets); } - void OnMouseUp(WidgetIndex widgetIndex) override + void onMouseUp(WidgetIndex widgetIndex) override { switch (widgetIndex) { @@ -80,14 +80,14 @@ namespace OpenRCT2::Ui::Windows case WIDX_OVERWRITE_CANCEL: case WIDX_OVERWRITE_CLOSE: - Close(); + close(); break; } } - void OnDraw(RenderTarget& rt) override + void onDraw(RenderTarget& rt) override { - DrawWidgets(rt); + drawWidgets(rt); auto ft = Formatter(); ft.Add(STR_STRING); @@ -121,11 +121,11 @@ namespace OpenRCT2::Ui::Windows if (keycode == SDLK_RETURN || keycode == SDLK_KP_ENTER) { - promptWindow->OnMouseUp(WIDX_OVERWRITE_OVERWRITE); + promptWindow->onMouseUp(WIDX_OVERWRITE_OVERWRITE); } else if (keycode == SDLK_ESCAPE) { - promptWindow->OnMouseUp(WIDX_OVERWRITE_CANCEL); + promptWindow->onMouseUp(WIDX_OVERWRITE_CANCEL); } } } // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/Park.cpp b/src/openrct2-ui/windows/Park.cpp index 5af970b4ab..5410d264da 100644 --- a/src/openrct2-ui/windows/Park.cpp +++ b/src/openrct2-ui/windows/Park.cpp @@ -180,14 +180,14 @@ namespace OpenRCT2::Ui::Windows ScreenRect _guestGraphBounds; public: - void OnOpen() override + void onOpen() override { number = 0; currentFrame = 0; _numberOfRides = -1; _numberOfStaff = -1; _peepAnimationFrame = 0; - SetPage(0); + setPage(0); _ratingProps.lineCol = colours[2]; _guestProps.lineCol = colours[2]; @@ -195,7 +195,7 @@ namespace OpenRCT2::Ui::Windows _guestProps.hoverIdx = -1; } - void OnClose() override + void onClose() override { if (isToolActive(classification, number)) { @@ -203,12 +203,12 @@ namespace OpenRCT2::Ui::Windows } } - void OnMouseUp(WidgetIndex idx) override + void onMouseUp(WidgetIndex idx) override { switch (idx) { case WIDX_CLOSE: - Close(); + close(); return; case WIDX_TAB_1: case WIDX_TAB_2: @@ -217,176 +217,176 @@ namespace OpenRCT2::Ui::Windows case WIDX_TAB_5: case WIDX_TAB_6: case WIDX_TAB_7: - SetPage(idx - WIDX_TAB_1); + setPage(idx - WIDX_TAB_1); return; } switch (page) { case WINDOW_PARK_PAGE_ENTRANCE: - OnMouseUpEntrance(idx); + onMouseUpEntrance(idx); break; case WINDOW_PARK_PAGE_OBJECTIVE: - OnMouseUpObjective(idx); + onMouseUpObjective(idx); break; } } - void OnResize() override + void onResize() override { switch (page) { case WINDOW_PARK_PAGE_ENTRANCE: - OnResizeEntrance(); + onResizeEntrance(); break; case WINDOW_PARK_PAGE_RATING: - OnResizeRating(); + onResizeRating(); break; case WINDOW_PARK_PAGE_GUESTS: - OnResizeGuests(); + onResizeGuests(); break; case WINDOW_PARK_PAGE_PRICE: - OnResizePrice(); + onResizePrice(); break; case WINDOW_PARK_PAGE_STATS: - OnResizeStats(); + onResizeStats(); break; case WINDOW_PARK_PAGE_OBJECTIVE: - OnResizeObjective(); + onResizeObjective(); break; case WINDOW_PARK_PAGE_AWARDS: - OnResizeAwards(); + onResizeAwards(); break; } } - void OnMouseDown(WidgetIndex idx) override + void onMouseDown(WidgetIndex idx) override { switch (page) { case WINDOW_PARK_PAGE_ENTRANCE: - OnMouseDownEntrance(idx); + onMouseDownEntrance(idx); break; case WINDOW_PARK_PAGE_PRICE: - OnMouseDownPrice(idx); + onMouseDownPrice(idx); break; } } - void OnDropdown(WidgetIndex widgetIndex, int32_t selectedIndex) override + void onDropdown(WidgetIndex widgetIndex, int32_t selectedIndex) override { switch (page) { case WINDOW_PARK_PAGE_ENTRANCE: - OnDropdownEntrance(widgetIndex, selectedIndex); + onDropdownEntrance(widgetIndex, selectedIndex); break; } } - void OnUpdate() override + void onUpdate() override { switch (page) { case WINDOW_PARK_PAGE_ENTRANCE: - OnUpdateEntrance(); + onUpdateEntrance(); break; case WINDOW_PARK_PAGE_RATING: - OnUpdateRating(); + onUpdateRating(); break; case WINDOW_PARK_PAGE_GUESTS: - OnUpdateGuests(); + onUpdateGuests(); break; case WINDOW_PARK_PAGE_PRICE: - OnUpdatePrice(); + onUpdatePrice(); break; case WINDOW_PARK_PAGE_STATS: - OnUpdateStats(); + onUpdateStats(); break; case WINDOW_PARK_PAGE_OBJECTIVE: - OnUpdateObjective(); + onUpdateObjective(); break; case WINDOW_PARK_PAGE_AWARDS: - OnUpdateAwards(); + onUpdateAwards(); break; } } - void OnTextInput(WidgetIndex widgetIndex, std::string_view text) override + void onTextInput(WidgetIndex widgetIndex, std::string_view text) override { switch (page) { case WINDOW_PARK_PAGE_ENTRANCE: - OnTextInputEntrance(widgetIndex, text); + onTextInputEntrance(widgetIndex, text); break; case WINDOW_PARK_PAGE_OBJECTIVE: - OnTextInputObjective(widgetIndex, text); + onTextInputObjective(widgetIndex, text); break; case WINDOW_PARK_PAGE_PRICE: - OnTextInputPrice(widgetIndex, text); + onTextInputPrice(widgetIndex, text); break; } } - void OnPrepareDraw() override + void onPrepareDraw() override { switch (page) { case WINDOW_PARK_PAGE_ENTRANCE: - OnPrepareDrawEntrance(); + onPrepareDrawEntrance(); break; case WINDOW_PARK_PAGE_RATING: - OnPrepareDrawRating(); + onPrepareDrawRating(); break; case WINDOW_PARK_PAGE_GUESTS: - OnPrepareDrawGuests(); + onPrepareDrawGuests(); break; case WINDOW_PARK_PAGE_PRICE: - OnPrepareDrawPrice(); + onPrepareDrawPrice(); break; case WINDOW_PARK_PAGE_STATS: - OnPrepareDrawStats(); + onPrepareDrawStats(); break; case WINDOW_PARK_PAGE_OBJECTIVE: - OnPrepareDrawObjective(); + onPrepareDrawObjective(); break; case WINDOW_PARK_PAGE_AWARDS: - OnPrepareDrawAwards(); + onPrepareDrawAwards(); break; } } - void OnDraw(RenderTarget& rt) override + void onDraw(RenderTarget& rt) override { switch (page) { case WINDOW_PARK_PAGE_ENTRANCE: - OnDrawEntrance(rt); + onDrawEntrance(rt); break; case WINDOW_PARK_PAGE_RATING: - OnDrawRating(rt); + onDrawRating(rt); break; case WINDOW_PARK_PAGE_GUESTS: - OnDrawGuests(rt); + onDrawGuests(rt); break; case WINDOW_PARK_PAGE_PRICE: - OnDrawPrice(rt); + onDrawPrice(rt); break; case WINDOW_PARK_PAGE_STATS: - OnDrawStats(rt); + onDrawStats(rt); break; case WINDOW_PARK_PAGE_OBJECTIVE: - OnDrawObjective(rt); + onDrawObjective(rt); break; case WINDOW_PARK_PAGE_AWARDS: - OnDrawAwards(rt); + onDrawAwards(rt); break; } } - void OnViewportRotate() override + void onViewportRotate() override { if (page == WINDOW_PARK_PAGE_ENTRANCE) { - InitViewport(); + initViewport(); } } @@ -407,7 +407,7 @@ namespace OpenRCT2::Ui::Windows } #pragma region Entrance page - void OnMouseUpEntrance(WidgetIndex widgetIndex) + void onMouseUpEntrance(WidgetIndex widgetIndex) { switch (widgetIndex) { @@ -415,7 +415,7 @@ namespace OpenRCT2::Ui::Windows ContextOpenWindow(WindowClass::LandRights); break; case WIDX_LOCATE: - ScrollToViewport(); + scrollToViewport(); break; case WIDX_RENAME: { @@ -433,14 +433,14 @@ namespace OpenRCT2::Ui::Windows } } - void OnResizeEntrance() + void onResizeEntrance() { flags |= WF_RESIZABLE; WindowSetResize(*this, { 230, 174 + 9 }, { 230 * 3, (274 + 9) * 3 }); - InitViewport(); + initViewport(); } - void OnMouseDownEntrance(WidgetIndex widgetIndex) + void onMouseDownEntrance(WidgetIndex widgetIndex) { if (widgetIndex == WIDX_OPEN_OR_CLOSE) { @@ -463,7 +463,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnDropdownEntrance(WidgetIndex widgetIndex, int32_t dropdownIndex) + void onDropdownEntrance(WidgetIndex widgetIndex, int32_t dropdownIndex) { if (widgetIndex == WIDX_OPEN_OR_CLOSE) { @@ -481,13 +481,13 @@ namespace OpenRCT2::Ui::Windows } } - void OnUpdateEntrance() + void onUpdateEntrance() { currentFrame++; - InvalidateWidget(WIDX_TAB_1); + invalidateWidget(WIDX_TAB_1); } - void OnTextInputEntrance(WidgetIndex widgetIndex, std::string_view text) + void onTextInputEntrance(WidgetIndex widgetIndex, std::string_view text) { if (widgetIndex == WIDX_RENAME && !text.empty()) { @@ -496,10 +496,10 @@ namespace OpenRCT2::Ui::Windows } } - void OnPrepareDrawEntrance() + void onPrepareDrawEntrance() { const auto& gameState = getGameState(); - InitScrollWidgets(); + initScrollWidgets(); SetPressedTab(); @@ -519,13 +519,13 @@ namespace OpenRCT2::Ui::Windows const auto openLightImage = SPR_G2_RCT1_OPEN_BUTTON_0 + parkIsOpen * 2 + widgetIsPressed(*this, WIDX_OPEN_LIGHT); widgets[WIDX_OPEN_LIGHT].image = ImageId(openLightImage); - // Only allow closing of park for guest / rating objective + // only allow closing of park for guest / rating objective if (gameState.scenarioOptions.objective.Type == Scenario::ObjectiveType::guestsAndRating) disabledWidgets |= (1uLL << WIDX_OPEN_OR_CLOSE) | (1uLL << WIDX_CLOSE_LIGHT) | (1uLL << WIDX_OPEN_LIGHT); else disabledWidgets &= ~((1uLL << WIDX_OPEN_OR_CLOSE) | (1uLL << WIDX_CLOSE_LIGHT) | (1uLL << WIDX_OPEN_LIGHT)); - // Only allow purchase of land when there is money + // only allow purchase of land when there is money if (gameState.park.flags & PARK_FLAGS_NO_MONEY) widgets[WIDX_BUY_LAND_RIGHTS].type = WidgetType::empty; else @@ -582,9 +582,9 @@ namespace OpenRCT2::Ui::Windows } } - void OnDrawEntrance(RenderTarget& rt) + void onDrawEntrance(RenderTarget& rt) { - DrawWidgets(rt); + drawWidgets(rt); DrawTabImages(rt); // Draw viewport @@ -605,7 +605,7 @@ namespace OpenRCT2::Ui::Windows ft, { TextAlignment::CENTRE }); } - void InitViewport() + void initViewport() { if (page != WINDOW_PARK_PAGE_ENTRANCE) return; @@ -627,11 +627,11 @@ namespace OpenRCT2::Ui::Windows else { viewportFlags = viewport->flags; - RemoveViewport(); + removeViewport(); } // Call invalidate event - OnPrepareDraw(); + onPrepareDraw(); focus = newFocus; @@ -645,35 +645,35 @@ namespace OpenRCT2::Ui::Windows *this, windowPos + ScreenCoordsXY{ viewportWidget->left + 1, viewportWidget->top + 1 }, viewportWidget->width() - 1, viewportWidget->height() - 1, focus.value()); flags |= WF_NO_SCROLLING; - Invalidate(); + invalidate(); } } if (viewport != nullptr) viewport->flags = viewportFlags; - Invalidate(); + invalidate(); } #pragma endregion #pragma region Rating page - void OnResizeRating() + void onResizeRating() { flags |= WF_RESIZABLE; WindowSetResize(*this, { 268, 174 + 9 }, kMaxWindowSize); } - void OnUpdateRating() + void onUpdateRating() { currentFrame++; - InvalidateWidget(WIDX_TAB_2); + invalidateWidget(WIDX_TAB_2); if (_ratingProps.UpdateHoverIndex()) { - InvalidateWidget(WIDX_BACKGROUND); + invalidateWidget(WIDX_BACKGROUND); } } - void OnPrepareDrawRating() + void onPrepareDrawRating() { SetPressedTab(); PrepareWindowTitleText(); @@ -697,9 +697,9 @@ namespace OpenRCT2::Ui::Windows kGraphNumYLabels, kParkRatingHistorySize); } - void OnDrawRating(RenderTarget& rt) + void onDrawRating(RenderTarget& rt) { - DrawWidgets(rt); + drawWidgets(rt); DrawTabImages(rt); Widget* widget = &widgets[WIDX_PAGE_BACKGROUND]; @@ -724,24 +724,24 @@ namespace OpenRCT2::Ui::Windows #pragma endregion #pragma region Guests page - void OnResizeGuests() + void onResizeGuests() { flags |= WF_RESIZABLE; WindowSetResize(*this, { 268, 174 + 9 }, kMaxWindowSize); } - void OnUpdateGuests() + void onUpdateGuests() { currentFrame++; _peepAnimationFrame = (_peepAnimationFrame + 1) % 24; - InvalidateWidget(WIDX_TAB_3); + invalidateWidget(WIDX_TAB_3); if (_guestProps.UpdateHoverIndex()) { - InvalidateWidget(WIDX_BACKGROUND); + invalidateWidget(WIDX_BACKGROUND); } } - void OnPrepareDrawGuests() + void onPrepareDrawGuests() { SetPressedTab(); PrepareWindowTitleText(); @@ -776,9 +776,9 @@ namespace OpenRCT2::Ui::Windows kGraphNumYLabels, kGuestsInParkHistorySize); } - void OnDrawGuests(RenderTarget& rt) + void onDrawGuests(RenderTarget& rt) { - DrawWidgets(rt); + drawWidgets(rt); DrawTabImages(rt); Widget* widget = &widgets[WIDX_PAGE_BACKGROUND]; @@ -803,12 +803,12 @@ namespace OpenRCT2::Ui::Windows #pragma endregion #pragma region Price page - void OnResizePrice() + void onResizePrice() { WindowSetResize(*this, { 230, 124 }, { 230, 124 }); } - void OnMouseDownPrice(WidgetIndex widgetIndex) + void onMouseDownPrice(WidgetIndex widgetIndex) { auto& gameState = getGameState(); switch (widgetIndex) @@ -837,13 +837,13 @@ namespace OpenRCT2::Ui::Windows } } - void OnUpdatePrice() + void onUpdatePrice() { currentFrame++; - InvalidateWidget(WIDX_TAB_4); + invalidateWidget(WIDX_TAB_4); } - void OnPrepareDrawPrice() + void onPrepareDrawPrice() { SetPressedTab(); PrepareWindowTitleText(); @@ -875,9 +875,9 @@ namespace OpenRCT2::Ui::Windows WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_7); } - void OnDrawPrice(RenderTarget& rt) + void onDrawPrice(RenderTarget& rt) { - DrawWidgets(rt); + drawWidgets(rt); DrawTabImages(rt); auto screenCoords = windowPos @@ -900,22 +900,22 @@ namespace OpenRCT2::Ui::Windows #pragma endregion #pragma region Stats page - void OnResizeStats() + void onResizeStats() { WindowSetResize(*this, { 230, 119 }, { 230, 119 }); } - void OnUpdateStats() + void onUpdateStats() { currentFrame++; - InvalidateWidget(WIDX_TAB_5); + invalidateWidget(WIDX_TAB_5); // Invalidate ride count if changed const auto rideCount = RideGetCount(); if (_numberOfRides != rideCount) { _numberOfRides = rideCount; - InvalidateWidget(WIDX_PAGE_BACKGROUND); + invalidateWidget(WIDX_PAGE_BACKGROUND); } // Invalidate number of staff if changed @@ -923,11 +923,11 @@ namespace OpenRCT2::Ui::Windows if (_numberOfStaff != staffCount) { _numberOfStaff = staffCount; - InvalidateWidget(WIDX_PAGE_BACKGROUND); + invalidateWidget(WIDX_PAGE_BACKGROUND); } } - void OnPrepareDrawStats() + void onPrepareDrawStats() { SetPressedTab(); PrepareWindowTitleText(); @@ -935,9 +935,9 @@ namespace OpenRCT2::Ui::Windows WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_7); } - void OnDrawStats(RenderTarget& rt) + void onDrawStats(RenderTarget& rt) { - DrawWidgets(rt); + drawWidgets(rt); DrawTabImages(rt); auto screenCoords = windowPos @@ -988,7 +988,7 @@ namespace OpenRCT2::Ui::Windows #pragma endregion #pragma region Objective page - void OnMouseUpObjective(WidgetIndex widgetIndex) + void onMouseUpObjective(WidgetIndex widgetIndex) { switch (widgetIndex) { @@ -1000,7 +1000,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnResizeObjective() + void onResizeObjective() { #ifndef DISABLE_TTF if (gCurrentTTFFontSet != nullptr) @@ -1010,23 +1010,23 @@ namespace OpenRCT2::Ui::Windows WindowSetResize(*this, { 230, 226 }, { 230, 226 }); } - void OnUpdateObjective() + void onUpdateObjective() { currentFrame++; - InvalidateWidget(WIDX_TAB_6); + invalidateWidget(WIDX_TAB_6); } - void OnTextInputObjective(WidgetIndex widgetIndex, std::string_view text) + void onTextInputObjective(WidgetIndex widgetIndex, std::string_view text) { if (widgetIndex == WIDX_ENTER_NAME && !text.empty()) { std::string strText(text); ScenarioSuccessSubmitName(getGameState(), strText.c_str()); - Invalidate(); + invalidate(); } } - void OnTextInputPrice(WidgetIndex widgetIndex, std::string_view text) + void onTextInputPrice(WidgetIndex widgetIndex, std::string_view text) { if (widgetIndex == WIDX_PRICE && !text.empty()) { @@ -1043,7 +1043,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnPrepareDrawObjective() + void onPrepareDrawObjective() { SetPressedTab(); PrepareWindowTitleText(); @@ -1061,10 +1061,10 @@ namespace OpenRCT2::Ui::Windows WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_7); } - void OnDrawObjective(RenderTarget& rt) + void onDrawObjective(RenderTarget& rt) { auto& gameState = getGameState(); - DrawWidgets(rt); + drawWidgets(rt); DrawTabImages(rt); // Scenario description @@ -1108,18 +1108,18 @@ namespace OpenRCT2::Ui::Windows #pragma endregion #pragma region Awards page - void OnResizeAwards() + void onResizeAwards() { WindowSetResize(*this, { 230, 182 }, { 230, 182 }); } - void OnUpdateAwards() + void onUpdateAwards() { currentFrame++; - InvalidateWidget(WIDX_TAB_7); + invalidateWidget(WIDX_TAB_7); } - void OnPrepareDrawAwards() + void onPrepareDrawAwards() { SetPressedTab(); PrepareWindowTitleText(); @@ -1127,9 +1127,9 @@ namespace OpenRCT2::Ui::Windows WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_7); } - void OnDrawAwards(RenderTarget& rt) + void onDrawAwards(RenderTarget& rt) { - DrawWidgets(rt); + drawWidgets(rt); DrawTabImages(rt); auto screenCoords = windowPos @@ -1151,7 +1151,7 @@ namespace OpenRCT2::Ui::Windows #pragma endregion #pragma region Common - void SetPage(int32_t newPage) + void setPage(int32_t newPage) { if (isToolActive(classification, number)) ToolCancel(); @@ -1171,13 +1171,13 @@ namespace OpenRCT2::Ui::Windows page = newPage; currentFrame = 0; _peepAnimationFrame = 0; - RemoveViewport(); + removeViewport(); holdDownWidgets = _pagedHoldDownWidgets[newPage]; - SetWidgets(_pagedWidgets[newPage]); + setWidgets(_pagedWidgets[newPage]); SetDisabledTabs(); - Invalidate(); - InitScrollWidgets(); + invalidate(); + initScrollWidgets(); if (page == WINDOW_PARK_PAGE_GUESTS || WINDOW_PARK_PAGE_RATING) { @@ -1186,9 +1186,9 @@ namespace OpenRCT2::Ui::Windows height -= getTitleBarDiffNormal(); } - OnResize(); - OnUpdate(); - ResizeFrame(); + onResize(); + onUpdate(); + resizeFrame(); if (listen && viewport != nullptr) viewport->flags |= VIEWPORT_FLAG_SOUND_ON; @@ -1288,7 +1288,7 @@ namespace OpenRCT2::Ui::Windows auto* wnd = windowMgr->FocusOrCreate(WindowClass::ParkInformation, { 230, 174 + 9 }, WF_10); if (wnd != nullptr && page != WINDOW_PARK_PAGE_ENTRANCE) { - wnd->OnMouseUp(WIDX_TAB_1 + page); + wnd->onMouseUp(WIDX_TAB_1 + page); } return wnd; } @@ -1329,10 +1329,10 @@ namespace OpenRCT2::Ui::Windows auto* wnd = ParkWindowOpen(WINDOW_PARK_PAGE_OBJECTIVE); if (wnd != nullptr) { - wnd->Invalidate(); + wnd->invalidate(); wnd->windowPos.x = ContextGetWidth() / 2 - 115; wnd->windowPos.y = ContextGetHeight() / 2 - 87; - wnd->Invalidate(); + wnd->invalidate(); } return wnd; } diff --git a/src/openrct2-ui/windows/PatrolArea.cpp b/src/openrct2-ui/windows/PatrolArea.cpp index c4c038dbef..2f4df7d1aa 100644 --- a/src/openrct2-ui/windows/PatrolArea.cpp +++ b/src/openrct2-ui/windows/PatrolArea.cpp @@ -56,9 +56,9 @@ namespace OpenRCT2::Ui::Windows class PatrolAreaWindow final : public Window { public: - void OnOpen() override + void onOpen() override { - SetWidgets(PatrolAreaWidgets); + setWidgets(PatrolAreaWidgets); holdDownWidgets = (1uLL << WIDX_INCREMENT) | (1uLL << WIDX_DECREMENT); WindowInitScrollWidgets(*this); @@ -66,19 +66,19 @@ namespace OpenRCT2::Ui::Windows gLandToolSize = 4; } - void OnClose() override + void onClose() override { // If the tool wasn't changed, turn tool off if (PatrolAreaToolIsActive()) ToolCancel(); } - void OnMouseUp(WidgetIndex widgetIndex) override + void onMouseUp(WidgetIndex widgetIndex) override { switch (widgetIndex) { case WIDX_CLOSE: - Close(); + close(); break; case WIDX_PREVIEW: InputSize(); @@ -86,22 +86,22 @@ namespace OpenRCT2::Ui::Windows } } - void OnMouseDown(WidgetIndex widgetIndex) override + void onMouseDown(WidgetIndex widgetIndex) override { switch (widgetIndex) { case WIDX_DECREMENT: gLandToolSize = std::max(kLandToolMinimumSize, gLandToolSize - 1); - Invalidate(); + invalidate(); break; case WIDX_INCREMENT: gLandToolSize = std::min(kLandToolMaximumSize, gLandToolSize + 1); - Invalidate(); + invalidate(); break; } } - void OnTextInput(WidgetIndex widgetIndex, std::string_view text) override + void onTextInput(WidgetIndex widgetIndex, std::string_view text) override { if (text.empty()) return; @@ -117,28 +117,28 @@ namespace OpenRCT2::Ui::Windows size = std::max(kLandToolMinimumSize, size); size = std::min(kLandToolMaximumSize, size); gLandToolSize = size; - Invalidate(); + invalidate(); } } - void OnUpdate() override + void onUpdate() override { // Close window if another tool is open or staff window gets closed if (!PatrolAreaToolIsActive() || !IsStaffWindowOpen()) { - Close(); + close(); } } - void OnPrepareDraw() override + void onPrepareDraw() override { - SetWidgetPressed(WIDX_PREVIEW, true); + setWidgetPressed(WIDX_PREVIEW, true); widgets[WIDX_PREVIEW].image = ImageId(LandTool::SizeToSpriteIndex(gLandToolSize)); } - void OnDraw(RenderTarget& rt) override + void onDraw(RenderTarget& rt) override { - DrawWidgets(rt); + drawWidgets(rt); // Draw number for tool sizes bigger than 7 if (gLandToolSize > kLandToolMaximumSizeWithSprite) @@ -152,7 +152,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnToolUpdate(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override + void onToolUpdate(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override { auto mapTile = GetBestCoordsFromPos(screenCoords); if (!mapTile) @@ -193,14 +193,14 @@ namespace OpenRCT2::Ui::Windows } } - void OnToolAbort(WidgetIndex widgetIndex) override + void onToolAbort(WidgetIndex widgetIndex) override { HideGridlines(); ClearPatrolAreaToRender(); GfxInvalidateScreen(); } - void OnToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override + void onToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override { auto mapTile = GetBestCoordsFromPos(screenCoords); if (mapTile) @@ -213,10 +213,10 @@ namespace OpenRCT2::Ui::Windows } } - OnToolDrag(widgetIndex, screenCoords); + onToolDrag(widgetIndex, screenCoords); } - void OnToolDrag(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override + void onToolDrag(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override { auto staff = getGameState().entities.GetEntity(_staffId); if (staff != nullptr) @@ -232,7 +232,7 @@ namespace OpenRCT2::Ui::Windows return _staffId; } - void SetStaffId(EntityId staffId) + void setStaffId(EntityId staffId) { _staffId = staffId; EnableTool(); @@ -297,7 +297,7 @@ namespace OpenRCT2::Ui::Windows WindowClass::PatrolArea, ScreenCoordsXY(ContextGetWidth() - kWindowSize.width, 29), kWindowSize, 0); if (w != nullptr) { - w->SetStaffId(staffId); + w->setStaffId(staffId); } return w; } diff --git a/src/openrct2-ui/windows/Player.cpp b/src/openrct2-ui/windows/Player.cpp index 25655435d7..6616d69421 100644 --- a/src/openrct2-ui/windows/Player.cpp +++ b/src/openrct2-ui/windows/Player.cpp @@ -87,16 +87,16 @@ namespace OpenRCT2::Ui::Windows bool _drawViewport = true; public: - void Init(const uint8_t id) + void init(const uint8_t id) { number = id; - InitScrollWidgets(); - SetPage(WINDOW_PLAYER_PAGE_OVERVIEW); + initScrollWidgets(); + setPage(WINDOW_PLAYER_PAGE_OVERVIEW); } #pragma region Events - void OnOpen() override + void onOpen() override { page = 0; currentFrame = 0; @@ -106,102 +106,102 @@ namespace OpenRCT2::Ui::Windows holdDownWidgets = 0; pressedWidgets = 0; - SetPage(WINDOW_PLAYER_PAGE_OVERVIEW); + setPage(WINDOW_PLAYER_PAGE_OVERVIEW); } - void OnResize() override + void onResize() override { switch (page) { case WINDOW_PLAYER_PAGE_OVERVIEW: - OnResizeOverview(); + onResizeOverview(); break; case WINDOW_PLAYER_PAGE_STATISTICS: - OnResizeStatistics(); + onResizeStatistics(); break; } } - void OnUpdate() override + void onUpdate() override { switch (page) { case WINDOW_PLAYER_PAGE_OVERVIEW: - OnUpdateOverview(); + onUpdateOverview(); break; case WINDOW_PLAYER_PAGE_STATISTICS: - OnUpdateStatistics(); + onUpdateStatistics(); break; } } - void OnPrepareDraw() override + void onPrepareDraw() override { switch (page) { case WINDOW_PLAYER_PAGE_OVERVIEW: - OnPrepareDrawOverview(); + onPrepareDrawOverview(); break; case WINDOW_PLAYER_PAGE_STATISTICS: - OnPrepareDrawStatistics(); + onPrepareDrawStatistics(); break; } } - void OnDraw(RenderTarget& rt) override + void onDraw(RenderTarget& rt) override { switch (page) { case WINDOW_PLAYER_PAGE_OVERVIEW: - OnDrawOverview(rt); + onDrawOverview(rt); break; case WINDOW_PLAYER_PAGE_STATISTICS: - OnDrawStatistics(rt); + onDrawStatistics(rt); break; } } - void OnMouseDown(WidgetIndex widgetIndex) override + void onMouseDown(WidgetIndex widgetIndex) override { switch (page) { case WINDOW_PLAYER_PAGE_OVERVIEW: - OnMouseDownOverview(widgetIndex); + onMouseDownOverview(widgetIndex); break; } } - void OnMouseUp(WidgetIndex widgetIndex) override + void onMouseUp(WidgetIndex widgetIndex) override { switch (widgetIndex) { case WIDX_CLOSE: - Close(); + close(); return; case WIDX_TAB_1: case WIDX_TAB_2: - SetPage(widgetIndex - WIDX_TAB_1); + setPage(widgetIndex - WIDX_TAB_1); return; } switch (page) { case WINDOW_PLAYER_PAGE_OVERVIEW: - OnMouseUpOverview(widgetIndex); + onMouseUpOverview(widgetIndex); break; } } - void OnDropdown(WidgetIndex widgetIndex, int32_t selectedIndex) override + void onDropdown(WidgetIndex widgetIndex, int32_t selectedIndex) override { switch (page) { case WINDOW_PLAYER_PAGE_OVERVIEW: - OnDropdownOverview(widgetIndex, selectedIndex); + onDropdownOverview(widgetIndex, selectedIndex); break; } } @@ -209,7 +209,7 @@ namespace OpenRCT2::Ui::Windows #pragma endregion private: - void SetPage(int32_t newPage) + void setPage(int32_t newPage) { // Skip setting page if we're already on this page, unless we're initialising the window if (page == newPage && !widgets.empty()) @@ -222,12 +222,12 @@ namespace OpenRCT2::Ui::Windows holdDownWidgets = 0; pressedWidgets = 0; - SetWidgets(window_player_page_widgets[newPage]); - Invalidate(); - OnResize(); - OnPrepareDraw(); - InitScrollWidgets(); - Invalidate(); + setWidgets(window_player_page_widgets[newPage]); + invalidate(); + onResize(); + onPrepareDraw(); + initScrollWidgets(); + invalidate(); if (page == WINDOW_PLAYER_PAGE_OVERVIEW) { @@ -236,18 +236,18 @@ namespace OpenRCT2::Ui::Windows const auto viewportFocus = Focus(TileCoordsXYZ(128, 128, 0).ToCoordsXYZ()); ViewportCreate(*this, windowPos, width, height, viewportFocus); flags |= WF_NO_SCROLLING; - OnPrepareDraw(); + onPrepareDraw(); UpdateViewport(false); } else if (originalPage != page) { - OnPrepareDraw(); + onPrepareDraw(); UpdateViewport(false); } } else { - RemoveViewport(); + removeViewport(); } } @@ -256,7 +256,7 @@ namespace OpenRCT2::Ui::Windows Widget* widget; // Tab 1 - if (!IsWidgetDisabled(WIDX_TAB_1)) + if (!isWidgetDisabled(WIDX_TAB_1)) { widget = &this->widgets[WIDX_TAB_1]; auto screenCoords = windowPos + ScreenCoordsXY{ widget->left, widget->top }; @@ -264,7 +264,7 @@ namespace OpenRCT2::Ui::Windows } // Tab 2 - if (!IsWidgetDisabled(WIDX_TAB_2)) + if (!isWidgetDisabled(WIDX_TAB_2)) { widget = &this->widgets[WIDX_TAB_2]; auto screenCoords = windowPos + ScreenCoordsXY{ widget->left, widget->top }; @@ -311,7 +311,7 @@ namespace OpenRCT2::Ui::Windows { viewport->viewPos = centreLoc.value(); } - InvalidateWidget(WIDX_VIEWPORT); + invalidateWidget(WIDX_VIEWPORT); } // Draw the viewport @@ -341,19 +341,19 @@ namespace OpenRCT2::Ui::Windows #pragma region Overview - void OnResizeOverview() + void onResizeOverview() { WindowSetResize(*this, { 240, 170 }, { 500, 300 }); } - void OnUpdateOverview() + void onUpdateOverview() { currentFrame++; - InvalidateWidget(WIDX_TAB_1 + page); + invalidateWidget(WIDX_TAB_1 + page); if (Network::GetPlayerIndex(static_cast(number)) == -1) { - Close(); + close(); return; } @@ -369,7 +369,7 @@ namespace OpenRCT2::Ui::Windows UpdateViewport(scroll); } - void OnPrepareDrawOverview() + void onPrepareDrawOverview() { int32_t playerIndex = Network::GetPlayerIndex(static_cast(number)); if (playerIndex == -1) @@ -407,7 +407,7 @@ namespace OpenRCT2::Ui::Windows viewport->height = viewportWidget->height(); } - // Only enable kick button for other players + // only enable kick button for other players const bool canKick = Network::CanPerformAction( Network::GetCurrentPlayerGroupIndex(), Network::Permission::KickPlayer); const bool isServer = Network::GetPlayerFlags(playerIndex) & Network::PlayerFlags::kIsServer; @@ -415,9 +415,9 @@ namespace OpenRCT2::Ui::Windows widgetSetEnabled(*this, WIDX_KICK, canKick && !isOwnWindow && !isServer); } - void OnDrawOverview(RenderTarget& rt) + void onDrawOverview(RenderTarget& rt) { - DrawWidgets(rt); + drawWidgets(rt); DrawTabImages(rt); int32_t player = Network::GetPlayerIndex(static_cast(number)); @@ -474,7 +474,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnMouseDownOverview(WidgetIndex widgetIndex) + void onMouseDownOverview(WidgetIndex widgetIndex) { auto* widget = &widgets[widgetIndex]; switch (widgetIndex) @@ -485,7 +485,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnMouseUpOverview(WidgetIndex widgetIndex) + void onMouseUpOverview(WidgetIndex widgetIndex) { switch (widgetIndex) { @@ -516,7 +516,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnDropdownOverview(WidgetIndex widgetIndex, int32_t dropdownIndex) + void onDropdownOverview(WidgetIndex widgetIndex, int32_t dropdownIndex) { const auto playerId = static_cast(number); const auto playerIdx = Network::GetPlayerIndex(playerId); @@ -572,23 +572,23 @@ namespace OpenRCT2::Ui::Windows #pragma region Statistics - void OnResizeStatistics() + void onResizeStatistics() { WindowSetResize(*this, { 210, 80 }, { 210, 80 }); } - void OnUpdateStatistics() + void onUpdateStatistics() { currentFrame++; - InvalidateWidget(WIDX_TAB_1 + page); + invalidateWidget(WIDX_TAB_1 + page); if (Network::GetPlayerIndex(static_cast(number)) == -1) { - Close(); + close(); } } - void OnPrepareDrawStatistics() + void onPrepareDrawStatistics() { pressedWidgets &= ~(WIDX_TAB_1); pressedWidgets &= ~(WIDX_TAB_2); @@ -599,9 +599,9 @@ namespace OpenRCT2::Ui::Windows WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_2); } - void OnDrawStatistics(RenderTarget& rt) + void onDrawStatistics(RenderTarget& rt) { - DrawWidgets(rt); + drawWidgets(rt); DrawTabImages(rt); int32_t player = Network::GetPlayerIndex(static_cast(number)); @@ -636,7 +636,7 @@ namespace OpenRCT2::Ui::Windows window = windowMgr->Create(WindowClass::Player, { 240, 170 }, WF_RESIZABLE); } - window->Init(id); + window->init(id); return window; } diff --git a/src/openrct2-ui/windows/ProgressWindow.cpp b/src/openrct2-ui/windows/ProgressWindow.cpp index 6cffe2739a..804b7b945e 100644 --- a/src/openrct2-ui/windows/ProgressWindow.cpp +++ b/src/openrct2-ui/windows/ProgressWindow.cpp @@ -84,20 +84,20 @@ namespace OpenRCT2::Ui::Windows int8_t style = -1; public: - void OnOpen() override + void onOpen() override { Audio::StopSFX(); - SetWidgets(kProgressWindowWidgets); + setWidgets(kProgressWindowWidgets); WindowSetResize(*this, kWindowSize, kWindowSize); currentFrame = 0; ApplyStyle(); - ResizeFrame(); + resizeFrame(); } - void OnClose() override + void onClose() override { if (_onClose != nullptr) { @@ -105,22 +105,22 @@ namespace OpenRCT2::Ui::Windows } } - void OnMouseUp(WidgetIndex widgetIndex) override + void onMouseUp(WidgetIndex widgetIndex) override { switch (widgetIndex) { case WIDX_CLOSE: - Close(); + close(); break; } } - void OnUpdate() override + void onUpdate() override { - Invalidate(); + invalidate(); } - void OnPrepareDraw() override + void onPrepareDraw() override { if (_onClose != nullptr) widgets[WIDX_CLOSE].type = WidgetType::closeBox; @@ -171,7 +171,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnDraw(RenderTarget& rt) override + void onDraw(RenderTarget& rt) override { WindowDrawWidgets(*this, rt); @@ -205,21 +205,21 @@ namespace OpenRCT2::Ui::Windows GfxDrawSprite(clipDPI, variant.vehicle, ScreenCoordsXY(position, widget.bottom + 1)); } - void SetCaption(const std::string& text) + void setCaption(const std::string& text) { _progressTitle = text; _currentProgress = 0; _totalCount = 0; - Invalidate(); + invalidate(); } - void SetCloseCallback(CloseCallback onClose) + void setCloseCallback(CloseCallback callback) { - _onClose = onClose; + _onClose = callback; } - void SetProgress(uint32_t currentProgress, uint32_t totalCount, StringId format) + void setProgress(uint32_t currentProgress, uint32_t totalCount, StringId format) { if (format == kStringIdNone) _progressFormat = STR_STRING_M_OF_N; @@ -228,7 +228,7 @@ namespace OpenRCT2::Ui::Windows _currentProgress = currentProgress; _totalCount = totalCount; - Invalidate(); + invalidate(); } }; @@ -249,8 +249,8 @@ namespace OpenRCT2::Ui::Windows WindowClass::ProgressWindow, kWindowSize, WF_10 | WF_TRANSPARENT | WF_CENTRE_SCREEN | WF_STICK_TO_FRONT); } - window->SetCaption(text); - window->SetCloseCallback(onClose); + window->setCaption(text); + window->setCloseCallback(onClose); return window; } @@ -263,7 +263,7 @@ namespace OpenRCT2::Ui::Windows return; } auto progressWindow = static_cast(window); - progressWindow->SetProgress(currentProgress, totalCount, format); + progressWindow->setProgress(currentProgress, totalCount, format); } // Closes the window, deliberately *without* executing the callback. @@ -276,7 +276,7 @@ namespace OpenRCT2::Ui::Windows return; } auto progressWindow = static_cast(window); - progressWindow->SetCloseCallback(nullptr); - progressWindow->Close(); + progressWindow->setCloseCallback(nullptr); + progressWindow->close(); } } // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/RefurbishRidePrompt.cpp b/src/openrct2-ui/windows/RefurbishRidePrompt.cpp index f99e742738..0124ac1268 100644 --- a/src/openrct2-ui/windows/RefurbishRidePrompt.cpp +++ b/src/openrct2-ui/windows/RefurbishRidePrompt.cpp @@ -49,13 +49,13 @@ namespace OpenRCT2::Ui::Windows _demolishRideCost = -RideGetRefundPrice(currentRide); } - void OnOpen() override + void onOpen() override { - SetWidgets(window_ride_refurbish_widgets); + setWidgets(window_ride_refurbish_widgets); WindowInitScrollWidgets(*this); } - void OnMouseUp(WidgetIndex widgetIndex) override + void onMouseUp(WidgetIndex widgetIndex) override { switch (widgetIndex) { @@ -67,12 +67,12 @@ namespace OpenRCT2::Ui::Windows } case WIDX_CANCEL: case WIDX_CLOSE: - Close(); + close(); break; } } - void OnDraw(RenderTarget& rt) override + void onDraw(RenderTarget& rt) override { WindowDrawWidgets(*this, rt); diff --git a/src/openrct2-ui/windows/Research.cpp b/src/openrct2-ui/windows/Research.cpp index 16892c32f5..f74acb527d 100644 --- a/src/openrct2-ui/windows/Research.cpp +++ b/src/openrct2-ui/windows/Research.cpp @@ -117,13 +117,13 @@ namespace OpenRCT2::Ui::Windows class ResearchWindow final : public Window { public: - void OnOpen() override + void onOpen() override { - SetPage(WINDOW_RESEARCH_PAGE_DEVELOPMENT); + setPage(WINDOW_RESEARCH_PAGE_DEVELOPMENT); ResearchUpdateUncompletedTypes(); } - void SetPage(int32_t newPageIndex) + void setPage(int32_t newPageIndex) { if (page == newPageIndex && !widgets.empty()) return; @@ -131,7 +131,7 @@ namespace OpenRCT2::Ui::Windows page = newPageIndex; currentFrame = 0; - Invalidate(); + invalidate(); if (newPageIndex == WINDOW_RESEARCH_PAGE_DEVELOPMENT) { width = kWindowSizeDevelopment.width; @@ -142,16 +142,16 @@ namespace OpenRCT2::Ui::Windows width = kWindowSizeFunding.width; height = kWindowSizeFunding.height; } - Invalidate(); + invalidate(); - SetWidgets(window_research_page_widgets[newPageIndex]); + setWidgets(window_research_page_widgets[newPageIndex]); holdDownWidgets = 0; disabledWidgets = 0; pressedWidgets = 0; } private: - void OnUpdate() override + void onUpdate() override { // Tab animation if (++currentFrame >= window_research_tab_animation_loops[page]) @@ -161,18 +161,18 @@ namespace OpenRCT2::Ui::Windows { case WINDOW_RESEARCH_PAGE_DEVELOPMENT: { - InvalidateWidget(WIDX_TAB_1); + invalidateWidget(WIDX_TAB_1); break; } case WINDOW_RESEARCH_PAGE_FUNDING: { - InvalidateWidget(WIDX_TAB_2); + invalidateWidget(WIDX_TAB_2); break; } } } - void OnMouseDown(WidgetIndex widgetIndex) override + void onMouseDown(WidgetIndex widgetIndex) override { if (page == WINDOW_RESEARCH_PAGE_FUNDING) { @@ -180,20 +180,20 @@ namespace OpenRCT2::Ui::Windows } } - void OnMouseUp(WidgetIndex widgetIndex) override + void onMouseUp(WidgetIndex widgetIndex) override { // Switch tab or close switch (widgetIndex) { case WIDX_CLOSE: { - Close(); + close(); break; } case WIDX_TAB_1: case WIDX_TAB_2: { - SetPage(widgetIndex - WIDX_TAB_1); + setPage(widgetIndex - WIDX_TAB_1); break; } } @@ -214,7 +214,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnDropdown(WidgetIndex widgetIndex, int32_t selectedIndex) override + void onDropdown(WidgetIndex widgetIndex, int32_t selectedIndex) override { if (page == WINDOW_RESEARCH_PAGE_FUNDING) { @@ -222,14 +222,14 @@ namespace OpenRCT2::Ui::Windows } } - void OnPrepareDraw() override + void onPrepareDraw() override { for (auto i = 0; i < WINDOW_RESEARCH_PAGE_COUNT; i++) { - SetWidgetPressed(WIDX_TAB_1 + i, false); + setWidgetPressed(WIDX_TAB_1 + i, false); } - SetWidgetPressed(WIDX_TAB_1 + page, true); + setWidgetPressed(WIDX_TAB_1 + page, true); switch (page) { @@ -246,9 +246,9 @@ namespace OpenRCT2::Ui::Windows } } - void OnDraw(RenderTarget& rt) override + void onDraw(RenderTarget& rt) override { - DrawWidgets(rt); + drawWidgets(rt); DrawTabImages(rt); switch (page) @@ -270,7 +270,7 @@ namespace OpenRCT2::Ui::Windows { WidgetIndex widgetIndex = WIDX_TAB_1 + tabPage; - if (!IsWidgetDisabled(widgetIndex)) + if (!isWidgetDisabled(widgetIndex)) { if (page == tabPage) { @@ -297,7 +297,7 @@ namespace OpenRCT2::Ui::Windows { auto* windowMgr = GetWindowManager(); auto* window = windowMgr->FocusOrCreate(WindowClass::Research, kWindowSizeDevelopment, WF_10); - window->SetPage(WINDOW_RESEARCH_PAGE_DEVELOPMENT); + window->setPage(WINDOW_RESEARCH_PAGE_DEVELOPMENT); return window; } diff --git a/src/openrct2-ui/windows/Ride.cpp b/src/openrct2-ui/windows/Ride.cpp index 0711f068b6..f510115570 100644 --- a/src/openrct2-ui/windows/Ride.cpp +++ b/src/openrct2-ui/windows/Ride.cpp @@ -745,12 +745,12 @@ namespace OpenRCT2::Ui::Windows rideId = ride.id; } - void OnOpen() override + void onOpen() override { - SetWidgets(PageWidgets[WINDOW_RIDE_PAGE_MAIN]); + setWidgets(PageWidgets[WINDOW_RIDE_PAGE_MAIN]); holdDownWidgets = PageHoldDownWidgets[WINDOW_RIDE_PAGE_MAIN]; - SetPage(WINDOW_RIDE_PAGE_MAIN); + setPage(WINDOW_RIDE_PAGE_MAIN); listInformationType = 0; pickedPeepFrame = 0; DisableTabs(); @@ -760,7 +760,7 @@ namespace OpenRCT2::Ui::Windows auto ride = GetRide(rideId); if (ride == nullptr) { - Close(); + close(); return; } UpdateOverallView(*ride); @@ -768,7 +768,7 @@ namespace OpenRCT2::Ui::Windows PopulateVehicleTypeDropdown(*ride, true); } - void OnClose() override + void onClose() override { switch (page) { @@ -780,7 +780,7 @@ namespace OpenRCT2::Ui::Windows break; } } - void OnResize() override + void onResize() override { switch (page) { @@ -817,7 +817,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnUpdate() override + void onUpdate() override { switch (page) { @@ -854,7 +854,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnPrepareDraw() override + void onPrepareDraw() override { switch (page) { @@ -890,7 +890,7 @@ namespace OpenRCT2::Ui::Windows break; } } - void OnDraw(RenderTarget& rt) override + void onDraw(RenderTarget& rt) override { switch (page) { @@ -927,7 +927,7 @@ namespace OpenRCT2::Ui::Windows } } - OpenRCT2String OnTooltip(WidgetIndex widgetIndex, StringId fallback) override + OpenRCT2String onTooltip(WidgetIndex widgetIndex, StringId fallback) override { switch (page) { @@ -938,7 +938,7 @@ namespace OpenRCT2::Ui::Windows } return { fallback, {} }; } - void OnMouseDown(WidgetIndex widgetIndex) override + void onMouseDown(WidgetIndex widgetIndex) override { switch (page) { @@ -971,7 +971,7 @@ namespace OpenRCT2::Ui::Windows break; } } - void OnMouseUp(WidgetIndex widgetIndex) override + void onMouseUp(WidgetIndex widgetIndex) override { switch (page) { @@ -1007,7 +1007,7 @@ namespace OpenRCT2::Ui::Windows break; } } - void OnDropdown(WidgetIndex widgetIndex, int32_t selectedIndex) override + void onDropdown(WidgetIndex widgetIndex, int32_t selectedIndex) override { switch (page) { @@ -1034,7 +1034,7 @@ namespace OpenRCT2::Ui::Windows break; } } - void OnTextInput(WidgetIndex widgetIndex, std::string_view text) override + void onTextInput(WidgetIndex widgetIndex, std::string_view text) override { switch (page) { @@ -1049,7 +1049,7 @@ namespace OpenRCT2::Ui::Windows break; } } - ScreenSize OnScrollGetSize(int32_t scrollIndex) override + ScreenSize onScrollGetSize(int32_t scrollIndex) override { switch (page) { @@ -1060,7 +1060,7 @@ namespace OpenRCT2::Ui::Windows } return {}; } - void OnScrollSelect(int32_t scrollIndex, int32_t scrollAreaType) override + void onScrollSelect(int32_t scrollIndex, int32_t scrollAreaType) override { switch (page) { @@ -1069,7 +1069,7 @@ namespace OpenRCT2::Ui::Windows break; } } - void OnScrollDraw(int32_t scrollIndex, RenderTarget& rt) override + void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override { switch (page) { @@ -1087,7 +1087,7 @@ namespace OpenRCT2::Ui::Windows break; } } - void OnToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override + void onToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override { switch (page) { @@ -1099,7 +1099,7 @@ namespace OpenRCT2::Ui::Windows break; } } - void OnToolDrag(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override + void onToolDrag(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override { switch (page) { @@ -1111,7 +1111,7 @@ namespace OpenRCT2::Ui::Windows break; } } - void OnToolAbort(WidgetIndex widgetIndex) override + void onToolAbort(WidgetIndex widgetIndex) override { switch (page) { @@ -1120,7 +1120,7 @@ namespace OpenRCT2::Ui::Windows break; } } - void OnViewportRotate() override + void onViewportRotate() override { switch (page) { @@ -1130,7 +1130,7 @@ namespace OpenRCT2::Ui::Windows } } - void SetPage(int32_t newPage) + void setPage(int32_t newPage) { if (isToolActive(classification, number)) ToolCancel(); @@ -1144,7 +1144,7 @@ namespace OpenRCT2::Ui::Windows windowMgr->CloseByClass(WindowClass::RideConstruction); // Closing the construction window sets the tab to the first page, which we don't want here, // as user just clicked the Vehicle page - SetPage(WINDOW_RIDE_PAGE_VEHICLE); + setPage(WINDOW_RIDE_PAGE_VEHICLE); } } @@ -1168,40 +1168,40 @@ namespace OpenRCT2::Ui::Windows // train, so I've removed it if (newPage == WINDOW_RIDE_PAGE_VEHICLE) { ride_update_max_vehicles(ride); //} - RemoveViewport(); + removeViewport(); holdDownWidgets = PageHoldDownWidgets[page]; pressedWidgets = 0; - SetWidgets(PageWidgets[page]); + setWidgets(PageWidgets[page]); DisableTabs(); - Invalidate(); + invalidate(); - OnResize(); - OnPrepareDraw(); - InitScrollWidgets(); - Invalidate(); + onResize(); + onPrepareDraw(); + initScrollWidgets(); + invalidate(); if (listen && viewport != nullptr) viewport->flags |= VIEWPORT_FLAG_SOUND_ON; } - void SetViewIndex(int16_t newIndex) + void setViewIndex(int16_t newIndex) { _viewIndex = newIndex; - OnViewportRotate(); + onViewportRotate(); } - int16_t GetViewIndex() const + int16_t getViewIndex() const { return _viewIndex; } - void ResetVehicleIndex() + void resetVehicleIndex() { _vehicleIndex = dropdownIndexToCarIndex(0); } private: - void DrawTabImage(RenderTarget& rt, int32_t tab, int32_t spriteIndex) + void drawTabImage(RenderTarget& rt, int32_t tab, int32_t spriteIndex) { WidgetIndex widgetIndex = WIDX_TAB_1 + tab; @@ -1335,18 +1335,18 @@ namespace OpenRCT2::Ui::Windows } } - void DrawTabImages(RenderTarget& rt) + void drawTabImages(RenderTarget& rt) { DrawTabVehicle(rt); - DrawTabImage(rt, WINDOW_RIDE_PAGE_OPERATING, SPR_TAB_GEARS_0); - DrawTabImage(rt, WINDOW_RIDE_PAGE_MAINTENANCE, SPR_TAB_WRENCH_0); - DrawTabImage(rt, WINDOW_RIDE_PAGE_INCOME, SPR_TAB_ADMISSION_0); + drawTabImage(rt, WINDOW_RIDE_PAGE_OPERATING, SPR_TAB_GEARS_0); + drawTabImage(rt, WINDOW_RIDE_PAGE_MAINTENANCE, SPR_TAB_WRENCH_0); + drawTabImage(rt, WINDOW_RIDE_PAGE_INCOME, SPR_TAB_ADMISSION_0); DrawTabMain(rt); - DrawTabImage(rt, WINDOW_RIDE_PAGE_MEASUREMENTS, SPR_TAB_TIMER_0); - DrawTabImage(rt, WINDOW_RIDE_PAGE_COLOUR, SPR_TAB_PAINT_0); - DrawTabImage(rt, WINDOW_RIDE_PAGE_GRAPHS, SPR_TAB_GRAPH_A_0); + drawTabImage(rt, WINDOW_RIDE_PAGE_MEASUREMENTS, SPR_TAB_TIMER_0); + drawTabImage(rt, WINDOW_RIDE_PAGE_COLOUR, SPR_TAB_PAINT_0); + drawTabImage(rt, WINDOW_RIDE_PAGE_GRAPHS, SPR_TAB_GRAPH_A_0); DrawTabCustomer(rt); - DrawTabImage(rt, WINDOW_RIDE_PAGE_MUSIC, SPR_TAB_MUSIC_0); + drawTabImage(rt, WINDOW_RIDE_PAGE_MUSIC, SPR_TAB_MUSIC_0); } void DisableTabs() @@ -1498,7 +1498,7 @@ namespace OpenRCT2::Ui::Windows return std::nullopt; } - void InitViewport() + void initViewport() { if (page != WINDOW_RIDE_PAGE_MAIN) return; @@ -1563,14 +1563,14 @@ namespace OpenRCT2::Ui::Windows return; } newViewportFlags = viewport->flags; - RemoveViewport(); + removeViewport(); } else if (Config::Get().general.AlwaysShowGridlines) { newViewportFlags |= VIEWPORT_FLAG_GRIDLINES; } - OnPrepareDraw(); + onPrepareDraw(); focus = newFocus; @@ -1586,12 +1586,12 @@ namespace OpenRCT2::Ui::Windows ViewportCreate(*this, screenPos, viewWidth, viewHeight, focus.value()); flags |= WF_NO_SCROLLING; - Invalidate(); + invalidate(); } if (viewport != nullptr) { viewport->flags = newViewportFlags; - Invalidate(); + invalidate(); } } @@ -1612,7 +1612,7 @@ namespace OpenRCT2::Ui::Windows switch (widgetIndex) { case WIDX_CLOSE: - Close(); + close(); return; case WIDX_TAB_1: case WIDX_TAB_2: @@ -1624,7 +1624,7 @@ namespace OpenRCT2::Ui::Windows case WIDX_TAB_8: case WIDX_TAB_9: case WIDX_TAB_10: - SetPage(widgetIndex - WIDX_TAB_1); + setPage(widgetIndex - WIDX_TAB_1); break; case WIDX_CONSTRUCTION: { @@ -1635,7 +1635,7 @@ namespace OpenRCT2::Ui::Windows auto* windowMgr = GetWindowManager(); if (windowMgr->FindByNumber(WindowClass::RideConstruction, ride->id.ToUnderlying()) != nullptr) { - Close(); + close(); return; } } @@ -1711,7 +1711,7 @@ namespace OpenRCT2::Ui::Windows WindowSetResize(*this, { kMinimumWindowWidth, newMinHeight }, { 500, 450 }); // Unlike with other windows, the focus needs to be recentred so it’s best to just reset it. focus = std::nullopt; - InitViewport(); + initViewport(); } size_t GetNumPeepsInTrain(const Ride& ride, int32_t trainIndex) const @@ -2193,8 +2193,8 @@ namespace OpenRCT2::Ui::Windows } _viewIndex = dropdownIndex; - InitViewport(); - Invalidate(); + initViewport(); + invalidate(); break; case WIDX_OPEN: { @@ -2240,7 +2240,7 @@ namespace OpenRCT2::Ui::Windows { if (dropdownIndex == 0) { - ScrollToViewport(); + scrollToViewport(); } else if (dropdownIndex == 1) { @@ -2255,8 +2255,8 @@ namespace OpenRCT2::Ui::Windows { // Update tab animation currentFrame++; - OnPrepareDraw(); - InvalidateWidget(WIDX_TAB_1); + onPrepareDraw(); + invalidateWidget(WIDX_TAB_1); // Update status auto ride = GetRide(rideId); @@ -2282,7 +2282,7 @@ namespace OpenRCT2::Ui::Windows } ride->windowInvalidateFlags &= ~RIDE_INVALIDATE_RIDE_MAIN; } - InvalidateWidget(WIDX_STATUS); + invalidateWidget(WIDX_STATUS); } void MainOnTextInput(WidgetIndex widgetIndex, std::string_view text) @@ -2302,7 +2302,7 @@ namespace OpenRCT2::Ui::Windows void MainViewportRotate() { focus = std::nullopt; - InitViewport(); + initViewport(); } void MainOnPrepareDraw() @@ -2570,7 +2570,7 @@ namespace OpenRCT2::Ui::Windows void MainOnDraw(RenderTarget& rt) { WindowDrawWidgets(*this, rt); - DrawTabImages(rt); + drawTabImages(rt); // Viewport and ear icon if (viewport != nullptr) @@ -2627,7 +2627,7 @@ namespace OpenRCT2::Ui::Windows switch (widgetIndex) { case WIDX_CLOSE: - Close(); + close(); return; case WIDX_TAB_1: case WIDX_TAB_2: @@ -2639,7 +2639,7 @@ namespace OpenRCT2::Ui::Windows case WIDX_TAB_8: case WIDX_TAB_9: case WIDX_TAB_10: - SetPage(widgetIndex - WIDX_TAB_1); + setPage(widgetIndex - WIDX_TAB_1); break; } } @@ -2707,8 +2707,8 @@ namespace OpenRCT2::Ui::Windows void VehicleUpdate() { currentFrame++; - OnPrepareDraw(); - InvalidateWidget(WIDX_TAB_2); + onPrepareDraw(); + invalidateWidget(WIDX_TAB_2); } OpenRCT2String VehicleTooltip(const WidgetIndex widgetIndex, StringId fallback) @@ -2859,7 +2859,7 @@ namespace OpenRCT2::Ui::Windows void VehicleOnDraw(RenderTarget& rt) { WindowDrawWidgets(*this, rt); - DrawTabImages(rt); + drawTabImages(rt); auto ride = GetRide(rideId); if (ride == nullptr) @@ -2927,7 +2927,7 @@ namespace OpenRCT2::Ui::Windows { auto heightIncrease = minimumPreviewStart - widgets[WIDX_VEHICLE_TRAINS_PREVIEW].top; height += heightIncrease; - ResizeFrame(); + resizeFrame(); for (auto i = EnumValue(WIDX_VEHICLE_TRAINS_PREVIEW); i <= WIDX_VEHICLE_CARS_PER_TRAIN_DECREASE; i++) { @@ -3152,7 +3152,7 @@ namespace OpenRCT2::Ui::Windows switch (widgetIndex) { case WIDX_CLOSE: - Close(); + close(); return; case WIDX_TAB_1: case WIDX_TAB_2: @@ -3164,7 +3164,7 @@ namespace OpenRCT2::Ui::Windows case WIDX_TAB_8: case WIDX_TAB_9: case WIDX_TAB_10: - SetPage(widgetIndex - WIDX_TAB_1); + setPage(widgetIndex - WIDX_TAB_1); break; case WIDX_LOAD_CHECKBOX: SetOperatingSetting( @@ -3392,14 +3392,14 @@ namespace OpenRCT2::Ui::Windows void OperatingUpdate() { currentFrame++; - OnPrepareDraw(); - InvalidateWidget(WIDX_TAB_3); + onPrepareDraw(); + invalidateWidget(WIDX_TAB_3); auto ride = GetRide(rideId); if (ride != nullptr && ride->windowInvalidateFlags & RIDE_INVALIDATE_RIDE_OPERATING) { ride->windowInvalidateFlags &= ~RIDE_INVALIDATE_RIDE_OPERATING; - Invalidate(); + invalidate(); } } @@ -3681,8 +3681,8 @@ namespace OpenRCT2::Ui::Windows void OperatingOnDraw(RenderTarget& rt) { - DrawWidgets(rt); - DrawTabImages(rt); + drawWidgets(rt); + drawTabImages(rt); auto ride = GetRide(rideId); if (ride == nullptr) @@ -3740,7 +3740,7 @@ namespace OpenRCT2::Ui::Windows switch (widgetIndex) { case WIDX_CLOSE: - Close(); + close(); return; case WIDX_TAB_1: case WIDX_TAB_2: @@ -3752,7 +3752,7 @@ namespace OpenRCT2::Ui::Windows case WIDX_TAB_8: case WIDX_TAB_9: case WIDX_TAB_10: - SetPage(widgetIndex - WIDX_TAB_1); + setPage(widgetIndex - WIDX_TAB_1); break; case WIDX_LOCATE_MECHANIC: LocateMechanic(); @@ -3971,14 +3971,14 @@ namespace OpenRCT2::Ui::Windows void MaintenanceUpdate() { currentFrame++; - OnPrepareDraw(); - InvalidateWidget(WIDX_TAB_4); + onPrepareDraw(); + invalidateWidget(WIDX_TAB_4); auto ride = GetRide(rideId); if (ride != nullptr && ride->windowInvalidateFlags & RIDE_INVALIDATE_RIDE_MAINTENANCE) { ride->windowInvalidateFlags &= ~RIDE_INVALIDATE_RIDE_MAINTENANCE; - Invalidate(); + invalidate(); } } @@ -4031,8 +4031,8 @@ namespace OpenRCT2::Ui::Windows uint16_t downTime = ride->downtime; widgetProgressBarSetNewPercentage(widgets[WIDX_DOWN_TIME_BAR], downTime); - DrawWidgets(rt); - DrawTabImages(rt); + drawWidgets(rt); + drawTabImages(rt); // Locate mechanic button image Widget* widget = &widgets[WIDX_LOCATE_MECHANIC]; @@ -4200,7 +4200,7 @@ namespace OpenRCT2::Ui::Windows switch (widgetIndex) { case WIDX_CLOSE: - Close(); + close(); return; case WIDX_TAB_1: case WIDX_TAB_2: @@ -4212,7 +4212,7 @@ namespace OpenRCT2::Ui::Windows case WIDX_TAB_8: case WIDX_TAB_9: case WIDX_TAB_10: - SetPage(widgetIndex - WIDX_TAB_1); + setPage(widgetIndex - WIDX_TAB_1); break; case WIDX_PAINT_INDIVIDUAL_AREA: ToolSet(*this, WIDX_PAINT_INDIVIDUAL_AREA, Tool::paintDown); @@ -4448,7 +4448,7 @@ namespace OpenRCT2::Ui::Windows { case WIDX_TRACK_COLOUR_SCHEME_DROPDOWN: _rideColour = static_cast(dropdownIndex); - Invalidate(); + invalidate(); break; case WIDX_TRACK_MAIN_COLOUR: { @@ -4507,7 +4507,7 @@ namespace OpenRCT2::Ui::Windows [this](const GameActions::GameAction* ga, const GameActions::Result* result) { if (result->Error == GameActions::Status::Ok) { - ResetVehicleIndex(); + resetVehicleIndex(); } }); GameActions::Execute(&rideSetAppearanceAction, gameState); @@ -4515,7 +4515,7 @@ namespace OpenRCT2::Ui::Windows } case WIDX_VEHICLE_COLOUR_INDEX_DROPDOWN: _vehicleIndex = dropdownIndexToCarIndex(dropdownIndex); - Invalidate(); + invalidate(); break; case WIDX_VEHICLE_BODY_COLOUR: { @@ -4547,9 +4547,9 @@ namespace OpenRCT2::Ui::Windows void ColourUpdate() { currentFrame++; - OnPrepareDraw(); - InvalidateWidget(WIDX_TAB_5); - InvalidateWidget(WIDX_VEHICLE_PREVIEW); + onPrepareDraw(); + invalidateWidget(WIDX_TAB_5); + invalidateWidget(WIDX_VEHICLE_PREVIEW); } void ColourOnToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) @@ -4817,8 +4817,8 @@ namespace OpenRCT2::Ui::Windows if (ride == nullptr) return; - DrawWidgets(rt); - DrawTabImages(rt); + drawWidgets(rt); + drawTabImages(rt); // Track / shop item preview const auto& trackPreviewWidget = widgets[WIDX_TRACK_PREVIEW]; @@ -4976,7 +4976,7 @@ namespace OpenRCT2::Ui::Windows switch (widgetIndex) { case WIDX_CLOSE: - Close(); + close(); return; case WIDX_TAB_1: case WIDX_TAB_2: @@ -4988,7 +4988,7 @@ namespace OpenRCT2::Ui::Windows case WIDX_TAB_8: case WIDX_TAB_9: case WIDX_TAB_10: - SetPage(widgetIndex - WIDX_TAB_1); + setPage(widgetIndex - WIDX_TAB_1); break; case WIDX_PLAY_MUSIC: ToggleMusic(); @@ -5112,16 +5112,16 @@ namespace OpenRCT2::Ui::Windows void MusicUpdate() { currentFrame++; - OnPrepareDraw(); - InvalidateWidget(WIDX_TAB_6); + onPrepareDraw(); + invalidateWidget(WIDX_TAB_6); if (auto ride = GetRide(rideId); ride != nullptr && ride->windowInvalidateFlags & RIDE_INVALIDATE_RIDE_MUSIC) { ride->windowInvalidateFlags &= ~RIDE_INVALIDATE_RIDE_MUSIC; - Invalidate(); - OnResize(); - OnPrepareDraw(); - Invalidate(); + invalidate(); + onResize(); + onPrepareDraw(); + invalidate(); } widgetScrollUpdateThumbs(*this, WIDX_MUSIC_DATA); @@ -5130,7 +5130,7 @@ namespace OpenRCT2::Ui::Windows ScreenSize MusicScrollGetSize(int32_t scrollIndex) { // Hack: can be removed when widgets are no longer shared globally - OnPrepareDraw(); + onPrepareDraw(); // Figure out minimum size ScreenSize size{}; @@ -5226,8 +5226,8 @@ namespace OpenRCT2::Ui::Windows void MusicOnDraw(RenderTarget& rt) { - DrawWidgets(rt); - DrawTabImages(rt); + drawWidgets(rt); + drawTabImages(rt); auto ride = GetRide(rideId); if (ride == nullptr) return; @@ -5267,7 +5267,7 @@ namespace OpenRCT2::Ui::Windows if (ride == nullptr) return; - // Only draw track listing when music is activated + // only draw track listing when music is activated auto isMusicActivated = (ride->lifecycleFlags & RIDE_LIFECYCLE_MUSIC) != 0; if (!isMusicActivated) return; @@ -5420,7 +5420,7 @@ namespace OpenRCT2::Ui::Windows switch (widgetIndex) { case WIDX_CLOSE: - Close(); + close(); return; case WIDX_TAB_1: case WIDX_TAB_2: @@ -5432,7 +5432,7 @@ namespace OpenRCT2::Ui::Windows case WIDX_TAB_8: case WIDX_TAB_9: case WIDX_TAB_10: - SetPage(widgetIndex - WIDX_TAB_1); + setPage(widgetIndex - WIDX_TAB_1); break; case WIDX_SELECT_NEARBY_SCENERY: MeasurementsDesignSelectNearbyScenery(); @@ -5497,13 +5497,13 @@ namespace OpenRCT2::Ui::Windows void MeasurementsUpdate() { currentFrame++; - OnPrepareDraw(); - InvalidateWidget(WIDX_TAB_7); + onPrepareDraw(); + invalidateWidget(WIDX_TAB_7); Ride* const ride = GetRide(rideId); if (ride && ride->windowInvalidateFlags & RIDE_INVALIDATE_RIDE_RATINGS) { - Invalidate(); + invalidate(); ride->windowInvalidateFlags &= ~RIDE_INVALIDATE_RIDE_RATINGS; } } @@ -5605,8 +5605,8 @@ namespace OpenRCT2::Ui::Windows void MeasurementsOnDraw(RenderTarget& rt) { - DrawWidgets(rt); - DrawTabImages(rt); + drawWidgets(rt); + drawTabImages(rt); if (widgets[WIDX_SAVE_DESIGN].type == WidgetType::button) { @@ -5866,7 +5866,7 @@ namespace OpenRCT2::Ui::Windows { listInformationType = type; } - Invalidate(); + invalidate(); } void GraphsOnMouseUp(WidgetIndex widgetIndex) @@ -5874,7 +5874,7 @@ namespace OpenRCT2::Ui::Windows switch (widgetIndex) { case WIDX_CLOSE: - Close(); + close(); return; case WIDX_TAB_1: case WIDX_TAB_2: @@ -5886,7 +5886,7 @@ namespace OpenRCT2::Ui::Windows case WIDX_TAB_8: case WIDX_TAB_9: case WIDX_TAB_10: - SetPage(widgetIndex - WIDX_TAB_1); + setPage(widgetIndex - WIDX_TAB_1); break; } } @@ -5921,10 +5921,10 @@ namespace OpenRCT2::Ui::Windows int32_t x; currentFrame++; - OnPrepareDraw(); - InvalidateWidget(WIDX_TAB_8); - OnPrepareDraw(); - InvalidateWidget(WIDX_GRAPH); + onPrepareDraw(); + invalidateWidget(WIDX_TAB_8); + onPrepareDraw(); + invalidateWidget(WIDX_GRAPH); widget = &widgets[WIDX_GRAPH]; x = scrolls[0].contentOffsetX; @@ -5945,7 +5945,7 @@ namespace OpenRCT2::Ui::Windows ScreenSize GraphsScrollGetSize(int32_t scrollIndex) { - OnPrepareDraw(); + onPrepareDraw(); ScreenSize size{}; // Set minimum size @@ -6049,8 +6049,8 @@ namespace OpenRCT2::Ui::Windows void GraphsOnDraw(RenderTarget& rt) { - DrawWidgets(rt); - DrawTabImages(rt); + drawWidgets(rt); + drawTabImages(rt); } void GraphsOnScrollDraw(RenderTarget& rt, int32_t scrollIndex) @@ -6395,7 +6395,7 @@ namespace OpenRCT2::Ui::Windows switch (widgetIndex) { case WIDX_CLOSE: - Close(); + close(); return; case WIDX_TAB_1: case WIDX_TAB_2: @@ -6407,7 +6407,7 @@ namespace OpenRCT2::Ui::Windows case WIDX_TAB_8: case WIDX_TAB_9: case WIDX_TAB_10: - SetPage(widgetIndex - WIDX_TAB_1); + setPage(widgetIndex - WIDX_TAB_1); break; case WIDX_PRIMARY_PRICE: { @@ -6471,14 +6471,14 @@ namespace OpenRCT2::Ui::Windows void IncomeUpdate() { currentFrame++; - OnPrepareDraw(); - InvalidateWidget(WIDX_TAB_9); + onPrepareDraw(); + invalidateWidget(WIDX_TAB_9); auto ride = GetRide(rideId); if (ride != nullptr && ride->windowInvalidateFlags & RIDE_INVALIDATE_RIDE_INCOME) { ride->windowInvalidateFlags &= ~RIDE_INVALIDATE_RIDE_INCOME; - Invalidate(); + invalidate(); } } @@ -6614,8 +6614,8 @@ namespace OpenRCT2::Ui::Windows money64 profit; ShopItem primaryItem, secondaryItem; - DrawWidgets(rt); - DrawTabImages(rt); + drawWidgets(rt); + drawTabImages(rt); auto ride = GetRide(rideId); if (ride == nullptr) @@ -6716,7 +6716,7 @@ namespace OpenRCT2::Ui::Windows switch (widgetIndex) { case WIDX_CLOSE: - Close(); + close(); return; case WIDX_TAB_1: case WIDX_TAB_2: @@ -6728,7 +6728,7 @@ namespace OpenRCT2::Ui::Windows case WIDX_TAB_8: case WIDX_TAB_9: case WIDX_TAB_10: - SetPage(widgetIndex - WIDX_TAB_1); + setPage(widgetIndex - WIDX_TAB_1); break; case WIDX_SHOW_GUESTS_THOUGHTS: { @@ -6770,14 +6770,14 @@ namespace OpenRCT2::Ui::Windows if (pickedPeepFrame >= 24) pickedPeepFrame = 0; - OnPrepareDraw(); - InvalidateWidget(WIDX_TAB_10); + onPrepareDraw(); + invalidateWidget(WIDX_TAB_10); auto ride = GetRide(rideId); if (ride != nullptr && ride->windowInvalidateFlags & RIDE_INVALIDATE_RIDE_CUSTOMER) { ride->windowInvalidateFlags &= ~RIDE_INVALIDATE_RIDE_CUSTOMER; - Invalidate(); + invalidate(); } } @@ -6813,8 +6813,8 @@ namespace OpenRCT2::Ui::Windows int16_t popularity, satisfaction, queueTime; StringId stringId; - DrawWidgets(rt); - DrawTabImages(rt); + drawWidgets(rt); + drawTabImages(rt); auto ride = GetRide(rideId); if (ride == nullptr) @@ -6959,11 +6959,11 @@ namespace OpenRCT2::Ui::Windows if (w == nullptr) { w = WindowRideOpen(ride); - w->SetViewIndex(0); + w->setViewIndex(0); } - else if (w->GetViewIndex() >= (1 + ride.numTrains + ride.numStations)) + else if (w->getViewIndex() >= (1 + ride.numTrains + ride.numStations)) { - w->SetViewIndex(0); + w->setViewIndex(0); } if (isToolActive(w->classification, w->number)) @@ -6973,10 +6973,10 @@ namespace OpenRCT2::Ui::Windows if (w->page != WINDOW_RIDE_PAGE_MAIN) { - w->SetPage(WINDOW_RIDE_PAGE_MAIN); + w->setPage(WINDOW_RIDE_PAGE_MAIN); } - w->OnViewportRotate(); + w->onViewportRotate(); return w; } @@ -7013,7 +7013,7 @@ namespace OpenRCT2::Ui::Windows } } - w->SetViewIndex(1 + ride.numTrains + stationIndex.ToUnderlying()); + w->setViewIndex(1 + ride.numTrains + stationIndex.ToUnderlying()); return w; } @@ -7087,7 +7087,7 @@ namespace OpenRCT2::Ui::Windows auto* w = static_cast(windowMgr->FindByNumber(WindowClass::Ride, ride->id.ToUnderlying())); if (w != nullptr) { - w->Invalidate(); + w->invalidate(); if (isToolActive(w->classification, w->number)) { @@ -7095,7 +7095,7 @@ namespace OpenRCT2::Ui::Windows } int32_t openedPeepWindow = 0; - if (w->GetViewIndex() == view) + if (w->getViewIndex() == view) { int32_t numPeepsLeft = vehicle->num_peeps; for (int32_t i = 0; i < 32 && numPeepsLeft > 0; i++) @@ -7129,8 +7129,8 @@ namespace OpenRCT2::Ui::Windows w = WindowRideOpen(*ride); } - w->SetViewIndex(view); - w->Invalidate(); + w->setViewIndex(view); + w->invalidate(); return w; } @@ -7143,14 +7143,14 @@ namespace OpenRCT2::Ui::Windows return; auto ride = vehicle.GetRide(); - auto viewVehicleIndex = w->GetViewIndex() - 1; + auto viewVehicleIndex = w->getViewIndex() - 1; if (ride == nullptr || viewVehicleIndex < 0 || viewVehicleIndex >= ride->numTrains) return; if (vehicle.Id != ride->vehicles[viewVehicleIndex]) return; - w->Invalidate(); + w->invalidate(); } void WindowRidePaintResetVehicle(RideId rideIndex) @@ -7161,9 +7161,9 @@ namespace OpenRCT2::Ui::Windows { if (w->page == 4) // WINDOW_RIDE_PAGE_COLOUR { - w->ResetVehicleIndex(); + w->resetVehicleIndex(); } - w->Invalidate(); + w->invalidate(); } } diff --git a/src/openrct2-ui/windows/RideConstruction.cpp b/src/openrct2-ui/windows/RideConstruction.cpp index 2575c7489c..d84bd77138 100644 --- a/src/openrct2-ui/windows/RideConstruction.cpp +++ b/src/openrct2-ui/windows/RideConstruction.cpp @@ -237,7 +237,7 @@ namespace OpenRCT2::Ui::Windows bool _autoOpeningShop{}; public: - void OnOpen() override + void onOpen() override { auto currentRide = GetRide(_currentRideIndex); if (currentRide == nullptr) @@ -245,10 +245,10 @@ namespace OpenRCT2::Ui::Windows return; } - SetWidgets(kRideConstructionWidgets); + setWidgets(kRideConstructionWidgets); number = _currentRideIndex.ToUnderlying(); - InitScrollWidgets(); + initScrollWidgets(); WindowPushOthersRight(*this); ShowGridlines(); @@ -281,7 +281,7 @@ namespace OpenRCT2::Ui::Windows UpdateTrackPieceWidgets(); } - void OnClose() override + void onClose() override { RideConstructionInvalidateCurrentTrack(); ViewportSetVisibility(ViewportVisibility::standard); @@ -1008,13 +1008,13 @@ namespace OpenRCT2::Ui::Windows { if ((newDisabledWidgets & (1uLL << i)) != (currentDisabledWidgets & (1uLL << i))) { - InvalidateWidget(i); + invalidateWidget(i); } } disabledWidgets = newDisabledWidgets; } - void OnUpdate() override + void onUpdate() override { auto currentRide = GetRide(_currentRideIndex); if (currentRide == nullptr) @@ -1026,7 +1026,7 @@ namespace OpenRCT2::Ui::Windows // editing currentRide while open will cause many issues until properly handled if (currentRide->status != RideStatus::closed && currentRide->status != RideStatus::simulating) { - Close(); + close(); return; } @@ -1038,7 +1038,7 @@ namespace OpenRCT2::Ui::Windows case TrackElemType::Whirlpool: case TrackElemType::Rapids: case TrackElemType::Waterfall: - InvalidateWidget(WIDX_CONSTRUCT); + invalidateWidget(WIDX_CONSTRUCT); break; default: break; @@ -1049,7 +1049,7 @@ namespace OpenRCT2::Ui::Windows { if (!isToolActive(*this, WIDX_CONSTRUCT)) { - Close(); + close(); return; } } @@ -1082,13 +1082,13 @@ namespace OpenRCT2::Ui::Windows UpdateTrackPieceWidgets(); } - void OnMouseUp(WidgetIndex widgetIndex) override + void onMouseUp(WidgetIndex widgetIndex) override { WindowRideConstructionUpdateEnabledTrackPieces(); switch (widgetIndex) { case WIDX_CLOSE: - Close(); + close(); break; case WIDX_ROTATE: Rotate(); @@ -1114,7 +1114,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnMouseDown(WidgetIndex widgetIndex) override + void onMouseDown(WidgetIndex widgetIndex) override { auto currentRide = GetRide(_currentRideIndex); if (currentRide == nullptr) @@ -1535,7 +1535,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnDropdown(WidgetIndex widgetIndex, int32_t selectedIndex) override + void onDropdown(WidgetIndex widgetIndex, int32_t selectedIndex) override { if (widgetIndex != WIDX_SPECIAL_TRACK_DROPDOWN) return; @@ -1568,7 +1568,7 @@ namespace OpenRCT2::Ui::Windows WindowRideConstructionUpdateActiveElements(); } - void OnToolUpdate(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override + void onToolUpdate(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override { switch (widgetIndex) { @@ -1582,7 +1582,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override + void onToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override { switch (widgetIndex) { @@ -1596,7 +1596,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnPrepareDraw() override + void onPrepareDraw() override { auto currentRide = GetRide(_currentRideIndex); if (currentRide == nullptr) @@ -1654,7 +1654,7 @@ namespace OpenRCT2::Ui::Windows currentRide->formatNameTo(ft); } - static void OnDrawUpdateCoveredPieces(const TrackDrawerDescriptor& trackDrawerDescriptor, std::span widgets) + static void onDrawUpdateCoveredPieces(const TrackDrawerDescriptor& trackDrawerDescriptor, std::span widgets) { widgets[WIDX_U_TRACK].type = WidgetType::empty; widgets[WIDX_O_TRACK].type = WidgetType::empty; @@ -1683,13 +1683,13 @@ namespace OpenRCT2::Ui::Windows widgets[WIDX_O_TRACK].tooltip = trackDrawerDescriptor.Covered.tooltip; } - void OnDraw(RenderTarget& rt) override + void onDraw(RenderTarget& rt) override { RenderTarget clippedRT; Widget* widget; int32_t widgetWidth, widgetHeight; - DrawWidgets(rt); + drawWidgets(rt); widget = &widgets[WIDX_CONSTRUCT]; if (widget->type == WidgetType::empty) @@ -1727,7 +1727,7 @@ namespace OpenRCT2::Ui::Windows } } - void UpdateWidgets() + void updateWidgets() { auto currentRide = GetRide(_currentRideIndex); if (currentRide == nullptr) @@ -1988,7 +1988,7 @@ namespace OpenRCT2::Ui::Windows bool boosterTrackSelected = TrackTypeIsBooster(_selectedTrackType) || TrackTypeIsBooster(_currentlySelectedTrack.trackType); - // Only necessary because TD6 writes speed and seat rotation to the same bits. Remove for new track design format. + // only necessary because TD6 writes speed and seat rotation to the same bits. Remove for new track design format. bool trackHasSpeedAndSeatRotation = _selectedTrackType == TrackElemType::BlockBrakes || _currentlySelectedTrack == TrackElemType::BlockBrakes || _selectedTrackType > TrackElemType::HighestAlias || _currentlySelectedTrack.trackType > TrackElemType::HighestAlias; @@ -2003,7 +2003,7 @@ namespace OpenRCT2::Ui::Windows widgets[WIDX_BANK_STRAIGHT].type = WidgetType::flatBtn; widgets[WIDX_BANK_RIGHT].type = WidgetType::flatBtn; } - OnDrawUpdateCoveredPieces(trackDrawerDescriptor, widgets); + onDrawUpdateCoveredPieces(trackDrawerDescriptor, widgets); } else { @@ -2032,7 +2032,7 @@ namespace OpenRCT2::Ui::Windows widgets[WIDX_SPEED_SETTING_SPINNER_DOWN].text = STR_NUMERIC_DOWN; auto spinnerStart = 124 + widgets[WIDX_TITLE].bottom; - ResizeSpinner(WIDX_SPEED_SETTING_SPINNER, { 12, spinnerStart }, { 85, kSpinnerHeight }); + resizeSpinner(WIDX_SPEED_SETTING_SPINNER, { 12, spinnerStart }, { 85, kSpinnerHeight }); holdDownWidgets |= (1uLL << WIDX_SPEED_SETTING_SPINNER_UP) | (1uLL << WIDX_SPEED_SETTING_SPINNER_DOWN); } @@ -2121,7 +2121,7 @@ namespace OpenRCT2::Ui::Windows break; default: pressedWidgets = newPressedWidgets; - Invalidate(); + invalidate(); return; } @@ -2220,10 +2220,10 @@ namespace OpenRCT2::Ui::Windows newPressedWidgets |= (1uLL << WIDX_CHAIN_LIFT); pressedWidgets = newPressedWidgets; - Invalidate(); + invalidate(); } - void UpdatePossibleRideConfigurations() + void updatePossibleRideConfigurations() { auto currentRide = GetRide(_currentRideIndex); if (currentRide == nullptr) @@ -2236,7 +2236,7 @@ namespace OpenRCT2::Ui::Windows _currentlyShowingBrakeOrBoosterSpeed = false; } - void UpdateMapSelection() + void updateMapSelection() { OpenRCT2::TrackElemType trackType; int32_t trackDirection; @@ -2273,12 +2273,12 @@ namespace OpenRCT2::Ui::Windows if (GetRide(_currentRideIndex)) { - SelectMapTiles(trackType, trackDirection, trackPos); + selectMapTiles(trackType, trackDirection, trackPos); MapInvalidateMapSelectionTiles(); } } - void SelectMapTiles(OpenRCT2::TrackElemType trackType, int32_t trackDirection, const CoordsXY& tileCoords) + void selectMapTiles(OpenRCT2::TrackElemType trackType, int32_t trackDirection, const CoordsXY& tileCoords) { // If the scenery tool is active, we do not display our tiles as it // will conflict with larger scenery objects selecting tiles @@ -2921,7 +2921,7 @@ namespace OpenRCT2::Ui::Windows } else { - w->OnMouseUp(WIDX_ENTRANCE); + w->onMouseUp(WIDX_ENTRANCE); } } } @@ -2944,7 +2944,7 @@ namespace OpenRCT2::Ui::Windows { if (!RideAreAllPossibleEntrancesAndExitsBuilt(*ride).Successful) { - w->OnMouseUp(WC_RIDE_CONSTRUCTION__WIDX_ENTRANCE); + w->onMouseUp(WC_RIDE_CONSTRUCTION__WIDX_ENTRANCE); } } } @@ -3176,7 +3176,7 @@ namespace OpenRCT2::Ui::Windows return; } - window->UpdateMapSelection(); + window->updateMapSelection(); _selectedTrackType = TrackElemType::None; if (_rideConstructionState == RideConstructionState::Selected) @@ -3195,8 +3195,8 @@ namespace OpenRCT2::Ui::Windows } } - window->UpdatePossibleRideConfigurations(); - window->UpdateWidgets(); + window->updatePossibleRideConfigurations(); + window->updateWidgets(); } /** @@ -3408,7 +3408,7 @@ namespace OpenRCT2::Ui::Windows // Re-using this other code, very slight difference from original // - Original code checks for MSB mask instead of 255 on trackPart->var_00 // - Original code checks this first as its already set origin tile, probably just a micro optimisation - window->SelectMapTiles(trackType, trackDirection, *mapCoords); + window->selectMapTiles(trackType, trackDirection, *mapCoords); } gMapSelectArrowPosition.z = z; @@ -3777,7 +3777,7 @@ namespace OpenRCT2::Ui::Windows break; gDisableErrorWindowSound = true; - w->OnMouseDown(WIDX_CONSTRUCT); + w->onMouseDown(WIDX_CONSTRUCT); gDisableErrorWindowSound = false; if (_trackPlaceCost == kMoney64Undefined) @@ -3841,19 +3841,19 @@ namespace OpenRCT2::Ui::Windows if (!widgetIsDisabled(*w, WIDX_LEFT_CURVE_VERY_SMALL) && w->widgets[WIDX_LEFT_CURVE_VERY_SMALL].type != WidgetType::empty) { - w->OnMouseDown(WIDX_LEFT_CURVE_VERY_SMALL); + w->onMouseDown(WIDX_LEFT_CURVE_VERY_SMALL); } break; case TrackCurve::Left: if (!widgetIsDisabled(*w, WIDX_LEFT_CURVE_SMALL) && w->widgets[WIDX_LEFT_CURVE_SMALL].type != WidgetType::empty) { - w->OnMouseDown(WIDX_LEFT_CURVE_SMALL); + w->onMouseDown(WIDX_LEFT_CURVE_SMALL); } else if ( !widgetIsDisabled(*w, WIDX_LEFT_CURVE_VERY_SMALL) && w->widgets[WIDX_LEFT_CURVE_VERY_SMALL].type != WidgetType::empty) { - w->OnMouseDown(WIDX_LEFT_CURVE_VERY_SMALL); + w->onMouseDown(WIDX_LEFT_CURVE_VERY_SMALL); } else { @@ -3863,18 +3863,18 @@ namespace OpenRCT2::Ui::Windows case TrackCurve::LeftLarge: if (!widgetIsDisabled(*w, WIDX_LEFT_CURVE) && w->widgets[WIDX_LEFT_CURVE].type != WidgetType::empty) { - w->OnMouseDown(WIDX_LEFT_CURVE); + w->onMouseDown(WIDX_LEFT_CURVE); } else if ( !widgetIsDisabled(*w, WIDX_LEFT_CURVE_SMALL) && w->widgets[WIDX_LEFT_CURVE_SMALL].type != WidgetType::empty) { - w->OnMouseDown(WIDX_LEFT_CURVE_SMALL); + w->onMouseDown(WIDX_LEFT_CURVE_SMALL); } else if ( !widgetIsDisabled(*w, WIDX_LEFT_CURVE_VERY_SMALL) && w->widgets[WIDX_LEFT_CURVE_VERY_SMALL].type != WidgetType::empty) { - w->OnMouseDown(WIDX_LEFT_CURVE_VERY_SMALL); + w->onMouseDown(WIDX_LEFT_CURVE_VERY_SMALL); } else { @@ -3884,22 +3884,22 @@ namespace OpenRCT2::Ui::Windows case TrackCurve::None: if (!widgetIsDisabled(*w, WIDX_LEFT_CURVE_LARGE) && w->widgets[WIDX_LEFT_CURVE_LARGE].type != WidgetType::empty) { - w->OnMouseDown(WIDX_LEFT_CURVE_LARGE); + w->onMouseDown(WIDX_LEFT_CURVE_LARGE); } else if (!widgetIsDisabled(*w, WIDX_LEFT_CURVE) && w->widgets[WIDX_LEFT_CURVE].type != WidgetType::empty) { - w->OnMouseDown(WIDX_LEFT_CURVE); + w->onMouseDown(WIDX_LEFT_CURVE); } else if ( !widgetIsDisabled(*w, WIDX_LEFT_CURVE_SMALL) && w->widgets[WIDX_LEFT_CURVE_SMALL].type != WidgetType::empty) { - w->OnMouseDown(WIDX_LEFT_CURVE_SMALL); + w->onMouseDown(WIDX_LEFT_CURVE_SMALL); } else if ( !widgetIsDisabled(*w, WIDX_LEFT_CURVE_VERY_SMALL) && w->widgets[WIDX_LEFT_CURVE_VERY_SMALL].type != WidgetType::empty) { - w->OnMouseDown(WIDX_LEFT_CURVE_VERY_SMALL); + w->onMouseDown(WIDX_LEFT_CURVE_VERY_SMALL); } else { @@ -3909,27 +3909,27 @@ namespace OpenRCT2::Ui::Windows case TrackCurve::RightLarge: if (!widgetIsDisabled(*w, WIDX_STRAIGHT) && w->widgets[WIDX_STRAIGHT].type != WidgetType::empty) { - w->OnMouseDown(WIDX_STRAIGHT); + w->onMouseDown(WIDX_STRAIGHT); } else if ( !widgetIsDisabled(*w, WIDX_LEFT_CURVE_LARGE) && w->widgets[WIDX_LEFT_CURVE_LARGE].type != WidgetType::empty) { - w->OnMouseDown(WIDX_LEFT_CURVE_LARGE); + w->onMouseDown(WIDX_LEFT_CURVE_LARGE); } else if (!widgetIsDisabled(*w, WIDX_LEFT_CURVE) && w->widgets[WIDX_LEFT_CURVE].type != WidgetType::empty) { - w->OnMouseDown(WIDX_LEFT_CURVE); + w->onMouseDown(WIDX_LEFT_CURVE); } else if ( !widgetIsDisabled(*w, WIDX_LEFT_CURVE_SMALL) && w->widgets[WIDX_LEFT_CURVE_SMALL].type != WidgetType::empty) { - w->OnMouseDown(WIDX_LEFT_CURVE_SMALL); + w->onMouseDown(WIDX_LEFT_CURVE_SMALL); } else if ( !widgetIsDisabled(*w, WIDX_LEFT_CURVE_VERY_SMALL) && w->widgets[WIDX_LEFT_CURVE_VERY_SMALL].type != WidgetType::empty) { - w->OnMouseDown(WIDX_LEFT_CURVE_VERY_SMALL); + w->onMouseDown(WIDX_LEFT_CURVE_VERY_SMALL); } else { @@ -3940,31 +3940,31 @@ namespace OpenRCT2::Ui::Windows if (!widgetIsDisabled(*w, WIDX_RIGHT_CURVE_LARGE) && w->widgets[WIDX_RIGHT_CURVE_LARGE].type != WidgetType::empty) { - w->OnMouseDown(WIDX_RIGHT_CURVE_LARGE); + w->onMouseDown(WIDX_RIGHT_CURVE_LARGE); } else if (!widgetIsDisabled(*w, WIDX_STRAIGHT) && w->widgets[WIDX_STRAIGHT].type != WidgetType::empty) { - w->OnMouseDown(WIDX_STRAIGHT); + w->onMouseDown(WIDX_STRAIGHT); } else if ( !widgetIsDisabled(*w, WIDX_LEFT_CURVE_LARGE) && w->widgets[WIDX_LEFT_CURVE_LARGE].type != WidgetType::empty) { - w->OnMouseDown(WIDX_LEFT_CURVE_LARGE); + w->onMouseDown(WIDX_LEFT_CURVE_LARGE); } else if (!widgetIsDisabled(*w, WIDX_LEFT_CURVE) && w->widgets[WIDX_LEFT_CURVE].type != WidgetType::empty) { - w->OnMouseDown(WIDX_LEFT_CURVE); + w->onMouseDown(WIDX_LEFT_CURVE); } else if ( !widgetIsDisabled(*w, WIDX_LEFT_CURVE_SMALL) && w->widgets[WIDX_LEFT_CURVE_SMALL].type != WidgetType::empty) { - w->OnMouseDown(WIDX_LEFT_CURVE_SMALL); + w->onMouseDown(WIDX_LEFT_CURVE_SMALL); } else if ( !widgetIsDisabled(*w, WIDX_LEFT_CURVE_VERY_SMALL) && w->widgets[WIDX_LEFT_CURVE_VERY_SMALL].type != WidgetType::empty) { - w->OnMouseDown(WIDX_LEFT_CURVE_VERY_SMALL); + w->onMouseDown(WIDX_LEFT_CURVE_VERY_SMALL); } else { @@ -3974,37 +3974,37 @@ namespace OpenRCT2::Ui::Windows case TrackCurve::RightSmall: if (!widgetIsDisabled(*w, WIDX_RIGHT_CURVE) && w->widgets[WIDX_RIGHT_CURVE].type != WidgetType::empty) { - w->OnMouseDown(WIDX_RIGHT_CURVE); + w->onMouseDown(WIDX_RIGHT_CURVE); } else if ( !widgetIsDisabled(*w, WIDX_RIGHT_CURVE_LARGE) && w->widgets[WIDX_RIGHT_CURVE_LARGE].type != WidgetType::empty) { - w->OnMouseDown(WIDX_RIGHT_CURVE_LARGE); + w->onMouseDown(WIDX_RIGHT_CURVE_LARGE); } else if (!widgetIsDisabled(*w, WIDX_STRAIGHT) && w->widgets[WIDX_STRAIGHT].type != WidgetType::empty) { - w->OnMouseDown(WIDX_STRAIGHT); + w->onMouseDown(WIDX_STRAIGHT); } else if ( !widgetIsDisabled(*w, WIDX_LEFT_CURVE_LARGE) && w->widgets[WIDX_LEFT_CURVE_LARGE].type != WidgetType::empty) { - w->OnMouseDown(WIDX_LEFT_CURVE_LARGE); + w->onMouseDown(WIDX_LEFT_CURVE_LARGE); } else if (!widgetIsDisabled(*w, WIDX_LEFT_CURVE) && w->widgets[WIDX_LEFT_CURVE].type != WidgetType::empty) { - w->OnMouseDown(WIDX_LEFT_CURVE); + w->onMouseDown(WIDX_LEFT_CURVE); } else if ( !widgetIsDisabled(*w, WIDX_LEFT_CURVE_SMALL) && w->widgets[WIDX_LEFT_CURVE_SMALL].type != WidgetType::empty) { - w->OnMouseDown(WIDX_LEFT_CURVE_SMALL); + w->onMouseDown(WIDX_LEFT_CURVE_SMALL); } else if ( !widgetIsDisabled(*w, WIDX_LEFT_CURVE_VERY_SMALL) && w->widgets[WIDX_LEFT_CURVE_VERY_SMALL].type != WidgetType::empty) { - w->OnMouseDown(WIDX_LEFT_CURVE_VERY_SMALL); + w->onMouseDown(WIDX_LEFT_CURVE_VERY_SMALL); } else { @@ -4015,41 +4015,41 @@ namespace OpenRCT2::Ui::Windows if (!widgetIsDisabled(*w, WIDX_RIGHT_CURVE_SMALL) && w->widgets[WIDX_RIGHT_CURVE_SMALL].type != WidgetType::empty) { - w->OnMouseDown(WIDX_RIGHT_CURVE_SMALL); + w->onMouseDown(WIDX_RIGHT_CURVE_SMALL); } else if (!widgetIsDisabled(*w, WIDX_RIGHT_CURVE) && w->widgets[WIDX_RIGHT_CURVE].type != WidgetType::empty) { - w->OnMouseDown(WIDX_RIGHT_CURVE); + w->onMouseDown(WIDX_RIGHT_CURVE); } else if ( !widgetIsDisabled(*w, WIDX_RIGHT_CURVE_LARGE) && w->widgets[WIDX_RIGHT_CURVE_LARGE].type != WidgetType::empty) { - w->OnMouseDown(WIDX_RIGHT_CURVE_LARGE); + w->onMouseDown(WIDX_RIGHT_CURVE_LARGE); } else if (!widgetIsDisabled(*w, WIDX_STRAIGHT) && w->widgets[WIDX_STRAIGHT].type != WidgetType::empty) { - w->OnMouseDown(WIDX_STRAIGHT); + w->onMouseDown(WIDX_STRAIGHT); } else if ( !widgetIsDisabled(*w, WIDX_LEFT_CURVE_LARGE) && w->widgets[WIDX_LEFT_CURVE_LARGE].type != WidgetType::empty) { - w->OnMouseDown(WIDX_LEFT_CURVE_LARGE); + w->onMouseDown(WIDX_LEFT_CURVE_LARGE); } else if (!widgetIsDisabled(*w, WIDX_LEFT_CURVE) && w->widgets[WIDX_LEFT_CURVE].type != WidgetType::empty) { - w->OnMouseDown(WIDX_LEFT_CURVE); + w->onMouseDown(WIDX_LEFT_CURVE); } else if ( !widgetIsDisabled(*w, WIDX_LEFT_CURVE_SMALL) && w->widgets[WIDX_LEFT_CURVE_SMALL].type != WidgetType::empty) { - w->OnMouseDown(WIDX_LEFT_CURVE_SMALL); + w->onMouseDown(WIDX_LEFT_CURVE_SMALL); } else if ( !widgetIsDisabled(*w, WIDX_LEFT_CURVE_VERY_SMALL) && w->widgets[WIDX_LEFT_CURVE_VERY_SMALL].type != WidgetType::empty) { - w->OnMouseDown(WIDX_LEFT_CURVE_VERY_SMALL); + w->onMouseDown(WIDX_LEFT_CURVE_VERY_SMALL); } else { @@ -4079,20 +4079,20 @@ namespace OpenRCT2::Ui::Windows if (!widgetIsDisabled(*w, WIDX_RIGHT_CURVE_VERY_SMALL) && w->widgets[WIDX_RIGHT_CURVE_VERY_SMALL].type != WidgetType::empty) { - w->OnMouseDown(WIDX_RIGHT_CURVE_VERY_SMALL); + w->onMouseDown(WIDX_RIGHT_CURVE_VERY_SMALL); } break; case TrackCurve::Right: if (!widgetIsDisabled(*w, WIDX_RIGHT_CURVE_SMALL) && w->widgets[WIDX_RIGHT_CURVE_SMALL].type != WidgetType::empty) { - w->OnMouseDown(WIDX_RIGHT_CURVE_SMALL); + w->onMouseDown(WIDX_RIGHT_CURVE_SMALL); } else if ( !widgetIsDisabled(*w, WIDX_RIGHT_CURVE_VERY_SMALL) && w->widgets[WIDX_RIGHT_CURVE_VERY_SMALL].type != WidgetType::empty) { - w->OnMouseDown(WIDX_RIGHT_CURVE_VERY_SMALL); + w->onMouseDown(WIDX_RIGHT_CURVE_VERY_SMALL); } else { @@ -4102,19 +4102,19 @@ namespace OpenRCT2::Ui::Windows case TrackCurve::RightLarge: if (!widgetIsDisabled(*w, WIDX_RIGHT_CURVE) && w->widgets[WIDX_RIGHT_CURVE].type != WidgetType::empty) { - w->OnMouseDown(WIDX_RIGHT_CURVE); + w->onMouseDown(WIDX_RIGHT_CURVE); } else if ( !widgetIsDisabled(*w, WIDX_RIGHT_CURVE_SMALL) && w->widgets[WIDX_RIGHT_CURVE_SMALL].type != WidgetType::empty) { - w->OnMouseDown(WIDX_RIGHT_CURVE_SMALL); + w->onMouseDown(WIDX_RIGHT_CURVE_SMALL); } else if ( !widgetIsDisabled(*w, WIDX_RIGHT_CURVE_VERY_SMALL) && w->widgets[WIDX_RIGHT_CURVE_VERY_SMALL].type != WidgetType::empty) { - w->OnMouseDown(WIDX_RIGHT_CURVE_VERY_SMALL); + w->onMouseDown(WIDX_RIGHT_CURVE_VERY_SMALL); } else { @@ -4125,23 +4125,23 @@ namespace OpenRCT2::Ui::Windows if (!widgetIsDisabled(*w, WIDX_RIGHT_CURVE_LARGE) && w->widgets[WIDX_RIGHT_CURVE_LARGE].type != WidgetType::empty) { - w->OnMouseDown(WIDX_RIGHT_CURVE_LARGE); + w->onMouseDown(WIDX_RIGHT_CURVE_LARGE); } else if (!widgetIsDisabled(*w, WIDX_LEFT_CURVE) && w->widgets[WIDX_RIGHT_CURVE].type != WidgetType::empty) { - w->OnMouseDown(WIDX_RIGHT_CURVE); + w->onMouseDown(WIDX_RIGHT_CURVE); } else if ( !widgetIsDisabled(*w, WIDX_RIGHT_CURVE_SMALL) && w->widgets[WIDX_RIGHT_CURVE_SMALL].type != WidgetType::empty) { - w->OnMouseDown(WIDX_RIGHT_CURVE_SMALL); + w->onMouseDown(WIDX_RIGHT_CURVE_SMALL); } else if ( !widgetIsDisabled(*w, WIDX_RIGHT_CURVE_VERY_SMALL) && w->widgets[WIDX_RIGHT_CURVE_VERY_SMALL].type != WidgetType::empty) { - w->OnMouseDown(WIDX_RIGHT_CURVE_VERY_SMALL); + w->onMouseDown(WIDX_RIGHT_CURVE_VERY_SMALL); } else { @@ -4151,29 +4151,29 @@ namespace OpenRCT2::Ui::Windows case TrackCurve::LeftLarge: if (!widgetIsDisabled(*w, WIDX_STRAIGHT) && w->widgets[WIDX_STRAIGHT].type != WidgetType::empty) { - w->OnMouseDown(WIDX_STRAIGHT); + w->onMouseDown(WIDX_STRAIGHT); } else if ( !widgetIsDisabled(*w, WIDX_RIGHT_CURVE_LARGE) && w->widgets[WIDX_RIGHT_CURVE_LARGE].type != WidgetType::empty) { - w->OnMouseDown(WIDX_RIGHT_CURVE_LARGE); + w->onMouseDown(WIDX_RIGHT_CURVE_LARGE); } else if (!widgetIsDisabled(*w, WIDX_RIGHT_CURVE) && w->widgets[WIDX_RIGHT_CURVE].type != WidgetType::empty) { - w->OnMouseDown(WIDX_RIGHT_CURVE); + w->onMouseDown(WIDX_RIGHT_CURVE); } else if ( !widgetIsDisabled(*w, WIDX_RIGHT_CURVE_SMALL) && w->widgets[WIDX_RIGHT_CURVE_SMALL].type != WidgetType::empty) { - w->OnMouseDown(WIDX_RIGHT_CURVE_SMALL); + w->onMouseDown(WIDX_RIGHT_CURVE_SMALL); } else if ( !widgetIsDisabled(*w, WIDX_RIGHT_CURVE_VERY_SMALL) && w->widgets[WIDX_RIGHT_CURVE_VERY_SMALL].type != WidgetType::empty) { - w->OnMouseDown(WIDX_RIGHT_CURVE_VERY_SMALL); + w->onMouseDown(WIDX_RIGHT_CURVE_VERY_SMALL); } else { @@ -4183,33 +4183,33 @@ namespace OpenRCT2::Ui::Windows case TrackCurve::Left: if (!widgetIsDisabled(*w, WIDX_LEFT_CURVE_LARGE) && w->widgets[WIDX_LEFT_CURVE_LARGE].type != WidgetType::empty) { - w->OnMouseDown(WIDX_LEFT_CURVE_LARGE); + w->onMouseDown(WIDX_LEFT_CURVE_LARGE); } else if (!widgetIsDisabled(*w, WIDX_STRAIGHT) && w->widgets[WIDX_STRAIGHT].type != WidgetType::empty) { - w->OnMouseDown(WIDX_STRAIGHT); + w->onMouseDown(WIDX_STRAIGHT); } else if ( !widgetIsDisabled(*w, WIDX_RIGHT_CURVE_LARGE) && w->widgets[WIDX_RIGHT_CURVE_LARGE].type != WidgetType::empty) { - w->OnMouseDown(WIDX_RIGHT_CURVE_LARGE); + w->onMouseDown(WIDX_RIGHT_CURVE_LARGE); } else if (!widgetIsDisabled(*w, WIDX_RIGHT_CURVE) && w->widgets[WIDX_RIGHT_CURVE].type != WidgetType::empty) { - w->OnMouseDown(WIDX_RIGHT_CURVE); + w->onMouseDown(WIDX_RIGHT_CURVE); } else if ( !widgetIsDisabled(*w, WIDX_RIGHT_CURVE_SMALL) && w->widgets[WIDX_RIGHT_CURVE_SMALL].type != WidgetType::empty) { - w->OnMouseDown(WIDX_RIGHT_CURVE_SMALL); + w->onMouseDown(WIDX_RIGHT_CURVE_SMALL); } else if ( !widgetIsDisabled(*w, WIDX_RIGHT_CURVE_VERY_SMALL) && w->widgets[WIDX_RIGHT_CURVE_VERY_SMALL].type != WidgetType::empty) { - w->OnMouseDown(WIDX_RIGHT_CURVE_VERY_SMALL); + w->onMouseDown(WIDX_RIGHT_CURVE_VERY_SMALL); } else { @@ -4219,38 +4219,38 @@ namespace OpenRCT2::Ui::Windows case TrackCurve::LeftSmall: if (!widgetIsDisabled(*w, WIDX_LEFT_CURVE) && w->widgets[WIDX_LEFT_CURVE].type != WidgetType::empty) { - w->OnMouseDown(WIDX_LEFT_CURVE); + w->onMouseDown(WIDX_LEFT_CURVE); } else if ( !widgetIsDisabled(*w, WIDX_LEFT_CURVE_LARGE) && w->widgets[WIDX_LEFT_CURVE_LARGE].type != WidgetType::empty) { - w->OnMouseDown(WIDX_LEFT_CURVE_LARGE); + w->onMouseDown(WIDX_LEFT_CURVE_LARGE); } else if (!widgetIsDisabled(*w, WIDX_STRAIGHT) && w->widgets[WIDX_STRAIGHT].type != WidgetType::empty) { - w->OnMouseDown(WIDX_STRAIGHT); + w->onMouseDown(WIDX_STRAIGHT); } else if ( !widgetIsDisabled(*w, WIDX_RIGHT_CURVE_LARGE) && w->widgets[WIDX_RIGHT_CURVE_LARGE].type != WidgetType::empty) { - w->OnMouseDown(WIDX_RIGHT_CURVE_LARGE); + w->onMouseDown(WIDX_RIGHT_CURVE_LARGE); } else if (!widgetIsDisabled(*w, WIDX_RIGHT_CURVE) && w->widgets[WIDX_RIGHT_CURVE].type != WidgetType::empty) { - w->OnMouseDown(WIDX_RIGHT_CURVE); + w->onMouseDown(WIDX_RIGHT_CURVE); } else if ( !widgetIsDisabled(*w, WIDX_RIGHT_CURVE_SMALL) && w->widgets[WIDX_RIGHT_CURVE_SMALL].type != WidgetType::empty) { - w->OnMouseDown(WIDX_RIGHT_CURVE_SMALL); + w->onMouseDown(WIDX_RIGHT_CURVE_SMALL); } else if ( !widgetIsDisabled(*w, WIDX_RIGHT_CURVE_VERY_SMALL) && w->widgets[WIDX_RIGHT_CURVE_VERY_SMALL].type != WidgetType::empty) { - w->OnMouseDown(WIDX_RIGHT_CURVE_VERY_SMALL); + w->onMouseDown(WIDX_RIGHT_CURVE_VERY_SMALL); } else { @@ -4260,42 +4260,42 @@ namespace OpenRCT2::Ui::Windows case TrackCurve::LeftVerySmall: if (!widgetIsDisabled(*w, WIDX_LEFT_CURVE_SMALL) && w->widgets[WIDX_LEFT_CURVE_SMALL].type != WidgetType::empty) { - w->OnMouseDown(WIDX_LEFT_CURVE_SMALL); + w->onMouseDown(WIDX_LEFT_CURVE_SMALL); } else if (!widgetIsDisabled(*w, WIDX_LEFT_CURVE) && w->widgets[WIDX_LEFT_CURVE].type != WidgetType::empty) { - w->OnMouseDown(WIDX_LEFT_CURVE); + w->onMouseDown(WIDX_LEFT_CURVE); } else if ( !widgetIsDisabled(*w, WIDX_LEFT_CURVE_LARGE) && w->widgets[WIDX_LEFT_CURVE_LARGE].type != WidgetType::empty) { - w->OnMouseDown(WIDX_LEFT_CURVE_LARGE); + w->onMouseDown(WIDX_LEFT_CURVE_LARGE); } else if (!widgetIsDisabled(*w, WIDX_STRAIGHT) && w->widgets[WIDX_STRAIGHT].type != WidgetType::empty) { - w->OnMouseDown(WIDX_STRAIGHT); + w->onMouseDown(WIDX_STRAIGHT); } else if ( !widgetIsDisabled(*w, WIDX_RIGHT_CURVE_LARGE) && w->widgets[WIDX_RIGHT_CURVE_LARGE].type != WidgetType::empty) { - w->OnMouseDown(WIDX_RIGHT_CURVE_LARGE); + w->onMouseDown(WIDX_RIGHT_CURVE_LARGE); } else if (!widgetIsDisabled(*w, WIDX_RIGHT_CURVE) && w->widgets[WIDX_RIGHT_CURVE].type != WidgetType::empty) { - w->OnMouseDown(WIDX_RIGHT_CURVE); + w->onMouseDown(WIDX_RIGHT_CURVE); } else if ( !widgetIsDisabled(*w, WIDX_RIGHT_CURVE_SMALL) && w->widgets[WIDX_RIGHT_CURVE_SMALL].type != WidgetType::empty) { - w->OnMouseDown(WIDX_RIGHT_CURVE_SMALL); + w->onMouseDown(WIDX_RIGHT_CURVE_SMALL); } else if ( !widgetIsDisabled(*w, WIDX_RIGHT_CURVE_VERY_SMALL) && w->widgets[WIDX_RIGHT_CURVE_VERY_SMALL].type != WidgetType::empty) { - w->OnMouseDown(WIDX_RIGHT_CURVE_VERY_SMALL); + w->onMouseDown(WIDX_RIGHT_CURVE_VERY_SMALL); } else { @@ -4318,23 +4318,23 @@ namespace OpenRCT2::Ui::Windows if (!widgetIsDisabled(*w, WIDX_STRAIGHT) && w->widgets[WIDX_STRAIGHT].type != WidgetType::empty) { - w->OnMouseDown(WIDX_STRAIGHT); + w->onMouseDown(WIDX_STRAIGHT); } if (!widgetIsDisabled(*w, WIDX_LEVEL) && w->widgets[WIDX_LEVEL].type != WidgetType::empty) { - w->OnMouseDown(WIDX_LEVEL); + w->onMouseDown(WIDX_LEVEL); } if (!widgetIsDisabled(*w, WIDX_CHAIN_LIFT) && w->widgets[WIDX_CHAIN_LIFT].type != WidgetType::empty && _currentTrackHasLiftHill) { - w->OnMouseDown(WIDX_CHAIN_LIFT); + w->onMouseDown(WIDX_CHAIN_LIFT); } if (!widgetIsDisabled(*w, WIDX_BANK_STRAIGHT) && w->widgets[WIDX_BANK_STRAIGHT].type != WidgetType::empty) { - w->OnMouseDown(WIDX_BANK_STRAIGHT); + w->onMouseDown(WIDX_BANK_STRAIGHT); } } @@ -4353,19 +4353,19 @@ namespace OpenRCT2::Ui::Windows if (IsTrackEnabled(TrackGroup::slopeVertical) && !widgetIsDisabled(*w, WIDX_SLOPE_DOWN_VERTICAL) && w->widgets[WIDX_SLOPE_DOWN_VERTICAL].type != WidgetType::empty) { - w->OnMouseDown(WIDX_SLOPE_DOWN_VERTICAL); + w->onMouseDown(WIDX_SLOPE_DOWN_VERTICAL); } break; case TrackPitch::Down25: if (!widgetIsDisabled(*w, WIDX_SLOPE_DOWN_STEEP) && w->widgets[WIDX_SLOPE_DOWN_STEEP].type != WidgetType::empty) { - w->OnMouseDown(WIDX_SLOPE_DOWN_STEEP); + w->onMouseDown(WIDX_SLOPE_DOWN_STEEP); } break; case TrackPitch::None: if (!widgetIsDisabled(*w, WIDX_SLOPE_DOWN) && w->widgets[WIDX_SLOPE_DOWN].type != WidgetType::empty) { - w->OnMouseDown(WIDX_SLOPE_DOWN); + w->onMouseDown(WIDX_SLOPE_DOWN); } else if (IsTrackEnabled(TrackGroup::slopeVertical)) { @@ -4374,7 +4374,7 @@ namespace OpenRCT2::Ui::Windows else if ( !widgetIsDisabled(*w, WIDX_SLOPE_DOWN_STEEP) && w->widgets[WIDX_SLOPE_DOWN_STEEP].type != WidgetType::empty) { - w->OnMouseDown(WIDX_SLOPE_DOWN_STEEP); + w->onMouseDown(WIDX_SLOPE_DOWN_STEEP); } else { @@ -4384,16 +4384,16 @@ namespace OpenRCT2::Ui::Windows case TrackPitch::Up25: if (!widgetIsDisabled(*w, WIDX_LEVEL) && w->widgets[WIDX_LEVEL].type != WidgetType::empty) { - w->OnMouseDown(WIDX_LEVEL); + w->onMouseDown(WIDX_LEVEL); } else if (!widgetIsDisabled(*w, WIDX_SLOPE_DOWN) && w->widgets[WIDX_SLOPE_DOWN].type != WidgetType::empty) { - w->OnMouseDown(WIDX_SLOPE_DOWN); + w->onMouseDown(WIDX_SLOPE_DOWN); } else if ( !widgetIsDisabled(*w, WIDX_SLOPE_DOWN_STEEP) && w->widgets[WIDX_SLOPE_DOWN_STEEP].type != WidgetType::empty) { - w->OnMouseDown(WIDX_SLOPE_DOWN_STEEP); + w->onMouseDown(WIDX_SLOPE_DOWN_STEEP); } else { @@ -4403,15 +4403,15 @@ namespace OpenRCT2::Ui::Windows case TrackPitch::Up60: if (!widgetIsDisabled(*w, WIDX_SLOPE_UP) && w->widgets[WIDX_SLOPE_UP].type != WidgetType::empty) { - w->OnMouseDown(WIDX_SLOPE_UP); + w->onMouseDown(WIDX_SLOPE_UP); } else if (!widgetIsDisabled(*w, WIDX_LEVEL) && w->widgets[WIDX_LEVEL].type != WidgetType::empty) { - w->OnMouseDown(WIDX_LEVEL); + w->onMouseDown(WIDX_LEVEL); } else if (!widgetIsDisabled(*w, WIDX_SLOPE_DOWN) && w->widgets[WIDX_SLOPE_DOWN].type != WidgetType::empty) { - w->OnMouseDown(WIDX_SLOPE_DOWN); + w->onMouseDown(WIDX_SLOPE_DOWN); } else if (IsTrackEnabled(TrackGroup::slopeVertical)) { @@ -4420,7 +4420,7 @@ namespace OpenRCT2::Ui::Windows else if ( !widgetIsDisabled(*w, WIDX_SLOPE_DOWN_STEEP) && w->widgets[WIDX_SLOPE_DOWN_STEEP].type != WidgetType::empty) { - w->OnMouseDown(WIDX_SLOPE_DOWN_STEEP); + w->onMouseDown(WIDX_SLOPE_DOWN_STEEP); } else { @@ -4431,7 +4431,7 @@ namespace OpenRCT2::Ui::Windows if (IsTrackEnabled(TrackGroup::slopeVertical) && !widgetIsDisabled(*w, WIDX_SLOPE_UP_STEEP) && w->widgets[WIDX_SLOPE_UP_VERTICAL].type != WidgetType::empty) { - w->OnMouseDown(WIDX_SLOPE_UP_STEEP); + w->onMouseDown(WIDX_SLOPE_UP_STEEP); } break; default: @@ -4454,19 +4454,19 @@ namespace OpenRCT2::Ui::Windows if (IsTrackEnabled(TrackGroup::slopeVertical) && !widgetIsDisabled(*w, WIDX_SLOPE_UP_VERTICAL) && w->widgets[WIDX_SLOPE_UP_VERTICAL].type != WidgetType::empty) { - w->OnMouseDown(WIDX_SLOPE_UP_VERTICAL); + w->onMouseDown(WIDX_SLOPE_UP_VERTICAL); } break; case TrackPitch::Up25: if (!widgetIsDisabled(*w, WIDX_SLOPE_UP_STEEP) && w->widgets[WIDX_SLOPE_UP_STEEP].type != WidgetType::empty) { - w->OnMouseDown(WIDX_SLOPE_UP_STEEP); + w->onMouseDown(WIDX_SLOPE_UP_STEEP); } break; case TrackPitch::None: if (!widgetIsDisabled(*w, WIDX_SLOPE_UP) && w->widgets[WIDX_SLOPE_UP].type != WidgetType::empty) { - w->OnMouseDown(WIDX_SLOPE_UP); + w->onMouseDown(WIDX_SLOPE_UP); } else if (IsTrackEnabled(TrackGroup::slopeVertical)) { @@ -4475,7 +4475,7 @@ namespace OpenRCT2::Ui::Windows else if ( !widgetIsDisabled(*w, WIDX_SLOPE_UP_STEEP) && w->widgets[WIDX_SLOPE_UP_STEEP].type != WidgetType::empty) { - w->OnMouseDown(WIDX_SLOPE_UP_STEEP); + w->onMouseDown(WIDX_SLOPE_UP_STEEP); } else { @@ -4485,16 +4485,16 @@ namespace OpenRCT2::Ui::Windows case TrackPitch::Down25: if (!widgetIsDisabled(*w, WIDX_LEVEL) && w->widgets[WIDX_LEVEL].type != WidgetType::empty) { - w->OnMouseDown(WIDX_LEVEL); + w->onMouseDown(WIDX_LEVEL); } else if (!widgetIsDisabled(*w, WIDX_SLOPE_UP) && w->widgets[WIDX_SLOPE_UP].type != WidgetType::empty) { - w->OnMouseDown(WIDX_SLOPE_UP); + w->onMouseDown(WIDX_SLOPE_UP); } else if ( !widgetIsDisabled(*w, WIDX_SLOPE_UP_STEEP) && w->widgets[WIDX_SLOPE_UP_STEEP].type != WidgetType::empty) { - w->OnMouseDown(WIDX_SLOPE_UP_STEEP); + w->onMouseDown(WIDX_SLOPE_UP_STEEP); } else { @@ -4504,15 +4504,15 @@ namespace OpenRCT2::Ui::Windows case TrackPitch::Down60: if (!widgetIsDisabled(*w, WIDX_SLOPE_DOWN) && w->widgets[WIDX_SLOPE_DOWN].type != WidgetType::empty) { - w->OnMouseDown(WIDX_SLOPE_DOWN); + w->onMouseDown(WIDX_SLOPE_DOWN); } else if (!widgetIsDisabled(*w, WIDX_LEVEL) && w->widgets[WIDX_LEVEL].type != WidgetType::empty) { - w->OnMouseDown(WIDX_LEVEL); + w->onMouseDown(WIDX_LEVEL); } else if (!widgetIsDisabled(*w, WIDX_SLOPE_UP) && w->widgets[WIDX_SLOPE_UP].type != WidgetType::empty) { - w->OnMouseDown(WIDX_SLOPE_UP); + w->onMouseDown(WIDX_SLOPE_UP); } else if (IsTrackEnabled(TrackGroup::slopeVertical)) { @@ -4521,7 +4521,7 @@ namespace OpenRCT2::Ui::Windows else if ( !widgetIsDisabled(*w, WIDX_SLOPE_UP_STEEP) && w->widgets[WIDX_SLOPE_UP_STEEP].type != WidgetType::empty) { - w->OnMouseDown(WIDX_SLOPE_UP_STEEP); + w->onMouseDown(WIDX_SLOPE_UP_STEEP); } else { @@ -4532,7 +4532,7 @@ namespace OpenRCT2::Ui::Windows if (IsTrackEnabled(TrackGroup::slopeVertical) && !widgetIsDisabled(*w, WIDX_SLOPE_DOWN_STEEP) && w->widgets[WIDX_SLOPE_DOWN_STEEP].type != WidgetType::empty) { - w->OnMouseDown(WIDX_SLOPE_DOWN_STEEP); + w->onMouseDown(WIDX_SLOPE_DOWN_STEEP); } break; default: @@ -4549,7 +4549,7 @@ namespace OpenRCT2::Ui::Windows return; } - w->OnMouseDown(WIDX_CHAIN_LIFT); + w->onMouseDown(WIDX_CHAIN_LIFT); } void WindowRideConstructionKeyboardShortcutBankLeft() @@ -4567,17 +4567,17 @@ namespace OpenRCT2::Ui::Windows case TrackRoll::None: if (!widgetIsDisabled(*w, WIDX_BANK_LEFT) && w->widgets[WIDX_BANK_LEFT].type != WidgetType::empty) { - w->OnMouseDown(WIDX_BANK_LEFT); + w->onMouseDown(WIDX_BANK_LEFT); } break; case TrackRoll::Right: if (!widgetIsDisabled(*w, WIDX_BANK_STRAIGHT) && w->widgets[WIDX_BANK_STRAIGHT].type != WidgetType::empty) { - w->OnMouseDown(WIDX_BANK_STRAIGHT); + w->onMouseDown(WIDX_BANK_STRAIGHT); } else if (!widgetIsDisabled(*w, WIDX_BANK_LEFT) && w->widgets[WIDX_BANK_LEFT].type != WidgetType::empty) { - w->OnMouseDown(WIDX_BANK_LEFT); + w->onMouseDown(WIDX_BANK_LEFT); } else { @@ -4604,17 +4604,17 @@ namespace OpenRCT2::Ui::Windows case TrackRoll::None: if (!widgetIsDisabled(*w, WIDX_BANK_RIGHT) && w->widgets[WIDX_BANK_RIGHT].type != WidgetType::empty) { - w->OnMouseDown(WIDX_BANK_RIGHT); + w->onMouseDown(WIDX_BANK_RIGHT); } break; case TrackRoll::Left: if (!widgetIsDisabled(*w, WIDX_BANK_STRAIGHT) && w->widgets[WIDX_BANK_STRAIGHT].type != WidgetType::empty) { - w->OnMouseDown(WIDX_BANK_STRAIGHT); + w->onMouseDown(WIDX_BANK_STRAIGHT); } else if (!widgetIsDisabled(*w, WIDX_BANK_RIGHT) && w->widgets[WIDX_BANK_RIGHT].type != WidgetType::empty) { - w->OnMouseDown(WIDX_BANK_RIGHT); + w->onMouseDown(WIDX_BANK_RIGHT); } else { @@ -4636,7 +4636,7 @@ namespace OpenRCT2::Ui::Windows return; } - w->OnMouseDown(WIDX_PREVIOUS_SECTION); + w->onMouseDown(WIDX_PREVIOUS_SECTION); } void WindowRideConstructionKeyboardShortcutNextTrack() @@ -4648,7 +4648,7 @@ namespace OpenRCT2::Ui::Windows return; } - w->OnMouseDown(WIDX_NEXT_SECTION); + w->onMouseDown(WIDX_NEXT_SECTION); } void WindowRideConstructionKeyboardShortcutBuildCurrent() @@ -4660,7 +4660,7 @@ namespace OpenRCT2::Ui::Windows return; } - w->OnMouseDown(WIDX_CONSTRUCT); + w->onMouseDown(WIDX_CONSTRUCT); } void WindowRideConstructionKeyboardShortcutDemolishCurrent() @@ -4672,7 +4672,7 @@ namespace OpenRCT2::Ui::Windows return; } - w->OnMouseDown(WIDX_DEMOLISH); + w->onMouseDown(WIDX_DEMOLISH); } static void WindowRideConstructionMouseUpDemolishNextPiece(const CoordsXYZD& piecePos, OpenRCT2::TrackElemType type) diff --git a/src/openrct2-ui/windows/RideList.cpp b/src/openrct2-ui/windows/RideList.cpp index c682c8ee6a..45cac623b5 100644 --- a/src/openrct2-ui/windows/RideList.cpp +++ b/src/openrct2-ui/windows/RideList.cpp @@ -180,9 +180,9 @@ namespace OpenRCT2::Ui::Windows std::vector _rideList; public: - void OnOpen() override + void onOpen() override { - SetWidgets(_rideListWidgets); + setWidgets(_rideListWidgets); WindowInitScrollWidgets(*this); WindowSetResize(*this, kWindowSize, kWindowSize * 2); @@ -201,16 +201,16 @@ namespace OpenRCT2::Ui::Windows * * rct2: 0x006B38A7 */ - void OnResize() override + void onResize() override { if (width < minWidth) { - Invalidate(); + invalidate(); width = minWidth; } if (height < minHeight) { - Invalidate(); + invalidate(); height = minHeight; } } @@ -219,12 +219,12 @@ namespace OpenRCT2::Ui::Windows * * rct2: 0x006B3511 */ - void OnMouseUp(WidgetIndex widgetIndex) override + void onMouseUp(WidgetIndex widgetIndex) override { switch (widgetIndex) { case WIDX_CLOSE: - Close(); + close(); break; case WIDX_HEADER_NAME: if (listInformationType != INFORMATION_TYPE_STATUS) @@ -270,7 +270,7 @@ namespace OpenRCT2::Ui::Windows case WIDX_SEARCH_CLEAR_BUTTON: _searchFilter.clear(); ApplySearchQuery(); - InvalidateWidget(WIDX_SEARCH_TEXT_BOX); + invalidateWidget(WIDX_SEARCH_TEXT_BOX); break; case WIDX_CLOSE_LIGHT: CloseAllRides(); @@ -287,7 +287,7 @@ namespace OpenRCT2::Ui::Windows { _quickDemolishMode = false; } - Invalidate(); + invalidate(); break; } } @@ -296,7 +296,7 @@ namespace OpenRCT2::Ui::Windows * * rct2: 0x006B3532 */ - void OnMouseDown(WidgetIndex widgetIndex) override + void onMouseDown(WidgetIndex widgetIndex) override { if (widgetIndex == WIDX_OPEN_CLOSE_ALL) { @@ -348,7 +348,7 @@ namespace OpenRCT2::Ui::Windows * * rct2: 0x006B3547 */ - void OnDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) override + void onDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) override { if (widgetIndex == WIDX_OPEN_CLOSE_ALL) { @@ -361,7 +361,7 @@ namespace OpenRCT2::Ui::Windows OpenAllRides(); } - Invalidate(); + invalidate(); } else if (widgetIndex == WIDX_HEADER_CUSTOMISE) { @@ -374,7 +374,7 @@ namespace OpenRCT2::Ui::Windows informationType = selectedValue; _windowRideListInformationType = InformationType(informationType); - Invalidate(); + invalidate(); // Automatically change sort if we're sorting by the custom/info column if (listInformationType != INFORMATION_TYPE_STATUS) @@ -389,20 +389,20 @@ namespace OpenRCT2::Ui::Windows * * rct2: 0x006B386B */ - void OnUpdate() override + void onUpdate() override { currentFrame = (currentFrame + 1) % 64; - InvalidateWidget(WIDX_TAB_1 + page); + invalidateWidget(WIDX_TAB_1 + page); if (_windowRideListInformationType != INFORMATION_TYPE_STATUS) - Invalidate(); + invalidate(); } - void OnPeriodicUpdate() override + void onPeriodicUpdate() override { SortList(); } - void OnTextInput(WidgetIndex widgetIndex, std::string_view text) override + void onTextInput(WidgetIndex widgetIndex, std::string_view text) override { if (widgetIndex != WIDX_SEARCH_TEXT_BOX) return; @@ -418,14 +418,14 @@ namespace OpenRCT2::Ui::Windows * * rct2: 0x006B35A1 */ - ScreenSize OnScrollGetSize(int32_t scrollIndex) override + ScreenSize onScrollGetSize(int32_t scrollIndex) override { const auto newHeight = static_cast(CountVisibleItems() * kScrollableRowHeight); auto top = std::max(0, newHeight - widgets[WIDX_LIST].bottom + widgets[WIDX_LIST].top + 21); if (top < scrolls[0].contentOffsetY) { scrolls[0].contentOffsetY = top; - Invalidate(); + invalidate(); } return { 0, newHeight }; @@ -451,7 +451,7 @@ namespace OpenRCT2::Ui::Windows * * rct2: 0x006B361F */ - void OnScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override + void onScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override { const auto index = GetNthVisibleItemIndex(screenCoords.y / kScrollableRowHeight); if (index < 0) @@ -477,21 +477,21 @@ namespace OpenRCT2::Ui::Windows * * rct2: 0x006B35EF */ - void OnScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override + void onScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override { const auto index = GetNthVisibleItemIndex(screenCoords.y / kScrollableRowHeight); if (index < 0) return; selectedListItem = index; - Invalidate(); + invalidate(); } /** * * rct2: 0x006B3182 */ - void OnPrepareDraw() override + void onPrepareDraw() override { auto ft = Formatter(); ft.Add(STR_UP); @@ -580,7 +580,7 @@ namespace OpenRCT2::Ui::Windows * * rct2: 0x006B3235 */ - void OnDraw(RenderTarget& rt) override + void onDraw(RenderTarget& rt) override { WindowDrawWidgets(*this, rt); DrawTabImages(rt); @@ -617,7 +617,7 @@ namespace OpenRCT2::Ui::Windows * * rct2: 0x006B3240 */ - void OnScrollDraw(int32_t scrollIndex, RenderTarget& rt) override + void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override { auto rtCoords = ScreenCoordsXY{ rt.x, rt.y }; GfxFillRect( @@ -1089,7 +1089,7 @@ namespace OpenRCT2::Ui::Windows } selectedListItem = -1; - Invalidate(); + invalidate(); } // window_ride_list_close_all diff --git a/src/openrct2-ui/windows/SavePrompt.cpp b/src/openrct2-ui/windows/SavePrompt.cpp index d1ed82d840..bb9afd350c 100644 --- a/src/openrct2-ui/windows/SavePrompt.cpp +++ b/src/openrct2-ui/windows/SavePrompt.cpp @@ -90,16 +90,16 @@ namespace OpenRCT2::Ui::Windows { } - void OnOpen() override + void onOpen() override { bool canSave = !(isInTrackDesignerOrManager()); if (canSave) - SetWidgets(_savePromptWidgets); + setWidgets(_savePromptWidgets); else - SetWidgets(_quitPromptWidgets); + setWidgets(_quitPromptWidgets); - InitScrollWidgets(); + initScrollWidgets(); // Pause the game if not network play. if (Network::GetMode() == Network::Mode::none) @@ -127,7 +127,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnClose() override + void onClose() override { // Unpause the game if (Network::GetMode() == Network::Mode::none) @@ -140,7 +140,7 @@ namespace OpenRCT2::Ui::Windows windowMgr->InvalidateByClass(WindowClass::TopToolbar); } - void OnMouseUp(WidgetIndex widgetIndex) override + void onMouseUp(WidgetIndex widgetIndex) override { if (gLegacyScene == LegacyScene::titleSequence || gLegacyScene == LegacyScene::trackDesigner || gLegacyScene == LegacyScene::trackDesignsManager) @@ -152,7 +152,7 @@ namespace OpenRCT2::Ui::Windows break; case WQIDX_CLOSE: case WQIDX_CANCEL: - Close(); + close(); break; } return; @@ -175,7 +175,7 @@ namespace OpenRCT2::Ui::Windows { intent = CreateSaveGameAsIntent(); } - Close(); + close(); intent->PutExtra(INTENT_EXTRA_CALLBACK, reinterpret_cast(WindowSavePromptCallback)); ContextOpenIntent(intent.get()); break; @@ -185,14 +185,14 @@ namespace OpenRCT2::Ui::Windows return; case WIDX_CLOSE: case WIDX_CANCEL: - Close(); + close(); return; } } - void OnDraw(RenderTarget& rt) override + void onDraw(RenderTarget& rt) override { - DrawWidgets(rt); + drawWidgets(rt); } }; diff --git a/src/openrct2-ui/windows/ScenarioSelect.cpp b/src/openrct2-ui/windows/ScenarioSelect.cpp index 26768f5ec7..460abbff6c 100644 --- a/src/openrct2-ui/windows/ScenarioSelect.cpp +++ b/src/openrct2-ui/windows/ScenarioSelect.cpp @@ -133,35 +133,35 @@ namespace OpenRCT2::Ui::Windows { } - void OnOpen() override + void onOpen() override { - SetWidgets(_scenarioSelectWidgets); + setWidgets(_scenarioSelectWidgets); // Load scenario list ScenarioRepositoryScan(); _highlightedScenario = nullptr; - InitTabs(); - InitialiseListItems(); - InitScrollWidgets(); + initTabs(); + initialiseListItems(); + initScrollWidgets(); } - void OnLanguageChange() override + void onLanguageChange() override { _listItems.clear(); ScenarioRepositoryScan(); - InitialiseListItems(); + initialiseListItems(); } - void OnMouseUp(WidgetIndex widgetIndex) override + void onMouseUp(WidgetIndex widgetIndex) override { if (widgetIndex == WIDX_CLOSE) { - Close(); + close(); } } - void OnMouseDown(WidgetIndex widgetIndex) override + void onMouseDown(WidgetIndex widgetIndex) override { if (widgetIndex >= WIDX_TAB1 && widgetIndex <= WIDX_TAB10) { @@ -172,12 +172,12 @@ namespace OpenRCT2::Ui::Windows _highlightedScenario = nullptr; _preview = {}; - InitialiseListItems(); - Invalidate(); - OnResize(); - OnPrepareDraw(); - InitScrollWidgets(); - Invalidate(); + initialiseListItems(); + invalidate(); + onResize(); + onPrepareDraw(); + initScrollWidgets(); + invalidate(); } } @@ -260,7 +260,7 @@ namespace OpenRCT2::Ui::Windows void UpdateParkPreview(const ParkPreview& preview) { _preview = preview; - Invalidate(); + invalidate(); } ScreenCoordsXY DrawPreview(RenderTarget& rt, ScreenCoordsXY screenPos) @@ -296,9 +296,9 @@ namespace OpenRCT2::Ui::Windows return frameEndPos; } - void OnDraw(RenderTarget& rt) override + void onDraw(RenderTarget& rt) override { - DrawWidgets(rt); + drawWidgets(rt); StringId format = STR_WINDOW_COLOUR_2_STRINGID; FontStyle fontStyle = FontStyle::Medium; @@ -420,7 +420,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnPrepareDraw() override + void onPrepareDraw() override { pressedWidgets &= ~( (1uLL << WIDX_CLOSE) | (1uLL << WIDX_TAB1) | (1uLL << WIDX_TAB2) | (1uLL << WIDX_TAB3) | (1uLL << WIDX_TAB4) @@ -434,7 +434,7 @@ namespace OpenRCT2::Ui::Windows widgets[WIDX_SCENARIOLIST].bottom = height - bottomMargin; } - ScreenSize OnScrollGetSize(int32_t scrollIndex) override + ScreenSize onScrollGetSize(int32_t scrollIndex) override { const int32_t scenarioItemHeight = GetScenarioListItemSize(); @@ -455,7 +455,7 @@ namespace OpenRCT2::Ui::Windows return { kWindowSize.width, y }; } - void OnScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override + void onScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override { const int32_t scenarioItemHeight = GetScenarioListItemSize(); @@ -495,15 +495,15 @@ namespace OpenRCT2::Ui::Windows { _highlightedScenario = selected; LoadPreview(); - Invalidate(); + invalidate(); } else if (_showLockedInformation != originalShowLockedInformation) { - Invalidate(); + invalidate(); } } - void OnScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override + void onScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override { const int32_t scenarioItemHeight = GetScenarioListItemSize(); @@ -534,7 +534,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnScrollDraw(int32_t scrollIndex, RenderTarget& rt) override + void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override { uint8_t paletteIndex = ColourMapA[colours[1].colour].mid_light; GfxClear(rt, paletteIndex); @@ -669,7 +669,7 @@ namespace OpenRCT2::Ui::Windows GfxDrawLine(rt, { darkLineLeftTop2, darkLineRightBottom2 }, darkColour); } - void InitialiseListItems() + void initialiseListItems() { size_t numScenarios = ScenarioRepositoryGetCount(); _listItems.clear(); @@ -792,7 +792,7 @@ namespace OpenRCT2::Ui::Windows return true; } - void InitTabs() + void initTabs() { uint32_t showPages = 0; size_t numScenarios = ScenarioRepositoryGetCount(); diff --git a/src/openrct2-ui/windows/Scenery.cpp b/src/openrct2-ui/windows/Scenery.cpp index c760217300..f7ca4b3eb5 100644 --- a/src/openrct2-ui/windows/Scenery.cpp +++ b/src/openrct2-ui/windows/Scenery.cpp @@ -216,11 +216,11 @@ namespace OpenRCT2::Ui::Windows int16_t _unkF64F0A{ 0 }; public: - void OnOpen() override + void onOpen() override { - Init(); + init(); - InitScrollWidgets(); + initScrollWidgets(); ContentUpdateScroll(); ShowGridlines(); gWindowSceneryRotation = 3; @@ -251,7 +251,7 @@ namespace OpenRCT2::Ui::Windows WindowPushOthersBelow(*this); } - void OnClose() override + void onClose() override { SceneryRemoveGhostToolPlacement(); HideGridlines(); @@ -267,27 +267,27 @@ namespace OpenRCT2::Ui::Windows ToolCancel(); } - void OnMouseUp(WidgetIndex widgetIndex) override + void onMouseUp(WidgetIndex widgetIndex) override { auto* windowMgr = Ui::GetWindowManager(); switch (widgetIndex) { case WIDX_SCENERY_CLOSE: - Close(); + close(); break; case WIDX_SCENERY_ROTATE_OBJECTS_BUTTON: gWindowSceneryRotation++; gWindowSceneryRotation = gWindowSceneryRotation % 4; SceneryRemoveGhostToolPlacement(); - Invalidate(); + invalidate(); break; case WIDX_SCENERY_REPAINT_SCENERY_BUTTON: _sceneryPaintEnabled ^= true; gWindowSceneryEyedropperEnabled = false; if (gWindowSceneryScatterEnabled) windowMgr->CloseByClass(WindowClass::SceneryScatter); - Invalidate(); + invalidate(); break; case WIDX_SCENERY_EYEDROPPER_BUTTON: _sceneryPaintEnabled = false; @@ -295,7 +295,7 @@ namespace OpenRCT2::Ui::Windows if (gWindowSceneryScatterEnabled) windowMgr->CloseByClass(WindowClass::SceneryScatter); SceneryRemoveGhostToolPlacement(); - Invalidate(); + invalidate(); break; case WIDX_SCENERY_BUILD_CLUSTER_BUTTON: _sceneryPaintEnabled = false; @@ -312,7 +312,7 @@ namespace OpenRCT2::Ui::Windows { ContextShowError(STR_CANT_DO_THIS, STR_PERMISSION_DENIED, {}); } - Invalidate(); + invalidate(); break; case WIDX_FILTER_TEXT_BOX: WindowStartTextbox(*this, widgetIndex, _filteredSceneryTab.Filter, kTextInputSize); @@ -321,7 +321,7 @@ namespace OpenRCT2::Ui::Windows _tabEntries[_activeTabIndex].Filter.clear(); ContentUpdateScroll(); scrolls->contentOffsetY = 0; - Invalidate(); + invalidate(); break; case WIDX_RESTRICT_SCENERY: { @@ -340,46 +340,46 @@ namespace OpenRCT2::Ui::Windows } } - void OnResize() override + void onResize() override { if (width < minWidth) { - Invalidate(); + invalidate(); width = minWidth; - Invalidate(); + invalidate(); } if (width > maxWidth) { - Invalidate(); + invalidate(); width = maxWidth; - Invalidate(); + invalidate(); } if (height < minHeight) { - Invalidate(); + invalidate(); height = minHeight; - Invalidate(); + invalidate(); // HACK: For some reason invalidate has not been called - OnPrepareDraw(); + onPrepareDraw(); ContentUpdateScroll(); } if (height > maxHeight) { - Invalidate(); + invalidate(); height = maxHeight; - Invalidate(); + invalidate(); // HACK: For some reason invalidate has not been called - OnPrepareDraw(); + onPrepareDraw(); ContentUpdateScroll(); } - ResizeFrame(); + resizeFrame(); } - void OnMouseDown(WidgetIndex widgetIndex) override + void onMouseDown(WidgetIndex widgetIndex) override { switch (widgetIndex) { @@ -397,14 +397,14 @@ namespace OpenRCT2::Ui::Windows if (widgetIndex >= WIDX_SCENERY_TAB_1) { _activeTabIndex = widgetIndex - WIDX_SCENERY_TAB_1; - Invalidate(); + invalidate(); gSceneryPlaceCost = kMoney64Undefined; ContentUpdateScroll(); } } - void OnDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) override + void onDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) override { if (dropdownIndex == -1) return; @@ -422,10 +422,10 @@ namespace OpenRCT2::Ui::Windows _sceneryTertiaryColour = ColourDropDownIndexToColour(dropdownIndex); } - Invalidate(); + invalidate(); } - void OnPeriodicUpdate() override + void onPeriodicUpdate() override { if (!_selectedScenery.IsUndefined()) { @@ -454,11 +454,11 @@ namespace OpenRCT2::Ui::Windows // This will happen when the mouse leaves the scroll window and is required so that the cost and description // switch to the tool scenery selection. _selectedScenery = {}; - Invalidate(); + invalidate(); } } - void OnUpdate() override + void onUpdate() override { const CursorState* state = ContextGetCursorState(); @@ -498,9 +498,9 @@ namespace OpenRCT2::Ui::Windows if (height < minHeight) { height = minHeight; - OnPrepareDraw(); + onPrepareDraw(); ContentUpdateScroll(); - Invalidate(); + invalidate(); } } } @@ -518,21 +518,21 @@ namespace OpenRCT2::Ui::Windows if (height > maxHeight) { - Invalidate(); + invalidate(); height = maxHeight; - OnPrepareDraw(); + onPrepareDraw(); ContentUpdateScroll(); } if (GetCurrentTextBox().window.classification == classification && GetCurrentTextBox().window.number == number) { WindowUpdateTextboxCaret(); - InvalidateWidget(WIDX_FILTER_TEXT_BOX); + invalidateWidget(WIDX_FILTER_TEXT_BOX); } if (!isToolActive(WindowClass::Scenery)) { - Close(); + close(); return; } @@ -582,7 +582,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnTextInput(WidgetIndex widgetIndex, std::string_view text) override + void onTextInput(WidgetIndex widgetIndex, std::string_view text) override { if (widgetIndex != WIDX_FILTER_TEXT_BOX) return; @@ -594,10 +594,10 @@ namespace OpenRCT2::Ui::Windows ContentUpdateScroll(); scrolls->contentOffsetY = 0; - Invalidate(); + invalidate(); } - ScreenSize OnScrollGetSize(int32_t scrollIndex) override + ScreenSize onScrollGetSize(int32_t scrollIndex) override { if (scrollIndex == kSceneryContentScrollIndex) { @@ -606,7 +606,7 @@ namespace OpenRCT2::Ui::Windows return {}; } - void OnScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override + void onScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override { if (scrollIndex == kSceneryContentScrollIndex) { @@ -614,7 +614,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override + void onScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override { if (scrollIndex == kSceneryContentScrollIndex) { @@ -622,7 +622,7 @@ namespace OpenRCT2::Ui::Windows } } - OpenRCT2String OnTooltip(const WidgetIndex widgetIndex, const StringId fallback) override + OpenRCT2String onTooltip(const WidgetIndex widgetIndex, const StringId fallback) override { if (widgetIndex >= WIDX_SCENERY_TAB_1) { @@ -656,7 +656,7 @@ namespace OpenRCT2::Ui::Windows return { kStringIdNone, Formatter() }; } - void OnPrepareDraw() override + void onPrepareDraw() override { _actualMinHeight = GetMinimumHeight(); @@ -822,7 +822,7 @@ namespace OpenRCT2::Ui::Windows } } - ResizeFrame(); + resizeFrame(); widgets[WIDX_SCENERY_LIST].right = windowWidth - 26; widgets[WIDX_SCENERY_LIST].bottom = height - kDescriptionHeight; @@ -847,9 +847,9 @@ namespace OpenRCT2::Ui::Windows widgets[WIDX_SCENERY_BUILD_CLUSTER_BUTTON].type = canFit ? WidgetType::flatBtn : WidgetType::empty; } - void OnDraw(RenderTarget& rt) override + void onDraw(RenderTarget& rt) override { - DrawWidgets(rt); + drawWidgets(rt); DrawTabs(rt, windowPos); auto selectedSceneryEntry = _selectedScenery; @@ -907,7 +907,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnScrollDraw(int32_t scrollIndex, RenderTarget& rt) override + void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override { if (scrollIndex == kSceneryContentScrollIndex) { @@ -915,7 +915,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnToolUpdate(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override + void onToolUpdate(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override { switch (widgetIndex) { @@ -925,7 +925,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override + void onToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override { switch (widgetIndex) { @@ -935,7 +935,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnToolDrag(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override + void onToolDrag(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override { switch (widgetIndex) { @@ -948,7 +948,7 @@ namespace OpenRCT2::Ui::Windows } } - void SetSelectedItem( + void setSelectedItem( const ScenerySelection& scenery, const std::optional primary, const std::optional secondary, const std::optional tertiary, const std::optional rotation) { @@ -980,10 +980,10 @@ namespace OpenRCT2::Ui::Windows Audio::Play(Audio::SoundId::Click1, 0, ContextGetWidth() / 2); _hoverCounter = -16; gSceneryPlaceCost = kMoney64Undefined; - Invalidate(); + invalidate(); } - void SetSelectedTab(const ObjectEntryIndex sceneryGroupIndex) + void setSelectedTab(const ObjectEntryIndex sceneryGroupIndex) { const auto* tabInfo = GetSceneryTabInfoForGroup(sceneryGroupIndex); if (tabInfo == nullptr) @@ -992,15 +992,15 @@ namespace OpenRCT2::Ui::Windows } const auto tabId = std::distance(&*_tabEntries.cbegin(), tabInfo); - OnMouseDown(WIDX_SCENERY_TAB_1 + tabId); + onMouseDown(WIDX_SCENERY_TAB_1 + tabId); } - const ScenerySelection GetTabSelection() + const ScenerySelection getTabSelection() { return GetSelectedScenery(_activeTabIndex); } - void Init() + void init() { _tabEntries.clear(); @@ -1038,7 +1038,7 @@ namespace OpenRCT2::Ui::Windows const auto* sceneryEntry = ObjectManager::GetObjectEntry(sceneryId); if (sceneryEntry != nullptr) { - InitSceneryEntry({ SCENERY_TYPE_SMALL, sceneryId }, sceneryEntry->scenery_tab_id); + initSceneryEntry({ SCENERY_TYPE_SMALL, sceneryId }, sceneryEntry->scenery_tab_id); } } @@ -1048,7 +1048,7 @@ namespace OpenRCT2::Ui::Windows const auto* sceneryEntry = ObjectManager::GetObjectEntry(sceneryId); if (sceneryEntry != nullptr) { - InitSceneryEntry({ SCENERY_TYPE_LARGE, sceneryId }, sceneryEntry->scenery_tab_id); + initSceneryEntry({ SCENERY_TYPE_LARGE, sceneryId }, sceneryEntry->scenery_tab_id); } } @@ -1058,7 +1058,7 @@ namespace OpenRCT2::Ui::Windows const auto* sceneryEntry = ObjectManager::GetObjectEntry(sceneryId); if (sceneryEntry != nullptr) { - InitSceneryEntry({ SCENERY_TYPE_WALL, sceneryId }, sceneryEntry->scenery_tab_id); + initSceneryEntry({ SCENERY_TYPE_WALL, sceneryId }, sceneryEntry->scenery_tab_id); } } @@ -1068,7 +1068,7 @@ namespace OpenRCT2::Ui::Windows const auto* sceneryEntry = ObjectManager::GetObjectEntry(sceneryId); if (sceneryEntry != nullptr) { - InitSceneryEntry({ SCENERY_TYPE_BANNER, sceneryId }, sceneryEntry->scenery_tab_id); + initSceneryEntry({ SCENERY_TYPE_BANNER, sceneryId }, sceneryEntry->scenery_tab_id); } } @@ -1077,7 +1077,7 @@ namespace OpenRCT2::Ui::Windows const auto* sceneryEntry = ObjectManager::GetObjectEntry(sceneryId); if (sceneryEntry != nullptr) { - InitSceneryEntry({ SCENERY_TYPE_PATH_ITEM, sceneryId }, sceneryEntry->scenery_tab_id); + initSceneryEntry({ SCENERY_TYPE_PATH_ITEM, sceneryId }, sceneryEntry->scenery_tab_id); } } @@ -1280,7 +1280,7 @@ namespace OpenRCT2::Ui::Windows return std::nullopt; } - void InitSceneryEntry(const ScenerySelection& selection, const ObjectEntryIndex sceneryGroupIndex) + void initSceneryEntry(const ScenerySelection& selection, const ObjectEntryIndex sceneryGroupIndex) { Guard::ArgumentInRange(selection.EntryIndex, 0, kObjectEntryIndexNull); @@ -1399,7 +1399,7 @@ namespace OpenRCT2::Ui::Windows void PrepareWidgets() { // Add the base widgets - SetWidgets(WindowSceneryBaseWidgets); + setWidgets(WindowSceneryBaseWidgets); auto hasMisc = GetSceneryTabInfoForMisc() != nullptr; auto kMaxTabsInThisRow = kMaxTabsPerRow - 1 - (hasMisc ? 1 : 0); @@ -1516,7 +1516,7 @@ namespace OpenRCT2::Ui::Windows Audio::Play(Audio::SoundId::Click1, 0, windowPos.x + (width / 2)); _hoverCounter = -16; gSceneryPlaceCost = kMoney64Undefined; - Invalidate(); + invalidate(); } void ContentScrollMouseOver(const ScreenCoordsXY& screenCoords) @@ -1525,7 +1525,7 @@ namespace OpenRCT2::Ui::Windows if (!scenery.IsUndefined() && _selectedScenery != scenery) { _selectedScenery = scenery; - Invalidate(); + invalidate(); } } @@ -2079,8 +2079,8 @@ namespace OpenRCT2::Ui::Windows /** * * rct2: 0x006E24F6 - * On failure returns kMoney64Undefined - * On success places ghost scenery and returns cost to place proper + * on failure returns kMoney64Undefined + * on success places ghost scenery and returns cost to place proper */ money64 TryPlaceGhostSmallScenery( CoordsXYZD loc, uint8_t quadrant, ObjectEntryIndex entryIndex, colour_t primaryColour, colour_t secondaryColour, @@ -3260,7 +3260,7 @@ namespace OpenRCT2::Ui::Windows auto* w = static_cast(windowMgr->BringToFrontByClass(WindowClass::Scenery)); if (w != nullptr) { - w->SetSelectedItem(scenery, primary, secondary, tertiary, rotation); + w->setSelectedItem(scenery, primary, secondary, tertiary, rotation); } } @@ -3271,7 +3271,7 @@ namespace OpenRCT2::Ui::Windows auto* w = static_cast(windowMgr->FindByClass(WindowClass::Scenery)); if (w != nullptr) { - return w->SetSelectedTab(sceneryGroupIndex); + return w->setSelectedTab(sceneryGroupIndex); } } @@ -3298,7 +3298,7 @@ namespace OpenRCT2::Ui::Windows auto* w = static_cast(windowMgr->FindByClass(WindowClass::Scenery)); if (w != nullptr) { - return w->GetTabSelection(); + return w->getTabSelection(); } else { @@ -3312,7 +3312,7 @@ namespace OpenRCT2::Ui::Windows auto* w = static_cast(windowMgr->FindByClass(WindowClass::Scenery)); if (w != nullptr) { - w->Init(); + w->init(); } } diff --git a/src/openrct2-ui/windows/SceneryScatter.cpp b/src/openrct2-ui/windows/SceneryScatter.cpp index a163b1f308..f88cc0ddaf 100644 --- a/src/openrct2-ui/windows/SceneryScatter.cpp +++ b/src/openrct2-ui/windows/SceneryScatter.cpp @@ -57,9 +57,9 @@ namespace OpenRCT2::Ui::Windows class SceneryScatterWindow final : public Window { public: - void OnOpen() override + void onOpen() override { - SetWidgets(_sceneryScatterWidgets); + setWidgets(_sceneryScatterWidgets); holdDownWidgets = (1uLL << WIDX_INCREMENT) | (1uLL << WIDX_DECREMENT); WindowInitScrollWidgets(*this); @@ -70,7 +70,7 @@ namespace OpenRCT2::Ui::Windows gWindowSceneryScatterDensity = ScatterToolDensity::MediumDensity; } - void OnClose() override + void onClose() override { gWindowSceneryScatterEnabled = false; } @@ -92,12 +92,12 @@ namespace OpenRCT2::Ui::Windows this, widgetIndex, STR_SELECTION_SIZE, STR_ENTER_SELECTION_SIZE, ft, kStringIdNone, kStringIdNone, maxLength); } - void OnMouseUp(WidgetIndex widgetIndex) override + void onMouseUp(WidgetIndex widgetIndex) override { switch (widgetIndex) { case WIDX_CLOSE: - Close(); + close(); break; case WIDX_PREVIEW: @@ -118,25 +118,25 @@ namespace OpenRCT2::Ui::Windows } } - void OnMouseDown(const WidgetIndex widgetIndex) override + void onMouseDown(const WidgetIndex widgetIndex) override { switch (widgetIndex) { case WIDX_DECREMENT: // Decrement land tool size, if it stays within the limit gWindowSceneryScatterSize = std::max(kLandToolMinimumSize, gWindowSceneryScatterSize - 1); - Invalidate(); + invalidate(); break; case WIDX_INCREMENT: // Increment land tool size, if it stays within the limit gWindowSceneryScatterSize = std::min(kLandToolMaximumSize, gWindowSceneryScatterSize + 1); - Invalidate(); + invalidate(); break; } } - void OnTextInput(const WidgetIndex widgetIndex, const std::string_view text) override + void onTextInput(const WidgetIndex widgetIndex, const std::string_view text) override { if (widgetIndex != WIDX_PREVIEW || text.empty()) return; @@ -152,11 +152,11 @@ namespace OpenRCT2::Ui::Windows res.value(), kLandToolMinimumSize, kLandToolMaximumSize); break; } - Invalidate(); + invalidate(); } } - void OnPrepareDraw() override + void onPrepareDraw() override { // Set the preview image button to be pressed down pressedWidgets = (1uLL << WIDX_PREVIEW); @@ -181,7 +181,7 @@ namespace OpenRCT2::Ui::Windows widgets[WIDX_PREVIEW].image = ImageId(LandTool::SizeToSpriteIndex(gWindowSceneryScatterSize)); } - void OnDraw(RenderTarget& rt) override + void onDraw(RenderTarget& rt) override { WindowDrawWidgets(*this, rt); diff --git a/src/openrct2-ui/windows/ServerList.cpp b/src/openrct2-ui/windows/ServerList.cpp index aef37ff1d4..2f32089db0 100644 --- a/src/openrct2-ui/windows/ServerList.cpp +++ b/src/openrct2-ui/windows/ServerList.cpp @@ -89,12 +89,12 @@ namespace OpenRCT2::Ui::Windows public: #pragma region Window Override Events - void OnOpen() override + void onOpen() override { _playerName = Config::Get().network.PlayerName; - SetWidgets(_serverListWidgets); + setWidgets(_serverListWidgets); widgets[WIDX_PLAYER_NAME_INPUT].string = const_cast(_playerName.c_str()); - InitScrollWidgets(); + initScrollWidgets(); numListItems = 0; selectedListItem = -1; @@ -109,19 +109,19 @@ namespace OpenRCT2::Ui::Windows ServerListFetchServersBegin(); } - void OnClose() override + void onClose() override { _serverList = {}; _fetchFuture = {}; Config::Save(); } - void OnMouseUp(WidgetIndex widgetIndex) override + void onMouseUp(WidgetIndex widgetIndex) override { switch (widgetIndex) { case WIDX_CLOSE: - Close(); + close(); break; case WIDX_PLAYER_NAME_INPUT: WindowStartTextbox(*this, widgetIndex, _playerName, kMaxPlayerNameLength); @@ -149,7 +149,7 @@ namespace OpenRCT2::Ui::Windows ServerListFetchServersBegin(); break; case WIDX_ADD_SERVER: - TextInputOpen(widgetIndex, STR_ADD_SERVER, STR_ENTER_HOSTNAME_OR_IP_ADDRESS, {}, kStringIdNone, 0, 128); + textInputOpen(widgetIndex, STR_ADD_SERVER, STR_ENTER_HOSTNAME_OR_IP_ADDRESS, {}, kStringIdNone, 0, 128); break; case WIDX_START_SERVER: ContextOpenWindow(WindowClass::ServerStart); @@ -157,12 +157,12 @@ namespace OpenRCT2::Ui::Windows } } - void OnResize() override + void onResize() override { WindowSetResize(*this, kMinimumWindowSize, kMaximumWindowSize); } - void OnDropdown(WidgetIndex widgetIndex, int32_t selectedIndex) override + void onDropdown(WidgetIndex widgetIndex, int32_t selectedIndex) override { if (selectedIndex == -1) { @@ -196,22 +196,22 @@ namespace OpenRCT2::Ui::Windows } } - void OnUpdate() override + void onUpdate() override { if (GetCurrentTextBox().window.classification == classification && GetCurrentTextBox().window.number == number) { WindowUpdateTextboxCaret(); - InvalidateWidget(WIDX_PLAYER_NAME_INPUT); + invalidateWidget(WIDX_PLAYER_NAME_INPUT); } ServerListFetchServersCheck(); } - ScreenSize OnScrollGetSize(int32_t scrollIndex) override + ScreenSize onScrollGetSize(int32_t scrollIndex) override { return { 0, numListItems * kItemHeight }; } - void OnScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override + void onScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override { int32_t serverIndex = selectedListItem; if (serverIndex >= 0 && serverIndex < static_cast(_serverList.GetCount())) @@ -233,7 +233,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override + void onScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override { auto& listWidget = widgets[WIDX_LIST]; @@ -257,11 +257,11 @@ namespace OpenRCT2::Ui::Windows listWidget.tooltip = showNetworkVersionTooltip ? static_cast(STR_NETWORK_VERSION_TIP) : kStringIdNone; WindowTooltipClose(); - Invalidate(); + invalidate(); } } - void OnTextInput(WidgetIndex widgetIndex, std::string_view text) override + void onTextInput(WidgetIndex widgetIndex, std::string_view text) override { if (text.empty()) return; @@ -278,7 +278,7 @@ namespace OpenRCT2::Ui::Windows Config::Get().network.PlayerName = _playerName; widgets[WIDX_PLAYER_NAME_INPUT].string = const_cast(_playerName.c_str()); - InvalidateWidget(WIDX_PLAYER_NAME_INPUT); + invalidateWidget(WIDX_PLAYER_NAME_INPUT); break; case WIDX_ADD_SERVER: @@ -289,22 +289,22 @@ namespace OpenRCT2::Ui::Windows entry.Favourite = true; _serverList.Add(entry); _serverList.WriteFavourites(); - Invalidate(); + invalidate(); break; } } } - OpenRCT2String OnTooltip(WidgetIndex widgetIndex, StringId fallback) override + OpenRCT2String onTooltip(WidgetIndex widgetIndex, StringId fallback) override { auto ft = Formatter(); ft.Add(_version.c_str()); return { fallback, ft }; } - void OnDraw(RenderTarget& rt) override + void onDraw(RenderTarget& rt) override { - DrawWidgets(rt); + drawWidgets(rt); DrawTextBasic( rt, windowPos + ScreenCoordsXY{ 6, widgets[WIDX_PLAYER_NAME_INPUT].top }, STR_PLAYER_NAME, {}, @@ -323,7 +323,7 @@ namespace OpenRCT2::Ui::Windows DrawTextBasic(rt, windowPos + ScreenCoordsXY{ 8, height - 15 }, _statusText, ft, { COLOUR_WHITE }); } - void OnScrollDraw(int32_t scrollIndex, RenderTarget& rt) override + void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override { uint8_t paletteIndex = ColourMapA[colours[1].colour].mid_light; GfxClear(rt, paletteIndex); @@ -503,12 +503,12 @@ namespace OpenRCT2::Ui::Windows LOG_WARNING("Unable to connect to master server: %s", e.what()); } _fetchFuture = {}; - Invalidate(); + invalidate(); } } } - void OnPrepareDraw() override + void onPrepareDraw() override { int32_t margin = 6; int32_t buttonHeight = 13; diff --git a/src/openrct2-ui/windows/ServerStart.cpp b/src/openrct2-ui/windows/ServerStart.cpp index 32a5ef25de..a9365ab887 100644 --- a/src/openrct2-ui/windows/ServerStart.cpp +++ b/src/openrct2-ui/windows/ServerStart.cpp @@ -62,16 +62,16 @@ namespace OpenRCT2::Ui::Windows class ServerStartWindow final : public Window { public: - void OnOpen() override + void onOpen() override { - SetWidgets(_windowServerStartWidgets); + setWidgets(_windowServerStartWidgets); widgets[WIDX_PORT_INPUT].string = _port; widgets[WIDX_NAME_INPUT].string = _name; widgets[WIDX_DESCRIPTION_INPUT].string = _description; widgets[WIDX_GREETING_INPUT].string = _greeting; widgets[WIDX_PASSWORD_INPUT].string = _password; - InitScrollWidgets(); + initScrollWidgets(); WindowSetResize(*this, { width, height }, { width, height }); currentFrame = 0; @@ -83,12 +83,12 @@ namespace OpenRCT2::Ui::Windows String::safeUtf8Copy(_description, Config::Get().network.ServerDescription.c_str(), sizeof(_description)); String::safeUtf8Copy(_greeting, Config::Get().network.ServerGreeting.c_str(), sizeof(_greeting)); } - void OnMouseUp(WidgetIndex widgetIndex) override + void onMouseUp(WidgetIndex widgetIndex) override { switch (widgetIndex) { case WIDX_CLOSE: - Close(); + close(); break; case WIDX_PORT_INPUT: WindowStartTextbox(*this, widgetIndex, _port, 6); @@ -111,7 +111,7 @@ namespace OpenRCT2::Ui::Windows Config::Get().network.Maxplayers++; } Config::Save(); - Invalidate(); + invalidate(); break; case WIDX_MAXPLAYERS_DECREASE: if (Config::Get().network.Maxplayers > 1) @@ -119,12 +119,12 @@ namespace OpenRCT2::Ui::Windows Config::Get().network.Maxplayers--; } Config::Save(); - Invalidate(); + invalidate(); break; case WIDX_ADVERTISE_CHECKBOX: Config::Get().network.Advertise = !Config::Get().network.Advertise; Config::Save(); - Invalidate(); + invalidate(); break; case WIDX_START_SERVER: Network::SetPassword(_password); @@ -140,27 +140,27 @@ namespace OpenRCT2::Ui::Windows break; } } - void OnPrepareDraw() override + void onPrepareDraw() override { ColourSchemeUpdateByClass(this, WindowClass::ServerList); - widgetSetCheckboxValue(*this, WIDX_ADVERTISE_CHECKBOX, Config::Get().network.Advertise); + setCheckboxValue(WIDX_ADVERTISE_CHECKBOX, Config::Get().network.Advertise); auto ft = Formatter::Common(); ft.Increment(18); ft.Add(Config::Get().network.Maxplayers); } - void OnUpdate() override + void onUpdate() override { if (GetCurrentTextBox().window.classification == classification && GetCurrentTextBox().window.number == number) { WindowUpdateTextboxCaret(); - InvalidateWidget(WIDX_NAME_INPUT); - InvalidateWidget(WIDX_DESCRIPTION_INPUT); - InvalidateWidget(WIDX_GREETING_INPUT); - InvalidateWidget(WIDX_PASSWORD_INPUT); + invalidateWidget(WIDX_NAME_INPUT); + invalidateWidget(WIDX_DESCRIPTION_INPUT); + invalidateWidget(WIDX_GREETING_INPUT); + invalidateWidget(WIDX_PASSWORD_INPUT); } } - void OnTextInput(WidgetIndex widgetIndex, std::string_view text) override + void onTextInput(WidgetIndex widgetIndex, std::string_view text) override { std::string temp = static_cast(text); int tempPort = 0; @@ -181,7 +181,7 @@ namespace OpenRCT2::Ui::Windows Config::Save(); } - InvalidateWidget(WIDX_PORT_INPUT); + invalidateWidget(WIDX_PORT_INPUT); break; case WIDX_NAME_INPUT: if (strcmp(_name, temp.c_str()) == 0) @@ -196,7 +196,7 @@ namespace OpenRCT2::Ui::Windows Config::Save(); } - InvalidateWidget(WIDX_NAME_INPUT); + invalidateWidget(WIDX_NAME_INPUT); break; case WIDX_DESCRIPTION_INPUT: if (strcmp(_description, temp.c_str()) == 0) @@ -206,7 +206,7 @@ namespace OpenRCT2::Ui::Windows Config::Get().network.ServerDescription = _description; Config::Save(); - InvalidateWidget(WIDX_DESCRIPTION_INPUT); + invalidateWidget(WIDX_DESCRIPTION_INPUT); break; case WIDX_GREETING_INPUT: if (strcmp(_greeting, temp.c_str()) == 0) @@ -216,7 +216,7 @@ namespace OpenRCT2::Ui::Windows Config::Get().network.ServerGreeting = _greeting; Config::Save(); - InvalidateWidget(WIDX_GREETING_INPUT); + invalidateWidget(WIDX_GREETING_INPUT); break; case WIDX_PASSWORD_INPUT: if (strcmp(_password, temp.c_str()) == 0) @@ -224,14 +224,14 @@ namespace OpenRCT2::Ui::Windows String::safeUtf8Copy(_password, temp.c_str(), sizeof(_password)); - InvalidateWidget(WIDX_PASSWORD_INPUT); + invalidateWidget(WIDX_PASSWORD_INPUT); break; } } - void OnDraw(RenderTarget& rt) override + void onDraw(RenderTarget& rt) override { - DrawWidgets(rt); + drawWidgets(rt); DrawTextBasic(rt, windowPos + ScreenCoordsXY{ 6, widgets[WIDX_PORT_INPUT].top }, STR_PORT, {}, { colours[1] }); DrawTextBasic( rt, windowPos + ScreenCoordsXY{ 6, widgets[WIDX_NAME_INPUT].top }, STR_SERVER_NAME, {}, { colours[1] }); diff --git a/src/openrct2-ui/windows/ShortcutKeys.cpp b/src/openrct2-ui/windows/ShortcutKeys.cpp index fd306829ec..0d7ee53d44 100644 --- a/src/openrct2-ui/windows/ShortcutKeys.cpp +++ b/src/openrct2-ui/windows/ShortcutKeys.cpp @@ -92,25 +92,25 @@ namespace OpenRCT2::Ui::Windows return nullptr; } - void OnOpen() override + void onOpen() override { - SetWidgets(window_shortcut_change_widgets); + setWidgets(window_shortcut_change_widgets); WindowInitScrollWidgets(*this); } - void OnClose() override + void onClose() override { auto& shortcutManager = GetShortcutManager(); shortcutManager.SetPendingShortcutChange({}); NotifyShortcutKeysWindow(); } - void OnMouseUp(WidgetIndex widgetIndex) override + void onMouseUp(WidgetIndex widgetIndex) override { switch (widgetIndex) { case WIDX_CLOSE: - Close(); + close(); break; case WIDX_REMOVE: Remove(); @@ -118,9 +118,9 @@ namespace OpenRCT2::Ui::Windows } } - void OnDraw(RenderTarget& rt) override + void onDraw(RenderTarget& rt) override { - DrawWidgets(rt); + drawWidgets(rt); ScreenCoordsXY stringCoords(windowPos.x + 125, windowPos.y + widgets[WIDX_TITLE].bottom + 16); @@ -149,7 +149,7 @@ namespace OpenRCT2::Ui::Windows shortcut->Current.clear(); shortcutManager.SaveUserBindings(); } - Close(); + close(); } }; @@ -180,43 +180,43 @@ namespace OpenRCT2::Ui::Windows uint32_t _tabAnimationIndex{}; public: - void OnOpen() override + void onOpen() override { - InitialiseTabs(); - InitialiseWidgets(); - InitialiseList(); + initialiseTabs(); + initialiseWidgets(); + initialiseList(); } - void OnClose() override + void onClose() override { auto* windowMgr = Ui::GetWindowManager(); windowMgr->CloseByClass(WindowClass::ResetShortcutKeysPrompt); } - void OnResize() override + void onResize() override { WindowSetResize(*this, kWindowSize, kMaximumWindowSize); } - void OnUpdate() override + void onUpdate() override { // Remove highlight when the mouse is not hovering over the list if (_highlightedItem != -1 && !widgetIsHighlighted(*this, WIDX_SCROLL)) { _highlightedItem = -1; - InvalidateWidget(WIDX_SCROLL); + invalidateWidget(WIDX_SCROLL); } _tabAnimationIndex++; - InvalidateWidget(static_cast(WIDX_TAB_0 + _currentTabIndex)); + invalidateWidget(static_cast(WIDX_TAB_0 + _currentTabIndex)); } - void OnMouseUp(WidgetIndex widgetIndex) override + void onMouseUp(WidgetIndex widgetIndex) override { switch (widgetIndex) { case WIDX_CLOSE: - Close(); + close(); break; case WIDX_RESET: ResetShortcutKeysPromptOpen(); @@ -232,7 +232,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnPrepareDraw() override + void onPrepareDraw() override { widgets[WIDX_SCROLL].right = width - 5; widgets[WIDX_SCROLL].bottom = height - 19; @@ -243,36 +243,36 @@ namespace OpenRCT2::Ui::Windows // Set selected tab for (size_t i = 0; i < _tabs.size(); i++) { - SetWidgetPressed(static_cast(WIDX_TAB_0 + i), false); + setWidgetPressed(static_cast(WIDX_TAB_0 + i), false); } - SetWidgetPressed(static_cast(WIDX_TAB_0 + _currentTabIndex), true); + setWidgetPressed(static_cast(WIDX_TAB_0 + _currentTabIndex), true); } - void OnDraw(RenderTarget& rt) override + void onDraw(RenderTarget& rt) override { - DrawWidgets(rt); + drawWidgets(rt); DrawTabImages(rt); } - ScreenSize OnScrollGetSize(int32_t scrollIndex) override + ScreenSize onScrollGetSize(int32_t scrollIndex) override { auto h = static_cast(_list.size() * kScrollableRowHeight); auto bottom = std::max(0, h - widgets[WIDX_SCROLL].bottom + widgets[WIDX_SCROLL].top + 21); if (bottom < scrolls[0].contentOffsetY) { scrolls[0].contentOffsetY = bottom; - Invalidate(); + invalidate(); } return { 0, h }; } - void OnScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override + void onScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override { auto index = static_cast((screenCoords.y - 1) / kScrollableRowHeight); if (static_cast(index) < _list.size()) { _highlightedItem = index; - Invalidate(); + invalidate(); } else { @@ -280,7 +280,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override + void onScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override { auto selectedItem = static_cast((screenCoords.y - 1) / kScrollableRowHeight); if (selectedItem < _list.size()) @@ -294,7 +294,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnScrollDraw(int32_t scrollIndex, RenderTarget& rt) override + void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override { auto rtCoords = ScreenCoordsXY{ rt.x, rt.y }; GfxFillRect( @@ -331,14 +331,14 @@ namespace OpenRCT2::Ui::Windows } } - void OnLanguageChange() override + void onLanguageChange() override { - InitialiseList(); + initialiseList(); } void RefreshBindings() { - InitialiseList(); + initialiseList(); } void ResetAllOnActiveTab() @@ -380,7 +380,7 @@ namespace OpenRCT2::Ui::Windows return group == groupFilter; } - void InitialiseList() + void initialiseList() { // Get shortcuts and sort by group auto shortcuts = GetShortcutsForCurrentTab(); @@ -416,7 +416,7 @@ namespace OpenRCT2::Ui::Windows _list.push_back(std::move(ssp)); } - Invalidate(); + invalidate(); } std::vector GetShortcutsForCurrentTab() @@ -433,7 +433,7 @@ namespace OpenRCT2::Ui::Windows return result; } - void InitialiseTabs() + void initialiseTabs() { _tabs.clear(); _tabs.push_back({ "interface", SPR_TAB_GEARS_0, 2, 4 }); @@ -442,7 +442,7 @@ namespace OpenRCT2::Ui::Windows _tabs.push_back({ {}, SPR_TAB_WRENCH_0, 2, 16 }); } - void InitialiseWidgets() + void initialiseWidgets() { widgets.clear(); widgets.insert(widgets.begin(), std::begin(_shortcutWidgets), std::end(_shortcutWidgets)); @@ -456,7 +456,7 @@ namespace OpenRCT2::Ui::Windows } WindowInitScrollWidgets(*this); - ResizeFrame(); + resizeFrame(); } void SetTab(size_t index) @@ -465,7 +465,7 @@ namespace OpenRCT2::Ui::Windows { _currentTabIndex = index; _tabAnimationIndex = 0; - InitialiseList(); + initialiseList(); } } @@ -481,7 +481,7 @@ namespace OpenRCT2::Ui::Windows { const auto& tabDesc = _tabs[tabIndex]; auto widgetIndex = static_cast(WIDX_TAB_0 + tabIndex); - if (!IsWidgetDisabled(widgetIndex)) + if (!isWidgetDisabled(widgetIndex)) { auto imageId = tabDesc.ImageId; if (imageId != 0) @@ -583,12 +583,12 @@ namespace OpenRCT2::Ui::Windows class ResetShortcutKeysPrompt final : public Window { - void OnOpen() override + void onOpen() override { - SetWidgets(WindowResetShortcutKeysPromptWidgets); + setWidgets(WindowResetShortcutKeysPromptWidgets); } - void OnMouseUp(WidgetIndex widgetIndex) override + void onMouseUp(WidgetIndex widgetIndex) override { switch (widgetIndex) { @@ -600,12 +600,12 @@ namespace OpenRCT2::Ui::Windows { static_cast(w)->ResetAllOnActiveTab(); } - Close(); + close(); break; } case WIDX_RESET_PROMPT_CANCEL: case WIDX_RESET_PROMPT_CLOSE: - Close(); + close(); break; } } diff --git a/src/openrct2-ui/windows/Sign.cpp b/src/openrct2-ui/windows/Sign.cpp index 18a90f178c..2e364ca4f2 100644 --- a/src/openrct2-ui/windows/Sign.cpp +++ b/src/openrct2-ui/windows/Sign.cpp @@ -84,17 +84,13 @@ namespace OpenRCT2::Ui::Windows } public: - void OnOpen() override + void onOpen() override { - SetWidgets(_signWidgets); + setWidgets(_signWidgets); WindowInitScrollWidgets(*this); } - /* - * Initializes the window and sets it's number and if it's small - * @return true if successfull - */ - bool Initialize(WindowNumber windowNumber, const bool isSmall) + bool initialise(WindowNumber windowNumber, const bool isSmall) { number = windowNumber; _isSmall = isSmall; @@ -142,17 +138,17 @@ namespace OpenRCT2::Ui::Windows viewportWidget.width() - 1, viewportWidget.height() - 1, Focus(CoordsXYZ{ signViewPosition, viewZ })); viewport->flags = Config::Get().general.AlwaysShowGridlines ? VIEWPORT_FLAG_GRIDLINES : VIEWPORT_FLAG_NONE; - Invalidate(); + invalidate(); return true; } - void OnMouseUp(WidgetIndex widgetIndex) override + void onMouseUp(WidgetIndex widgetIndex) override { auto* banner = GetBanner(GetBannerIndex()); if (banner == nullptr) { - Close(); + close(); return; } @@ -160,14 +156,14 @@ namespace OpenRCT2::Ui::Windows switch (widgetIndex) { case WIDX_CLOSE: - Close(); + close(); break; case WIDX_SIGN_DEMOLISH: { auto* tileElement = BannerGetTileElement(GetBannerIndex()); if (tileElement == nullptr) { - Close(); + close(); return; } auto bannerCoords = banner->position.ToCoordsXY(); @@ -193,7 +189,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnMouseDown(WidgetIndex widgetIndex) override + void onMouseDown(WidgetIndex widgetIndex) override { Widget* widget = &widgets[widgetIndex]; switch (widgetIndex) @@ -207,7 +203,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) override + void onDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) override { auto& gameState = getGameState(); switch (widgetIndex) @@ -236,10 +232,10 @@ namespace OpenRCT2::Ui::Windows return; } - Invalidate(); + invalidate(); } - void OnTextInput(WidgetIndex widgetIndex, std::string_view text) override + void onTextInput(WidgetIndex widgetIndex, std::string_view text) override { if (widgetIndex == WIDX_SIGN_TEXT && !text.empty()) { @@ -248,7 +244,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnPrepareDraw() override + void onPrepareDraw() override { Widget* main_colour_btn = &widgets[WIDX_MAIN_COLOUR]; Widget* text_colour_btn = &widgets[WIDX_TEXT_COLOUR]; @@ -296,9 +292,9 @@ namespace OpenRCT2::Ui::Windows text_colour_btn->image = getColourButtonImage(_textColour); } - void OnDraw(RenderTarget& rt) override + void onDraw(RenderTarget& rt) override { - DrawWidgets(rt); + drawWidgets(rt); if (viewport != nullptr) { @@ -306,9 +302,9 @@ namespace OpenRCT2::Ui::Windows } } - void OnViewportRotate() override + void onViewportRotate() override { - RemoveViewport(); + removeViewport(); auto banner = GetBanner(GetBannerIndex()); if (banner == nullptr) @@ -325,7 +321,7 @@ namespace OpenRCT2::Ui::Windows viewportWidget->width() - 1, viewportWidget->height() - 1, Focus(CoordsXYZ{ signViewPos })); if (viewport != nullptr) viewport->flags = Config::Get().general.AlwaysShowGridlines ? VIEWPORT_FLAG_GRIDLINES : VIEWPORT_FLAG_NONE; - Invalidate(); + invalidate(); } }; @@ -346,7 +342,7 @@ namespace OpenRCT2::Ui::Windows if (w == nullptr) return nullptr; - bool result = w->Initialize(number, false); + bool result = w->initialise(number, false); if (result != true) return nullptr; @@ -370,7 +366,7 @@ namespace OpenRCT2::Ui::Windows if (w == nullptr) return nullptr; - bool result = w->Initialize(number, true); + bool result = w->initialise(number, true); if (result != true) return nullptr; diff --git a/src/openrct2-ui/windows/Staff.cpp b/src/openrct2-ui/windows/Staff.cpp index f184629c87..f9b88c1ea7 100644 --- a/src/openrct2-ui/windows/Staff.cpp +++ b/src/openrct2-ui/windows/Staff.cpp @@ -135,7 +135,7 @@ namespace OpenRCT2::Ui::Windows int32_t _pickedPeepOldX = kLocationNull; public: - void Initialise(EntityId entityId) + void initialise(EntityId entityId) { number = entityId.ToUnderlying(); auto* staff = GetStaff(); @@ -148,17 +148,17 @@ namespace OpenRCT2::Ui::Windows ViewportInit(); } - void OnOpen() override + void onOpen() override { - SetPage(WINDOW_STAFF_OVERVIEW); + setPage(WINDOW_STAFF_OVERVIEW); } - void OnClose() override + void onClose() override { CancelTools(); } - void OnLanguageChange() override + void onLanguageChange() override { auto* staff = GetStaff(); if (staff == nullptr) @@ -168,7 +168,7 @@ namespace OpenRCT2::Ui::Windows _availableCostumes = getAvailableCostumeStrings(AnimationPeepType::Entertainer); } - void OnMouseUp(WidgetIndex widgetIndex) override + void onMouseUp(WidgetIndex widgetIndex) override { if (widgetIndex <= WIDX_TAB_3) CommonMouseUp(widgetIndex); @@ -185,7 +185,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnMouseDown(WidgetIndex widgetIndex) override + void onMouseDown(WidgetIndex widgetIndex) override { switch (page) { @@ -198,7 +198,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) override + void onDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) override { switch (page) { @@ -211,7 +211,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnPrepareDraw() override + void onPrepareDraw() override { CommonPrepareDrawBefore(); @@ -228,9 +228,9 @@ namespace OpenRCT2::Ui::Windows CommonPrepareDrawAfter(); } - void OnDraw(RenderTarget& rt) override + void onDraw(RenderTarget& rt) override { - DrawWidgets(rt); + drawWidgets(rt); DrawTabImages(rt); switch (page) @@ -244,7 +244,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnResize() override + void onResize() override { switch (page) { @@ -260,7 +260,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnUpdate() override + void onUpdate() override { switch (page) { @@ -276,7 +276,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnToolUpdate(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override + void onToolUpdate(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override { switch (page) { @@ -286,7 +286,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override + void onToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override { switch (page) { @@ -296,7 +296,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnToolAbort(WidgetIndex widgetIndex) override + void onToolAbort(WidgetIndex widgetIndex) override { switch (page) { @@ -306,7 +306,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnViewportRotate() override + void onViewportRotate() override { switch (page) { @@ -316,7 +316,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnTextInput(WidgetIndex widgetIndex, std::string_view text) override + void onTextInput(WidgetIndex widgetIndex, std::string_view text) override { switch (page) { @@ -333,12 +333,12 @@ namespace OpenRCT2::Ui::Windows switch (widgetIndex) { case WIDX_CLOSE: - Close(); + close(); break; case WIDX_TAB_1: case WIDX_TAB_2: case WIDX_TAB_3: - SetPage(widgetIndex - WIDX_TAB_1); + setPage(widgetIndex - WIDX_TAB_1); break; } } @@ -463,7 +463,7 @@ namespace OpenRCT2::Ui::Windows { if (dropdownIndex == 0) { - ScrollToViewport(); + scrollToViewport(); } else if (dropdownIndex == 1) { @@ -525,7 +525,7 @@ namespace OpenRCT2::Ui::Windows widgets[WIDX_PICKUP].left = width - 25; widgets[WIDX_PICKUP].right = width - 2; - SetWidgetPressed(WIDX_PATROL, WindowPatrolAreaGetCurrentStaffId() == staff->Id); + setWidgetPressed(WIDX_PATROL, WindowPatrolAreaGetCurrentStaffId() == staff->Id); widgets[WIDX_PATROL].left = width - 25; widgets[WIDX_PATROL].right = width - 2; @@ -577,7 +577,7 @@ namespace OpenRCT2::Ui::Windows void DrawOverviewTabImage(RenderTarget& rt) { - if (IsWidgetDisabled(WIDX_TAB_1)) + if (isWidgetDisabled(WIDX_TAB_1)) return; const auto& widget = widgets[WIDX_TAB_1]; @@ -647,7 +647,7 @@ namespace OpenRCT2::Ui::Windows pickedPeepFrame++; pickedPeepFrame %= pickAnimLength * 4; - InvalidateWidget(WIDX_TAB_1); + invalidateWidget(WIDX_TAB_1); const std::optional tempFocus = staff->State != PeepState::Picked ? std::optional(Focus(staff->Id)) : std::nullopt; @@ -893,10 +893,10 @@ namespace OpenRCT2::Ui::Windows void OptionsSetCheckboxValues() { - SetCheckboxValue(WIDX_CHECKBOX_1, false); - SetCheckboxValue(WIDX_CHECKBOX_2, false); - SetCheckboxValue(WIDX_CHECKBOX_3, false); - SetCheckboxValue(WIDX_CHECKBOX_4, false); + setCheckboxValue(WIDX_CHECKBOX_1, false); + setCheckboxValue(WIDX_CHECKBOX_2, false); + setCheckboxValue(WIDX_CHECKBOX_3, false); + setCheckboxValue(WIDX_CHECKBOX_4, false); auto staff = GetStaff(); if (staff == nullptr) @@ -908,7 +908,7 @@ namespace OpenRCT2::Ui::Windows for (auto index = Numerics::bitScanForward(staffOrders); index != -1; index = Numerics::bitScanForward(staffOrders)) { staffOrders &= ~(1 << index); - SetCheckboxValue(WIDX_CHECKBOX_1 + index, true); + setCheckboxValue(WIDX_CHECKBOX_1 + index, true); } } @@ -920,7 +920,7 @@ namespace OpenRCT2::Ui::Windows void OptionsUpdate() { currentFrame++; - InvalidateWidget(WIDX_TAB_2); + invalidateWidget(WIDX_TAB_2); } #pragma endregion @@ -999,7 +999,7 @@ namespace OpenRCT2::Ui::Windows void StatsUpdate() { currentFrame++; - InvalidateWidget(WIDX_TAB_3); + invalidateWidget(WIDX_TAB_3); auto staff = GetStaff(); if (staff == nullptr) @@ -1010,7 +1010,7 @@ namespace OpenRCT2::Ui::Windows if (staff->WindowInvalidateFlags & PEEP_INVALIDATE_STAFF_STATS) { staff->WindowInvalidateFlags &= ~PEEP_INVALIDATE_STAFF_STATS; - Invalidate(); + invalidate(); } } #pragma endregion @@ -1024,26 +1024,26 @@ namespace OpenRCT2::Ui::Windows for (WidgetIndex widgetIndex = WIDX_TAB_1; widgetIndex < widgets.size(); widgetIndex++) { - SetWidgetDisabled(widgetIndex, false); + setWidgetDisabled(widgetIndex, false); } if (staff->AssignedStaffType == StaffType::Security) { - SetWidgetDisabled(WIDX_TAB_2, true); + setWidgetDisabled(WIDX_TAB_2, true); } if (page == WINDOW_STAFF_OVERVIEW) { if (staff->CanBePickedUp()) { - SetWidgetDisabled(WIDX_PICKUP, false); + setWidgetDisabled(WIDX_PICKUP, false); } else { - SetWidgetDisabled(WIDX_PICKUP, true); + setWidgetDisabled(WIDX_PICKUP, true); } - SetWidgetDisabled(WIDX_FIRE, staff->State == PeepState::Fixing || staff->State == PeepState::Inspecting); + setWidgetDisabled(WIDX_FIRE, staff->State == PeepState::Fixing || staff->State == PeepState::Inspecting); } } @@ -1053,7 +1053,7 @@ namespace OpenRCT2::Ui::Windows ToolCancel(); } - void SetPage(int32_t newPage) + void setPage(int32_t newPage) { CancelTools(); @@ -1072,16 +1072,16 @@ namespace OpenRCT2::Ui::Windows currentFrame = 0; pressedWidgets = 0; holdDownWidgets = 0; - SetWidgets(window_staff_page_widgets[page]); + setWidgets(window_staff_page_widgets[page]); - RemoveViewport(); + removeViewport(); - Invalidate(); - OnResize(); - OnPrepareDraw(); - InitScrollWidgets(); + invalidate(); + onResize(); + onPrepareDraw(); + initScrollWidgets(); ViewportInit(); - Invalidate(); + invalidate(); if (listen && viewport != nullptr) viewport->flags |= VIEWPORT_FLAG_SOUND_ON; @@ -1090,8 +1090,8 @@ namespace OpenRCT2::Ui::Windows void SetPressedTab() { for (int32_t i = 0; i < WINDOW_STAFF_PAGE_COUNT; i++) - SetWidgetPressed((WIDX_TAB_1 + i), false); - SetWidgetPressed(WIDX_TAB_1 + page, true); + setWidgetPressed((WIDX_TAB_1 + i), false); + setWidgetPressed(WIDX_TAB_1 + page, true); } void SetOrder(int32_t orderId) @@ -1132,7 +1132,7 @@ namespace OpenRCT2::Ui::Windows return; viewport_flags = viewport->flags; - RemoveViewport(); + removeViewport(); } else { @@ -1141,7 +1141,7 @@ namespace OpenRCT2::Ui::Windows viewport_flags |= VIEWPORT_FLAG_GRIDLINES; } - OnPrepareDraw(); + onPrepareDraw(); focus = tempFocus; @@ -1157,13 +1157,13 @@ namespace OpenRCT2::Ui::Windows ViewportCreate(*this, screenPos, viewportWidth, viewportHeight, focus.value()); flags |= WF_NO_SCROLLING; - Invalidate(); + invalidate(); } } if (viewport != nullptr) viewport->flags = viewport_flags; - Invalidate(); + invalidate(); } void ShowLocateDropdown(Widget* widget) @@ -1196,7 +1196,7 @@ namespace OpenRCT2::Ui::Windows auto screenCoords = windowPos + ScreenCoordsXY{ widget->left, widget->top }; - if (!IsWidgetDisabled(widgetIndex)) + if (!isWidgetDisabled(widgetIndex)) { if (page == p) { @@ -1235,7 +1235,7 @@ namespace OpenRCT2::Ui::Windows return nullptr; if (w != nullptr) - w->Initialise(peep->Id); + w->initialise(peep->Id); return w; } diff --git a/src/openrct2-ui/windows/StaffFirePrompt.cpp b/src/openrct2-ui/windows/StaffFirePrompt.cpp index 9f1a8a690a..035df03a9c 100644 --- a/src/openrct2-ui/windows/StaffFirePrompt.cpp +++ b/src/openrct2-ui/windows/StaffFirePrompt.cpp @@ -45,18 +45,18 @@ namespace OpenRCT2::Ui::Windows class StaffFirePromptWindow final : public Window { public: - void SetWindowNumber(WindowNumber windownumber) + void setWindowNumber(WindowNumber windownumber) { number = windownumber; } - void OnOpen() override + void onOpen() override { - SetWidgets(_staffFireWidgets); + setWidgets(_staffFireWidgets); WindowInitScrollWidgets(*this); } - void OnMouseUp(WidgetIndex widgetIndex) override + void onMouseUp(WidgetIndex widgetIndex) override { switch (widgetIndex) { @@ -68,14 +68,14 @@ namespace OpenRCT2::Ui::Windows } case WIDX_CLOSE: case WIDX_CANCEL: - Close(); + close(); break; } } - void OnDraw(RenderTarget& rt) override + void onDraw(RenderTarget& rt) override { - DrawWidgets(rt); + drawWidgets(rt); Peep* peep = getGameState().entities.GetEntity(EntityId::FromUnderlying(number)); // The staff member may have been fired in the meantime. @@ -97,7 +97,7 @@ namespace OpenRCT2::Ui::Windows auto* windowMgr = GetWindowManager(); auto* window = windowMgr->FocusOrCreate( WindowClass::FirePrompt, kWindowSize, WF_CENTRE_SCREEN | WF_TRANSPARENT); - window->SetWindowNumber(peep->Id.ToUnderlying()); + window->setWindowNumber(peep->Id.ToUnderlying()); return window; } } // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/StaffList.cpp b/src/openrct2-ui/windows/StaffList.cpp index 2998ed4a53..6f7a54d9fe 100644 --- a/src/openrct2-ui/windows/StaffList.cpp +++ b/src/openrct2-ui/windows/StaffList.cpp @@ -117,9 +117,9 @@ namespace OpenRCT2::Ui::Windows uint32_t _tabAnimationIndex{}; public: - void OnOpen() override + void onOpen() override { - SetWidgets(_staffListWidgets); + setWidgets(_staffListWidgets); WindowInitScrollWidgets(*this); WindowSetResize(*this, kWindowSize, { kMaximumWindowWidth, kMaximumWindowHeight }); @@ -128,17 +128,17 @@ namespace OpenRCT2::Ui::Windows RefreshList(); } - void OnClose() override + void onClose() override { CancelTools(); } - void OnMouseUp(WidgetIndex widgetIndex) override + void onMouseUp(WidgetIndex widgetIndex) override { switch (widgetIndex) { case WIDX_STAFF_LIST_CLOSE: - Close(); + close(); break; case WIDX_STAFF_LIST_HIRE_BUTTON: { @@ -159,12 +159,12 @@ namespace OpenRCT2::Ui::Windows break; case WIDX_STAFF_LIST_QUICK_FIRE: _quickFireMode = !_quickFireMode; - Invalidate(); + invalidate(); break; } } - void OnUpdate() override + void onUpdate() override { auto animPeepType = AnimationPeepType(static_cast(_selectedTab) + 1); auto* animObj = findPeepAnimationsObjectForType(animPeepType); @@ -176,7 +176,7 @@ namespace OpenRCT2::Ui::Windows if (_tabAnimationIndex >= anim.frame_offsets.size() * 4) _tabAnimationIndex = 0; - InvalidateWidget(WIDX_STAFF_LIST_HANDYMEN_TAB + _selectedTab); + invalidateWidget(WIDX_STAFF_LIST_HANDYMEN_TAB + _selectedTab); } // Enable highlighting of these staff members in map window @@ -198,7 +198,7 @@ namespace OpenRCT2::Ui::Windows RefreshList(); } - void OnMouseDown(WidgetIndex widgetIndex) override + void onMouseDown(WidgetIndex widgetIndex) override { switch (widgetIndex) { @@ -212,7 +212,7 @@ namespace OpenRCT2::Ui::Windows { _selectedTab = static_cast(newSelectedTab); RefreshList(); - Invalidate(); + invalidate(); scrolls[0].contentOffsetY = 0; CancelTools(); } @@ -224,7 +224,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) override + void onDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) override { if (dropdownIndex == -1) { @@ -238,14 +238,14 @@ namespace OpenRCT2::Ui::Windows } } - void OnPrepareDraw() override + void onPrepareDraw() override { // Set selected tab - SetWidgetPressed(WIDX_STAFF_LIST_HANDYMEN_TAB, false); - SetWidgetPressed(WIDX_STAFF_LIST_MECHANICS_TAB, false); - SetWidgetPressed(WIDX_STAFF_LIST_SECURITY_TAB, false); - SetWidgetPressed(WIDX_STAFF_LIST_ENTERTAINERS_TAB, false); - SetWidgetPressed(_selectedTab + WIDX_STAFF_LIST_HANDYMEN_TAB, true); + setWidgetPressed(WIDX_STAFF_LIST_HANDYMEN_TAB, false); + setWidgetPressed(WIDX_STAFF_LIST_MECHANICS_TAB, false); + setWidgetPressed(WIDX_STAFF_LIST_SECURITY_TAB, false); + setWidgetPressed(WIDX_STAFF_LIST_ENTERTAINERS_TAB, false); + setWidgetPressed(_selectedTab + WIDX_STAFF_LIST_HANDYMEN_TAB, true); widgets[WIDX_STAFF_LIST_HIRE_BUTTON].text = GetStaffNamingConvention(GetSelectedStaffType()).ActionHire; widgets[WIDX_STAFF_LIST_UNIFORM_COLOUR_PICKER].type = WidgetType::empty; @@ -256,7 +256,7 @@ namespace OpenRCT2::Ui::Windows widgets[WIDX_STAFF_LIST_UNIFORM_COLOUR_PICKER].image = getColourButtonImage( StaffGetColour(GetSelectedStaffType())); } - SetWidgetPressed(WIDX_STAFF_LIST_QUICK_FIRE, _quickFireMode); + setWidgetPressed(WIDX_STAFF_LIST_QUICK_FIRE, _quickFireMode); widgets[WIDX_STAFF_LIST_LIST].right = width - 4; widgets[WIDX_STAFF_LIST_LIST].bottom = height - 15; @@ -270,9 +270,9 @@ namespace OpenRCT2::Ui::Windows widgets[WIDX_STAFF_LIST_HIRE_BUTTON].right = width - 11; } - void OnDraw(RenderTarget& rt) override + void onDraw(RenderTarget& rt) override { - DrawWidgets(rt); + drawWidgets(rt); DrawTabImages(rt); if (!(getGameState().park.flags & PARK_FLAGS_NO_MONEY)) @@ -301,12 +301,12 @@ namespace OpenRCT2::Ui::Windows rt, windowPos + ScreenCoordsXY{ 4, widgets[WIDX_STAFF_LIST_LIST].bottom + 2 }, STR_STAFF_LIST_COUNTER, ft); } - ScreenSize OnScrollGetSize(int32_t scrollIndex) override + ScreenSize onScrollGetSize(int32_t scrollIndex) override { if (_highlightedIndex) { _highlightedIndex = {}; - Invalidate(); + invalidate(); } auto scrollHeight = static_cast(_staffList.size()) * kScrollableRowHeight; @@ -316,24 +316,24 @@ namespace OpenRCT2::Ui::Windows if (i < scrolls[0].contentOffsetY) { scrolls[0].contentOffsetY = i; - Invalidate(); + invalidate(); } auto scrollWidth = widgets[WIDX_STAFF_LIST_LIST].width() - 15; return { scrollWidth, scrollHeight }; } - void OnScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override + void onScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override { auto i = static_cast(screenCoords.y / kScrollableRowHeight); if (i != _highlightedIndex) { _highlightedIndex = static_cast(i); - Invalidate(); + invalidate(); } } - void OnScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override + void onScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override { int32_t i = screenCoords.y / kScrollableRowHeight; auto& gameState = getGameState(); @@ -364,7 +364,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnScrollDraw(int32_t scrollIndex, RenderTarget& rt) override + void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override { auto rtCoords = ScreenCoordsXY{ rt.x, rt.y }; GfxFillRect( @@ -450,7 +450,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override + void onToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override { if (widgetIndex == WIDX_STAFF_LIST_SHOW_PATROL_AREA_BUTTON) { @@ -459,7 +459,7 @@ namespace OpenRCT2::Ui::Windows { ToolCancel(); auto* staffWindow = StaffOpen(closestStaffMember); - staffWindow->OnDropdown(WC_PEEP__WIDX_PATROL, 0); + staffWindow->onDropdown(WC_PEEP__WIDX_PATROL, 0); } else { @@ -470,7 +470,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnToolAbort(WidgetIndex widgetIndex) override + void onToolAbort(WidgetIndex widgetIndex) override { if (widgetIndex == WIDX_STAFF_LIST_SHOW_PATROL_AREA_BUTTON) { diff --git a/src/openrct2-ui/windows/TextInput.cpp b/src/openrct2-ui/windows/TextInput.cpp index da156a0aa2..da68bdcdc1 100644 --- a/src/openrct2-ui/windows/TextInput.cpp +++ b/src/openrct2-ui/windows/TextInput.cpp @@ -59,14 +59,14 @@ namespace OpenRCT2::Ui::Windows u8string _buffer; public: - void OnOpen() override + void onOpen() override { - SetWidgets(_textInputWidgets); + setWidgets(_textInputWidgets); WindowInitScrollWidgets(*this); - SetParentWindow(nullptr, 0); + setParentWindow(nullptr, 0); } - void SetParentWindow(WindowBase* parentWindow, WidgetIndex widgetIndex) + void setParentWindow(WindowBase* parentWindow, WidgetIndex widgetIndex) { // Save calling window details so that the information can be passed back to the correct window & widget if (parentWindow == nullptr) @@ -91,14 +91,14 @@ namespace OpenRCT2::Ui::Windows } } - void SetTitle(StringId title, StringId description, const Formatter& decriptionArgs) + void setTitle(StringId title, StringId description, const Formatter& decriptionArgs) { _titleStringId = title; _descriptionStringId = description; _descriptionArgs = decriptionArgs; } - void SetTitle(std::string_view title, std::string_view description) + void setTitle(std::string_view title, std::string_view description) { _titleStringId = kStringIdNone; _title = title; @@ -106,7 +106,7 @@ namespace OpenRCT2::Ui::Windows _description = description; } - void SetText(std::string_view text, size_t maxLength) + void setText(std::string_view text, size_t maxLength) { text = String::utf8TruncateCodePoints(text, maxLength); _buffer = u8string{ text }; @@ -114,20 +114,20 @@ namespace OpenRCT2::Ui::Windows SetTexboxSession(ContextStartTextInput(_buffer, maxLength)); } - void SetCallback(std::function callback, std::function cancelCallback) + void setCallback(std::function callback, std::function cancelCallback) { _callback = callback; _cancelCallback = cancelCallback; } - void OnClose() override + void onClose() override { // Make sure that we take it out of the text input // mode otherwise problems may occur. ContextStopTextInput(); } - void OnUpdate() override + void onUpdate() override { if (HasParentWindow()) { @@ -135,7 +135,7 @@ namespace OpenRCT2::Ui::Windows auto parentWindow = GetParentWindow(); if (parentWindow == nullptr) { - Close(); + close(); return; } } @@ -145,10 +145,10 @@ namespace OpenRCT2::Ui::Windows if (_cursorBlink > 30) _cursorBlink = 0; - Invalidate(); + invalidate(); } - void OnMouseUp(WidgetIndex widgetIndex) override + void onMouseUp(WidgetIndex widgetIndex) override { switch (widgetIndex) { @@ -156,16 +156,16 @@ namespace OpenRCT2::Ui::Windows case WIDX_CLOSE: ContextStopTextInput(); ExecuteCallback(false); - Close(); + close(); break; case WIDX_OKAY: ContextStopTextInput(); ExecuteCallback(true); - Close(); + close(); } } - void OnPrepareDraw() override + void onPrepareDraw() override { // Change window size if required. int32_t newHeight = CalculateWindowHeight(_buffer.data()); @@ -193,9 +193,9 @@ namespace OpenRCT2::Ui::Windows } } - void OnDraw(RenderTarget& rt) override + void onDraw(RenderTarget& rt) override { - DrawWidgets(rt); + drawWidgets(rt); auto screenCoords = windowPos + ScreenCoordsXY{ kWindowSize.width / 2, widgets[WIDX_TITLE].bottom + 13 }; @@ -296,11 +296,11 @@ namespace OpenRCT2::Ui::Windows } } - void OnReturnPressed() + void onReturnPressed() { ContextStopTextInput(); ExecuteCallback(true); - Close(); + close(); } int32_t CalculateWindowHeight(std::string_view text) @@ -329,7 +329,7 @@ namespace OpenRCT2::Ui::Windows auto w = GetParentWindow(); if (w != nullptr) { - w->OnTextInput(_parentWidget.widgetIndex, _buffer); + w->onTextInput(_parentWidget.widgetIndex, _buffer); } } } @@ -376,9 +376,9 @@ namespace OpenRCT2::Ui::Windows WindowClass::Textinput, { kWindowSize.width, kWindowSize.height + 10 }, WF_CENTRE_SCREEN | WF_STICK_TO_FRONT); if (w != nullptr) { - w->SetParentWindow(call_w, call_widget); - w->SetTitle(title, description, descriptionArgs); - w->SetText(existing_text, maxLength); + w->setParentWindow(call_w, call_widget); + w->setTitle(title, description, descriptionArgs); + w->setText(existing_text, maxLength); } } @@ -391,9 +391,9 @@ namespace OpenRCT2::Ui::Windows WindowClass::Textinput, { kWindowSize.width, kWindowSize.height + 10 }, WF_CENTRE_SCREEN | WF_STICK_TO_FRONT); if (w != nullptr) { - w->SetTitle(title, description); - w->SetText(initialValue, maxLength); - w->SetCallback(callback, cancelCallback); + w->setTitle(title, description); + w->setText(initialValue, maxLength); + w->setCallback(callback, cancelCallback); } } @@ -416,7 +416,7 @@ namespace OpenRCT2::Ui::Windows if (w->classification == WindowClass::Textinput) { auto textInputWindow = static_cast(w); - textInputWindow->OnReturnPressed(); + textInputWindow->onReturnPressed(); } } @@ -424,6 +424,6 @@ namespace OpenRCT2::Ui::Windows auto* windowMgr = GetWindowManager(); w = windowMgr->FindByNumber(wndClass, wndNumber); if (w != nullptr) - w->Invalidate(); + w->invalidate(); } } // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/Themes.cpp b/src/openrct2-ui/windows/Themes.cpp index 80911ba714..806713b7cd 100644 --- a/src/openrct2-ui/windows/Themes.cpp +++ b/src/openrct2-ui/windows/Themes.cpp @@ -259,9 +259,9 @@ namespace OpenRCT2::Ui::Windows public: #pragma region Window Override Events - void OnOpen() override + void onOpen() override { - SetWidgets(_themesWidgets); + setWidgets(_themesWidgets); WindowThemesInitVars(); WindowInitScrollWidgets(*this); @@ -272,7 +272,7 @@ namespace OpenRCT2::Ui::Windows _buttonIndex = -1; } - void OnResize() override + void onResize() override { if (_selectedTab == WINDOW_THEMES_TAB_SETTINGS) { @@ -290,16 +290,16 @@ namespace OpenRCT2::Ui::Windows } } - void OnUpdate() override + void onUpdate() override { currentFrame++; if (currentFrame >= window_themes_tab_animation_loops[_selectedTab]) currentFrame = 0; - InvalidateWidget(WIDX_THEMES_SETTINGS_TAB + _selectedTab); + invalidateWidget(WIDX_THEMES_SETTINGS_TAB + _selectedTab); } - void OnPrepareDraw() override + void onPrepareDraw() override { int32_t newPressedWidgets = pressedWidgets & ~((1LL << WIDX_THEMES_SETTINGS_TAB) | (1LL << WIDX_THEMES_MAIN_UI_TAB) | (1LL << WIDX_THEMES_PARK_TAB) @@ -353,12 +353,11 @@ namespace OpenRCT2::Ui::Windows widgets[WIDX_THEMES_PRESETS_DROPDOWN].type = WidgetType::empty; widgets[WIDX_THEMES_COLOURBTN_MASK].type = WidgetType::empty; - widgetSetCheckboxValue(*this, WIDX_THEMES_RCT1_RIDE_LIGHTS, ThemeGetFlags() & UITHEME_FLAG_USE_LIGHTS_RIDE); - widgetSetCheckboxValue(*this, WIDX_THEMES_RCT1_PARK_LIGHTS, ThemeGetFlags() & UITHEME_FLAG_USE_LIGHTS_PARK); - widgetSetCheckboxValue( - *this, WIDX_THEMES_RCT1_SCENARIO_FONT, ThemeGetFlags() & UITHEME_FLAG_USE_ALTERNATIVE_SCENARIO_SELECT_FONT); - widgetSetCheckboxValue( - *this, WIDX_THEMES_RCT1_BOTTOM_TOOLBAR, ThemeGetFlags() & UITHEME_FLAG_USE_FULL_BOTTOM_TOOLBAR); + setCheckboxValue(WIDX_THEMES_RCT1_RIDE_LIGHTS, ThemeGetFlags() & UITHEME_FLAG_USE_LIGHTS_RIDE); + setCheckboxValue(WIDX_THEMES_RCT1_PARK_LIGHTS, ThemeGetFlags() & UITHEME_FLAG_USE_LIGHTS_PARK); + setCheckboxValue( + WIDX_THEMES_RCT1_SCENARIO_FONT, ThemeGetFlags() & UITHEME_FLAG_USE_ALTERNATIVE_SCENARIO_SELECT_FONT); + setCheckboxValue(WIDX_THEMES_RCT1_BOTTOM_TOOLBAR, ThemeGetFlags() & UITHEME_FLAG_USE_FULL_BOTTOM_TOOLBAR); } else { @@ -379,7 +378,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnDraw(RenderTarget& rt) override + void onDraw(RenderTarget& rt) override { // Widgets WindowDrawWidgets(*this, rt); @@ -405,7 +404,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnMouseDown(WidgetIndex widgetIndex) override + void onMouseDown(WidgetIndex widgetIndex) override { auto widget = &widgets[widgetIndex]; auto* windowMgr = Ui::GetWindowManager(); @@ -428,8 +427,8 @@ namespace OpenRCT2::Ui::Windows _selectedTab = static_cast(newSelectedTab); scrolls[0].contentOffsetY = 0; currentFrame = 0; - OnResize(); - Invalidate(); + onResize(); + invalidate(); break; } case WIDX_THEMES_PRESETS_DROPDOWN: @@ -501,7 +500,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnMouseUp(WidgetIndex widgetIndex) override + void onMouseUp(WidgetIndex widgetIndex) override { size_t activeAvailableThemeIndex; const utf8* activeThemeName; @@ -509,7 +508,7 @@ namespace OpenRCT2::Ui::Windows switch (widgetIndex) { case WIDX_THEMES_CLOSE: - Close(); + close(); break; case WIDX_THEMES_DUPLICATE_BUTTON:; activeAvailableThemeIndex = ThemeManagerGetAvailableThemeIndex(); @@ -545,7 +544,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnDropdown(WidgetIndex widgetIndex, int32_t selectedIndex) override + void onDropdown(WidgetIndex widgetIndex, int32_t selectedIndex) override { switch (widgetIndex) { @@ -575,7 +574,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnTextInput(WidgetIndex widgetIndex, std::string_view text) override + void onTextInput(WidgetIndex widgetIndex, std::string_view text) override { if (text.empty()) return; @@ -596,7 +595,7 @@ namespace OpenRCT2::Ui::Windows { ThemeRename(std::string(text).c_str()); } - Invalidate(); + invalidate(); } else { @@ -611,7 +610,7 @@ namespace OpenRCT2::Ui::Windows } } - ScreenSize OnScrollGetSize(int32_t scrollIndex) override + ScreenSize onScrollGetSize(int32_t scrollIndex) override { if (_selectedTab == WINDOW_THEMES_TAB_SETTINGS || _selectedTab == WINDOW_THEMES_TAB_FEATURES) return {}; @@ -623,13 +622,13 @@ namespace OpenRCT2::Ui::Windows if (i < scrolls[0].contentOffsetY) { scrolls[0].contentOffsetY = i; - Invalidate(); + invalidate(); } return { 420, scrollHeight }; } - void OnScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override + void onScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override { if (screenCoords.y / _max_row_height < GetColourSchemeTabCount()) { @@ -667,7 +666,7 @@ namespace OpenRCT2::Ui::Windows auto colour = ThemeGetColour(wc, _buttonIndex); WindowDropdownShowColour( this, &(widgets[WIDX_THEMES_COLOURBTN_MASK]), colours[1], colour.colour, true); - InvalidateWidget(WIDX_THEMES_LIST); + invalidateWidget(WIDX_THEMES_LIST); } } else if ( @@ -693,7 +692,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnScrollDraw(int32_t scrollIndex, RenderTarget& rt) override + void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override { ScreenCoordsXY screenCoords; diff --git a/src/openrct2-ui/windows/TileInspector.cpp b/src/openrct2-ui/windows/TileInspector.cpp index b221cee126..7efe8c0b22 100644 --- a/src/openrct2-ui/windows/TileInspector.cpp +++ b/src/openrct2-ui/windows/TileInspector.cpp @@ -511,38 +511,38 @@ static uint64_t PageDisabledWidgets[] = { Banner _copiedBanner; public: - void OnOpen() override + void onOpen() override { WindowSetResize(*this, kMinimumWindowSize, kMaximumWindowSize); windowTileInspectorSelectedIndex = -1; - SetPage(TileInspectorPage::Default); + setPage(TileInspectorPage::Default); WindowInitScrollWidgets(*this); _tileSelected = false; ToolSet(*this, WIDX_BACKGROUND, Tool::crosshair); } - void OnUpdate() override + void onUpdate() override { // Check if the mouse is hovering over the list if (!widgetIsHighlighted(*this, WIDX_LIST)) { if (_highlightedIndex != -1) - InvalidateWidget(WIDX_LIST); + invalidateWidget(WIDX_LIST); _highlightedIndex = -1; } if (!isToolActive(WindowClass::TileInspector)) - Close(); + close(); } - void OnMouseUp(WidgetIndex widgetIndex) override + void onMouseUp(WidgetIndex widgetIndex) override { switch (widgetIndex) { case WIDX_CLOSE: - Close(); + close(); return; case WIDX_BUTTON_REMOVE: @@ -576,7 +576,7 @@ static uint64_t PageDisabledWidgets[] = { break; } - // Only element-specific widgets from now on + // only element-specific widgets from now on if (tileInspectorPage == TileInspectorPage::Default || windowTileInspectorSelectedIndex == -1) return; @@ -661,12 +661,12 @@ static uint64_t PageDisabledWidgets[] = { { case WIDX_TRACK_CHECK_APPLY_TO_ALL: _applyToAll ^= 1; - InvalidateWidget(widgetIndex); + invalidateWidget(widgetIndex); break; case WIDX_TRACK_CHECK_CHAIN_LIFT: { - bool entireTrackBlock = IsWidgetPressed(WIDX_TRACK_CHECK_APPLY_TO_ALL); + bool entireTrackBlock = isWidgetPressed(WIDX_TRACK_CHECK_APPLY_TO_ALL); bool newLift = !tileElement->AsTrack()->HasChain(); TrackBlockSetLift(windowTileInspectorSelectedIndex, entireTrackBlock, newLift); break; @@ -739,7 +739,7 @@ static uint64_t PageDisabledWidgets[] = { } } - void OnClose() override + void onClose() override { if (isToolActive(WindowClass::TileInspector)) ToolCancel(); @@ -752,21 +752,21 @@ static uint64_t PageDisabledWidgets[] = { windowTileInspectorSelectedIndex = -1; } - void OnResize() override + void onResize() override { if (width < minWidth) { - Invalidate(); + invalidate(); width = minWidth; } if (height < minHeight) { - Invalidate(); + invalidate(); height = minHeight; } } - void OnMouseDown(WidgetIndex widgetIndex) override + void onMouseDown(WidgetIndex widgetIndex) override { switch (widgetIndex) { @@ -795,7 +795,7 @@ static uint64_t PageDisabledWidgets[] = { break; } // switch widget index - // Only element-specific widgets from now on + // only element-specific widgets from now on if (tileInspectorPage == TileInspectorPage::Default || windowTileInspectorSelectedIndex == -1) return; @@ -835,14 +835,14 @@ static uint64_t PageDisabledWidgets[] = { switch (widgetIndex) { case WIDX_TRACK_SPINNER_HEIGHT_INCREASE: - if (IsWidgetPressed(WIDX_TRACK_CHECK_APPLY_TO_ALL)) + if (isWidgetPressed(WIDX_TRACK_CHECK_APPLY_TO_ALL)) TrackBlockHeightOffset(windowTileInspectorSelectedIndex, 1); else BaseHeightOffset(windowTileInspectorSelectedIndex, 1); break; case WIDX_TRACK_SPINNER_HEIGHT_DECREASE: - if (IsWidgetPressed(WIDX_TRACK_CHECK_APPLY_TO_ALL)) + if (isWidgetPressed(WIDX_TRACK_CHECK_APPLY_TO_ALL)) TrackBlockHeightOffset(windowTileInspectorSelectedIndex, -1); else BaseHeightOffset(windowTileInspectorSelectedIndex, -1); @@ -950,7 +950,7 @@ static uint64_t PageDisabledWidgets[] = { } } - void OnDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) override + void onDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) override { if (dropdownIndex == -1) return; @@ -964,7 +964,7 @@ static uint64_t PageDisabledWidgets[] = { } } - void OnToolUpdate(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override + void onToolUpdate(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override { MapInvalidateSelectionRect(); gMapSelectFlags.set(MapSelectFlag::enable); @@ -999,22 +999,22 @@ static uint64_t PageDisabledWidgets[] = { MapInvalidateSelectionRect(); } - void OnToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override + void onToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override { UpdateSelectedTile(screenCoords); } - void OnToolDrag(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override + void onToolDrag(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override { UpdateSelectedTile(screenCoords); } - ScreenSize OnScrollGetSize(int32_t scrollIndex) override + ScreenSize onScrollGetSize(int32_t scrollIndex) override { return ScreenSize(kWindowSize.width - 30, windowTileInspectorElementCount * kScrollableRowHeight); } - void OnScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override + void onScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override { // There is nothing to interact with when no tile is selected if (!_tileSelected) @@ -1033,19 +1033,19 @@ static uint64_t PageDisabledWidgets[] = { } } - void OnScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override + void onScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override { int16_t index = windowTileInspectorElementCount - (screenCoords.y - 1) / kScrollableRowHeight - 1; if (index < 0 || index >= windowTileInspectorElementCount) _highlightedIndex = -1; else _highlightedIndex = index; - InvalidateWidget(WIDX_LIST); + invalidateWidget(WIDX_LIST); } - void OnDraw(RenderTarget& rt) override + void onDraw(RenderTarget& rt) override { - DrawWidgets(rt); + drawWidgets(rt); ScreenCoordsXY screenCoords(windowPos.x, windowPos.y); // Draw coordinates @@ -1483,7 +1483,7 @@ static uint64_t PageDisabledWidgets[] = { // Current animation frame auto colour = colours[1]; - if (IsWidgetDisabled(WIDX_WALL_SPINNER_ANIMATION_FRAME)) + if (isWidgetDisabled(WIDX_WALL_SPINNER_ANIMATION_FRAME)) { colour = colours[0].withFlag(ColourFlag::inset, true); } @@ -1581,7 +1581,7 @@ static uint64_t PageDisabledWidgets[] = { } } - void OnScrollDraw(int32_t scrollIndex, RenderTarget& rt) override + void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override { const int32_t listWidth = widgets[WIDX_LIST].width(); GfxFillRect( @@ -1756,13 +1756,13 @@ static uint64_t PageDisabledWidgets[] = { } private: - void SetPage(const TileInspectorPage p) + void setPage(const TileInspectorPage p) { // Skip setting page if we're already on this page, unless we're initialising the window if (tileInspectorPage == p && !widgets.empty()) return; - Invalidate(); + invalidate(); // subtract current page height, then add new page height if (tileInspectorPage != TileInspectorPage::Default) { @@ -1778,11 +1778,11 @@ static uint64_t PageDisabledWidgets[] = { } tileInspectorPage = p; auto pageIndex = EnumValue(p); - SetWidgets(PageWidgets[pageIndex]); + setWidgets(PageWidgets[pageIndex]); holdDownWidgets = PageHoldDownWidgets[pageIndex]; disabledWidgets = PageDisabledWidgets[pageIndex]; pressedWidgets = 0; - Invalidate(); + invalidate(); } void UpdateSelectedTile(const ScreenCoordsXY& screenCoords) @@ -1840,7 +1840,7 @@ static uint64_t PageDisabledWidgets[] = { { windowTileInspectorSelectedIndex = index; } - Invalidate(); + invalidate(); } void LoadTile(TileElement* elementToSelect) @@ -1860,7 +1860,7 @@ static uint64_t PageDisabledWidgets[] = { numItems++; } while (!(element++)->IsLastForTile()); windowTileInspectorElementCount = numItems; - Invalidate(); + invalidate(); } void RemoveElement(int32_t elementIndex) @@ -1911,7 +1911,7 @@ static uint64_t PageDisabledWidgets[] = { _copiedBanner = *banner; } _elementCopied = true; - Invalidate(); + invalidate(); } void PasteElement() @@ -2076,7 +2076,7 @@ static uint64_t PageDisabledWidgets[] = { GameActions::Execute(&modifyTile, getGameState()); } - void OnPrepareDraw() override + void onPrepareDraw() override { const TileElement* const tileElement = OpenRCT2::TileInspector::GetSelectedElement(); @@ -2122,34 +2122,34 @@ static uint64_t PageDisabledWidgets[] = { if (tileInspectorPage != p) { - SetPage(p); - Invalidate(); + setPage(p); + invalidate(); } // X and Y spinners - SetWidgetDisabledAndInvalidate( + setWidgetDisabledAndInvalidate( WIDX_SPINNER_X_INCREASE, !(_tileSelected && ((_toolMap.x / 32) < kMaximumMapSizeTechnical - 1))); - SetWidgetDisabledAndInvalidate(WIDX_SPINNER_X_DECREASE, !(_tileSelected && ((_toolMap.x / 32) > 0))); - SetWidgetDisabledAndInvalidate( + setWidgetDisabledAndInvalidate(WIDX_SPINNER_X_DECREASE, !(_tileSelected && ((_toolMap.x / 32) > 0))); + setWidgetDisabledAndInvalidate( WIDX_SPINNER_Y_INCREASE, !(_tileSelected && ((_toolMap.y / 32) < kMaximumMapSizeTechnical - 1))); - SetWidgetDisabledAndInvalidate(WIDX_SPINNER_Y_DECREASE, !(_tileSelected && ((_toolMap.y / 32) > 0))); + setWidgetDisabledAndInvalidate(WIDX_SPINNER_Y_DECREASE, !(_tileSelected && ((_toolMap.y / 32) > 0))); // Sort buttons - SetWidgetDisabledAndInvalidate(WIDX_BUTTON_SORT, !(_tileSelected && windowTileInspectorElementCount > 1)); + setWidgetDisabledAndInvalidate(WIDX_BUTTON_SORT, !(_tileSelected && windowTileInspectorElementCount > 1)); // Move Up button - SetWidgetDisabledAndInvalidate( + setWidgetDisabledAndInvalidate( WIDX_BUTTON_MOVE_UP, !(windowTileInspectorSelectedIndex != -1 && windowTileInspectorSelectedIndex < windowTileInspectorElementCount - 1)); // Move Down button - SetWidgetDisabledAndInvalidate(WIDX_BUTTON_MOVE_DOWN, !(windowTileInspectorSelectedIndex > 0)); + setWidgetDisabledAndInvalidate(WIDX_BUTTON_MOVE_DOWN, !(windowTileInspectorSelectedIndex > 0)); // Copy button - SetWidgetDisabledAndInvalidate(WIDX_BUTTON_COPY, !(windowTileInspectorSelectedIndex >= 0)); + setWidgetDisabledAndInvalidate(WIDX_BUTTON_COPY, !(windowTileInspectorSelectedIndex >= 0)); // Paste button - SetWidgetDisabledAndInvalidate(WIDX_BUTTON_PASTE, !(_tileSelected && _elementCopied)); + setWidgetDisabledAndInvalidate(WIDX_BUTTON_PASTE, !(_tileSelected && _elementCopied)); widgets[WIDX_BACKGROUND].bottom = height - 1; @@ -2203,19 +2203,19 @@ static uint64_t PageDisabledWidgets[] = { widgets[WIDX_SURFACE_CHECK_CORNER_W].bottom = widgets[WIDX_SURFACE_CHECK_CORNER_W].top + 13; widgets[WIDX_SURFACE_CHECK_DIAGONAL].top = GBBT(propertiesAnchor, 3) + 7 * 1; widgets[WIDX_SURFACE_CHECK_DIAGONAL].bottom = widgets[WIDX_SURFACE_CHECK_DIAGONAL].top + 13; - SetCheckboxValue( + setCheckboxValue( WIDX_SURFACE_CHECK_CORNER_N, tileElement->AsSurface()->GetSlope() & (1 << ((2 - GetCurrentRotation()) & 3))); - SetCheckboxValue( + setCheckboxValue( WIDX_SURFACE_CHECK_CORNER_E, tileElement->AsSurface()->GetSlope() & (1 << ((3 - GetCurrentRotation()) & 3))); - SetCheckboxValue( + setCheckboxValue( WIDX_SURFACE_CHECK_CORNER_S, tileElement->AsSurface()->GetSlope() & (1 << ((0 - GetCurrentRotation()) & 3))); - SetCheckboxValue( + setCheckboxValue( WIDX_SURFACE_CHECK_CORNER_W, tileElement->AsSurface()->GetSlope() & (1 << ((1 - GetCurrentRotation()) & 3))); - SetCheckboxValue( + setCheckboxValue( WIDX_SURFACE_CHECK_DIAGONAL, tileElement->AsSurface()->GetSlope() & kTileSlopeDiagonalFlag); break; @@ -2248,24 +2248,24 @@ static uint64_t PageDisabledWidgets[] = { widgets[WIDX_PATH_CHECK_EDGE_W].bottom = widgets[WIDX_PATH_CHECK_EDGE_W].top + 13; widgets[WIDX_PATH_CHECK_EDGE_NW].top = GBBT(propertiesAnchor, 4) + 7 * 1; widgets[WIDX_PATH_CHECK_EDGE_NW].bottom = widgets[WIDX_PATH_CHECK_EDGE_NW].top + 13; - SetCheckboxValue(WIDX_PATH_CHECK_SLOPED, tileElement->AsPath()->IsSloped()); - SetCheckboxValue(WIDX_PATH_CHECK_JUNCTION_RAILINGS, tileElement->AsPath()->HasJunctionRailings()); - SetCheckboxValue(WIDX_PATH_CHECK_BROKEN, tileElement->AsPath()->IsBroken()); - SetCheckboxValue( + setCheckboxValue(WIDX_PATH_CHECK_SLOPED, tileElement->AsPath()->IsSloped()); + setCheckboxValue(WIDX_PATH_CHECK_JUNCTION_RAILINGS, tileElement->AsPath()->HasJunctionRailings()); + setCheckboxValue(WIDX_PATH_CHECK_BROKEN, tileElement->AsPath()->IsBroken()); + setCheckboxValue( WIDX_PATH_CHECK_EDGE_NE, tileElement->AsPath()->GetEdges() & (1 << ((0 - GetCurrentRotation()) & 3))); - SetCheckboxValue( + setCheckboxValue( WIDX_PATH_CHECK_EDGE_SE, tileElement->AsPath()->GetEdges() & (1 << ((1 - GetCurrentRotation()) & 3))); - SetCheckboxValue( + setCheckboxValue( WIDX_PATH_CHECK_EDGE_SW, tileElement->AsPath()->GetEdges() & (1 << ((2 - GetCurrentRotation()) & 3))); - SetCheckboxValue( + setCheckboxValue( WIDX_PATH_CHECK_EDGE_NW, tileElement->AsPath()->GetEdges() & (1 << ((3 - GetCurrentRotation()) & 3))); - SetCheckboxValue( + setCheckboxValue( WIDX_PATH_CHECK_EDGE_E, tileElement->AsPath()->GetCorners() & (1 << ((0 - GetCurrentRotation()) & 3))); - SetCheckboxValue( + setCheckboxValue( WIDX_PATH_CHECK_EDGE_S, tileElement->AsPath()->GetCorners() & (1 << ((1 - GetCurrentRotation()) & 3))); - SetCheckboxValue( + setCheckboxValue( WIDX_PATH_CHECK_EDGE_W, tileElement->AsPath()->GetCorners() & (1 << ((2 - GetCurrentRotation()) & 3))); - SetCheckboxValue( + setCheckboxValue( WIDX_PATH_CHECK_EDGE_N, tileElement->AsPath()->GetCorners() & (1 << ((3 - GetCurrentRotation()) & 3))); break; @@ -2284,13 +2284,13 @@ static uint64_t PageDisabledWidgets[] = { widgets[WIDX_TRACK_CHECK_BRAKE_CLOSED].bottom = GBBB(propertiesAnchor, 3); widgets[WIDX_TRACK_CHECK_IS_INDESTRUCTIBLE].top = GBBT(propertiesAnchor, 4); widgets[WIDX_TRACK_CHECK_IS_INDESTRUCTIBLE].bottom = GBBB(propertiesAnchor, 4); - SetCheckboxValue(WIDX_TRACK_CHECK_APPLY_TO_ALL, _applyToAll); - SetCheckboxValue(WIDX_TRACK_CHECK_CHAIN_LIFT, tileElement->AsTrack()->HasChain()); - SetCheckboxValue(WIDX_TRACK_CHECK_BRAKE_CLOSED, tileElement->AsTrack()->IsBrakeClosed()); + setCheckboxValue(WIDX_TRACK_CHECK_APPLY_TO_ALL, _applyToAll); + setCheckboxValue(WIDX_TRACK_CHECK_CHAIN_LIFT, tileElement->AsTrack()->HasChain()); + setCheckboxValue(WIDX_TRACK_CHECK_BRAKE_CLOSED, tileElement->AsTrack()->IsBrakeClosed()); widgets[WIDX_TRACK_CHECK_BRAKE_CLOSED].content = tileElement->AsTrack()->IsBlockStart() ? STR_TILE_INSPECTOR_TRACK_BLOCK_BRAKE : STR_TILE_INSPECTOR_TRACK_BRAKE_CLOSED; - SetCheckboxValue(WIDX_TRACK_CHECK_IS_INDESTRUCTIBLE, tileElement->AsTrack()->IsIndestructible()); + setCheckboxValue(WIDX_TRACK_CHECK_IS_INDESTRUCTIBLE, tileElement->AsTrack()->IsIndestructible()); break; case TileElementType::SmallScenery: @@ -2318,10 +2318,10 @@ static uint64_t PageDisabledWidgets[] = { bool E = tileElement->AsSmallScenery()->GetSceneryQuadrant() == ((1 - GetCurrentRotation()) & 3); bool S = tileElement->AsSmallScenery()->GetSceneryQuadrant() == ((2 - GetCurrentRotation()) & 3); bool W = tileElement->AsSmallScenery()->GetSceneryQuadrant() == ((3 - GetCurrentRotation()) & 3); - SetCheckboxValue(WIDX_SCENERY_CHECK_QUARTER_N, N); - SetCheckboxValue(WIDX_SCENERY_CHECK_QUARTER_E, E); - SetCheckboxValue(WIDX_SCENERY_CHECK_QUARTER_S, S); - SetCheckboxValue(WIDX_SCENERY_CHECK_QUARTER_W, W); + setCheckboxValue(WIDX_SCENERY_CHECK_QUARTER_N, N); + setCheckboxValue(WIDX_SCENERY_CHECK_QUARTER_E, E); + setCheckboxValue(WIDX_SCENERY_CHECK_QUARTER_S, S); + setCheckboxValue(WIDX_SCENERY_CHECK_QUARTER_W, W); // Collision checkboxes widgets[WIDX_SCENERY_CHECK_COLLISION_N].top = GBBT(propertiesAnchor, 2) + 5 + 7 * 0; @@ -2337,10 +2337,10 @@ static uint64_t PageDisabledWidgets[] = { E = (occupiedQuadrants & (1 << ((3 - GetCurrentRotation()) & 3))) != 0; S = (occupiedQuadrants & (1 << ((0 - GetCurrentRotation()) & 3))) != 0; W = (occupiedQuadrants & (1 << ((1 - GetCurrentRotation()) & 3))) != 0; - SetCheckboxValue(WIDX_SCENERY_CHECK_COLLISION_N, N); - SetCheckboxValue(WIDX_SCENERY_CHECK_COLLISION_E, E); - SetCheckboxValue(WIDX_SCENERY_CHECK_COLLISION_S, S); - SetCheckboxValue(WIDX_SCENERY_CHECK_COLLISION_W, W); + setCheckboxValue(WIDX_SCENERY_CHECK_COLLISION_N, N); + setCheckboxValue(WIDX_SCENERY_CHECK_COLLISION_E, E); + setCheckboxValue(WIDX_SCENERY_CHECK_COLLISION_S, S); + setCheckboxValue(WIDX_SCENERY_CHECK_COLLISION_W, W); break; } @@ -2353,7 +2353,7 @@ static uint64_t PageDisabledWidgets[] = { widgets[WIDX_ENTRANCE_SPINNER_HEIGHT_DECREASE].bottom = GBBB(propertiesAnchor, 0) - 4; widgets[WIDX_ENTRANCE_BUTTON_MAKE_USABLE].top = GBBT(propertiesAnchor, 1); widgets[WIDX_ENTRANCE_BUTTON_MAKE_USABLE].bottom = GBBB(propertiesAnchor, 1); - SetWidgetDisabled( + setWidgetDisabled( WIDX_ENTRANCE_BUTTON_MAKE_USABLE, !(tileElement->AsEntrance()->GetEntranceType() != ENTRANCE_TYPE_PARK_ENTRANCE)); break; @@ -2390,17 +2390,17 @@ static uint64_t PageDisabledWidgets[] = { widgets[WIDX_WALL_ANIMATION_IS_BACKWARDS].bottom = GBBB(propertiesAnchor, 3); // Wall slope dropdown - SetWidgetDisabled(WIDX_WALL_DROPDOWN_SLOPE, !canBeSloped); - InvalidateWidget(WIDX_WALL_DROPDOWN_SLOPE); - SetWidgetDisabled(WIDX_WALL_DROPDOWN_SLOPE_BUTTON, !canBeSloped); - InvalidateWidget(WIDX_WALL_DROPDOWN_SLOPE_BUTTON); + setWidgetDisabled(WIDX_WALL_DROPDOWN_SLOPE, !canBeSloped); + invalidateWidget(WIDX_WALL_DROPDOWN_SLOPE); + setWidgetDisabled(WIDX_WALL_DROPDOWN_SLOPE_BUTTON, !canBeSloped); + invalidateWidget(WIDX_WALL_DROPDOWN_SLOPE_BUTTON); // Wall animation frame spinner - SetWidgetDisabled(WIDX_WALL_SPINNER_ANIMATION_FRAME, !hasAnimation); - SetWidgetDisabled(WIDX_WALL_SPINNER_ANIMATION_FRAME_INCREASE, !hasAnimation); - SetWidgetDisabled(WIDX_WALL_SPINNER_ANIMATION_FRAME_DECREASE, !hasAnimation); + setWidgetDisabled(WIDX_WALL_SPINNER_ANIMATION_FRAME, !hasAnimation); + setWidgetDisabled(WIDX_WALL_SPINNER_ANIMATION_FRAME_INCREASE, !hasAnimation); + setWidgetDisabled(WIDX_WALL_SPINNER_ANIMATION_FRAME_DECREASE, !hasAnimation); - SetCheckboxValue(WIDX_WALL_ANIMATION_IS_BACKWARDS, tileElement->AsWall()->AnimationIsBackwards()); - SetWidgetDisabled(WIDX_WALL_ANIMATION_IS_BACKWARDS, !hasAnimation); + setCheckboxValue(WIDX_WALL_ANIMATION_IS_BACKWARDS, tileElement->AsWall()->AnimationIsBackwards()); + setWidgetDisabled(WIDX_WALL_ANIMATION_IS_BACKWARDS, !hasAnimation); break; } @@ -2428,16 +2428,16 @@ static uint64_t PageDisabledWidgets[] = { widgets[WIDX_BANNER_CHECK_BLOCK_SW].bottom = GBBB(propertiesAnchor, 2); widgets[WIDX_BANNER_CHECK_BLOCK_NW].top = GBBT(propertiesAnchor, 1); widgets[WIDX_BANNER_CHECK_BLOCK_NW].bottom = GBBB(propertiesAnchor, 1); - SetCheckboxValue( + setCheckboxValue( WIDX_BANNER_CHECK_BLOCK_NE, (tileElement->AsBanner()->GetAllowedEdges() & (1 << ((0 - GetCurrentRotation()) & 3)))); - SetCheckboxValue( + setCheckboxValue( WIDX_BANNER_CHECK_BLOCK_SE, (tileElement->AsBanner()->GetAllowedEdges() & (1 << ((1 - GetCurrentRotation()) & 3)))); - SetCheckboxValue( + setCheckboxValue( WIDX_BANNER_CHECK_BLOCK_SW, (tileElement->AsBanner()->GetAllowedEdges() & (1 << ((2 - GetCurrentRotation()) & 3)))); - SetCheckboxValue( + setCheckboxValue( WIDX_BANNER_CHECK_BLOCK_NW, (tileElement->AsBanner()->GetAllowedEdges() & (1 << ((3 - GetCurrentRotation()) & 3)))); break; diff --git a/src/openrct2-ui/windows/TitleExit.cpp b/src/openrct2-ui/windows/TitleExit.cpp index 40e4920532..b9a50e0282 100644 --- a/src/openrct2-ui/windows/TitleExit.cpp +++ b/src/openrct2-ui/windows/TitleExit.cpp @@ -27,13 +27,13 @@ namespace OpenRCT2::Ui::Windows class TitleExitWindow final : public Window { - void OnOpen() override + void onOpen() override { - SetWidgets(_titleExitWidgets); - InitScrollWidgets(); + setWidgets(_titleExitWidgets); + initScrollWidgets(); } - void OnMouseUp(WidgetIndex widgetIndex) override + void onMouseUp(WidgetIndex widgetIndex) override { switch (widgetIndex) { @@ -44,9 +44,9 @@ namespace OpenRCT2::Ui::Windows }; } - void OnDraw(RenderTarget& rt) override + void onDraw(RenderTarget& rt) override { - DrawWidgets(rt); + drawWidgets(rt); } }; diff --git a/src/openrct2-ui/windows/TitleLogo.cpp b/src/openrct2-ui/windows/TitleLogo.cpp index 4431fbe7e3..1c54cf5d20 100644 --- a/src/openrct2-ui/windows/TitleLogo.cpp +++ b/src/openrct2-ui/windows/TitleLogo.cpp @@ -33,16 +33,16 @@ namespace OpenRCT2::Ui::Windows * Creates the window containing the logo and the expansion packs on the title screen. * rct2: 0x0066B679 (part of 0x0066B3E8) */ - void OnOpen() override + void onOpen() override { - SetWidgets(_titleLogoWidgets); + setWidgets(_titleLogoWidgets); WindowInitScrollWidgets(*this); colours[0] = ColourWithFlags{ COLOUR_GREY }.withFlag(ColourFlag::translucent, true); colours[1] = ColourWithFlags{ COLOUR_GREY }.withFlag(ColourFlag::translucent, true); colours[2] = ColourWithFlags{ COLOUR_GREY }.withFlag(ColourFlag::translucent, true); } - void OnMouseUp(WidgetIndex widgetIndex) override + void onMouseUp(WidgetIndex widgetIndex) override { switch (widgetIndex) { @@ -56,7 +56,7 @@ namespace OpenRCT2::Ui::Windows * * rct2: 0x0066B872 */ - void OnDraw(RenderTarget& rt) override + void onDraw(RenderTarget& rt) override { auto screenCoords = windowPos + ScreenCoordsXY{ 2, 2 }; GfxDrawSprite(rt, ImageId(SPR_G2_LOGO), screenCoords); diff --git a/src/openrct2-ui/windows/TitleMenu.cpp b/src/openrct2-ui/windows/TitleMenu.cpp index f2793a547a..33948b78a7 100644 --- a/src/openrct2-ui/windows/TitleMenu.cpp +++ b/src/openrct2-ui/windows/TitleMenu.cpp @@ -90,9 +90,9 @@ namespace OpenRCT2::Ui::Windows ScreenRect _filterRect; public: - void OnOpen() override + void onOpen() override { - SetWidgets(_titleMenuWidgets); + setWidgets(_titleMenuWidgets); #ifdef DISABLE_NETWORK widgets[WIDX_MULTIPLAYER].type = WidgetType::empty; @@ -114,10 +114,10 @@ namespace OpenRCT2::Ui::Windows windowPos.x = (ContextGetWidth() - width) / 2; colours[1] = ColourWithFlags{ COLOUR_LIGHT_ORANGE }.withFlag(ColourFlag::translucent, true); - InitScrollWidgets(); + initScrollWidgets(); } - void OnMouseUp(WidgetIndex widgetIndex) override + void onMouseUp(WidgetIndex widgetIndex) override { WindowBase* windowToOpen = nullptr; @@ -171,7 +171,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnMouseDown(WidgetIndex widgetIndex) override + void onMouseDown(WidgetIndex widgetIndex) override { if (widgetIndex == WIDX_GAME_TOOLS) { @@ -217,7 +217,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnDropdown(WidgetIndex widgetIndex, int32_t selectedIndex) override + void onDropdown(WidgetIndex widgetIndex, int32_t selectedIndex) override { if (selectedIndex == -1) { @@ -254,13 +254,13 @@ namespace OpenRCT2::Ui::Windows } } - CursorID OnCursor(WidgetIndex, const ScreenCoordsXY&, CursorID cursorId) override + CursorID onCursor(WidgetIndex, const ScreenCoordsXY&, CursorID cursorId) override { gTooltipCloseTimeout = gCurrentRealTimeTicks + 2000; return cursorId; } - void OnPrepareDraw() override + void onPrepareDraw() override { _filterRect = { windowPos + ScreenCoordsXY{ 0, UpdateButtonDims.height }, windowPos + ScreenCoordsXY{ width - 1, MenuButtonDims.height + UpdateButtonDims.height - 1 } }; @@ -271,10 +271,10 @@ namespace OpenRCT2::Ui::Windows } } - void OnDraw(RenderTarget& rt) override + void onDraw(RenderTarget& rt) override { GfxFilterRect(rt, _filterRect, FilterPaletteID::Palette51); - DrawWidgets(rt); + drawWidgets(rt); } }; diff --git a/src/openrct2-ui/windows/TitleOptions.cpp b/src/openrct2-ui/windows/TitleOptions.cpp index e5e4f25ab9..18f4cfade1 100644 --- a/src/openrct2-ui/windows/TitleOptions.cpp +++ b/src/openrct2-ui/windows/TitleOptions.cpp @@ -27,13 +27,13 @@ namespace OpenRCT2::Ui::Windows class TitleOptionsWindow final : public Window { public: - void OnOpen() override + void onOpen() override { - SetWidgets(_windowTitleOptionsWidgets); + setWidgets(_windowTitleOptionsWidgets); WindowInitScrollWidgets(*this); } - void OnMouseUp(WidgetIndex widgetIndex) override + void onMouseUp(WidgetIndex widgetIndex) override { switch (widgetIndex) { @@ -43,9 +43,9 @@ namespace OpenRCT2::Ui::Windows } } - void OnDraw(RenderTarget& rt) override + void onDraw(RenderTarget& rt) override { - DrawWidgets(rt); + drawWidgets(rt); } }; diff --git a/src/openrct2-ui/windows/TitleVersion.cpp b/src/openrct2-ui/windows/TitleVersion.cpp index f5e358f0c8..5ea0d9f334 100644 --- a/src/openrct2-ui/windows/TitleVersion.cpp +++ b/src/openrct2-ui/windows/TitleVersion.cpp @@ -23,7 +23,7 @@ namespace OpenRCT2::Ui::Windows class TitleVersionWindow final : public Window { - void OnDraw(RenderTarget& rt) override + void onDraw(RenderTarget& rt) override { // Write name and version information const auto whiteOutline = ColourWithFlags{ COLOUR_WHITE }.withFlag(ColourFlag::withOutline, true); diff --git a/src/openrct2-ui/windows/Tooltip.cpp b/src/openrct2-ui/windows/Tooltip.cpp index 964cd8031c..8329d3724c 100644 --- a/src/openrct2-ui/windows/Tooltip.cpp +++ b/src/openrct2-ui/windows/Tooltip.cpp @@ -82,9 +82,9 @@ namespace OpenRCT2::Ui::Windows } } - void OnOpen() override + void onOpen() override { - SetWidgets(_tooltipWidgets); + setWidgets(_tooltipWidgets); width = _textWidth + 5; height = _textHeight + 4; @@ -95,12 +95,12 @@ namespace OpenRCT2::Ui::Windows ResetTooltipNotShown(); } - void OnUpdate() override + void onUpdate() override { UpdatePosition(gTooltipCursor); } - void OnDraw(RenderTarget& rt) override + void onDraw(RenderTarget& rt) override { int32_t left = windowPos.x; int32_t top = windowPos.y; @@ -177,7 +177,7 @@ namespace OpenRCT2::Ui::Windows return; auto widget = &widgetWindow->widgets[widgetIndex]; - widgetWindow->OnPrepareDraw(); + widgetWindow->onPrepareDraw(); OpenRCT2String result; if (widget->flags.has(WidgetFlag::tooltipIsString)) @@ -200,7 +200,7 @@ namespace OpenRCT2::Ui::Windows gTooltipWidget.windowClassification = widgetWindow->classification; gTooltipWidget.windowNumber = widgetWindow->number; gTooltipWidget.widgetIndex = widgetIndex; - result = widgetWindow->OnTooltip(widgetIndex, stringId); + result = widgetWindow->onTooltip(widgetIndex, stringId); if (result.str == kStringIdNone) return; } diff --git a/src/openrct2-ui/windows/TopToolbar.cpp b/src/openrct2-ui/windows/TopToolbar.cpp index 96dfce766f..6bba56abb9 100644 --- a/src/openrct2-ui/windows/TopToolbar.cpp +++ b/src/openrct2-ui/windows/TopToolbar.cpp @@ -279,34 +279,521 @@ namespace OpenRCT2::Ui::Windows private: bool _waitingForPause{ false }; - void InitViewMenu(Widget& widget); + void initViewMenu(Widget& widget) + { + using namespace Dropdown; + constexpr ItemExt items[] = { + ToggleOption(DDIDX_UNDERGROUND_INSIDE, STR_UNDERGROUND_VIEW), + ToggleOption(DDIDX_TRANSPARENT_WATER, STR_VIEWPORT_TRANSPARENT_WATER), + ToggleOption(DDIDX_HIDE_BASE, STR_REMOVE_BASE_LAND), + ToggleOption(DDIDX_HIDE_VERTICAL, STR_REMOVE_VERTICAL_FACES), + ExtSeparator(), + ToggleOption(DDIDX_HIDE_RIDES, STR_SEE_THROUGH_RIDES), + ToggleOption(DDIDX_HIDE_VEHICLES, STR_SEE_THROUGH_VEHICLES), + ToggleOption(DDIDX_HIDE_VEGETATION, STR_SEE_THROUGH_VEGETATION), + ToggleOption(DDIDX_HIDE_SCENERY, STR_SEE_THROUGH_SCENERY), + ToggleOption(DDIDX_HIDE_PATHS, STR_SEE_THROUGH_PATHS), + ToggleOption(DDIDX_HIDE_SUPPORTS, STR_SEE_THROUGH_SUPPORTS), + ToggleOption(DDIDX_HIDE_GUESTS, STR_SEE_THROUGH_GUESTS), + ToggleOption(DDIDX_HIDE_STAFF, STR_SEE_THROUGH_STAFF), + ExtSeparator(), + ToggleOption(DDIDX_LAND_HEIGHTS, STR_HEIGHT_MARKS_ON_LAND), + ToggleOption(DDIDX_TRACK_HEIGHTS, STR_HEIGHT_MARKS_ON_RIDE_TRACKS), + ToggleOption(DDIDX_PATH_HEIGHTS, STR_HEIGHT_MARKS_ON_PATHS), + ExtSeparator(), + ToggleOption(DDIDX_VIEW_CLIPPING, STR_VIEW_CLIPPING_MENU), + ToggleOption(DDIDX_HIGHLIGHT_PATH_ISSUES, STR_HIGHLIGHT_PATH_ISSUES_MENU), + ExtSeparator(), + ToggleOption(DDIDX_TRANSPARENCY, STR_TRANSPARENCY_OPTIONS), + }; - void ViewMenuDropdown(int16_t dropdownIndex); + static_assert(ItemIDsMatchIndices(items)); - void InitMapMenu(Widget& widget); + SetItems(items); - void MapMenuDropdown(int16_t dropdownIndex); + WindowDropdownShowText( + { windowPos.x + widget.left, windowPos.y + widget.top }, widget.height() + 1, + colours[1].withFlag(ColourFlag::translucent, true), 0, TOP_TOOLBAR_VIEW_MENU_COUNT); - void InitFastforwardMenu(Widget& widget); + auto mvpFlags = WindowGetMain()->viewport->flags; + gDropdown.items[DDIDX_UNDERGROUND_INSIDE].setChecked(mvpFlags & VIEWPORT_FLAG_UNDERGROUND_INSIDE); + gDropdown.items[DDIDX_TRANSPARENT_WATER].setChecked(Config::Get().general.TransparentWater); + gDropdown.items[DDIDX_HIDE_BASE].setChecked(mvpFlags & VIEWPORT_FLAG_HIDE_BASE); + gDropdown.items[DDIDX_HIDE_VERTICAL].setChecked(mvpFlags & VIEWPORT_FLAG_HIDE_VERTICAL); + gDropdown.items[DDIDX_HIDE_RIDES].setChecked(mvpFlags & VIEWPORT_FLAG_HIDE_RIDES); + gDropdown.items[DDIDX_HIDE_VEHICLES].setChecked(mvpFlags & VIEWPORT_FLAG_HIDE_VEHICLES); + gDropdown.items[DDIDX_HIDE_VEGETATION].setChecked(mvpFlags & VIEWPORT_FLAG_HIDE_VEGETATION); + gDropdown.items[DDIDX_HIDE_SCENERY].setChecked(mvpFlags & VIEWPORT_FLAG_HIDE_SCENERY); + gDropdown.items[DDIDX_HIDE_PATHS].setChecked(mvpFlags & VIEWPORT_FLAG_HIDE_PATHS); + gDropdown.items[DDIDX_HIDE_SUPPORTS].setChecked(mvpFlags & VIEWPORT_FLAG_HIDE_SUPPORTS); + gDropdown.items[DDIDX_HIDE_GUESTS].setChecked(mvpFlags & VIEWPORT_FLAG_HIDE_GUESTS); + gDropdown.items[DDIDX_HIDE_STAFF].setChecked(mvpFlags & VIEWPORT_FLAG_HIDE_STAFF); + gDropdown.items[DDIDX_LAND_HEIGHTS].setChecked(mvpFlags & VIEWPORT_FLAG_LAND_HEIGHTS); + gDropdown.items[DDIDX_TRACK_HEIGHTS].setChecked(mvpFlags & VIEWPORT_FLAG_TRACK_HEIGHTS); + gDropdown.items[DDIDX_PATH_HEIGHTS].setChecked(mvpFlags & VIEWPORT_FLAG_PATH_HEIGHTS); + gDropdown.items[DDIDX_VIEW_CLIPPING].setChecked(mvpFlags & VIEWPORT_FLAG_CLIP_VIEW); + gDropdown.items[DDIDX_HIGHLIGHT_PATH_ISSUES].setChecked(mvpFlags & VIEWPORT_FLAG_HIGHLIGHT_PATH_ISSUES); - void FastforwardMenuDropdown(int16_t dropdownIndex); + gDropdown.defaultIndex = DDIDX_UNDERGROUND_INSIDE; + } - void InitFileMenu(Widget& widget); + void viewMenuDropdown(int16_t dropdownIndex) + { + auto* w = WindowGetMain(); + if (w != nullptr) + { + switch (dropdownIndex) + { + case DDIDX_UNDERGROUND_INSIDE: + w->viewport->flags ^= VIEWPORT_FLAG_UNDERGROUND_INSIDE; + break; + case DDIDX_TRANSPARENT_WATER: + Config::Get().general.TransparentWater ^= 1; + Config::Save(); + break; + case DDIDX_HIDE_BASE: + w->viewport->flags ^= VIEWPORT_FLAG_HIDE_BASE; + break; + case DDIDX_HIDE_VERTICAL: + w->viewport->flags ^= VIEWPORT_FLAG_HIDE_VERTICAL; + break; + case DDIDX_HIDE_RIDES: + w->viewport->flags ^= VIEWPORT_FLAG_HIDE_RIDES; + break; + case DDIDX_HIDE_VEHICLES: + w->viewport->flags ^= VIEWPORT_FLAG_HIDE_VEHICLES; + break; + case DDIDX_HIDE_VEGETATION: + w->viewport->flags ^= VIEWPORT_FLAG_HIDE_VEGETATION; + break; + case DDIDX_HIDE_SCENERY: + w->viewport->flags ^= VIEWPORT_FLAG_HIDE_SCENERY; + break; + case DDIDX_HIDE_PATHS: + w->viewport->flags ^= VIEWPORT_FLAG_HIDE_PATHS; + break; + case DDIDX_HIDE_SUPPORTS: + w->viewport->flags ^= VIEWPORT_FLAG_HIDE_SUPPORTS; + break; + case DDIDX_HIDE_GUESTS: + w->viewport->flags ^= VIEWPORT_FLAG_HIDE_GUESTS; + break; + case DDIDX_HIDE_STAFF: + w->viewport->flags ^= VIEWPORT_FLAG_HIDE_STAFF; + break; + case DDIDX_LAND_HEIGHTS: + w->viewport->flags ^= VIEWPORT_FLAG_LAND_HEIGHTS; + break; + case DDIDX_TRACK_HEIGHTS: + w->viewport->flags ^= VIEWPORT_FLAG_TRACK_HEIGHTS; + break; + case DDIDX_PATH_HEIGHTS: + w->viewport->flags ^= VIEWPORT_FLAG_PATH_HEIGHTS; + break; + case DDIDX_VIEW_CLIPPING: + { + auto* windowMgr = GetWindowManager(); + if (windowMgr->FindByClass(WindowClass::ViewClipping) == nullptr) + { + ContextOpenWindow(WindowClass::ViewClipping); + } + else + { + // If window is already open, toggle the view clipping on/off + w->viewport->flags ^= VIEWPORT_FLAG_CLIP_VIEW; + } + break; + } + case DDIDX_HIGHLIGHT_PATH_ISSUES: + w->viewport->flags ^= VIEWPORT_FLAG_HIGHLIGHT_PATH_ISSUES; + break; + case DDIDX_TRANSPARENCY: + ContextOpenWindow(WindowClass::Transparency); + break; + default: + return; + } + w->invalidate(); + } + } - void InitCheatsMenu(Widget& widget); + void initMapMenu(Widget& widget) + { + auto i = 0; + gDropdown.items[i++] = Dropdown::PlainMenuLabel(STR_SHORTCUT_SHOW_MAP); + gDropdown.items[i++] = Dropdown::PlainMenuLabel(STR_EXTRA_VIEWPORT); + if (gLegacyScene == LegacyScene::scenarioEditor && getGameState().editorStep == EditorStep::LandscapeEditor) + { + gDropdown.items[i++] = Dropdown::PlainMenuLabel(STR_MAPGEN_MENU_ITEM); + } - void CheatsMenuDropdown(int16_t dropdownIndex); +#ifdef ENABLE_SCRIPTING + const auto& customMenuItems = OpenRCT2::Scripting::CustomMenuItems; + if (!customMenuItems.empty()) + { + gDropdown.items[i++] = Dropdown::Separator(); + for (const auto& item : customMenuItems) + { + if (item.Kind == OpenRCT2::Scripting::CustomToolbarMenuItemKind::Standard) + { + gDropdown.items[i] = Dropdown::PlainMenuLabel(item.Text.c_str()); + i++; + } + } + } +#endif - void InitDebugMenu(Widget& widget); + WindowDropdownShowText( + { windowPos.x + widget.left, windowPos.y + widget.top }, widget.height() + 1, + colours[1].withFlag(ColourFlag::translucent, true), 0, i); + gDropdown.defaultIndex = DDIDX_SHOW_MAP; + } - void DebugMenuDropdown(int16_t dropdownIndex); + void mapMenuDropdown(int16_t dropdownIndex) + { + int32_t customStartIndex = 3; + if (gLegacyScene == LegacyScene::scenarioEditor && getGameState().editorStep == EditorStep::LandscapeEditor) + { + customStartIndex++; + } - void InitNetworkMenu(Widget& widget); + if (dropdownIndex < customStartIndex) + { + switch (dropdownIndex) + { + case 0: + ContextOpenWindow(WindowClass::Map); + break; + case 1: + ContextOpenWindow(WindowClass::Viewport); + break; + case 2: + ContextOpenWindow(WindowClass::Mapgen); + break; + } + } + else + { +#ifdef ENABLE_SCRIPTING + const auto& customMenuItems = OpenRCT2::Scripting::CustomMenuItems; + auto customIndex = static_cast(dropdownIndex - customStartIndex); + size_t i = 0; + for (const auto& item : customMenuItems) + { + if (item.Kind == OpenRCT2::Scripting::CustomToolbarMenuItemKind::Standard) + { + if (i == customIndex) + { + item.Invoke(); + break; + } + i++; + } + } +#endif + } + } - void NetworkMenuDropdown(int16_t dropdownIndex); + void initFastforwardMenu(Widget& widget) + { + int32_t num_items = 4; + gDropdown.items[0] = Dropdown::MenuLabel(STR_SPEED_NORMAL); + gDropdown.items[1] = Dropdown::MenuLabel(STR_SPEED_QUICK); + gDropdown.items[2] = Dropdown::MenuLabel(STR_SPEED_FAST); + gDropdown.items[3] = Dropdown::MenuLabel(STR_SPEED_TURBO); + + if (Config::Get().general.DebuggingTools) + { + num_items = 6; + + gDropdown.items[4] = Dropdown::Separator(); + gDropdown.items[5] = Dropdown::MenuLabel(STR_SPEED_HYPER); + } + + WindowDropdownShowText( + { windowPos.x + widget.left, windowPos.y + widget.top }, widget.height() + 1, + colours[0].withFlag(ColourFlag::translucent, true), 0, num_items); + + // Set checkmarks + if (gGameSpeed <= 4) + { + gDropdown.items[gGameSpeed - 1].setChecked(true); + } + if (gGameSpeed == 8) + { + gDropdown.items[5].setChecked(true); + } + + if (Config::Get().general.DebuggingTools) + { + gDropdown.defaultIndex = (gGameSpeed == 8 ? 0 : gGameSpeed); + } + else + { + gDropdown.defaultIndex = (gGameSpeed >= 4 ? 0 : gGameSpeed); + } + if (gDropdown.defaultIndex == 4) + { + gDropdown.defaultIndex = 5; + } + } + + void fastforwardMenuDropdown(int16_t dropdownIndex) + { + auto* w = WindowGetMain(); + if (w != nullptr) + { + if (dropdownIndex >= 0 && dropdownIndex <= 5) + { + auto newSpeed = dropdownIndex + 1; + if (newSpeed >= 5) + newSpeed = 8; + + auto setSpeedAction = GameActions::GameSetSpeedAction(newSpeed); + GameActions::Execute(&setSpeedAction, getGameState()); + } + } + } + + void initFileMenu(Widget& widget) + { + int32_t numItems = 0; + if (isInTrackDesignerOrManager()) + { + gDropdown.items[numItems++] = Dropdown::PlainMenuLabel(STR_SCREENSHOT); + gDropdown.items[numItems++] = Dropdown::PlainMenuLabel(STR_GIANT_SCREENSHOT); + gDropdown.items[numItems++] = Dropdown::Separator(); + gDropdown.items[numItems++] = Dropdown::PlainMenuLabel(STR_ABOUT); + gDropdown.items[numItems++] = Dropdown::PlainMenuLabel(STR_FILE_BUG_ON_GITHUB); + + if (OpenRCT2::GetContext()->HasNewVersionInfo()) + gDropdown.items[numItems++] = Dropdown::PlainMenuLabel(STR_UPDATE_AVAILABLE); + + gDropdown.items[numItems++] = Dropdown::PlainMenuLabel(STR_OPTIONS); + gDropdown.items[numItems++] = Dropdown::Separator(); + + if (gLegacyScene == LegacyScene::trackDesigner) + gDropdown.items[numItems++] = Dropdown::PlainMenuLabel(STR_QUIT_ROLLERCOASTER_DESIGNER); + else + gDropdown.items[numItems++] = Dropdown::PlainMenuLabel(STR_QUIT_TRACK_DESIGNS_MANAGER); + + gDropdown.items[numItems++] = Dropdown::PlainMenuLabel(STR_EXIT_OPENRCT2); + } + else if (gLegacyScene == LegacyScene::scenarioEditor) + { + gDropdown.items[numItems++] = Dropdown::PlainMenuLabel(STR_LOAD_LANDSCAPE); + gDropdown.items[numItems++] = Dropdown::Separator(); + gDropdown.items[numItems++] = Dropdown::PlainMenuLabel(STR_SAVE_LANDSCAPE); + gDropdown.items[numItems++] = Dropdown::Separator(); + gDropdown.items[numItems++] = Dropdown::PlainMenuLabel(STR_SCREENSHOT); + gDropdown.items[numItems++] = Dropdown::PlainMenuLabel(STR_GIANT_SCREENSHOT); + gDropdown.items[numItems++] = Dropdown::Separator(); + gDropdown.items[numItems++] = Dropdown::PlainMenuLabel(STR_ABOUT); + gDropdown.items[numItems++] = Dropdown::PlainMenuLabel(STR_FILE_BUG_ON_GITHUB); + + if (OpenRCT2::GetContext()->HasNewVersionInfo()) + gDropdown.items[numItems++] = Dropdown::PlainMenuLabel(STR_UPDATE_AVAILABLE); + + gDropdown.items[numItems++] = Dropdown::PlainMenuLabel(STR_OPTIONS); + gDropdown.items[numItems++] = Dropdown::Separator(); + gDropdown.items[numItems++] = Dropdown::PlainMenuLabel(STR_QUIT_SCENARIO_EDITOR); + gDropdown.items[numItems++] = Dropdown::PlainMenuLabel(STR_EXIT_OPENRCT2); + } + else + { + gDropdown.items[numItems++] = Dropdown::PlainMenuLabel(STR_NEW_GAME); + gDropdown.items[numItems++] = Dropdown::PlainMenuLabel(STR_LOAD_GAME); + gDropdown.items[numItems++] = Dropdown::Separator(); + gDropdown.items[numItems++] = Dropdown::PlainMenuLabel(STR_SAVE_GAME); + gDropdown.items[numItems++] = Dropdown::PlainMenuLabel(STR_SAVE_GAME_AS); + gDropdown.items[numItems++] = Dropdown::Separator(); + gDropdown.items[numItems++] = Dropdown::PlainMenuLabel(STR_SCREENSHOT); + gDropdown.items[numItems++] = Dropdown::PlainMenuLabel(STR_GIANT_SCREENSHOT); + gDropdown.items[numItems++] = Dropdown::Separator(); + gDropdown.items[numItems++] = Dropdown::PlainMenuLabel(STR_ABOUT); + gDropdown.items[numItems++] = Dropdown::PlainMenuLabel(STR_FILE_BUG_ON_GITHUB); + + if (OpenRCT2::GetContext()->HasNewVersionInfo()) + gDropdown.items[numItems++] = Dropdown::PlainMenuLabel(STR_UPDATE_AVAILABLE); + + gDropdown.items[numItems++] = Dropdown::PlainMenuLabel(STR_OPTIONS); + gDropdown.items[numItems++] = Dropdown::Separator(); + gDropdown.items[numItems++] = Dropdown::PlainMenuLabel(STR_QUIT_TO_MENU); + gDropdown.items[numItems++] = Dropdown::PlainMenuLabel(STR_EXIT_OPENRCT2); + } + + WindowDropdownShowText( + { windowPos.x + widget.left, windowPos.y + widget.top }, widget.height() + 1, + colours[0].withFlag(ColourFlag::translucent, true), Dropdown::Flag::StayOpen, numItems); + } + + void initCheatsMenu(Widget& widget) + { + using namespace Dropdown; + + constexpr ItemExt items[] = { + ToggleOption(DDIDX_CHEATS, STR_CHEAT_TITLE), + ToggleOption(DDIDX_TILE_INSPECTOR, STR_DEBUG_DROPDOWN_TILE_INSPECTOR), + ToggleOption(DDIDX_OBJECT_SELECTION, STR_DEBUG_DROPDOWN_OBJECT_SELECTION), + ToggleOption(DDIDX_INVENTIONS_LIST, STR_DEBUG_DROPDOWN_INVENTIONS_LIST), + ToggleOption(DDIDX_SCENARIO_OPTIONS, STR_DEBUG_DROPDOWN_SCENARIO_OPTIONS), + ExtSeparator(), + ToggleOption(DDIDX_ENABLE_SANDBOX_MODE, STR_ENABLE_SANDBOX_MODE), + ToggleOption(DDIDX_DISABLE_CLEARANCE_CHECKS, STR_DISABLE_CLEARANCE_CHECKS), + ToggleOption(DDIDX_DISABLE_SUPPORT_LIMITS, STR_DISABLE_SUPPORT_LIMITS), + }; + static_assert(ItemIDsMatchIndices(items)); + + SetItems(items); + + WindowDropdownShowText( + { windowPos.x + widget.left, windowPos.y + widget.top }, widget.height() + 1, + colours[0].withFlag(ColourFlag::translucent, true), Dropdown::Flag::StayOpen, TOP_TOOLBAR_CHEATS_COUNT); + + // Disable items that are not yet available in multiplayer + if (Network::GetMode() != Network::Mode::none) + { + gDropdown.items[DDIDX_OBJECT_SELECTION].setDisabled(true); + gDropdown.items[DDIDX_INVENTIONS_LIST].setDisabled(true); + } + + if (isInEditorMode()) + { + gDropdown.items[DDIDX_OBJECT_SELECTION].setDisabled(true); + gDropdown.items[DDIDX_INVENTIONS_LIST].setDisabled(true); + gDropdown.items[DDIDX_SCENARIO_OPTIONS].setDisabled(true); + gDropdown.items[DDIDX_ENABLE_SANDBOX_MODE].setDisabled(true); + } + + auto& gameState = getGameState(); + if (gameState.cheats.sandboxMode) + { + gDropdown.items[DDIDX_ENABLE_SANDBOX_MODE].setChecked(true); + } + if (gameState.cheats.disableClearanceChecks) + { + gDropdown.items[DDIDX_DISABLE_CLEARANCE_CHECKS].setChecked(true); + } + if (gameState.cheats.disableSupportLimits) + { + gDropdown.items[DDIDX_DISABLE_SUPPORT_LIMITS].setChecked(true); + } + + gDropdown.defaultIndex = DDIDX_CHEATS; + } + + void cheatsMenuDropdown(int16_t dropdownIndex) + { + switch (dropdownIndex) + { + case DDIDX_CHEATS: + ContextOpenWindow(WindowClass::Cheats); + break; + case DDIDX_TILE_INSPECTOR: + ContextOpenWindow(WindowClass::TileInspector); + break; + case DDIDX_OBJECT_SELECTION: + { + auto* windowMgr = Ui::GetWindowManager(); + windowMgr->CloseAll(); + ContextOpenWindow(WindowClass::EditorObjectSelection); + break; + } + case DDIDX_INVENTIONS_LIST: + ContextOpenWindow(WindowClass::EditorInventionList); + break; + case DDIDX_SCENARIO_OPTIONS: + ContextOpenWindow(WindowClass::EditorScenarioOptions); + break; + case DDIDX_ENABLE_SANDBOX_MODE: + CheatsSet(CheatType::SandboxMode, !getGameState().cheats.sandboxMode); + break; + case DDIDX_DISABLE_CLEARANCE_CHECKS: + CheatsSet(CheatType::DisableClearanceChecks, !getGameState().cheats.disableClearanceChecks); + break; + case DDIDX_DISABLE_SUPPORT_LIMITS: + CheatsSet(CheatType::DisableSupportLimits, !getGameState().cheats.disableSupportLimits); + break; + } + } + + void initDebugMenu(Widget& widget) + { + gDropdown.items[DDIDX_CONSOLE] = Dropdown::ToggleOption(STR_DEBUG_DROPDOWN_CONSOLE); + gDropdown.items[DDIDX_DEBUG_PAINT] = Dropdown::ToggleOption(STR_DEBUG_DROPDOWN_DEBUG_PAINT); + + WindowDropdownShowText( + { windowPos.x + widget.left, windowPos.y + widget.top }, widget.height() + 1, + colours[0].withFlag(ColourFlag::translucent, true), Dropdown::Flag::StayOpen, TOP_TOOLBAR_DEBUG_COUNT); + + auto* windowMgr = GetWindowManager(); + gDropdown.items[DDIDX_CONSOLE].setChecked(windowMgr->FindByClass(WindowClass::Console) != nullptr); + gDropdown.items[DDIDX_DEBUG_PAINT].setChecked(windowMgr->FindByClass(WindowClass::DebugPaint) != nullptr); + } + + void debugMenuDropdown(int16_t dropdownIndex) + { + auto* w = WindowGetMain(); + if (w != nullptr) + { + switch (dropdownIndex) + { + case DDIDX_CONSOLE: + { + auto& console = GetInGameConsole(); + console.Open(); + break; + } + case DDIDX_DEBUG_PAINT: + { + auto* windowMgr = GetWindowManager(); + if (windowMgr->FindByClass(WindowClass::DebugPaint) == nullptr) + { + ContextOpenWindow(WindowClass::DebugPaint); + } + else + { + windowMgr->CloseByClass(WindowClass::DebugPaint); + } + break; + } + } + } + } + + void initNetworkMenu(Widget& widget) + { + gDropdown.items[DDIDX_MULTIPLAYER] = Dropdown::PlainMenuLabel(STR_MULTIPLAYER); + gDropdown.items[DDIDX_MULTIPLAYER_RECONNECT] = Dropdown::PlainMenuLabel(STR_MULTIPLAYER_RECONNECT); + + WindowDropdownShowText( + { windowPos.x + widget.left, windowPos.y + widget.top }, widget.height() + 1, + colours[0].withFlag(ColourFlag::translucent, true), 0, TOP_TOOLBAR_NETWORK_COUNT); + + gDropdown.items[DDIDX_MULTIPLAYER_RECONNECT].setDisabled(!Network::IsDesynchronised()); + + gDropdown.defaultIndex = DDIDX_MULTIPLAYER; + } + + void networkMenuDropdown(int16_t dropdownIndex) + { + auto* w = WindowGetMain(); + if (w != nullptr) + { + switch (dropdownIndex) + { + case DDIDX_MULTIPLAYER: + ContextOpenWindow(WindowClass::Multiplayer); + break; + case DDIDX_MULTIPLAYER_RECONNECT: + Network::Reconnect(); + break; + } + } + } public: - void OnMouseUp(WidgetIndex widgetIndex) override + void onMouseUp(WidgetIndex widgetIndex) override { WindowBase* mainWindow; @@ -389,37 +876,37 @@ namespace OpenRCT2::Ui::Windows } } - void OnMouseDown(WidgetIndex widgetIndex) override + void onMouseDown(WidgetIndex widgetIndex) override { Widget& widget = widgets[widgetIndex]; switch (widgetIndex) { case WIDX_FILE_MENU: - InitFileMenu(widget); + initFileMenu(widget); break; case WIDX_CHEATS: - InitCheatsMenu(widget); + initCheatsMenu(widget); break; case WIDX_VIEW_MENU: - InitViewMenu(widget); + initViewMenu(widget); break; case WIDX_MAP: - InitMapMenu(widget); + initMapMenu(widget); break; case WIDX_FASTFORWARD: - InitFastforwardMenu(widget); + initFastforwardMenu(widget); break; case WIDX_DEBUG: - InitDebugMenu(widget); + initDebugMenu(widget); break; case WIDX_NETWORK: - InitNetworkMenu(widget); + initNetworkMenu(widget); break; } } - void OnDropdown(WidgetIndex widgetIndex, int32_t selectedIndex) override + void onDropdown(WidgetIndex widgetIndex, int32_t selectedIndex) override { if (selectedIndex == -1) { @@ -524,22 +1011,22 @@ namespace OpenRCT2::Ui::Windows } break; case WIDX_CHEATS: - CheatsMenuDropdown(selectedIndex); + cheatsMenuDropdown(selectedIndex); break; case WIDX_VIEW_MENU: - ViewMenuDropdown(selectedIndex); + viewMenuDropdown(selectedIndex); break; case WIDX_MAP: - MapMenuDropdown(selectedIndex); + mapMenuDropdown(selectedIndex); break; case WIDX_FASTFORWARD: - FastforwardMenuDropdown(selectedIndex); + fastforwardMenuDropdown(selectedIndex); break; case WIDX_DEBUG: - DebugMenuDropdown(selectedIndex); + debugMenuDropdown(selectedIndex); break; case WIDX_NETWORK: - NetworkMenuDropdown(selectedIndex); + networkMenuDropdown(selectedIndex); break; } } @@ -547,7 +1034,7 @@ namespace OpenRCT2::Ui::Windows #ifdef ENABLE_SCRIPTING // The following are tool events for custom tools set by user scripts. // NB: these can't go into CustomWindow.cpp, as tools may be active without a visible window. - void OnToolUpdate(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override + void onToolUpdate(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override { auto& customTool = OpenRCT2::Scripting::ActiveCustomTool; if (customTool) @@ -556,7 +1043,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override + void onToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override { auto& customTool = OpenRCT2::Scripting::ActiveCustomTool; if (customTool) @@ -565,7 +1052,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnToolDrag(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override + void onToolDrag(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override { auto& customTool = OpenRCT2::Scripting::ActiveCustomTool; if (customTool) @@ -574,7 +1061,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnToolUp(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override + void onToolUp(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override { auto& customTool = OpenRCT2::Scripting::ActiveCustomTool; if (customTool) @@ -583,7 +1070,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnToolAbort(WidgetIndex widgetIndex) override + void onToolAbort(WidgetIndex widgetIndex) override { auto& customTool = OpenRCT2::Scripting::ActiveCustomTool; if (customTool) @@ -863,7 +1350,7 @@ namespace OpenRCT2::Ui::Windows AlignButtons(kWidgetOrderCombined, xPos); } - void OnPrepareDraw() override + void onPrepareDraw() override { ResetWidgetToDefaultState(); HideDisabledButtons(); @@ -883,7 +1370,7 @@ namespace OpenRCT2::Ui::Windows AlignButtonsCentre(); } - void OnDraw(RenderTarget& rt) override + void onDraw(RenderTarget& rt) override { const auto& gameState = getGameState(); int32_t imgId; @@ -1007,7 +1494,7 @@ namespace OpenRCT2::Ui::Windows screenPos = windowPos + ScreenCoordsXY{ widgets[WIDX_ROTATE_ANTI_CLOCKWISE].left + 2, widgets[WIDX_ROTATE_ANTI_CLOCKWISE].top + 0 }; - if (IsWidgetPressed(WIDX_ROTATE_ANTI_CLOCKWISE)) + if (isWidgetPressed(WIDX_ROTATE_ANTI_CLOCKWISE)) screenPos.y++; GfxDrawSprite(rt, ImageId(SPR_G2_ICON_ROTATE_ANTI_CLOCKWISE), screenPos); } @@ -1025,523 +1512,10 @@ namespace OpenRCT2::Ui::Windows WindowClass::TopToolbar, ScreenCoordsXY(0, 0), { ContextGetWidth(), kTopToolbarHeight + 1 }, WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_NO_BACKGROUND | WF_NO_TITLE_BAR); - window->SetWidgets(_topToolbarWidgets); + window->setWidgets(_topToolbarWidgets); WindowInitScrollWidgets(*window); return window; } - - void TopToolbar::InitViewMenu(Widget& widget) - { - using namespace Dropdown; - constexpr ItemExt items[] = { - ToggleOption(DDIDX_UNDERGROUND_INSIDE, STR_UNDERGROUND_VIEW), - ToggleOption(DDIDX_TRANSPARENT_WATER, STR_VIEWPORT_TRANSPARENT_WATER), - ToggleOption(DDIDX_HIDE_BASE, STR_REMOVE_BASE_LAND), - ToggleOption(DDIDX_HIDE_VERTICAL, STR_REMOVE_VERTICAL_FACES), - ExtSeparator(), - ToggleOption(DDIDX_HIDE_RIDES, STR_SEE_THROUGH_RIDES), - ToggleOption(DDIDX_HIDE_VEHICLES, STR_SEE_THROUGH_VEHICLES), - ToggleOption(DDIDX_HIDE_VEGETATION, STR_SEE_THROUGH_VEGETATION), - ToggleOption(DDIDX_HIDE_SCENERY, STR_SEE_THROUGH_SCENERY), - ToggleOption(DDIDX_HIDE_PATHS, STR_SEE_THROUGH_PATHS), - ToggleOption(DDIDX_HIDE_SUPPORTS, STR_SEE_THROUGH_SUPPORTS), - ToggleOption(DDIDX_HIDE_GUESTS, STR_SEE_THROUGH_GUESTS), - ToggleOption(DDIDX_HIDE_STAFF, STR_SEE_THROUGH_STAFF), - ExtSeparator(), - ToggleOption(DDIDX_LAND_HEIGHTS, STR_HEIGHT_MARKS_ON_LAND), - ToggleOption(DDIDX_TRACK_HEIGHTS, STR_HEIGHT_MARKS_ON_RIDE_TRACKS), - ToggleOption(DDIDX_PATH_HEIGHTS, STR_HEIGHT_MARKS_ON_PATHS), - ExtSeparator(), - ToggleOption(DDIDX_VIEW_CLIPPING, STR_VIEW_CLIPPING_MENU), - ToggleOption(DDIDX_HIGHLIGHT_PATH_ISSUES, STR_HIGHLIGHT_PATH_ISSUES_MENU), - ExtSeparator(), - ToggleOption(DDIDX_TRANSPARENCY, STR_TRANSPARENCY_OPTIONS), - }; - - static_assert(ItemIDsMatchIndices(items)); - - SetItems(items); - - WindowDropdownShowText( - { windowPos.x + widget.left, windowPos.y + widget.top }, widget.height() + 1, - colours[1].withFlag(ColourFlag::translucent, true), 0, TOP_TOOLBAR_VIEW_MENU_COUNT); - - auto mvpFlags = WindowGetMain()->viewport->flags; - gDropdown.items[DDIDX_UNDERGROUND_INSIDE].setChecked(mvpFlags & VIEWPORT_FLAG_UNDERGROUND_INSIDE); - gDropdown.items[DDIDX_TRANSPARENT_WATER].setChecked(Config::Get().general.TransparentWater); - gDropdown.items[DDIDX_HIDE_BASE].setChecked(mvpFlags & VIEWPORT_FLAG_HIDE_BASE); - gDropdown.items[DDIDX_HIDE_VERTICAL].setChecked(mvpFlags & VIEWPORT_FLAG_HIDE_VERTICAL); - gDropdown.items[DDIDX_HIDE_RIDES].setChecked(mvpFlags & VIEWPORT_FLAG_HIDE_RIDES); - gDropdown.items[DDIDX_HIDE_VEHICLES].setChecked(mvpFlags & VIEWPORT_FLAG_HIDE_VEHICLES); - gDropdown.items[DDIDX_HIDE_VEGETATION].setChecked(mvpFlags & VIEWPORT_FLAG_HIDE_VEGETATION); - gDropdown.items[DDIDX_HIDE_SCENERY].setChecked(mvpFlags & VIEWPORT_FLAG_HIDE_SCENERY); - gDropdown.items[DDIDX_HIDE_PATHS].setChecked(mvpFlags & VIEWPORT_FLAG_HIDE_PATHS); - gDropdown.items[DDIDX_HIDE_SUPPORTS].setChecked(mvpFlags & VIEWPORT_FLAG_HIDE_SUPPORTS); - gDropdown.items[DDIDX_HIDE_GUESTS].setChecked(mvpFlags & VIEWPORT_FLAG_HIDE_GUESTS); - gDropdown.items[DDIDX_HIDE_STAFF].setChecked(mvpFlags & VIEWPORT_FLAG_HIDE_STAFF); - gDropdown.items[DDIDX_LAND_HEIGHTS].setChecked(mvpFlags & VIEWPORT_FLAG_LAND_HEIGHTS); - gDropdown.items[DDIDX_TRACK_HEIGHTS].setChecked(mvpFlags & VIEWPORT_FLAG_TRACK_HEIGHTS); - gDropdown.items[DDIDX_PATH_HEIGHTS].setChecked(mvpFlags & VIEWPORT_FLAG_PATH_HEIGHTS); - gDropdown.items[DDIDX_VIEW_CLIPPING].setChecked(mvpFlags & VIEWPORT_FLAG_CLIP_VIEW); - gDropdown.items[DDIDX_HIGHLIGHT_PATH_ISSUES].setChecked(mvpFlags & VIEWPORT_FLAG_HIGHLIGHT_PATH_ISSUES); - - gDropdown.defaultIndex = DDIDX_UNDERGROUND_INSIDE; - } - - void TopToolbar::ViewMenuDropdown(int16_t dropdownIndex) - { - auto* w = WindowGetMain(); - if (w != nullptr) - { - switch (dropdownIndex) - { - case DDIDX_UNDERGROUND_INSIDE: - w->viewport->flags ^= VIEWPORT_FLAG_UNDERGROUND_INSIDE; - break; - case DDIDX_TRANSPARENT_WATER: - Config::Get().general.TransparentWater ^= 1; - Config::Save(); - break; - case DDIDX_HIDE_BASE: - w->viewport->flags ^= VIEWPORT_FLAG_HIDE_BASE; - break; - case DDIDX_HIDE_VERTICAL: - w->viewport->flags ^= VIEWPORT_FLAG_HIDE_VERTICAL; - break; - case DDIDX_HIDE_RIDES: - w->viewport->flags ^= VIEWPORT_FLAG_HIDE_RIDES; - break; - case DDIDX_HIDE_VEHICLES: - w->viewport->flags ^= VIEWPORT_FLAG_HIDE_VEHICLES; - break; - case DDIDX_HIDE_VEGETATION: - w->viewport->flags ^= VIEWPORT_FLAG_HIDE_VEGETATION; - break; - case DDIDX_HIDE_SCENERY: - w->viewport->flags ^= VIEWPORT_FLAG_HIDE_SCENERY; - break; - case DDIDX_HIDE_PATHS: - w->viewport->flags ^= VIEWPORT_FLAG_HIDE_PATHS; - break; - case DDIDX_HIDE_SUPPORTS: - w->viewport->flags ^= VIEWPORT_FLAG_HIDE_SUPPORTS; - break; - case DDIDX_HIDE_GUESTS: - w->viewport->flags ^= VIEWPORT_FLAG_HIDE_GUESTS; - break; - case DDIDX_HIDE_STAFF: - w->viewport->flags ^= VIEWPORT_FLAG_HIDE_STAFF; - break; - case DDIDX_LAND_HEIGHTS: - w->viewport->flags ^= VIEWPORT_FLAG_LAND_HEIGHTS; - break; - case DDIDX_TRACK_HEIGHTS: - w->viewport->flags ^= VIEWPORT_FLAG_TRACK_HEIGHTS; - break; - case DDIDX_PATH_HEIGHTS: - w->viewport->flags ^= VIEWPORT_FLAG_PATH_HEIGHTS; - break; - case DDIDX_VIEW_CLIPPING: - { - auto* windowMgr = GetWindowManager(); - if (windowMgr->FindByClass(WindowClass::ViewClipping) == nullptr) - { - ContextOpenWindow(WindowClass::ViewClipping); - } - else - { - // If window is already open, toggle the view clipping on/off - w->viewport->flags ^= VIEWPORT_FLAG_CLIP_VIEW; - } - break; - } - case DDIDX_HIGHLIGHT_PATH_ISSUES: - w->viewport->flags ^= VIEWPORT_FLAG_HIGHLIGHT_PATH_ISSUES; - break; - case DDIDX_TRANSPARENCY: - ContextOpenWindow(WindowClass::Transparency); - break; - default: - return; - } - w->Invalidate(); - } - } - - void TopToolbar::InitMapMenu(Widget& widget) - { - auto i = 0; - gDropdown.items[i++] = Dropdown::PlainMenuLabel(STR_SHORTCUT_SHOW_MAP); - gDropdown.items[i++] = Dropdown::PlainMenuLabel(STR_EXTRA_VIEWPORT); - if (gLegacyScene == LegacyScene::scenarioEditor && getGameState().editorStep == EditorStep::LandscapeEditor) - { - gDropdown.items[i++] = Dropdown::PlainMenuLabel(STR_MAPGEN_MENU_ITEM); - } - -#ifdef ENABLE_SCRIPTING - const auto& customMenuItems = OpenRCT2::Scripting::CustomMenuItems; - if (!customMenuItems.empty()) - { - gDropdown.items[i++] = Dropdown::Separator(); - for (const auto& item : customMenuItems) - { - if (item.Kind == OpenRCT2::Scripting::CustomToolbarMenuItemKind::Standard) - { - gDropdown.items[i] = Dropdown::PlainMenuLabel(item.Text.c_str()); - i++; - } - } - } -#endif - - WindowDropdownShowText( - { windowPos.x + widget.left, windowPos.y + widget.top }, widget.height() + 1, - colours[1].withFlag(ColourFlag::translucent, true), 0, i); - gDropdown.defaultIndex = DDIDX_SHOW_MAP; - } - - void TopToolbar::MapMenuDropdown(int16_t dropdownIndex) - { - int32_t customStartIndex = 3; - if (gLegacyScene == LegacyScene::scenarioEditor && getGameState().editorStep == EditorStep::LandscapeEditor) - { - customStartIndex++; - } - - if (dropdownIndex < customStartIndex) - { - switch (dropdownIndex) - { - case 0: - ContextOpenWindow(WindowClass::Map); - break; - case 1: - ContextOpenWindow(WindowClass::Viewport); - break; - case 2: - ContextOpenWindow(WindowClass::Mapgen); - break; - } - } - else - { -#ifdef ENABLE_SCRIPTING - const auto& customMenuItems = OpenRCT2::Scripting::CustomMenuItems; - auto customIndex = static_cast(dropdownIndex - customStartIndex); - size_t i = 0; - for (const auto& item : customMenuItems) - { - if (item.Kind == OpenRCT2::Scripting::CustomToolbarMenuItemKind::Standard) - { - if (i == customIndex) - { - item.Invoke(); - break; - } - i++; - } - } -#endif - } - } - - void TopToolbar::InitFastforwardMenu(Widget& widget) - { - int32_t num_items = 4; - gDropdown.items[0] = Dropdown::MenuLabel(STR_SPEED_NORMAL); - gDropdown.items[1] = Dropdown::MenuLabel(STR_SPEED_QUICK); - gDropdown.items[2] = Dropdown::MenuLabel(STR_SPEED_FAST); - gDropdown.items[3] = Dropdown::MenuLabel(STR_SPEED_TURBO); - - if (Config::Get().general.DebuggingTools) - { - num_items = 6; - - gDropdown.items[4] = Dropdown::Separator(); - gDropdown.items[5] = Dropdown::MenuLabel(STR_SPEED_HYPER); - } - - WindowDropdownShowText( - { windowPos.x + widget.left, windowPos.y + widget.top }, widget.height() + 1, - colours[0].withFlag(ColourFlag::translucent, true), 0, num_items); - - // Set checkmarks - if (gGameSpeed <= 4) - { - gDropdown.items[gGameSpeed - 1].setChecked(true); - } - if (gGameSpeed == 8) - { - gDropdown.items[5].setChecked(true); - } - - if (Config::Get().general.DebuggingTools) - { - gDropdown.defaultIndex = (gGameSpeed == 8 ? 0 : gGameSpeed); - } - else - { - gDropdown.defaultIndex = (gGameSpeed >= 4 ? 0 : gGameSpeed); - } - if (gDropdown.defaultIndex == 4) - { - gDropdown.defaultIndex = 5; - } - } - - void TopToolbar::FastforwardMenuDropdown(int16_t dropdownIndex) - { - auto* w = WindowGetMain(); - if (w != nullptr) - { - if (dropdownIndex >= 0 && dropdownIndex <= 5) - { - auto newSpeed = dropdownIndex + 1; - if (newSpeed >= 5) - newSpeed = 8; - - auto setSpeedAction = GameActions::GameSetSpeedAction(newSpeed); - GameActions::Execute(&setSpeedAction, getGameState()); - } - } - } - - void TopToolbar::InitFileMenu(Widget& widget) - { - int32_t numItems = 0; - if (isInTrackDesignerOrManager()) - { - gDropdown.items[numItems++] = Dropdown::PlainMenuLabel(STR_SCREENSHOT); - gDropdown.items[numItems++] = Dropdown::PlainMenuLabel(STR_GIANT_SCREENSHOT); - gDropdown.items[numItems++] = Dropdown::Separator(); - gDropdown.items[numItems++] = Dropdown::PlainMenuLabel(STR_ABOUT); - gDropdown.items[numItems++] = Dropdown::PlainMenuLabel(STR_FILE_BUG_ON_GITHUB); - - if (OpenRCT2::GetContext()->HasNewVersionInfo()) - gDropdown.items[numItems++] = Dropdown::PlainMenuLabel(STR_UPDATE_AVAILABLE); - - gDropdown.items[numItems++] = Dropdown::PlainMenuLabel(STR_OPTIONS); - gDropdown.items[numItems++] = Dropdown::Separator(); - - if (gLegacyScene == LegacyScene::trackDesigner) - gDropdown.items[numItems++] = Dropdown::PlainMenuLabel(STR_QUIT_ROLLERCOASTER_DESIGNER); - else - gDropdown.items[numItems++] = Dropdown::PlainMenuLabel(STR_QUIT_TRACK_DESIGNS_MANAGER); - - gDropdown.items[numItems++] = Dropdown::PlainMenuLabel(STR_EXIT_OPENRCT2); - } - else if (gLegacyScene == LegacyScene::scenarioEditor) - { - gDropdown.items[numItems++] = Dropdown::PlainMenuLabel(STR_LOAD_LANDSCAPE); - gDropdown.items[numItems++] = Dropdown::Separator(); - gDropdown.items[numItems++] = Dropdown::PlainMenuLabel(STR_SAVE_LANDSCAPE); - gDropdown.items[numItems++] = Dropdown::Separator(); - gDropdown.items[numItems++] = Dropdown::PlainMenuLabel(STR_SCREENSHOT); - gDropdown.items[numItems++] = Dropdown::PlainMenuLabel(STR_GIANT_SCREENSHOT); - gDropdown.items[numItems++] = Dropdown::Separator(); - gDropdown.items[numItems++] = Dropdown::PlainMenuLabel(STR_ABOUT); - gDropdown.items[numItems++] = Dropdown::PlainMenuLabel(STR_FILE_BUG_ON_GITHUB); - - if (OpenRCT2::GetContext()->HasNewVersionInfo()) - gDropdown.items[numItems++] = Dropdown::PlainMenuLabel(STR_UPDATE_AVAILABLE); - - gDropdown.items[numItems++] = Dropdown::PlainMenuLabel(STR_OPTIONS); - gDropdown.items[numItems++] = Dropdown::Separator(); - gDropdown.items[numItems++] = Dropdown::PlainMenuLabel(STR_QUIT_SCENARIO_EDITOR); - gDropdown.items[numItems++] = Dropdown::PlainMenuLabel(STR_EXIT_OPENRCT2); - } - else - { - gDropdown.items[numItems++] = Dropdown::PlainMenuLabel(STR_NEW_GAME); - gDropdown.items[numItems++] = Dropdown::PlainMenuLabel(STR_LOAD_GAME); - gDropdown.items[numItems++] = Dropdown::Separator(); - gDropdown.items[numItems++] = Dropdown::PlainMenuLabel(STR_SAVE_GAME); - gDropdown.items[numItems++] = Dropdown::PlainMenuLabel(STR_SAVE_GAME_AS); - gDropdown.items[numItems++] = Dropdown::Separator(); - gDropdown.items[numItems++] = Dropdown::PlainMenuLabel(STR_SCREENSHOT); - gDropdown.items[numItems++] = Dropdown::PlainMenuLabel(STR_GIANT_SCREENSHOT); - gDropdown.items[numItems++] = Dropdown::Separator(); - gDropdown.items[numItems++] = Dropdown::PlainMenuLabel(STR_ABOUT); - gDropdown.items[numItems++] = Dropdown::PlainMenuLabel(STR_FILE_BUG_ON_GITHUB); - - if (OpenRCT2::GetContext()->HasNewVersionInfo()) - gDropdown.items[numItems++] = Dropdown::PlainMenuLabel(STR_UPDATE_AVAILABLE); - - gDropdown.items[numItems++] = Dropdown::PlainMenuLabel(STR_OPTIONS); - gDropdown.items[numItems++] = Dropdown::Separator(); - gDropdown.items[numItems++] = Dropdown::PlainMenuLabel(STR_QUIT_TO_MENU); - gDropdown.items[numItems++] = Dropdown::PlainMenuLabel(STR_EXIT_OPENRCT2); - } - - WindowDropdownShowText( - { windowPos.x + widget.left, windowPos.y + widget.top }, widget.height() + 1, - colours[0].withFlag(ColourFlag::translucent, true), Dropdown::Flag::StayOpen, numItems); - } - - void TopToolbar::InitCheatsMenu(Widget& widget) - { - using namespace Dropdown; - - constexpr ItemExt items[] = { - ToggleOption(DDIDX_CHEATS, STR_CHEAT_TITLE), - ToggleOption(DDIDX_TILE_INSPECTOR, STR_DEBUG_DROPDOWN_TILE_INSPECTOR), - ToggleOption(DDIDX_OBJECT_SELECTION, STR_DEBUG_DROPDOWN_OBJECT_SELECTION), - ToggleOption(DDIDX_INVENTIONS_LIST, STR_DEBUG_DROPDOWN_INVENTIONS_LIST), - ToggleOption(DDIDX_SCENARIO_OPTIONS, STR_DEBUG_DROPDOWN_SCENARIO_OPTIONS), - ExtSeparator(), - ToggleOption(DDIDX_ENABLE_SANDBOX_MODE, STR_ENABLE_SANDBOX_MODE), - ToggleOption(DDIDX_DISABLE_CLEARANCE_CHECKS, STR_DISABLE_CLEARANCE_CHECKS), - ToggleOption(DDIDX_DISABLE_SUPPORT_LIMITS, STR_DISABLE_SUPPORT_LIMITS), - }; - static_assert(ItemIDsMatchIndices(items)); - - SetItems(items); - - WindowDropdownShowText( - { windowPos.x + widget.left, windowPos.y + widget.top }, widget.height() + 1, - colours[0].withFlag(ColourFlag::translucent, true), Dropdown::Flag::StayOpen, TOP_TOOLBAR_CHEATS_COUNT); - - // Disable items that are not yet available in multiplayer - if (Network::GetMode() != Network::Mode::none) - { - gDropdown.items[DDIDX_OBJECT_SELECTION].setDisabled(true); - gDropdown.items[DDIDX_INVENTIONS_LIST].setDisabled(true); - } - - if (isInEditorMode()) - { - gDropdown.items[DDIDX_OBJECT_SELECTION].setDisabled(true); - gDropdown.items[DDIDX_INVENTIONS_LIST].setDisabled(true); - gDropdown.items[DDIDX_SCENARIO_OPTIONS].setDisabled(true); - gDropdown.items[DDIDX_ENABLE_SANDBOX_MODE].setDisabled(true); - } - - auto& gameState = getGameState(); - if (gameState.cheats.sandboxMode) - { - gDropdown.items[DDIDX_ENABLE_SANDBOX_MODE].setChecked(true); - } - if (gameState.cheats.disableClearanceChecks) - { - gDropdown.items[DDIDX_DISABLE_CLEARANCE_CHECKS].setChecked(true); - } - if (gameState.cheats.disableSupportLimits) - { - gDropdown.items[DDIDX_DISABLE_SUPPORT_LIMITS].setChecked(true); - } - - gDropdown.defaultIndex = DDIDX_CHEATS; - } - - void TopToolbar::CheatsMenuDropdown(int16_t dropdownIndex) - { - switch (dropdownIndex) - { - case DDIDX_CHEATS: - ContextOpenWindow(WindowClass::Cheats); - break; - case DDIDX_TILE_INSPECTOR: - ContextOpenWindow(WindowClass::TileInspector); - break; - case DDIDX_OBJECT_SELECTION: - { - auto* windowMgr = Ui::GetWindowManager(); - windowMgr->CloseAll(); - ContextOpenWindow(WindowClass::EditorObjectSelection); - break; - } - case DDIDX_INVENTIONS_LIST: - ContextOpenWindow(WindowClass::EditorInventionList); - break; - case DDIDX_SCENARIO_OPTIONS: - ContextOpenWindow(WindowClass::EditorScenarioOptions); - break; - case DDIDX_ENABLE_SANDBOX_MODE: - CheatsSet(CheatType::SandboxMode, !getGameState().cheats.sandboxMode); - break; - case DDIDX_DISABLE_CLEARANCE_CHECKS: - CheatsSet(CheatType::DisableClearanceChecks, !getGameState().cheats.disableClearanceChecks); - break; - case DDIDX_DISABLE_SUPPORT_LIMITS: - CheatsSet(CheatType::DisableSupportLimits, !getGameState().cheats.disableSupportLimits); - break; - } - } - - void TopToolbar::InitDebugMenu(Widget& widget) - { - gDropdown.items[DDIDX_CONSOLE] = Dropdown::ToggleOption(STR_DEBUG_DROPDOWN_CONSOLE); - gDropdown.items[DDIDX_DEBUG_PAINT] = Dropdown::ToggleOption(STR_DEBUG_DROPDOWN_DEBUG_PAINT); - - WindowDropdownShowText( - { windowPos.x + widget.left, windowPos.y + widget.top }, widget.height() + 1, - colours[0].withFlag(ColourFlag::translucent, true), Dropdown::Flag::StayOpen, TOP_TOOLBAR_DEBUG_COUNT); - - auto* windowMgr = GetWindowManager(); - gDropdown.items[DDIDX_CONSOLE].setChecked(windowMgr->FindByClass(WindowClass::Console) != nullptr); - gDropdown.items[DDIDX_DEBUG_PAINT].setChecked(windowMgr->FindByClass(WindowClass::DebugPaint) != nullptr); - } - - void TopToolbar::DebugMenuDropdown(int16_t dropdownIndex) - { - auto* w = WindowGetMain(); - if (w != nullptr) - { - switch (dropdownIndex) - { - case DDIDX_CONSOLE: - { - auto& console = GetInGameConsole(); - console.Open(); - break; - } - case DDIDX_DEBUG_PAINT: - { - auto* windowMgr = GetWindowManager(); - if (windowMgr->FindByClass(WindowClass::DebugPaint) == nullptr) - { - ContextOpenWindow(WindowClass::DebugPaint); - } - else - { - windowMgr->CloseByClass(WindowClass::DebugPaint); - } - break; - } - } - } - } - - void TopToolbar::InitNetworkMenu(Widget& widget) - { - gDropdown.items[DDIDX_MULTIPLAYER] = Dropdown::PlainMenuLabel(STR_MULTIPLAYER); - gDropdown.items[DDIDX_MULTIPLAYER_RECONNECT] = Dropdown::PlainMenuLabel(STR_MULTIPLAYER_RECONNECT); - - WindowDropdownShowText( - { windowPos.x + widget.left, windowPos.y + widget.top }, widget.height() + 1, - colours[0].withFlag(ColourFlag::translucent, true), 0, TOP_TOOLBAR_NETWORK_COUNT); - - gDropdown.items[DDIDX_MULTIPLAYER_RECONNECT].setDisabled(!Network::IsDesynchronised()); - - gDropdown.defaultIndex = DDIDX_MULTIPLAYER; - } - - void TopToolbar::NetworkMenuDropdown(int16_t dropdownIndex) - { - auto* w = WindowGetMain(); - if (w != nullptr) - { - switch (dropdownIndex) - { - case DDIDX_MULTIPLAYER: - ContextOpenWindow(WindowClass::Multiplayer); - break; - case DDIDX_MULTIPLAYER_RECONNECT: - Network::Reconnect(); - break; - } - } - } } // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/TrackDesignManage.cpp b/src/openrct2-ui/windows/TrackDesignManage.cpp index 58da1e9daf..d7fc6cbe0f 100644 --- a/src/openrct2-ui/windows/TrackDesignManage.cpp +++ b/src/openrct2-ui/windows/TrackDesignManage.cpp @@ -54,6 +54,8 @@ namespace OpenRCT2::Ui::Windows #pragma endregion + static void WindowTrackDeletePromptOpen(TrackDesignFileRef* tdFileRef); + class TrackDesignManageWindow final : public Window { private: @@ -65,11 +67,77 @@ namespace OpenRCT2::Ui::Windows { } - void OnOpen() override; - void OnClose() override; - void OnMouseUp(WidgetIndex widgetIndex) override; - void OnTextInput(WidgetIndex widgetIndex, std::string_view text) override; - void OnDraw(RenderTarget& rt) override; + void onOpen() override + { + setWidgets(_trackManageWidgets); + WindowInitScrollWidgets(*this); + + WindowTrackDesignListSetBeingUpdated(true); + } + + void onClose() override + { + WindowTrackDesignListSetBeingUpdated(false); + } + + void onMouseUp(WidgetIndex widgetIndex) override + { + switch (widgetIndex) + { + case WIDX_CLOSE: + { + auto* windowMgr = Ui::GetWindowManager(); + windowMgr->CloseByClass(WindowClass::TrackDeletePrompt); + close(); + break; + } + case WIDX_RENAME: + WindowTextInputRawOpen( + this, widgetIndex, STR_TRACK_DESIGN_RENAME_TITLE, STR_TRACK_DESIGN_RENAME_DESC, {}, + _trackDesignFileReference->name.c_str(), kTrackDesignNameMaxLength); + break; + case WIDX_DELETE: + WindowTrackDeletePromptOpen(_trackDesignFileReference); + break; + } + } + + void onTextInput(WidgetIndex widgetIndex, std::string_view text) override + { + if (widgetIndex != WIDX_RENAME) + { + return; + } + else if (text.empty()) + { + ContextShowError(STR_CANT_RENAME_TRACK_DESIGN, kStringIdNone, {}); + return; + } + else if (!Platform::IsFilenameValid(text)) + { + ContextShowError(STR_CANT_RENAME_TRACK_DESIGN, STR_NEW_NAME_CONTAINS_INVALID_CHARACTERS, {}); + return; + } + + if (TrackRepositoryRename(_trackDesignFileReference->path, std::string(text))) + { + auto* windowMgr = Ui::GetWindowManager(); + windowMgr->CloseByClass(WindowClass::TrackDeletePrompt); + close(); + WindowTrackDesignListReloadTracks(); + } + else + { + ContextShowError( + STR_CANT_RENAME_TRACK_DESIGN, STR_ANOTHER_FILE_EXISTS_WITH_NAME_OR_FILE_IS_WRITE_PROTECTED, {}); + } + } + + void onDraw(RenderTarget& rt) override + { + Formatter::Common().Add(_trackDesignFileReference->name.c_str()); + drawWidgets(rt); + } }; class TrackDeletePromptWindow final : public Window @@ -83,13 +151,56 @@ namespace OpenRCT2::Ui::Windows { } - void OnOpen() override; - void OnMouseUp(WidgetIndex widgetIndex) override; - void OnDraw(RenderTarget& rt) override; + void onOpen() override + { + setWidgets(_trackDeletePromptWidgets); + WindowInitScrollWidgets(*this); + } + + void onMouseUp(WidgetIndex widgetIndex) override + { + switch (widgetIndex) + { + case WIDX_CLOSE: + case WIDX_PROMPT_CANCEL: + close(); + break; + case WIDX_PROMPT_DELETE: + // tdPath has to be saved before window is closed, as that would blank it out. + auto tdPath = _trackDesignFileReference->path; + close(); + if (TrackRepositoryDelete(tdPath)) + { + auto* windowMgr = Ui::GetWindowManager(); + windowMgr->CloseByClass(WindowClass::ManageTrackDesign); + WindowTrackDesignListReloadTracks(); + } + else + { + ContextShowError(STR_CANT_DELETE_TRACK_DESIGN, STR_FILE_IS_WRITE_PROTECTED_OR_LOCKED, {}); + } + break; + } + } + + void onDraw(RenderTarget& rt) override + { + drawWidgets(rt); + + const auto titleBarBottom = widgets[WIDX_TITLE].bottom; + const auto buttonTop = widgets[WIDX_PROMPT_DELETE].top; + const auto fontHeight = FontGetLineHeight(FontStyle::Medium); + + const auto maxMessageHeight = buttonTop - titleBarBottom; + const auto messageTop = titleBarBottom + (maxMessageHeight - fontHeight) / 2; + + auto ft = Formatter(); + ft.Add(_trackDesignFileReference->name.c_str()); + DrawTextWrapped( + rt, windowPos + ScreenCoordsXY{ width / 2, messageTop }, (width - 4), + STR_ARE_YOU_SURE_YOU_WANT_TO_PERMANENTLY_DELETE_TRACK, ft, { TextAlignment::CENTRE }); + } }; - - static void WindowTrackDeletePromptOpen(TrackDesignFileRef* tdFileRef); - /** * * rct2: 0x006D348F @@ -107,77 +218,6 @@ namespace OpenRCT2::Ui::Windows return window; } - void TrackDesignManageWindow::OnOpen() - { - SetWidgets(_trackManageWidgets); - WindowInitScrollWidgets(*this); - - WindowTrackDesignListSetBeingUpdated(true); - } - - void TrackDesignManageWindow::OnClose() - { - WindowTrackDesignListSetBeingUpdated(false); - } - - void TrackDesignManageWindow::OnMouseUp(WidgetIndex widgetIndex) - { - switch (widgetIndex) - { - case WIDX_CLOSE: - { - auto* windowMgr = Ui::GetWindowManager(); - windowMgr->CloseByClass(WindowClass::TrackDeletePrompt); - Close(); - break; - } - case WIDX_RENAME: - WindowTextInputRawOpen( - this, widgetIndex, STR_TRACK_DESIGN_RENAME_TITLE, STR_TRACK_DESIGN_RENAME_DESC, {}, - _trackDesignFileReference->name.c_str(), kTrackDesignNameMaxLength); - break; - case WIDX_DELETE: - WindowTrackDeletePromptOpen(_trackDesignFileReference); - break; - } - } - - void TrackDesignManageWindow::OnTextInput(WidgetIndex widgetIndex, std::string_view text) - { - if (widgetIndex != WIDX_RENAME) - { - return; - } - else if (text.empty()) - { - ContextShowError(STR_CANT_RENAME_TRACK_DESIGN, kStringIdNone, {}); - return; - } - else if (!Platform::IsFilenameValid(text)) - { - ContextShowError(STR_CANT_RENAME_TRACK_DESIGN, STR_NEW_NAME_CONTAINS_INVALID_CHARACTERS, {}); - return; - } - - if (TrackRepositoryRename(_trackDesignFileReference->path, std::string(text))) - { - auto* windowMgr = Ui::GetWindowManager(); - windowMgr->CloseByClass(WindowClass::TrackDeletePrompt); - Close(); - WindowTrackDesignListReloadTracks(); - } - else - { - ContextShowError(STR_CANT_RENAME_TRACK_DESIGN, STR_ANOTHER_FILE_EXISTS_WITH_NAME_OR_FILE_IS_WRITE_PROTECTED, {}); - } - } - - void TrackDesignManageWindow::OnDraw(RenderTarget& rt) - { - Formatter::Common().Add(_trackDesignFileReference->name.c_str()); - DrawWidgets(rt); - } - /** * * rct2: 0x006D35CD @@ -193,54 +233,4 @@ namespace OpenRCT2::Ui::Windows std::move(trackDeletePromptWindow), WindowClass::TrackDeletePrompt, {}, kWindowSizeDeletePrompt, WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_AUTO_POSITION | WF_CENTRE_SCREEN); } - - void TrackDeletePromptWindow::OnOpen() - { - SetWidgets(_trackDeletePromptWidgets); - WindowInitScrollWidgets(*this); - } - - void TrackDeletePromptWindow::OnMouseUp(WidgetIndex widgetIndex) - { - switch (widgetIndex) - { - case WIDX_CLOSE: - case WIDX_PROMPT_CANCEL: - Close(); - break; - case WIDX_PROMPT_DELETE: - // tdPath has to be saved before window is closed, as that would blank it out. - auto tdPath = _trackDesignFileReference->path; - Close(); - if (TrackRepositoryDelete(tdPath)) - { - auto* windowMgr = Ui::GetWindowManager(); - windowMgr->CloseByClass(WindowClass::ManageTrackDesign); - WindowTrackDesignListReloadTracks(); - } - else - { - ContextShowError(STR_CANT_DELETE_TRACK_DESIGN, STR_FILE_IS_WRITE_PROTECTED_OR_LOCKED, {}); - } - break; - } - } - - void TrackDeletePromptWindow::OnDraw(RenderTarget& rt) - { - DrawWidgets(rt); - - const auto titleBarBottom = widgets[WIDX_TITLE].bottom; - const auto buttonTop = widgets[WIDX_PROMPT_DELETE].top; - const auto fontHeight = FontGetLineHeight(FontStyle::Medium); - - const auto maxMessageHeight = buttonTop - titleBarBottom; - const auto messageTop = titleBarBottom + (maxMessageHeight - fontHeight) / 2; - - auto ft = Formatter(); - ft.Add(_trackDesignFileReference->name.c_str()); - DrawTextWrapped( - rt, windowPos + ScreenCoordsXY{ width / 2, messageTop }, (width - 4), - STR_ARE_YOU_SURE_YOU_WANT_TO_PERMANENTLY_DELETE_TRACK, ft, { TextAlignment::CENTRE }); - } } // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/TrackDesignPlace.cpp b/src/openrct2-ui/windows/TrackDesignPlace.cpp index 8bedbc00a4..7d1c076e2b 100644 --- a/src/openrct2-ui/windows/TrackDesignPlace.cpp +++ b/src/openrct2-ui/windows/TrackDesignPlace.cpp @@ -100,9 +100,9 @@ namespace OpenRCT2::Ui::Windows int32_t _trackPlaceZ; public: - void OnOpen() override + void onOpen() override { - SetWidgets(_trackPlaceWidgets); + setWidgets(_trackPlaceWidgets); WindowInitScrollWidgets(*this); ToolSet(*this, WIDX_PRICE, Tool::crosshair); gInputFlags.set(InputFlag::unk6); @@ -114,7 +114,7 @@ namespace OpenRCT2::Ui::Windows _currentTrackPieceDirection = (2 - GetCurrentRotation()) & 3; } - void OnClose() override + void onClose() override { ClearProvisional(); ViewportSetVisibility(ViewportVisibility::standard); @@ -127,29 +127,29 @@ namespace OpenRCT2::Ui::Windows _trackDesign = nullptr; } - void OnMouseUp(WidgetIndex widgetIndex) override + void onMouseUp(WidgetIndex widgetIndex) override { switch (widgetIndex) { case WIDX_CLOSE: - Close(); + close(); break; case WIDX_ROTATE: ClearProvisional(); _currentTrackPieceDirection = (_currentTrackPieceDirection + 1) & 3; - Invalidate(); + invalidate(); _placementLoc.SetNull(); DrawMiniPreview(*_trackDesign); break; case WIDX_MIRROR: TrackDesignMirror(*_trackDesign); _currentTrackPieceDirection = (0 - _currentTrackPieceDirection) & 3; - Invalidate(); + invalidate(); _placementLoc.SetNull(); DrawMiniPreview(*_trackDesign); break; case WIDX_SELECT_DIFFERENT_DESIGN: - Close(); + close(); auto intent = Intent(WindowClass::TrackDesignList); intent.PutExtra(INTENT_EXTRA_RIDE_TYPE, _window_track_list_item.Type); @@ -159,13 +159,13 @@ namespace OpenRCT2::Ui::Windows } } - void OnUpdate() override + void onUpdate() override { if (!isToolActive(WindowClass::TrackDesignPlace)) - Close(); + close(); } - void OnToolUpdate(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override + void onToolUpdate(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override { TrackDesignState tds{}; @@ -236,13 +236,13 @@ namespace OpenRCT2::Ui::Windows if (cost != _placementCost) { _placementCost = cost; - InvalidateWidget(WIDX_PRICE); + invalidateWidget(WIDX_PRICE); } TrackDesignPreviewDrawOutlines(tds, *_trackDesign, RideGetTemporaryForPreview(), trackLoc); } - void OnToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override + void onToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override { ClearProvisional(); MapInvalidateMapSelectionTiles(); @@ -314,29 +314,29 @@ namespace OpenRCT2::Ui::Windows { RideInitialiseConstructionWindow(*getRide); auto* wnd = windowMgr->FindByClass(WindowClass::RideConstruction); - wnd->OnMouseUp(WC_RIDE_CONSTRUCTION__WIDX_ENTRANCE); + wnd->onMouseUp(WC_RIDE_CONSTRUCTION__WIDX_ENTRANCE); } } }); GameActions::Execute(&tdAction, getGameState()); } - void OnToolAbort(WidgetIndex widgetIndex) override + void onToolAbort(WidgetIndex widgetIndex) override { ClearProvisional(); } - void OnViewportRotate() override + void onViewportRotate() override { DrawMiniPreview(*_trackDesign); } - void OnPrepareDraw() override + void onPrepareDraw() override { DrawMiniPreview(*_trackDesign); } - void OnDraw(RenderTarget& rt) override + void onDraw(RenderTarget& rt) override { auto ft = Formatter::Common(); ft.Add(_trackDesign->gameStateData.name.c_str()); @@ -390,7 +390,7 @@ namespace OpenRCT2::Ui::Windows } } - void Init(std::unique_ptr&& trackDesign) + void init(std::unique_ptr&& trackDesign) { _trackDesign = std::move(trackDesign); } @@ -736,7 +736,7 @@ namespace OpenRCT2::Ui::Windows auto* window = windowMgr->FocusOrCreate(WindowClass::TrackDesignPlace, kWindowSize, 0); if (window != nullptr) { - window->Init(std::move(openTrackDesign)); + window->init(std::move(openTrackDesign)); } return window; } diff --git a/src/openrct2-ui/windows/TrackList.cpp b/src/openrct2-ui/windows/TrackList.cpp index 8640856008..09de9e532d 100644 --- a/src/openrct2-ui/windows/TrackList.cpp +++ b/src/openrct2-ui/windows/TrackList.cpp @@ -122,7 +122,7 @@ namespace OpenRCT2::Ui::Windows { if (listIndex == 0) { - Close(); + close(); RideConstructNew(_window_track_list_item); return; } @@ -213,10 +213,10 @@ namespace OpenRCT2::Ui::Windows _window_track_list_item = item; } - void OnOpen() override + void onOpen() override { String::set(_filterString, sizeof(_filterString), ""); - SetWidgets(_trackListWidgets); + setWidgets(_trackListWidgets); widgets[WIDX_FILTER_STRING].string = _filterString; LoadDesignsList(_window_track_list_item); @@ -247,7 +247,7 @@ namespace OpenRCT2::Ui::Windows Editor::LoadTrackManager(); } - void OnClose() override + void onClose() override { // Dispose track design and preview _loadedTrackDesign = nullptr; @@ -268,25 +268,25 @@ namespace OpenRCT2::Ui::Windows } } - void OnMouseUp(const WidgetIndex widgetIndex) override + void onMouseUp(const WidgetIndex widgetIndex) override { switch (widgetIndex) { case WIDX_CLOSE: - Close(); + close(); break; case WIDX_ROTATE: _currentTrackPieceDirection++; _currentTrackPieceDirection %= 4; - Invalidate(); + invalidate(); break; case WIDX_TOGGLE_SCENERY: gTrackDesignSceneryToggle = !gTrackDesignSceneryToggle; _loadedTrackDesignIndex = kTrackDesignIndexUnloaded; - Invalidate(); + invalidate(); break; case WIDX_BACK: - Close(); + close(); if (!(gLegacyScene == LegacyScene::trackDesignsManager)) { ContextOpenWindow(WindowClass::ConstructRide); @@ -316,12 +316,12 @@ namespace OpenRCT2::Ui::Windows String::set(_filterString, sizeof(_filterString), ""); FilterList(); - Invalidate(); + invalidate(); break; } } - ScreenSize OnScrollGetSize(const int32_t scrollIndex) override + ScreenSize onScrollGetSize(const int32_t scrollIndex) override { size_t numItems = _filteredTrackIds.size(); if (!(gLegacyScene == LegacyScene::trackDesignsManager)) @@ -334,7 +334,7 @@ namespace OpenRCT2::Ui::Windows return { width, scrollHeight }; } - void OnScrollMouseDown(const int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override + void onScrollMouseDown(const int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override { if (!_selectedItemIsBeingUpdated) { @@ -346,7 +346,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnScrollMouseOver(const int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override + void onScrollMouseOver(const int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override { if (!_selectedItemIsBeingUpdated) { @@ -354,12 +354,12 @@ namespace OpenRCT2::Ui::Windows if (i != -1 && selectedListItem != i) { selectedListItem = i; - Invalidate(); + invalidate(); } } } - void OnTextInput(const WidgetIndex widgetIndex, std::string_view text) override + void onTextInput(const WidgetIndex widgetIndex, std::string_view text) override { if (widgetIndex != WIDX_FILTER_STRING) return; @@ -373,10 +373,10 @@ namespace OpenRCT2::Ui::Windows scrolls->contentOffsetY = 0; - Invalidate(); + invalidate(); } - void OnPrepareDraw() override + void onPrepareDraw() override { StringId stringId = kStringIdNone; const auto* entry = GetRideEntryByIndex(_window_track_list_item.EntryIndex); @@ -432,26 +432,26 @@ namespace OpenRCT2::Ui::Windows widgets[WIDX_TOGGLE_SCENERY].top = widgets[WIDX_TOGGLE_SCENERY].bottom - kRotateAndSceneryButtonSize; } - void OnUpdate() override + void onUpdate() override { if (GetCurrentTextBox().window.classification == classification && GetCurrentTextBox().window.number == number) { WindowUpdateTextboxCaret(); - InvalidateWidget(WIDX_FILTER_STRING); // TODO Check this + invalidateWidget(WIDX_FILTER_STRING); // TODO Check this } if (_reloadTrackDesigns) { LoadDesignsList(_window_track_list_item); selectedListItem = 0; - Invalidate(); + invalidate(); _reloadTrackDesigns = false; } } - void OnDraw(RenderTarget& rt) override + void onDraw(RenderTarget& rt) override { - DrawWidgets(rt); + drawWidgets(rt); int32_t listItemIndex = selectedListItem; if ((gLegacyScene == LegacyScene::trackDesignsManager) == 0) @@ -670,7 +670,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnScrollDraw(const int32_t scrollIndex, RenderTarget& rt) override + void onScrollDraw(const int32_t scrollIndex, RenderTarget& rt) override { uint8_t paletteIndex = ColourMapA[colours[0].colour].mid_light; GfxClear(rt, paletteIndex); diff --git a/src/openrct2-ui/windows/Transparency.cpp b/src/openrct2-ui/windows/Transparency.cpp index aebabb98e8..fbbfc9cca0 100644 --- a/src/openrct2-ui/windows/Transparency.cpp +++ b/src/openrct2-ui/windows/Transparency.cpp @@ -86,9 +86,9 @@ namespace OpenRCT2::Ui::Windows { private: public: - void OnOpen() override + void onOpen() override { - SetWidgets(_transparancyWidgets); + setWidgets(_transparancyWidgets); WindowPushOthersBelow(*this); auto* w = WindowGetMain(); @@ -96,12 +96,12 @@ namespace OpenRCT2::Ui::Windows windowPos.x = ((w->width / 2) - (width / 2)); } - void OnMouseUp(WidgetIndex widgetIndex) override + void onMouseUp(WidgetIndex widgetIndex) override { switch (widgetIndex) { case WIDX_CLOSE: - Close(); + close(); break; default: ToggleViewportFlag(widgetIndex); @@ -109,7 +109,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnPrepareDraw() override + void onPrepareDraw() override { uint32_t wflags = 0; WindowBase* w = WindowGetMain(); @@ -120,30 +120,30 @@ namespace OpenRCT2::Ui::Windows if (w != nullptr) wflags = w->viewport->flags; - SetWidgetPressed(WIDX_HIDE_VEGETATION, (wflags & VIEWPORT_FLAG_HIDE_VEGETATION)); - SetWidgetPressed(WIDX_HIDE_SCENERY, (wflags & VIEWPORT_FLAG_HIDE_SCENERY)); - SetWidgetPressed(WIDX_HIDE_PATHS, (wflags & VIEWPORT_FLAG_HIDE_PATHS)); - SetWidgetPressed(WIDX_HIDE_RIDES, (wflags & VIEWPORT_FLAG_HIDE_RIDES)); - SetWidgetPressed(WIDX_HIDE_VEHICLES, (wflags & VIEWPORT_FLAG_HIDE_VEHICLES)); - SetWidgetPressed(WIDX_HIDE_SUPPORTS, (wflags & VIEWPORT_FLAG_HIDE_SUPPORTS)); - SetWidgetPressed(WIDX_HIDE_GUESTS, (wflags & VIEWPORT_FLAG_HIDE_GUESTS)); - SetWidgetPressed(WIDX_HIDE_STAFF, (wflags & VIEWPORT_FLAG_HIDE_STAFF)); - SetWidgetPressed(WIDX_INVISIBLE_VEGETATION, (wflags & VIEWPORT_FLAG_INVISIBLE_VEGETATION)); - SetWidgetPressed(WIDX_INVISIBLE_SCENERY, (wflags & VIEWPORT_FLAG_INVISIBLE_SCENERY)); - SetWidgetPressed(WIDX_INVISIBLE_PATHS, (wflags & VIEWPORT_FLAG_INVISIBLE_PATHS)); - SetWidgetPressed(WIDX_INVISIBLE_RIDES, (wflags & VIEWPORT_FLAG_INVISIBLE_RIDES)); - SetWidgetPressed(WIDX_INVISIBLE_VEHICLES, (wflags & VIEWPORT_FLAG_INVISIBLE_VEHICLES)); - SetWidgetPressed(WIDX_INVISIBLE_SUPPORTS, (wflags & VIEWPORT_FLAG_INVISIBLE_SUPPORTS)); + setWidgetPressed(WIDX_HIDE_VEGETATION, (wflags & VIEWPORT_FLAG_HIDE_VEGETATION)); + setWidgetPressed(WIDX_HIDE_SCENERY, (wflags & VIEWPORT_FLAG_HIDE_SCENERY)); + setWidgetPressed(WIDX_HIDE_PATHS, (wflags & VIEWPORT_FLAG_HIDE_PATHS)); + setWidgetPressed(WIDX_HIDE_RIDES, (wflags & VIEWPORT_FLAG_HIDE_RIDES)); + setWidgetPressed(WIDX_HIDE_VEHICLES, (wflags & VIEWPORT_FLAG_HIDE_VEHICLES)); + setWidgetPressed(WIDX_HIDE_SUPPORTS, (wflags & VIEWPORT_FLAG_HIDE_SUPPORTS)); + setWidgetPressed(WIDX_HIDE_GUESTS, (wflags & VIEWPORT_FLAG_HIDE_GUESTS)); + setWidgetPressed(WIDX_HIDE_STAFF, (wflags & VIEWPORT_FLAG_HIDE_STAFF)); + setWidgetPressed(WIDX_INVISIBLE_VEGETATION, (wflags & VIEWPORT_FLAG_INVISIBLE_VEGETATION)); + setWidgetPressed(WIDX_INVISIBLE_SCENERY, (wflags & VIEWPORT_FLAG_INVISIBLE_SCENERY)); + setWidgetPressed(WIDX_INVISIBLE_PATHS, (wflags & VIEWPORT_FLAG_INVISIBLE_PATHS)); + setWidgetPressed(WIDX_INVISIBLE_RIDES, (wflags & VIEWPORT_FLAG_INVISIBLE_RIDES)); + setWidgetPressed(WIDX_INVISIBLE_VEHICLES, (wflags & VIEWPORT_FLAG_INVISIBLE_VEHICLES)); + setWidgetPressed(WIDX_INVISIBLE_SUPPORTS, (wflags & VIEWPORT_FLAG_INVISIBLE_SUPPORTS)); for (WidgetIndex i = WIDX_INVISIBLE_VEGETATION; i <= WIDX_INVISIBLE_SUPPORTS; i++) { - widgets[i].image = ImageId(IsWidgetPressed(i) ? SPR_G2_BUTTON_HIDE_FULL : SPR_G2_BUTTON_HIDE_PARTIAL); + widgets[i].image = ImageId(isWidgetPressed(i) ? SPR_G2_BUTTON_HIDE_FULL : SPR_G2_BUTTON_HIDE_PARTIAL); } } - void OnDraw(RenderTarget& rt) override + void onDraw(RenderTarget& rt) override { - DrawWidgets(rt); + drawWidgets(rt); // Locate mechanic button image const auto& widget = widgets[WIDX_HIDE_STAFF]; auto screenCoords = windowPos + ScreenCoordsXY{ widget.left, widget.top }; @@ -225,7 +225,7 @@ namespace OpenRCT2::Ui::Windows return; w->viewport->flags = wflags; - w->Invalidate(); + w->invalidate(); } void SaveInConfig(uint32_t wflags) diff --git a/src/openrct2-ui/windows/ViewClipping.cpp b/src/openrct2-ui/windows/ViewClipping.cpp index 17aeddcbfc..93becbbee3 100644 --- a/src/openrct2-ui/windows/ViewClipping.cpp +++ b/src/openrct2-ui/windows/ViewClipping.cpp @@ -80,18 +80,18 @@ namespace OpenRCT2::Ui::Windows static inline DisplayType _clipHeightDisplayType; public: - void OnCloseButton() + void onCloseButton() { - OnClose(); + onClose(); } - void OnMouseUp(WidgetIndex widgetIndex) override + void onMouseUp(WidgetIndex widgetIndex) override { // mouseup appears to be used for buttons, checkboxes switch (widgetIndex) { case WIDX_CLOSE: - Close(); + close(); break; case WIDX_CLIP_CHECKBOX_ENABLE: { @@ -100,9 +100,9 @@ namespace OpenRCT2::Ui::Windows if (mainWindow != nullptr) { mainWindow->viewport->flags ^= VIEWPORT_FLAG_CLIP_VIEW; - mainWindow->Invalidate(); + mainWindow->invalidate(); } - this->Invalidate(); + this->invalidate(); break; } case WIDX_CLIP_HEIGHT_VALUE: @@ -115,7 +115,7 @@ namespace OpenRCT2::Ui::Windows { _clipHeightDisplayType = DisplayType::DisplayRaw; } - this->Invalidate(); + this->invalidate(); break; case WIDX_CLIP_SELECTOR: // Activate the selection tool @@ -146,15 +146,15 @@ namespace OpenRCT2::Ui::Windows if (auto mainWindow = WindowGetMain(); mainWindow != nullptr) { mainWindow->viewport->flags ^= VIEWPORT_FLAG_CLIP_VIEW_SEE_THROUGH; - mainWindow->Invalidate(); + mainWindow->invalidate(); } - Invalidate(); + invalidate(); break; } } } - void OnMouseDown(WidgetIndex widgetIndex) override + void onMouseDown(WidgetIndex widgetIndex) override { WindowBase* mainWindow; @@ -165,19 +165,19 @@ namespace OpenRCT2::Ui::Windows SetClipHeight(gClipHeight + 1); mainWindow = WindowGetMain(); if (mainWindow != nullptr) - mainWindow->Invalidate(); + mainWindow->invalidate(); break; case WIDX_CLIP_HEIGHT_DECREASE: if (gClipHeight > 0) SetClipHeight(gClipHeight - 1); mainWindow = WindowGetMain(); if (mainWindow != nullptr) - mainWindow->Invalidate(); + mainWindow->invalidate(); break; } } - void OnUpdate() override + void onUpdate() override { const auto& widget = widgets[WIDX_CLIP_HEIGHT_SLIDER]; const ScrollArea* const scroll = &this->scrolls[0]; @@ -192,7 +192,7 @@ namespace OpenRCT2::Ui::Windows WindowBase* mainWindow = WindowGetMain(); if (mainWindow != nullptr) { - mainWindow->Invalidate(); + mainWindow->invalidate(); } } @@ -204,10 +204,10 @@ namespace OpenRCT2::Ui::Windows gClipSelectionB = _previousClipSelectionB; } - InvalidateWidget(WIDX_CLIP_HEIGHT_SLIDER); + invalidateWidget(WIDX_CLIP_HEIGHT_SLIDER); } - void OnToolUpdate(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override + void onToolUpdate(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override { if (_dragging) { @@ -226,7 +226,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override + void onToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override { int32_t direction; auto mapCoords = ScreenPosToMapPos(screenCoords, &direction); @@ -237,7 +237,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnToolDrag(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override + void onToolDrag(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override { if (!_dragging) { @@ -259,7 +259,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnToolUp(WidgetIndex, const ScreenCoordsXY&) override + void onToolUp(WidgetIndex, const ScreenCoordsXY&) override { gClipSelectionA = gMapSelectPositionA; gClipSelectionB = gMapSelectPositionB; @@ -268,17 +268,16 @@ namespace OpenRCT2::Ui::Windows GfxInvalidateScreen(); } - void OnPrepareDraw() override + void onPrepareDraw() override { widgetScrollUpdateThumbs(*this, WIDX_CLIP_HEIGHT_SLIDER); WindowBase* mainWindow = WindowGetMain(); if (mainWindow != nullptr) { - widgetSetCheckboxValue(*this, WIDX_CLIP_CHECKBOX_ENABLE, mainWindow->viewport->flags & VIEWPORT_FLAG_CLIP_VIEW); - widgetSetCheckboxValue( - *this, WIDX_CLIP_SEE_THROUGH_CHECKBOX_ENABLE, - mainWindow->viewport->flags & VIEWPORT_FLAG_CLIP_VIEW_SEE_THROUGH); + setCheckboxValue(WIDX_CLIP_CHECKBOX_ENABLE, mainWindow->viewport->flags & VIEWPORT_FLAG_CLIP_VIEW); + setCheckboxValue( + WIDX_CLIP_SEE_THROUGH_CHECKBOX_ENABLE, mainWindow->viewport->flags & VIEWPORT_FLAG_CLIP_VIEW_SEE_THROUGH); } if (IsActive()) @@ -291,7 +290,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnDraw(RenderTarget& rt) override + void onDraw(RenderTarget& rt) override { WindowDrawWidgets(*this, rt); @@ -355,14 +354,14 @@ namespace OpenRCT2::Ui::Windows } } - ScreenSize OnScrollGetSize(int32_t scrollIndex) override + ScreenSize onScrollGetSize(int32_t scrollIndex) override { return { 1000, 0 }; } - void OnOpen() override + void onOpen() override { - SetWidgets(_viewClippingWidgets); + setWidgets(_viewClippingWidgets); this->holdDownWidgets = (1uLL << WIDX_CLIP_HEIGHT_INCREASE) | (1uL << WIDX_CLIP_HEIGHT_DECREASE); WindowInitScrollWidgets(*this); @@ -381,19 +380,19 @@ namespace OpenRCT2::Ui::Windows if (mainWindow != nullptr) { mainWindow->viewport->flags |= VIEWPORT_FLAG_CLIP_VIEW; - mainWindow->Invalidate(); + mainWindow->invalidate(); } } private: - void OnClose() override + void onClose() override { // Turn off view clipping when the window is closed. WindowBase* mainWindow = WindowGetMain(); if (mainWindow != nullptr) { mainWindow->viewport->flags &= ~VIEWPORT_FLAG_CLIP_VIEW; - mainWindow->Invalidate(); + mainWindow->invalidate(); } } diff --git a/src/openrct2-ui/windows/Viewport.cpp b/src/openrct2-ui/windows/Viewport.cpp index c5b7866d83..e93822007d 100644 --- a/src/openrct2-ui/windows/Viewport.cpp +++ b/src/openrct2-ui/windows/Viewport.cpp @@ -70,17 +70,17 @@ namespace OpenRCT2::Ui::Windows } public: - void OnOpen() override + void onOpen() override { GetFreeViewportNumber(); - SetWidgets(_viewportWidgets); + setWidgets(_viewportWidgets); // Create viewport ViewportCreate(*this, windowPos, width, height, Focus(TileCoordsXYZ(128, 128, 0).ToCoordsXYZ())); if (viewport == nullptr) { - Close(); + close(); ErrorOpen("Unexpected Error", "Failed to create viewport window."); return; } @@ -99,7 +99,7 @@ namespace OpenRCT2::Ui::Windows WindowSetResize(*this, kWindowSize, { (ContextGetWidth() * 4) / 5, (ContextGetHeight() * 4) / 5 }); } - void OnUpdate() override + void onUpdate() override { auto* mainWindow = WindowGetMain(); if (mainWindow == nullptr) @@ -108,16 +108,16 @@ namespace OpenRCT2::Ui::Windows if (viewport != nullptr && viewport->flags != (mainWindow->viewport->flags | VIEWPORT_FLAG_INDEPENDENT_ROTATION)) { viewport->flags = mainWindow->viewport->flags | VIEWPORT_FLAG_INDEPENDENT_ROTATION; - InvalidateWidget(WIDX_VIEWPORT); + invalidateWidget(WIDX_VIEWPORT); } } - void OnMouseUp(WidgetIndex widgetIndex) override + void onMouseUp(WidgetIndex widgetIndex) override { switch (widgetIndex) { case WIDX_CLOSE: - Close(); + close(); break; case WIDX_ZOOM_IN: { @@ -143,22 +143,22 @@ namespace OpenRCT2::Ui::Windows case WIDX_ROTATE: { ViewportRotateSingle(this, 1); - Invalidate(); + invalidate(); break; } } } - void OnDraw(RenderTarget& rt) override + void onDraw(RenderTarget& rt) override { - DrawWidgets(rt); + drawWidgets(rt); // Draw viewport if (viewport != nullptr) WindowDrawViewport(rt, *this); } - void OnResize() override + void onResize() override { int32_t screenWidth = ContextGetWidth(); int32_t screenHeight = ContextGetHeight(); @@ -172,7 +172,7 @@ namespace OpenRCT2::Ui::Windows WindowSetResize(*this, { minWidth, minHeight }, { maxWidth, maxHeight }); } - void OnPrepareDraw() override + void onPrepareDraw() override { widgets[WIDX_ZOOM_IN].left = width - 27; widgets[WIDX_ZOOM_IN].right = width - 2; diff --git a/src/openrct2-ui/windows/Water.cpp b/src/openrct2-ui/windows/Water.cpp index 977b83a24e..8606d9065b 100644 --- a/src/openrct2-ui/windows/Water.cpp +++ b/src/openrct2-ui/windows/Water.cpp @@ -55,9 +55,9 @@ namespace OpenRCT2::Ui::Windows money64 _waterToolLowerCost = kMoney64Undefined; public: - void OnOpen() override + void onOpen() override { - SetWidgets(_waterWidgets); + setWidgets(_waterWidgets); holdDownWidgets = (1uLL << WIDX_INCREMENT) | (1uLL << WIDX_DECREMENT); WindowInitScrollWidgets(*this); @@ -66,7 +66,7 @@ namespace OpenRCT2::Ui::Windows gLandToolSize = 1; } - void OnClose() override + void onClose() override { // If the tool wasn't changed, turn tool off if (isToolActive(WindowClass::Water, WIDX_BACKGROUND)) @@ -75,12 +75,12 @@ namespace OpenRCT2::Ui::Windows } } - void OnMouseUp(WidgetIndex widgetIndex) override + void onMouseUp(WidgetIndex widgetIndex) override { switch (widgetIndex) { case WIDX_CLOSE: - Close(); + close(); break; case WIDX_PREVIEW: InputSize(); @@ -88,7 +88,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnMouseDown(WidgetIndex widgetIndex) override + void onMouseDown(WidgetIndex widgetIndex) override { switch (widgetIndex) { @@ -97,28 +97,28 @@ namespace OpenRCT2::Ui::Windows gLandToolSize = std::max(kLandToolMinimumSize, gLandToolSize - 1); // Invalidate the window - Invalidate(); + invalidate(); break; case WIDX_INCREMENT: // Increment land tool size gLandToolSize = std::min(kLandToolMaximumSize, gLandToolSize + 1); // Invalidate the window - Invalidate(); + invalidate(); break; } } - void OnUpdate() override + void onUpdate() override { // Close window if another tool is open if (!isToolActive(WindowClass::Water, WIDX_BACKGROUND)) { - Close(); + close(); } } - void OnTextInput(WidgetIndex widgetIndex, std::string_view text) override + void onTextInput(WidgetIndex widgetIndex, std::string_view text) override { int32_t size; char* end; @@ -136,25 +136,25 @@ namespace OpenRCT2::Ui::Windows size = std::min(kLandToolMaximumSize, size); gLandToolSize = size; - Invalidate(); + invalidate(); } } - void OnPrepareDraw() override + void onPrepareDraw() override { // Set the preview image button to be pressed down - SetWidgetPressed(WIDX_PREVIEW, true); + setWidgetPressed(WIDX_PREVIEW, true); // Update the preview image widgets[WIDX_PREVIEW].image = ImageId(LandTool::SizeToSpriteIndex(gLandToolSize)); } - void OnDraw(RenderTarget& rt) override + void onDraw(RenderTarget& rt) override { auto screenCoords = ScreenCoordsXY{ windowPos.x + widgets[WIDX_PREVIEW].midX(), windowPos.y + widgets[WIDX_PREVIEW].midY() }; - DrawWidgets(rt); + drawWidgets(rt); // Draw number for tool sizes bigger than 7 if (gLandToolSize > kLandToolMaximumSizeWithSprite) { @@ -186,7 +186,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnToolUpdate(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override + void onToolUpdate(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override { switch (widgetIndex) { @@ -196,7 +196,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override + void onToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override { switch (widgetIndex) { @@ -209,7 +209,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnToolDrag(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override + void onToolDrag(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override { switch (widgetIndex) { @@ -219,7 +219,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnToolUp(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override + void onToolUp(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override { switch (widgetIndex) { @@ -231,7 +231,7 @@ namespace OpenRCT2::Ui::Windows } } - void OnToolAbort(WidgetIndex widgetIndex) override + void onToolAbort(WidgetIndex widgetIndex) override { switch (widgetIndex) { diff --git a/src/openrct2/Editor.cpp b/src/openrct2/Editor.cpp index 59d6954b20..f2607ae00e 100644 --- a/src/openrct2/Editor.cpp +++ b/src/openrct2/Editor.cpp @@ -119,7 +119,7 @@ namespace OpenRCT2::Editor ObjectListLoad(); ViewportInitAll(); WindowBase* mainWindow = OpenEditorWindows(); - mainWindow->SetViewportLocation(TileCoordsXYZ{ 75, 75, 14 }.ToCoordsXYZ()); + mainWindow->setViewportLocation(TileCoordsXYZ{ 75, 75, 14 }.ToCoordsXYZ()); LoadPalette(); gScreenAge = 0; gameState.scenarioOptions.name = LanguageGetString(STR_MY_NEW_SCENARIO); @@ -196,7 +196,7 @@ namespace OpenRCT2::Editor ObjectListLoad(); ViewportInitAll(); WindowBase* mainWindow = OpenEditorWindows(); - mainWindow->SetViewportLocation(TileCoordsXYZ{ 75, 75, 14 }.ToCoordsXYZ()); + mainWindow->setViewportLocation(TileCoordsXYZ{ 75, 75, 14 }.ToCoordsXYZ()); LoadPalette(); GameLoadScripts(); @@ -224,7 +224,7 @@ namespace OpenRCT2::Editor ObjectListLoad(); ViewportInitAll(); WindowBase* mainWindow = OpenEditorWindows(); - mainWindow->SetViewportLocation(TileCoordsXYZ{ 75, 75, 14 }.ToCoordsXYZ()); + mainWindow->setViewportLocation(TileCoordsXYZ{ 75, 75, 14 }.ToCoordsXYZ()); LoadPalette(); GameLoadScripts(); diff --git a/src/openrct2/entity/Guest.cpp b/src/openrct2/entity/Guest.cpp index 891a4e7789..e450430dba 100644 --- a/src/openrct2/entity/Guest.cpp +++ b/src/openrct2/entity/Guest.cpp @@ -1466,7 +1466,7 @@ void Guest::CheckCantFindRide() if (w != nullptr) { - w->OnPrepareDraw(); + w->onPrepareDraw(); } windowMgr->InvalidateByNumber(WindowClass::Peep, Id); @@ -3163,7 +3163,7 @@ static void GuestLeavePark(Guest& guest) auto* windowMgr = Ui::GetWindowManager(); WindowBase* w = windowMgr->FindByNumber(WindowClass::Peep, guest.Id); if (w != nullptr) - w->OnPrepareDraw(); + w->onPrepareDraw(); windowMgr->InvalidateByNumber(WindowClass::Peep, guest.Id); } diff --git a/src/openrct2/entity/Peep.cpp b/src/openrct2/entity/Peep.cpp index c34a52c3b0..a5899e408b 100644 --- a/src/openrct2/entity/Peep.cpp +++ b/src/openrct2/entity/Peep.cpp @@ -573,7 +573,7 @@ void PeepWindowStateUpdate(Peep* peep) auto* windowMgr = Ui::GetWindowManager(); WindowBase* w = windowMgr->FindByNumber(WindowClass::Peep, peep->Id.ToUnderlying()); if (w != nullptr) - w->OnPrepareDraw(); + w->onPrepareDraw(); if (peep->Is()) { diff --git a/src/openrct2/interface/InteractiveConsole.cpp b/src/openrct2/interface/InteractiveConsole.cpp index b0c42198e9..7819f183df 100644 --- a/src/openrct2/interface/InteractiveConsole.cpp +++ b/src/openrct2/interface/InteractiveConsole.cpp @@ -934,7 +934,7 @@ static void ConsoleCommandSet(InteractiveConsole& console, const arguments_t& ar { auto location = TileCoordsXYZ(int_val[0], int_val[1], 0).ToCoordsXYZ().ToTileCentre(); location.z = TileElementHeight(location); - w->SetViewportLocation(location); + w->setViewportLocation(location); console.Execute("get location"); } } diff --git a/src/openrct2/interface/Viewport.cpp b/src/openrct2/interface/Viewport.cpp index 961b77a09d..256fa26010 100644 --- a/src/openrct2/interface/Viewport.cpp +++ b/src/openrct2/interface/Viewport.cpp @@ -548,7 +548,7 @@ namespace OpenRCT2 if (bit) return; } - window->Invalidate(); + window->invalidate(); } } @@ -838,8 +838,8 @@ namespace OpenRCT2 viewport->viewPos = *centreLoc; } - w.Invalidate(); - w.OnViewportRotate(); + w.invalidate(); + w.onViewportRotate(); } void ViewportRotateSingle(WindowBase* window, int32_t direction) @@ -1175,7 +1175,7 @@ namespace OpenRCT2 if (!(mainWindow->viewport->flags & VIEWPORT_FLAG_GRIDLINES)) { mainWindow->viewport->flags |= VIEWPORT_FLAG_GRIDLINES; - mainWindow->Invalidate(); + mainWindow->invalidate(); } } } @@ -1199,7 +1199,7 @@ namespace OpenRCT2 if (!Config::Get().general.AlwaysShowGridlines) { mainWindow->viewport->flags &= ~VIEWPORT_FLAG_GRIDLINES; - mainWindow->Invalidate(); + mainWindow->invalidate(); } } } @@ -1219,7 +1219,7 @@ namespace OpenRCT2 if (!(mainWindow->viewport->flags & VIEWPORT_FLAG_LAND_OWNERSHIP)) { mainWindow->viewport->flags |= VIEWPORT_FLAG_LAND_OWNERSHIP; - mainWindow->Invalidate(); + mainWindow->invalidate(); } } } @@ -1243,7 +1243,7 @@ namespace OpenRCT2 if (mainWindow->viewport->flags & VIEWPORT_FLAG_LAND_OWNERSHIP) { mainWindow->viewport->flags &= ~VIEWPORT_FLAG_LAND_OWNERSHIP; - mainWindow->Invalidate(); + mainWindow->invalidate(); } } } @@ -1263,7 +1263,7 @@ namespace OpenRCT2 if (!(mainWindow->viewport->flags & VIEWPORT_FLAG_CONSTRUCTION_RIGHTS)) { mainWindow->viewport->flags |= VIEWPORT_FLAG_CONSTRUCTION_RIGHTS; - mainWindow->Invalidate(); + mainWindow->invalidate(); } } } @@ -1287,7 +1287,7 @@ namespace OpenRCT2 if (mainWindow->viewport->flags & VIEWPORT_FLAG_CONSTRUCTION_RIGHTS) { mainWindow->viewport->flags &= ~VIEWPORT_FLAG_CONSTRUCTION_RIGHTS; - mainWindow->Invalidate(); + mainWindow->invalidate(); } } } @@ -1339,7 +1339,7 @@ namespace OpenRCT2 break; } if (invalidate != 0) - window->Invalidate(); + window->invalidate(); } } diff --git a/src/openrct2/interface/Window.cpp b/src/openrct2/interface/Window.cpp index edaf9abcfc..b9f8663a3f 100644 --- a/src/openrct2/interface/Window.cpp +++ b/src/openrct2/interface/Window.cpp @@ -111,7 +111,7 @@ static constexpr float kWindowScrollLocations[][2] = { void WindowDispatchUpdateAll() { // gTooltipNotShownTicks++; - WindowVisitEach([&](WindowBase* w) { w->OnUpdate(); }); + WindowVisitEach([&](WindowBase* w) { w->onUpdate(); }); } void WindowUpdateAllViewports() @@ -177,7 +177,7 @@ static constexpr float kWindowScrollLocations[][2] = { { gWindowUpdateTicks = gCurrentRealTimeTicks + kGameUpdateFPS; - WindowVisitEach([](WindowBase* w) { w->OnPeriodicUpdate(); }); + WindowVisitEach([](WindowBase* w) { w->onPeriodicUpdate(); }); } // Border flash invalidation @@ -187,7 +187,7 @@ static constexpr float kWindowScrollLocations[][2] = { w->flags -= WF_WHITE_BORDER_ONE; if (!(w->flags & WF_WHITE_BORDER_MASK)) { - w->Invalidate(); + w->invalidate(); } } }); @@ -200,7 +200,7 @@ static constexpr float kWindowScrollLocations[][2] = { void WindowNotifyLanguageChange() { - WindowVisitEach([&](WindowBase* w) { w->OnLanguageChange(); }); + WindowVisitEach([&](WindowBase* w) { w->onLanguageChange(); }); } /* @@ -255,12 +255,12 @@ static constexpr float kWindowScrollLocations[][2] = { if (w->windowPos.y + w->height <= window.windowPos.y) return; - w->Invalidate(); + w->invalidate(); if (window.windowPos.x + window.width + 13 >= ContextGetWidth()) return; auto push_amount = window.windowPos.x + window.width - w->windowPos.x + 3; w->windowPos.x += push_amount; - w->Invalidate(); + w->invalidate(); if (w->viewport != nullptr) w->viewport->pos.x += push_amount; }); @@ -290,13 +290,13 @@ static constexpr float kWindowScrollLocations[][2] = { return; // Invalidate the window's current area - w2->Invalidate(); + w2->invalidate(); int32_t push_amount = w1.windowPos.y + w1.height - w2->windowPos.y + 3; w2->windowPos.y += push_amount; // Invalidate the window's new area - w2->Invalidate(); + w2->invalidate(); // Update viewport position if necessary if (w2->viewport != nullptr) @@ -345,7 +345,7 @@ static constexpr float kWindowScrollLocations[][2] = { if (!(w.viewport->flags & VIEWPORT_FLAG_UNDERGROUND_INSIDE)) { w.viewport->flags |= VIEWPORT_FLAG_UNDERGROUND_INSIDE; - w.Invalidate(); + w.invalidate(); } } else @@ -353,7 +353,7 @@ static constexpr float kWindowScrollLocations[][2] = { if (w.viewport->flags & VIEWPORT_FLAG_UNDERGROUND_INSIDE) { w.viewport->flags &= ~VIEWPORT_FLAG_UNDERGROUND_INSIDE; - w.Invalidate(); + w.invalidate(); } } @@ -478,7 +478,7 @@ static constexpr float kWindowScrollLocations[][2] = { // a window on top of the viewport. auto* windowMgr = Ui::GetWindowManager(); windowMgr->BringToFront(w); - w.Invalidate(); + w.invalidate(); } /** @@ -617,14 +617,14 @@ static constexpr float kWindowScrollLocations[][2] = { // Invalidate modifies the window colours so first get the correct // colour before setting the global variables for the string painting - w.OnPrepareDraw(); + w.onPrepareDraw(); // Text colouring gCurrentWindowColours[0] = w.colours[0].colour; gCurrentWindowColours[1] = w.colours[1].colour; gCurrentWindowColours[2] = w.colours[2].colour; - w.OnDraw(copy); + w.onDraw(copy); } bool isToolActive(WindowClass cls) @@ -712,7 +712,7 @@ static constexpr float kWindowScrollLocations[][2] = { WindowBase* w = windowMgr->FindByNumber( gCurrentToolWidget.windowClassification, gCurrentToolWidget.windowNumber); if (w != nullptr) - w->OnToolAbort(gCurrentToolWidget.widgetIndex); + w->onToolAbort(gCurrentToolWidget.widgetIndex); } } } diff --git a/src/openrct2/interface/WindowBase.cpp b/src/openrct2/interface/WindowBase.cpp index ca4553ef3f..9ea2e81d23 100644 --- a/src/openrct2/interface/WindowBase.cpp +++ b/src/openrct2/interface/WindowBase.cpp @@ -8,7 +8,7 @@ namespace OpenRCT2 { - void WindowBase::SetViewportLocation(const CoordsXYZ& coords) + void WindowBase::setViewportLocation(const CoordsXYZ& coords) { WindowScrollToLocation(*this, coords); flags &= ~WF_SCROLLING_TO_LOCATION; @@ -19,15 +19,15 @@ namespace OpenRCT2 viewport->viewPos = savedViewPos; } - Invalidate(); + invalidate(); } - void WindowBase::Invalidate() + void WindowBase::invalidate() { GfxSetDirtyBlocks({ windowPos, windowPos + ScreenCoordsXY{ width, height } }); } - void WindowBase::RemoveViewport() + void WindowBase::removeViewport() { if (viewport == nullptr) return; @@ -36,15 +36,15 @@ namespace OpenRCT2 viewport = nullptr; } - void WindowBase::SetWidgets(const std::span newWidgets) + void WindowBase::setWidgets(const std::span newWidgets) { widgets.clear(); widgets.insert(widgets.end(), newWidgets.begin(), newWidgets.end()); - ResizeFrame(); + resizeFrame(); } - CursorID WindowBase::OnCursor(WidgetIndex, const ScreenCoordsXY&, CursorID) + CursorID WindowBase::onCursor(WidgetIndex, const ScreenCoordsXY&, CursorID) { return CursorID::Arrow; } @@ -70,7 +70,7 @@ namespace OpenRCT2 closeButton.string = !translucent ? kCloseBoxStringBlackNormal : kCloseBoxStringWhiteNormal; } - void WindowBase::ResizeFrame() + void WindowBase::resizeFrame() { if (widgets.size() < 3) return; @@ -116,7 +116,7 @@ namespace OpenRCT2 if (!hasTitleWidget || heightDifference == 0) return; - Invalidate(); + invalidate(); // Offset title and close button titleWidget.bottom += heightDifference; @@ -126,7 +126,7 @@ namespace OpenRCT2 minHeight += heightDifference; maxHeight += heightDifference; - Invalidate(); + invalidate(); // Resize frame again to match new height frameWidget.bottom = height - 1; diff --git a/src/openrct2/interface/WindowBase.h b/src/openrct2/interface/WindowBase.h index 3851afe191..a9e3c7b2a9 100644 --- a/src/openrct2/interface/WindowBase.h +++ b/src/openrct2/interface/WindowBase.h @@ -109,11 +109,11 @@ namespace OpenRCT2 bool isVisible = true; EntityId viewportSmartFollowSprite{ EntityId::GetNull() }; // Handles setting viewport target sprite etc - void SetViewportLocation(const CoordsXYZ& coords); - void Invalidate(); - void RemoveViewport(); - void SetWidgets(const std::span newWidgets); - void ResizeFrame(); + void setViewportLocation(const CoordsXYZ& coords); + void invalidate(); + void removeViewport(); + void setWidgets(const std::span newWidgets); + void resizeFrame(); int16_t getTitleBarTargetHeight() const; int16_t getTitleBarCurrentHeight() const; @@ -132,92 +132,92 @@ namespace OpenRCT2 } // Events - virtual void OnOpen() + virtual void onOpen() { } - virtual bool CanClose() + virtual bool canClose() { return true; } - virtual void OnClose() + virtual void onClose() { } - virtual void OnResize() + virtual void onResize() { } - virtual void OnUpdate() + virtual void onUpdate() { } - virtual void OnPeriodicUpdate() + virtual void onPeriodicUpdate() { } - virtual void OnPrepareDraw() + virtual void onPrepareDraw() { } - virtual void OnDraw(RenderTarget& rt) + virtual void onDraw(RenderTarget& rt) { } - virtual void OnDrawWidget(WidgetIndex widgetIndex, RenderTarget& rt) + virtual void onDrawWidget(WidgetIndex widgetIndex, RenderTarget& rt) { } - virtual OpenRCT2String OnTooltip(WidgetIndex widgetIndex, StringId fallback) + virtual OpenRCT2String onTooltip(WidgetIndex widgetIndex, StringId fallback) { return { fallback, {} }; } - virtual void OnMouseDown(WidgetIndex widgetIndex) + virtual void onMouseDown(WidgetIndex widgetIndex) { } - virtual void OnMouseUp(WidgetIndex widgetIndex) + virtual void onMouseUp(WidgetIndex widgetIndex) { } - virtual void OnDropdown(WidgetIndex widgetIndex, int32_t selectedIndex) + virtual void onDropdown(WidgetIndex widgetIndex, int32_t selectedIndex) { } - virtual void OnTextInput(WidgetIndex widgetIndex, std::string_view text) + virtual void onTextInput(WidgetIndex widgetIndex, std::string_view text) { } - virtual ScreenSize OnScrollGetSize(int32_t scrollIndex) + virtual ScreenSize onScrollGetSize(int32_t scrollIndex) { return {}; } - virtual void OnScrollSelect(int32_t scrollIndex, int32_t scrollAreaType) + virtual void onScrollSelect(int32_t scrollIndex, int32_t scrollAreaType) { } - virtual void OnScrollMouseDrag(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) + virtual void onScrollMouseDrag(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) { } - virtual void OnScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) + virtual void onScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) { } - virtual void OnScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) + virtual void onScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) { } - virtual void OnScrollDraw(int32_t scrollIndex, RenderTarget& rt) + virtual void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) { } - virtual void OnToolUpdate(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) + virtual void onToolUpdate(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) { } - virtual void OnToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) + virtual void onToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) { } - virtual void OnToolDrag(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) + virtual void onToolDrag(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) { } - virtual void OnToolUp(WidgetIndex widgetIndex, const ScreenCoordsXY&) + virtual void onToolUp(WidgetIndex widgetIndex, const ScreenCoordsXY&) { } - virtual void OnToolAbort(WidgetIndex widgetIndex) + virtual void onToolAbort(WidgetIndex widgetIndex) { } - virtual void OnViewportRotate() + virtual void onViewportRotate() { } - virtual void OnMoved(const ScreenCoordsXY&) + virtual void onMoved(const ScreenCoordsXY&) { } - virtual CursorID OnCursor(WidgetIndex, const ScreenCoordsXY&, CursorID); - virtual void OnLanguageChange() + virtual CursorID onCursor(WidgetIndex, const ScreenCoordsXY&, CursorID); + virtual void onLanguageChange() { } diff --git a/src/openrct2/ride/Ride.cpp b/src/openrct2/ride/Ride.cpp index 4d7c5422b3..40d2fc46d3 100644 --- a/src/openrct2/ride/Ride.cpp +++ b/src/openrct2/ride/Ride.cpp @@ -3992,7 +3992,7 @@ void Ride::constructMissingEntranceOrExit() const auto* windowMgr = Ui::GetWindowManager(); w = windowMgr->FindByClass(WindowClass::RideConstruction); if (w != nullptr) - w->OnMouseUp(entranceOrExit); + w->onMouseUp(entranceOrExit); } } diff --git a/src/openrct2/ride/RideConstruction.cpp b/src/openrct2/ride/RideConstruction.cpp index b547893ace..e32106ff5c 100644 --- a/src/openrct2/ride/RideConstruction.cpp +++ b/src/openrct2/ride/RideConstruction.cpp @@ -239,7 +239,7 @@ void RideClearForConstruction(Ride& ride) auto* windowMgr = Ui::GetWindowManager(); auto w = windowMgr->FindByNumber(WindowClass::Ride, ride.id.ToUnderlying()); if (w != nullptr) - w->OnResize(); + w->onResize(); } /** diff --git a/src/openrct2/scenes/title/Command/SetLocation.cpp b/src/openrct2/scenes/title/Command/SetLocation.cpp index cb2ef15804..ebf4bea7d3 100644 --- a/src/openrct2/scenes/title/Command/SetLocation.cpp +++ b/src/openrct2/scenes/title/Command/SetLocation.cpp @@ -28,7 +28,7 @@ namespace OpenRCT2::Title // Prevent scroll adjustment due to window placement when in-game auto oldLegacyScene = gLegacyScene; gLegacyScene = LegacyScene::titleSequence; - w->SetViewportLocation({ loc, z }); + w->setViewportLocation({ loc, z }); gLegacyScene = oldLegacyScene; }