Skip to content

Commit

Permalink
Add a location retirement confirmation
Browse files Browse the repository at this point in the history
  • Loading branch information
lethosor committed Dec 25, 2015
1 parent 64d861b commit a9ad2f4
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions NEWS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions plugins/confirm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 <PluginCommand> &commands)
{
Expand Down
11 changes: 11 additions & 0 deletions plugins/lua/confirm.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit a9ad2f4

Please sign in to comment.