diff --git a/NEWS.rst b/NEWS.rst index 4ff70f63e..e7fbe0ef7 100644 --- a/NEWS.rst +++ b/NEWS.rst @@ -29,6 +29,13 @@ Changelog .. contents:: :depth: 2 +DFHack future +============= + +New Features +------------ +- `search-plugin`: Support for the location occupation assignment menu + DFHack 0.40.24-r5 ================= diff --git a/library/xml b/library/xml index 9e8fa01ee..ed0eec72c 160000 --- a/library/xml +++ b/library/xml @@ -1 +1 @@ -Subproject commit 9e8fa01ee53857b29b6b55f39597bc6176f4ba07 +Subproject commit ed0eec72c7b29a61cc367337d89c339c2853f0ab diff --git a/plugins/search.cpp b/plugins/search.cpp index f5b10f156..cd94b3320 100644 --- a/plugins/search.cpp +++ b/plugins/search.cpp @@ -21,6 +21,7 @@ #include "df/viewscreen_buildinglistst.h" #include "df/viewscreen_joblistst.h" #include "df/historical_figure.h" +#include "df/viewscreen_locationsst.h" #include "df/interface_key.h" #include "df/interfacest.h" #include "df/layer_object_listst.h" @@ -1948,6 +1949,47 @@ IMPLEMENT_HOOKS(df::viewscreen_topicmeeting_fill_land_holder_positionsst, noble_ // END: Noble suggestion search // +// +// START: Location occupation assignment search +// + +typedef search_generic location_assign_occupation_search_base; +class location_assign_occupation_search : public location_assign_occupation_search_base +{ +public: + bool can_init (df::viewscreen_locationsst *screen) + { + return screen->menu == df::viewscreen_locationsst::AssignOccupation; + } + + string get_element_description (df::unit *unit) const + { + return unit ? get_unit_description(unit) : "Nobody"; + } + + void render() const + { + print_search_option(37, gps->dimy - 3); + } + + vector *get_primary_list() + { + return &viewscreen->units; + } + + virtual int32_t *get_viewscreen_cursor() + { + return &viewscreen->unit_idx; + } + +}; + +IMPLEMENT_HOOKS(df::viewscreen_locationsst, location_assign_occupation_search); + +// +// END: Location occupation assignment search +// + #define SEARCH_HOOKS \ HOOK_ACTION(unitlist_search_hook) \ HOOK_ACTION(roomlist_search_hook) \ @@ -1964,7 +2006,8 @@ IMPLEMENT_HOOKS(df::viewscreen_topicmeeting_fill_land_holder_positionsst, noble_ HOOK_ACTION(burrow_search_hook) \ HOOK_ACTION(stockpile_search_hook) \ HOOK_ACTION(room_assign_search_hook) \ - HOOK_ACTION(noble_suggest_search_hook) + HOOK_ACTION(noble_suggest_search_hook) \ + HOOK_ACTION(location_assign_occupation_search_hook) DFhackCExport command_result plugin_enable ( color_ostream &out, bool enable) {