From 7eb9f1945009ae5a2a0d191b6af03193ddfa990b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Janiszewski?= Date: Thu, 8 Sep 2016 20:44:56 +0200 Subject: [PATCH] Workaround for mingw bug --- src/paint/map_element/surface.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/paint/map_element/surface.c b/src/paint/map_element/surface.c index 8652bd6b63..d1dce51370 100644 --- a/src/paint/map_element/surface.c +++ b/src/paint/map_element/surface.c @@ -1321,16 +1321,33 @@ void surface_paint(uint8 direction, uint16 height, rct_map_element * mapElement) tunnel_entry backupLeftTunnels[65]; tunnel_entry backupRightTunnels[65]; +#ifdef __MINGW32__ + // The other code crashes mingw 4.8.2, as available on Travis + for (int i = 0; i < 65; i++) { + backupLeftTunnels[i] = gLeftTunnels[i]; + backupRightTunnels[i] = gRightTunnels[i]; + } +#else memcpy(backupLeftTunnels, gLeftTunnels, sizeof(tunnel_entry) * 65); memcpy(backupRightTunnels, gRightTunnels, sizeof(tunnel_entry) * 65); +#endif viewport_surface_draw_land_side_top(EDGE_TOPLEFT, height / 16, eax / 32, tileDescriptors[0], tileDescriptors[3]); viewport_surface_draw_land_side_top(EDGE_TOPRIGHT, height / 16, eax / 32, tileDescriptors[0], tileDescriptors[4]); viewport_surface_draw_land_side_bottom(EDGE_BOTTOMLEFT, height / 16, eax / 32, tileDescriptors[0], tileDescriptors[1]); viewport_surface_draw_land_side_bottom(EDGE_BOTTOMRIGHT, height / 16, eax / 32, tileDescriptors[0], tileDescriptors[2]); + +#ifdef __MINGW32__ + // The other code crashes mingw 4.8.2, as available on Travis + for (int i = 0; i < 65; i++) { + gLeftTunnels[i] = backupLeftTunnels[i]; + gRightTunnels[i] = backupRightTunnels[i]; + } +#else memcpy(gLeftTunnels, backupLeftTunnels, sizeof(tunnel_entry) * 65); memcpy(gRightTunnels, backupRightTunnels, sizeof(tunnel_entry) * 65); +#endif } RCT2_GLOBAL(0x009E3298, uint16) = 0;