From a9ad2f40f1db79b0153083bd2beb7b3235502552 Mon Sep 17 00:00:00 2001 From: lethosor Date: Fri, 25 Dec 2015 11:18:55 -0500 Subject: [PATCH] Add a location retirement confirmation --- NEWS.rst | 1 + plugins/confirm.cpp | 2 ++ plugins/lua/confirm.lua | 11 +++++++++++ 3 files changed, 14 insertions(+) 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()