From c4853bd6e121ac4d0fab9b63991a3513a1de96e6 Mon Sep 17 00:00:00 2001 From: Nilsolm Date: Mon, 6 Apr 2020 19:13:18 +0200 Subject: [PATCH 1/6] 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) From c8e63cf7a6fadd3216a3df3d43d602dc2bdc7d2f Mon Sep 17 00:00:00 2001 From: Ben Lubar Date: Tue, 7 Apr 2020 10:17:01 -0500 Subject: [PATCH 2/6] update structures --- library/xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/xml b/library/xml index 596e30324..a0c75e22c 160000 --- a/library/xml +++ b/library/xml @@ -1 +1 @@ -Subproject commit 596e3032417fb3d8dbe7d62a544ddd415ae2d89f +Subproject commit a0c75e22cdc918240e71ea738c8277499315f88d From 6b810b97a02a0e2b9fb91b7d0468e1163c9ae3c4 Mon Sep 17 00:00:00 2001 From: Ben Lubar Date: Tue, 7 Apr 2020 13:46:44 -0500 Subject: [PATCH 3/6] DataDefs.h can have little a documentation --- library/include/DataDefs.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/library/include/DataDefs.h b/library/include/DataDefs.h index a6639f7b1..fd70b7ba8 100644 --- a/library/include/DataDefs.h +++ b/library/include/DataDefs.h @@ -68,6 +68,8 @@ namespace DFHack IDTYPE_UNION }; + // pointer flags (bitfield), stored in the count field of struct_field_info + // if mode is POINTER. enum pointer_identity_flags { PTRFLAG_IS_ARRAY = 1, PTRFLAG_HAS_BAD_POINTERS = 2, @@ -164,7 +166,12 @@ namespace DFHack // Bitfields struct bitfield_item_info { + // the name of the field, or null if the field is unnamed const char *name; + // size is positive for defined fields, zero for bits past the end + // of the field, and negative for padding on multi-bit fields + // + // ex. if bits[2].size is -2, then bits[0].size is at least 3 int size; }; From 509755d7269c0b8ce0c22afe0ca4fdceb38c0e5e Mon Sep 17 00:00:00 2001 From: Ben Lubar Date: Tue, 7 Apr 2020 16:08:19 -0500 Subject: [PATCH 4/6] update structures --- library/xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/xml b/library/xml index a0c75e22c..b585e182c 160000 --- a/library/xml +++ b/library/xml @@ -1 +1 @@ -Subproject commit a0c75e22cdc918240e71ea738c8277499315f88d +Subproject commit b585e182c404a14130d42bf87a60f94aebbfd1fd From 9a2549bad6092bac2c2ee90a60c5f3d2d455196a Mon Sep 17 00:00:00 2001 From: lethosor Date: Thu, 9 Apr 2020 23:56:01 -0400 Subject: [PATCH 5/6] Update xml --- library/xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/xml b/library/xml index b585e182c..e4522edf1 160000 --- a/library/xml +++ b/library/xml @@ -1 +1 @@ -Subproject commit b585e182c404a14130d42bf87a60f94aebbfd1fd +Subproject commit e4522edf112824fb0edac874cec0d0f7f9c33c5f From 0b926e2d150a208b8989204f0424e0cb2e2ac2bc Mon Sep 17 00:00:00 2001 From: lethosor Date: Fri, 10 Apr 2020 23:29:00 -0400 Subject: [PATCH 6/6] Update changelog, authors --- docs/Authors.rst | 1 + docs/changelog.txt | 3 +++ 2 files changed, 4 insertions(+) diff --git a/docs/Authors.rst b/docs/Authors.rst index 1bfcf051b..72d61de06 100644 --- a/docs/Authors.rst +++ b/docs/Authors.rst @@ -34,6 +34,7 @@ Clayton Hughes Clément Vuchener cvuchener Dan Amlund danamlund Daniel Brooks db48x +David Nilsolm David Corbett dscorbett David Seguin dseguin David Timm dtimm diff --git a/docs/changelog.txt b/docs/changelog.txt index 34f5c3660..3ca170566 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -42,6 +42,9 @@ changelog.txt uses a syntax similar to RST, with a few special sequences: ## Fixes - `tweak` embark-profile-name: fixed handling of the native shift+space key +## Misc Improvements +- `search`: added support for the fortress mode justice screen + ## Lua - ``pairs()`` now returns available class methods for DF types