Map unknown elem type to corrupt, update tile inspector

In map view, all unknown types are mapped to MAP_ELEMENT_TYPE_CORRUPT,
the type that prevents rendering of all following elements on given
tile.

Tile inspector now displays element type (numeric value) for unknown
types.
This commit is contained in:
Michał Janiszewski 2015-12-27 00:59:22 +01:00
parent 53970c2d77
commit e3f5ea25ae
3 changed files with 14 additions and 2 deletions

View File

@ -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];
}

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 {