Add a search option to the location occupation menu

develop
lethosor 2015-12-23 16:57:43 -05:00
parent 9bf7e550a7
commit e3e68a8df9
3 changed files with 52 additions and 2 deletions

@ -29,6 +29,13 @@ Changelog
.. contents:: .. contents::
:depth: 2 :depth: 2
DFHack future
=============
New Features
------------
- `search-plugin`: Support for the location occupation assignment menu
DFHack 0.40.24-r5 DFHack 0.40.24-r5
================= =================

@ -1 +1 @@
Subproject commit 9e8fa01ee53857b29b6b55f39597bc6176f4ba07 Subproject commit ed0eec72c7b29a61cc367337d89c339c2853f0ab

@ -21,6 +21,7 @@
#include "df/viewscreen_buildinglistst.h" #include "df/viewscreen_buildinglistst.h"
#include "df/viewscreen_joblistst.h" #include "df/viewscreen_joblistst.h"
#include "df/historical_figure.h" #include "df/historical_figure.h"
#include "df/viewscreen_locationsst.h"
#include "df/interface_key.h" #include "df/interface_key.h"
#include "df/interfacest.h" #include "df/interfacest.h"
#include "df/layer_object_listst.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 // END: Noble suggestion search
// //
//
// START: Location occupation assignment search
//
typedef search_generic<df::viewscreen_locationsst, df::unit*> 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<df::unit*> *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 \ #define SEARCH_HOOKS \
HOOK_ACTION(unitlist_search_hook) \ HOOK_ACTION(unitlist_search_hook) \
HOOK_ACTION(roomlist_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(burrow_search_hook) \
HOOK_ACTION(stockpile_search_hook) \ HOOK_ACTION(stockpile_search_hook) \
HOOK_ACTION(room_assign_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) DFhackCExport command_result plugin_enable ( color_ostream &out, bool enable)
{ {