From 0ed7e605225eb8b8763eebe11ed24baf0c549c15 Mon Sep 17 00:00:00 2001 From: lethosor Date: Sat, 10 Jun 2017 19:06:43 -0400 Subject: [PATCH] getAnyUnit: support viewscreen_layer_unit_relationshipst --- library/modules/Gui.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/library/modules/Gui.cpp b/library/modules/Gui.cpp index ccbad8f00..611e00205 100644 --- a/library/modules/Gui.cpp +++ b/library/modules/Gui.cpp @@ -88,6 +88,7 @@ using namespace DFHack; #include "df/viewscreen_layer_noblelistst.h" #include "df/viewscreen_layer_overall_healthst.h" #include "df/viewscreen_layer_stockpilest.h" +#include "df/viewscreen_layer_unit_relationshipst.h" #include "df/viewscreen_locationsst.h" #include "df/viewscreen_petst.h" #include "df/viewscreen_storesst.h" @@ -838,6 +839,14 @@ df::unit *Gui::getAnyUnit(df::viewscreen *top) if (VIRTUAL_CAST_VAR(screen, df::viewscreen_dungeon_monsterstatusst, top)) return screen->unit; + if (VIRTUAL_CAST_VAR(screen, df::viewscreen_layer_unit_relationshipst, top)) + { + if (VIRTUAL_CAST_VAR(list, df::layer_object_listst, vector_get(screen->layer_objects, 0))) + return vector_get(screen->relation_unit, list->cursor); + + return NULL; + } + if (VIRTUAL_CAST_VAR(screen, df::viewscreen_itemst, top)) { df::general_ref *ref = vector_get(screen->entry_ref, screen->cursor_pos);