From 1ed6c70663d4ada28538d56138ecbcee58ee47fe Mon Sep 17 00:00:00 2001 From: lethosor Date: Thu, 18 Jan 2018 10:17:54 -0500 Subject: [PATCH] dwarfmonitor: Add "view unit" option to prefs screen --- plugins/dwarfmonitor.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/plugins/dwarfmonitor.cpp b/plugins/dwarfmonitor.cpp index 6f5481369..7aed7188d 100644 --- a/plugins/dwarfmonitor.cpp +++ b/plugins/dwarfmonitor.cpp @@ -45,6 +45,7 @@ #include "df/trapcomp_flags.h" #include "df/unit_preference.h" #include "df/unit_soul.h" +#include "df/viewscreen_unitst.h" #include "df/world_raws.h" using std::deque; @@ -1345,14 +1346,14 @@ public: preferences_column.auto_select = true; preferences_column.setTitle("Preference"); preferences_column.bottom_margin = 3; - preferences_column.search_margin = 35; + preferences_column.search_margin = 50; dwarf_column.multiselect = false; dwarf_column.auto_select = true; dwarf_column.allow_null = true; dwarf_column.setTitle("Units with Preference"); dwarf_column.bottom_margin = 3; - dwarf_column.search_margin = 35; + dwarf_column.search_margin = 50; populatePreferencesColumn(); } @@ -1635,6 +1636,16 @@ public: Screen::dismiss(this); return; } + else if (input->count(interface_key::CUSTOM_SHIFT_V)) + { + df::unit *unit = getSelectedUnit(); + if (unit) + { + auto unitscr = df::allocate(); + unitscr->unit = unit; + Screen::show(unitscr); + } + } else if (input->count(interface_key::CUSTOM_SHIFT_Z)) { df::unit *selected_unit = getSelectedUnit(); @@ -1690,6 +1701,10 @@ public: int32_t x = 2; OutputHotkeyString(x, y, "Leave", LEAVESCREEN); + x += 2; + OutputHotkeyString(x, y, "View Unit", CUSTOM_SHIFT_V, false, 0, + getSelectedUnit() ? COLOR_WHITE : COLOR_DARKGREY); + x += 2; OutputHotkeyString(x, y, "Zoom Unit", CUSTOM_SHIFT_Z, false, 0, getSelectedUnit() ? COLOR_WHITE : COLOR_DARKGREY);