From c4853bd6e121ac4d0fab9b63991a3513a1de96e6 Mon Sep 17 00:00:00 2001 From: Nilsolm Date: Mon, 6 Apr 2020 19:13:18 +0200 Subject: [PATCH] Add search to justice screen --- plugins/search.cpp | 82 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) diff --git a/plugins/search.cpp b/plugins/search.cpp index 43e14996a..7e72c2c1c 100644 --- a/plugins/search.cpp +++ b/plugins/search.cpp @@ -25,6 +25,7 @@ #include "df/viewscreen_buildinglistst.h" #include "df/viewscreen_dwarfmodest.h" #include "df/viewscreen_joblistst.h" +#include "df/viewscreen_justicest.h" #include "df/viewscreen_kitchenprefst.h" #include "df/viewscreen_layer_militaryst.h" #include "df/viewscreen_layer_noblelistst.h" @@ -2327,6 +2328,85 @@ IMPLEMENT_HOOKS(df::viewscreen_layer_stone_restrictionst, stone_search); // END: Stone status screen search // +// +// START: Justice screen conviction search +// + +typedef search_generic justice_conviction_search_base; +class justice_conviction_search : public justice_conviction_search_base +{ +public: + bool can_init (df::viewscreen_justicest *screen) + { + return screen->cur_column == df::viewscreen_justicest::ConvictChoices; + } + + string get_element_description (df::unit *unit) const + { + return get_unit_description(unit); + } + + void render() const + { + print_search_option(37); + } + + vector *get_primary_list() + { + return &viewscreen->convict_choices; + } + + virtual int32_t *get_viewscreen_cursor() + { + return &viewscreen->cursor_right; + } +}; + +IMPLEMENT_HOOKS(df::viewscreen_justicest, justice_conviction_search); + +// +// END: Justice screen conviction search +// + +// +// START: Justice screen interrogation search +// + +typedef search_generic justice_interrogation_search_base; +class justice_interrogation_search : public justice_interrogation_search_base +{ +public: + bool can_init (df::viewscreen_justicest *screen) + { + return screen->cur_column == df::viewscreen_justicest::InterrogateChoices; + } + + string get_element_description (df::unit *unit) const + { + return get_unit_description(unit); + } + + void render() const + { + print_search_option(37); + } + + vector *get_primary_list() + { + return &viewscreen->interrogate_choices; + } + + virtual int32_t *get_viewscreen_cursor() + { + return &viewscreen->cursor_right; + } +}; + +IMPLEMENT_HOOKS(df::viewscreen_justicest, justice_interrogation_search); + +// +// END: Justice screen conviction search +// #define SEARCH_HOOKS \ HOOK_ACTION(unitlist_search_hook) \ @@ -2350,6 +2430,8 @@ IMPLEMENT_HOOKS(df::viewscreen_layer_stone_restrictionst, stone_search); HOOK_ACTION(location_assign_occupation_search_hook) \ HOOK_ACTION(kitchen_pref_search_hook) \ HOOK_ACTION(stone_search_hook) \ + HOOK_ACTION(justice_conviction_search_hook) \ + HOOK_ACTION(justice_interrogation_search_hook) \ DFhackCExport command_result plugin_enable ( color_ostream &out, bool enable)