Skip to content

Commit

Permalink
Fix #22007: Cannot update image of ImgButton from plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
Harry-Hopkinson committed May 11, 2024
1 parent b0a3888 commit bda383c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions distribution/changelog.txt
Expand Up @@ -9,6 +9,7 @@
- Change: [#7248] Small mini-maps are now centred in the map window.
- Fix: [#13294] Map corners are cut off in some directions (original bug).
- Fix: [#21974] No reason specified when attempting to place benches, lamps, or bins on path with no unconnected edges (original bug).
- Fix: [#22012] [Plugin] Images on ImgButton widgets cannot be updated.

0.4.11 (2024-05-05)
------------------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions src/openrct2-ui/scripting/ScWidget.hpp
Expand Up @@ -502,7 +502,7 @@ namespace OpenRCT2::Scripting
uint32_t image_get() const
{
auto widget = GetWidget();
if (widget != nullptr && widget->type == WindowWidgetType::FlatBtn)
if (widget != nullptr && (widget->type == WindowWidgetType::FlatBtn || widget->type == WindowWidgetType::ImgBtn))
{
if (GetTargetAPIVersion() <= API_VERSION_63_G2_REORDER)
{
Expand All @@ -516,7 +516,7 @@ namespace OpenRCT2::Scripting
void image_set(DukValue value)
{
auto widget = GetWidget();
if (widget != nullptr && widget->type == WindowWidgetType::FlatBtn)
if (widget != nullptr && (widget->type == WindowWidgetType::FlatBtn || widget->type == WindowWidgetType::ImgBtn))
{
widget->image = ImageId(ImageFromDuk(value));
Invalidate();
Expand Down

0 comments on commit bda383c

Please sign in to comment.