From f49149222e99c7edeff517dc478c5f9f5942bd9f Mon Sep 17 00:00:00 2001 From: frutiemax Date: Thu, 16 Jul 2020 17:01:42 -0400 Subject: [PATCH] Close #12245: Use coords objects for SetLocation (Window_internal.h) --- src/openrct2-ui/title/TitleSequencePlayer.cpp | 2 +- src/openrct2/Editor.cpp | 6 +++--- src/openrct2/interface/InteractiveConsole.cpp | 2 +- src/openrct2/interface/Window_internal.cpp | 4 ++-- src/openrct2/interface/Window_internal.h | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/openrct2-ui/title/TitleSequencePlayer.cpp b/src/openrct2-ui/title/TitleSequencePlayer.cpp index 23432ab6c6..c9cc75cfed 100644 --- a/src/openrct2-ui/title/TitleSequencePlayer.cpp +++ b/src/openrct2-ui/title/TitleSequencePlayer.cpp @@ -478,7 +478,7 @@ private: // Prevent scroll adjustment due to window placement when in-game auto oldScreenFlags = gScreenFlags; gScreenFlags = SCREEN_FLAGS_TITLE_DEMO; - w->SetLocation(loc.x, loc.y, z); + w->SetLocation({ loc, z }); gScreenFlags = oldScreenFlags; viewport_update_position(w); diff --git a/src/openrct2/Editor.cpp b/src/openrct2/Editor.cpp index c7575aabad..231095504c 100644 --- a/src/openrct2/Editor.cpp +++ b/src/openrct2/Editor.cpp @@ -87,7 +87,7 @@ namespace Editor gS6Info.category = SCENARIO_CATEGORY_OTHER; viewport_init_all(); rct_window* mainWindow = context_open_window_view(WV_EDITOR_MAIN); - mainWindow->SetLocation(2400, 2400, 112); + mainWindow->SetLocation(TileCoordsXYZ{ 75, 75, 14 }.ToCoordsXYZ()); load_palette(); gScreenAge = 0; gScenarioName = language_get_string(STR_MY_NEW_SCENARIO); @@ -163,7 +163,7 @@ namespace Editor gS6Info.editor_step = EDITOR_STEP_OBJECT_SELECTION; viewport_init_all(); rct_window* mainWindow = context_open_window_view(WV_EDITOR_MAIN); - mainWindow->SetLocation(2400, 2400, 112); + mainWindow->SetLocation(TileCoordsXYZ{ 75, 75, 14 }.ToCoordsXYZ()); load_palette(); } @@ -184,7 +184,7 @@ namespace Editor gS6Info.editor_step = EDITOR_STEP_OBJECT_SELECTION; viewport_init_all(); rct_window* mainWindow = context_open_window_view(WV_EDITOR_MAIN); - mainWindow->SetLocation(2400, 2400, 112); + mainWindow->SetLocation(TileCoordsXYZ{ 75, 75, 14 }.ToCoordsXYZ()); load_palette(); } diff --git a/src/openrct2/interface/InteractiveConsole.cpp b/src/openrct2/interface/InteractiveConsole.cpp index ad136f2f14..8c078b55d3 100644 --- a/src/openrct2/interface/InteractiveConsole.cpp +++ b/src/openrct2/interface/InteractiveConsole.cpp @@ -909,7 +909,7 @@ static int32_t cc_set(InteractiveConsole& console, const arguments_t& argv) { auto location = TileCoordsXYZ(int_val[0], int_val[1], 0).ToCoordsXYZ().ToTileCentre(); location.z = tile_element_height(location); - w->SetLocation(location.x, location.y, location.z); + w->SetLocation(location); viewport_update_position(w); console.Execute("get location"); } diff --git a/src/openrct2/interface/Window_internal.cpp b/src/openrct2/interface/Window_internal.cpp index c4f64912f1..0a0d0e738e 100644 --- a/src/openrct2/interface/Window_internal.cpp +++ b/src/openrct2/interface/Window_internal.cpp @@ -2,9 +2,9 @@ #include "../world/Sprite.h" -void rct_window::SetLocation(int32_t newX, int32_t newY, int32_t newZ) +void rct_window::SetLocation(const CoordsXYZ& coords) { - window_scroll_to_location(this, { newX, newY, newZ }); + window_scroll_to_location(this, coords); flags &= ~WF_SCROLLING_TO_LOCATION; } diff --git a/src/openrct2/interface/Window_internal.h b/src/openrct2/interface/Window_internal.h index 42329cf0cc..9504dba230 100644 --- a/src/openrct2/interface/Window_internal.h +++ b/src/openrct2/interface/Window_internal.h @@ -91,7 +91,7 @@ struct rct_window uint8_t visibility; uint16_t viewport_smart_follow_sprite; // Handles setting viewport target sprite etc - void SetLocation(int32_t x, int32_t y, int32_t z); + void SetLocation(const CoordsXYZ& coords); void ScrollToViewport(); void Invalidate(); };