1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-22 23:33:04 +01:00

Make use of std::optional strict

This commit is contained in:
ζeh Matt
2021-09-13 19:47:13 +03:00
parent 6ffb03dde0
commit 59a6c34db4
39 changed files with 204 additions and 200 deletions

View File

@@ -909,7 +909,7 @@ void window_rotate_camera(rct_window* w, int32_t direction)
// other != viewport probably triggers on viewports in ride or guest window?
// naoXYCoords is nullopt if middle of viewport is obstructed by another window?
if (!mapXYCoords || other != viewport)
if (!mapXYCoords.has_value() || other != viewport)
{
auto viewPos = ScreenCoordsXY{ (viewport->view_width >> 1), (viewport->view_height >> 1) } + viewport->viewPos;
@@ -926,9 +926,9 @@ void window_rotate_camera(rct_window* w, int32_t direction)
auto centreLoc = centre_2d_coordinates(coords, viewport);
if (centreLoc)
if (centreLoc.has_value())
{
w->savedViewPos = *centreLoc;
w->savedViewPos = centreLoc.value();
viewport->viewPos = *centreLoc;
}
@@ -976,7 +976,7 @@ void window_viewport_centre_tile_around_cursor(rct_window* w, int32_t map_x, int
int32_t z = tile_element_height({ map_x, map_y });
auto centreLoc = centre_2d_coordinates({ map_x, map_y, z }, w->viewport);
if (!centreLoc)
if (!centreLoc.has_value())
{
log_error("Invalid location.");
return;