add ride previews

This commit is contained in:
Ted John 2016-07-02 12:06:29 +01:00
parent 52c11267bc
commit ebcbb085d2
3 changed files with 19 additions and 3 deletions

View File

@ -327,6 +327,20 @@ void RideObject::Unload()
gfx_object_free_images(_legacyType.images_offset, GetImageTable()->GetCount());
}
void RideObject::DrawPreview(rct_drawpixelinfo * dpi) const
{
uint32 imageId = _legacyType.images_offset;
if (_legacyType.ride_type[0] == 0xFF)
{
imageId++;
if (_legacyType.ride_type[1] == 0xFF)
{
imageId++;
}
}
gfx_draw_sprite(dpi, imageId, 0, 0, 0);
}
const utf8 * RideObject::GetName() const
{
const utf8 * name = GetStringTable()->GetString(OBJ_STRING_ID_NAME);

View File

@ -40,6 +40,8 @@ public:
void Load() override;
void Unload() override;
void DrawPreview(rct_drawpixelinfo * dpi) const;
const utf8 * GetName() const override;
const utf8 * GetDescription() const;
const utf8 * GetCapacity() const;

View File

@ -1335,8 +1335,8 @@ static void window_editor_object_selection_paint(rct_window *w, rct_drawpixelinf
widget = &w->widgets[WIDX_PREVIEW];
{
rct_drawpixelinfo clipDPI;
x = w->x + widget->left;
y = w->y + widget->top;
x = w->x + widget->left + 1;
y = w->y + widget->top + 1;
int width = widget->right - widget->left;
int height = widget->bottom - widget->top;
if (clip_drawpixelinfo(&clipDPI, dpi, x, y, width, height)) {
@ -1949,7 +1949,7 @@ static bool filter_chunks(const ObjectRepositoryItem * item)
break;
}
}
if (_filter_flags & (1 << (gRideCategories[get_ride_type_string_id(item)] + 5)))
if (_filter_flags & (1 << (gRideCategories[rideType] + 5)))
return true;
}
return false;