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 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; }; diff --git a/library/xml b/library/xml index 596e30324..e4522edf1 160000 --- a/library/xml +++ b/library/xml @@ -1 +1 @@ -Subproject commit 596e3032417fb3d8dbe7d62a544ddd415ae2d89f +Subproject commit e4522edf112824fb0edac874cec0d0f7f9c33c5f 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)