Merge pull request #2559 from janisozaur/map-assert

Add mapElementType entry for corrupt element
This commit is contained in:
Ted John 2015-12-27 15:47:21 +00:00
commit ce0442f4a2
3 changed files with 21 additions and 6 deletions

View File

@ -1399,7 +1399,8 @@ static const uint16 ElementTypeMaskColour[] = {
0x0000, // MAP_ELEMENT_TYPE_ENTRANCE
0xFFFF, // MAP_ELEMENT_TYPE_FENCE
0x0000, // MAP_ELEMENT_TYPE_SCENERY_MULTIPLE
0xFFFF // MAP_ELEMENT_TYPE_BANNER
0xFFFF, // MAP_ELEMENT_TYPE_BANNER
0x0000, // MAP_ELEMENT_TYPE_CORRUPT
};
static const uint16 ElementTypeAddColour[] = {
@ -1410,7 +1411,8 @@ static const uint16 ElementTypeAddColour[] = {
0xBABA, // MAP_ELEMENT_TYPE_ENTRANCE
0x0000, // MAP_ELEMENT_TYPE_FENCE
0x6363, // MAP_ELEMENT_TYPE_SCENERY_MULTIPLE
0x0000 // MAP_ELEMENT_TYPE_BANNER
0x0000, // MAP_ELEMENT_TYPE_BANNER
0x4444, // MAP_ELEMENT_TYPE_CORRUPT
};
enum {
@ -1545,10 +1547,15 @@ 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);
colour &= ElementTypeMaskColour[mapElementType >> 2];
colour |= ElementTypeAddColour[mapElementType >> 2];
int mapElementType = map_element_get_type(mapElement) >> 2;
if (mapElementType >= count)
{
mapElementType = MAP_ELEMENT_TYPE_CORRUPT >> 2;
}
colour &= ElementTypeMaskColour[mapElementType];
colour |= ElementTypeAddColour[mapElementType];
}
return colour;

View File

@ -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);

View File

@ -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 {