1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-27 16:54:52 +01:00

fix crash on window size decrease

This commit is contained in:
Miso Zmiric (Mike Squinter)
2014-11-24 22:02:04 +00:00
parent eb83dfa4d5
commit 1f60018acd

View File

@@ -500,12 +500,18 @@ void redraw_peep_and_rain()
if (rain_no_pixels == 0) {
return;
}
rct_window *window = window_get_main();
uint32 pixels = window->width * window->height;
uint32 *rain_pixels = RCT2_ADDRESS(RCT2_ADDRESS_RAIN_PIXEL_STORE, uint32);
if (rain_pixels) {
uint8 *screen_pixels = RCT2_ADDRESS(RCT2_ADDRESS_SCREEN_DPI, rct_drawpixelinfo)->bits;
for (int i = 0; i < rain_no_pixels; i++) {
uint32 pixel = rain_pixels[i];
if (pixel >> 8 > pixels) {
log_verbose("Pixel error, skipping rain draw in this frame");
break;
}
screen_pixels[pixel >> 8] = pixel & 0xFF;
}
RCT2_GLOBAL(0x009E2C78, uint32) = 1;