diff --git a/NEWS.rst b/NEWS.rst index ec7fa5454..5d4ef51e3 100644 --- a/NEWS.rst +++ b/NEWS.rst @@ -34,6 +34,7 @@ DFHack future New Features ------------ +- `confirm`: Added a confirmation for retiring locations - `search-plugin`: Support for the location occupation assignment menu Fixes diff --git a/plugins/confirm.cpp b/plugins/confirm.cpp index ec8ee2a73..3ea5d540c 100644 --- a/plugins/confirm.cpp +++ b/plugins/confirm.cpp @@ -19,6 +19,7 @@ #include "df/general_ref_contained_in_itemst.h" #include "df/viewscreen_dwarfmodest.h" #include "df/viewscreen_layer_militaryst.h" +#include "df/viewscreen_locationsst.h" #include "df/viewscreen_tradegoodsst.h" using namespace DFHack; @@ -453,6 +454,7 @@ DEFINE_CONFIRMATION(squad_disband, viewscreen_layer_militaryst, 0); DEFINE_CONFIRMATION(uniform_delete, viewscreen_layer_militaryst, 0); DEFINE_CONFIRMATION(note_delete, viewscreen_dwarfmodest, 0); DEFINE_CONFIRMATION(route_delete, viewscreen_dwarfmodest, 0); +DEFINE_CONFIRMATION(location_retire, viewscreen_locationsst, 0); DFhackCExport command_result plugin_init (color_ostream &out, vector &commands) { diff --git a/plugins/lua/confirm.lua b/plugins/lua/confirm.lua index 751b1b4da..135187358 100644 --- a/plugins/lua/confirm.lua +++ b/plugins/lua/confirm.lua @@ -192,6 +192,17 @@ end route_delete.title = "Delete route" route_delete.message = "Are you sure you want to delete this route?" +location_retire = defconf('location-retire') +function location_retire.intercept_key(key) + return key == keys.LOCATION_RETIRE and + (screen.menu == df.viewscreen_locationsst.T_menu.Locations or + screen.menu == df.viewscreen_locationsst.T_menu.Occupations) and + screen.in_edit == df.viewscreen_locationsst.T_in_edit.None and + screen.locations[screen.location_idx] +end +location_retire.title = "Retire location" +location_retire.message = "Are you sure you want to retire this location?" + -- End of confirmation definitions function check()