diff --git a/src/windows/map.c b/src/windows/map.c index 83a1e5227d..2c5ea253d5 100644 --- a/src/windows/map.c +++ b/src/windows/map.c @@ -1547,9 +1547,13 @@ static uint16 map_window_get_pixel_colour_peep(int x, int y) if (!(mapElement->properties.surface.ownership & OWNERSHIP_OWNED)) colour = 10 | (colour & 0xFF00); + const size_t count = countof(ElementTypeAddColour); while (!map_element_is_last_for_tile(mapElement++)) { int mapElementType = map_element_get_type(mapElement) >> 2; - assert(mapElementType < countof(ElementTypeMaskColour)); + if (mapElementType >= count) + { + mapElementType = MAP_ELEMENT_TYPE_CORRUPT >> 2; + } colour &= ElementTypeMaskColour[mapElementType]; colour |= ElementTypeAddColour[mapElementType]; } diff --git a/src/windows/tile_inspector.c b/src/windows/tile_inspector.c index e6e8122b24..c3425d6d77 100644 --- a/src/windows/tile_inspector.c +++ b/src/windows/tile_inspector.c @@ -390,6 +390,11 @@ static void window_tile_inspector_scrollpaint(rct_window *w, rct_drawpixelinfo * ); type_name = buffer; break; + case MAP_ELEMENT_TYPE_CORRUPT: + // fall-through + default: + sprintf(buffer, "Unknown (type %d)", type); + type_name = buffer; } gfx_draw_string(dpi, type_name, 12, x, y); diff --git a/src/world/map.h b/src/world/map.h index 705df960c5..3466048755 100644 --- a/src/world/map.h +++ b/src/world/map.h @@ -121,7 +121,10 @@ enum { MAP_ELEMENT_TYPE_ENTRANCE = (4 << 2), MAP_ELEMENT_TYPE_FENCE = (5 << 2), MAP_ELEMENT_TYPE_SCENERY_MULTIPLE = (6 << 2), - MAP_ELEMENT_TYPE_BANNER = (7 << 2) + MAP_ELEMENT_TYPE_BANNER = (7 << 2), + // The corrupt element type is used for skipping drawing other following + // elements on a given tile. + MAP_ELEMENT_TYPE_CORRUPT = (8 << 2), }; enum {