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:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user