diff --git a/docs/changelog.txt b/docs/changelog.txt index 9bc714e48..447f2f22e 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -56,6 +56,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences: - Removed ``Notes`` module (C++-only). Access ``ui.waypoints.points`` directly instead. - Removed ``Windows`` module (C++-only) - unused. - ``Constructions`` module (C++-only): removed ``t_construction``, ``isValid()``, ``getCount()``, ``getConstruction()``, and ``copyConstruction()``. Access ``world.constructions`` directly instead. +- ``Gui::getSelectedItem()``, ``Gui::getAnyItem()``: added support for the artifacts screen ## Lua - ``tile-material``: fix the order of declarations. The ``GetTileMat`` function now returns the material as intended (always returned nil before). Also changed the license info, with permission of the original author. diff --git a/library/modules/Gui.cpp b/library/modules/Gui.cpp index 963b2ecd6..fc78bb57d 100644 --- a/library/modules/Gui.cpp +++ b/library/modules/Gui.cpp @@ -106,6 +106,7 @@ using namespace DFHack; #include "df/viewscreen_unitlistst.h" #include "df/viewscreen_unitst.h" #include "df/viewscreen_reportlistst.h" +#include "df/viewscreen_treasurelistst.h" #include "df/viewscreen_workquota_conditionst.h" #include "df/viewscreen_workshop_profilest.h" #include "df/world.h" @@ -1181,6 +1182,13 @@ df::item *Gui::getAnyItem(df::viewscreen *top) return NULL; } + if (VIRTUAL_CAST_VAR(screen, df::viewscreen_treasurelistst, top)) + { + if (world) + return vector_get(world->items.other[df::items_other_id::ANY_ARTIFACT], screen->sel_idx); + return NULL; + } + if (auto dfscreen = dfhack_viewscreen::try_cast(top)) return dfscreen->getSelectedItem();