mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2025-12-23 15:52:55 +01:00
Reduce nested ifs and remove ?: in main_window_zoom
This commit is contained in:
@@ -1080,18 +1080,24 @@ void window_zoom_out(rct_window* w, bool atCursor)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void main_window_zoom(bool zoomIn, bool atCursor)
|
void main_window_zoom(bool zoomIn, bool atCursor)
|
||||||
{
|
|
||||||
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
|
|
||||||
return;
|
|
||||||
if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || gEditorStep == EditorStep::LandscapeEditor)
|
|
||||||
{
|
|
||||||
if (!(gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER))
|
|
||||||
{
|
{
|
||||||
auto* mainWindow = window_get_main();
|
auto* mainWindow = window_get_main();
|
||||||
if (mainWindow != nullptr)
|
if (mainWindow != nullptr)
|
||||||
window_zoom_set(mainWindow, mainWindow->viewport->zoom + (zoomIn ? -1 : 1), atCursor);
|
return;
|
||||||
}
|
|
||||||
}
|
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR && gEditorStep != EditorStep::LandscapeEditor)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (zoomIn)
|
||||||
|
window_zoom_in(mainWindow, atCursor);
|
||||||
|
else
|
||||||
|
window_zoom_out(mainWindow, atCursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user