Merge remote-tracking branch 'lethosor/getSelectedItem-artifacts' into develop

develop
lethosor 2022-07-15 00:46:53 -04:00
commit c2f07778b9
No known key found for this signature in database
GPG Key ID: 76A269552F4F58C1
2 changed files with 9 additions and 0 deletions

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

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