mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2025-12-23 15:52:55 +01:00
Make uses of window_get_main use (const) auto*
This commit is contained in:
@@ -531,7 +531,7 @@ void game_load_init()
|
||||
}
|
||||
else
|
||||
{
|
||||
const auto mainWindow = window_get_main();
|
||||
auto* mainWindow = window_get_main();
|
||||
window_unfollow_sprite(mainWindow);
|
||||
}
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ void DrawWeather(rct_drawpixelinfo* dpi, IWeatherDrawer* weatherDrawer)
|
||||
{
|
||||
uint32_t viewFlags = 0;
|
||||
|
||||
rct_viewport* viewport = window_get_viewport(window_get_main());
|
||||
const auto* viewport = window_get_viewport(window_get_main());
|
||||
if (viewport != nullptr)
|
||||
viewFlags = viewport->flags;
|
||||
|
||||
|
||||
@@ -1086,7 +1086,7 @@ void main_window_zoom(bool zoomIn, bool atCursor)
|
||||
{
|
||||
if (!(gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER))
|
||||
{
|
||||
rct_window* mainWindow = window_get_main();
|
||||
auto* mainWindow = window_get_main();
|
||||
if (mainWindow != nullptr)
|
||||
window_zoom_set(mainWindow, mainWindow->viewport->zoom + (zoomIn ? -1 : 1), atCursor);
|
||||
}
|
||||
@@ -1706,7 +1706,7 @@ void window_resize_gui(int32_t width, int32_t height)
|
||||
*/
|
||||
void window_resize_gui_scenario_editor(int32_t width, int32_t height)
|
||||
{
|
||||
rct_window* mainWind = window_get_main();
|
||||
auto* mainWind = window_get_main();
|
||||
if (mainWind != nullptr)
|
||||
{
|
||||
rct_viewport* viewport = mainWind->viewport;
|
||||
@@ -1797,7 +1797,7 @@ void window_update_viewport_ride_music()
|
||||
|
||||
static void window_snap_left(rct_window* w, int32_t proximity)
|
||||
{
|
||||
auto mainWindow = window_get_main();
|
||||
const auto* mainWindow = window_get_main();
|
||||
auto wBottom = w->windowPos.y + w->height;
|
||||
auto wLeftProximity = w->windowPos.x - (proximity * 2);
|
||||
auto wRightProximity = w->windowPos.x + (proximity * 2);
|
||||
@@ -1827,7 +1827,7 @@ static void window_snap_left(rct_window* w, int32_t proximity)
|
||||
|
||||
static void window_snap_top(rct_window* w, int32_t proximity)
|
||||
{
|
||||
auto mainWindow = window_get_main();
|
||||
const auto* mainWindow = window_get_main();
|
||||
auto wRight = w->windowPos.x + w->width;
|
||||
auto wTopProximity = w->windowPos.y - (proximity * 2);
|
||||
auto wBottomProximity = w->windowPos.y + (proximity * 2);
|
||||
@@ -1857,7 +1857,7 @@ static void window_snap_top(rct_window* w, int32_t proximity)
|
||||
|
||||
static void window_snap_right(rct_window* w, int32_t proximity)
|
||||
{
|
||||
auto mainWindow = window_get_main();
|
||||
const auto* mainWindow = window_get_main();
|
||||
auto wRight = w->windowPos.x + w->width;
|
||||
auto wBottom = w->windowPos.y + w->height;
|
||||
auto wLeftProximity = wRight - (proximity * 2);
|
||||
@@ -1887,7 +1887,7 @@ static void window_snap_right(rct_window* w, int32_t proximity)
|
||||
|
||||
static void window_snap_bottom(rct_window* w, int32_t proximity)
|
||||
{
|
||||
auto mainWindow = window_get_main();
|
||||
const auto* mainWindow = window_get_main();
|
||||
auto wRight = w->windowPos.x + w->width;
|
||||
auto wBottom = w->windowPos.y + w->height;
|
||||
auto wTopProximity = wBottom - (proximity * 2);
|
||||
|
||||
@@ -3704,7 +3704,7 @@ static bool ride_create_cable_lift(ride_id_t rideIndex, bool isApplying)
|
||||
*/
|
||||
void Ride::ConstructMissingEntranceOrExit() const
|
||||
{
|
||||
rct_window* w = window_get_main();
|
||||
auto* w = window_get_main();
|
||||
if (w == nullptr)
|
||||
return;
|
||||
|
||||
@@ -3757,7 +3757,7 @@ void Ride::ConstructMissingEntranceOrExit() const
|
||||
*/
|
||||
static void ride_scroll_to_track_error(CoordsXYE* trackElement)
|
||||
{
|
||||
rct_window* w = window_get_main();
|
||||
auto* w = window_get_main();
|
||||
if (w != nullptr)
|
||||
{
|
||||
window_scroll_to_location(w, { *trackElement, trackElement->element->GetBaseZ() });
|
||||
|
||||
Reference in New Issue
Block a user