1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-24 08:12:53 +01:00

Fix invalid locations breaking viewports

Fixes #1183. Note this isn't the same fix that rct2 uses. But I feel it solves the main issue
This commit is contained in:
Duncan Frost
2015-06-03 19:00:16 +01:00
parent fb1c8c4e42
commit 17abada57e
3 changed files with 12 additions and 3 deletions

View File

@@ -147,6 +147,15 @@ void center_2d_coordinates(int x, int y, int z, int* out_x, int* out_y, rct_view
break;
}
// If the start location was invalid
// propagate the invalid location to the output.
// This fixes a bug that caused the game to enter an infinite loop.
if (start_x == (sint16)0x8000){
*out_x = (sint16)0x8000;
*out_y = 0;
return;
}
*out_x = x - viewport->view_width / 2;
*out_y = y - viewport->view_height / 2;
}