Add confirmation for convicting dwarves of crimes

Closes #1593
develop
lethosor 2020-06-20 12:02:13 -04:00
parent 5073bd31c4
commit aee4fcd1a6
3 changed files with 20 additions and 0 deletions

@ -44,6 +44,9 @@ changelog.txt uses a syntax similar to RST, with a few special sequences:
- `labormanager`: fixed handling of new jobs in 0.47 - `labormanager`: fixed handling of new jobs in 0.47
- Fixed ``Units::isEggLayer``, ``Units::isGrazer``, ``Units::isMilkable``, ``Units::isTrainableHunting``, ``Units::isTrainableWar``, and ``Units::isTamable`` ignoring the unit's caste - Fixed ``Units::isEggLayer``, ``Units::isGrazer``, ``Units::isMilkable``, ``Units::isTrainableHunting``, ``Units::isTrainableWar``, and ``Units::isTamable`` ignoring the unit's caste
## Misc Improvements
- `confirm`: added a confirmation dialog for convicting dwarves of crimes
## Ruby ## Ruby
- Updated ``item_find`` and ``building_find`` to use centralized logic that works on more screens - Updated ``item_find`` and ``building_find`` to use centralized logic that works on more screens

@ -18,6 +18,7 @@
#include "df/general_ref.h" #include "df/general_ref.h"
#include "df/general_ref_contained_in_itemst.h" #include "df/general_ref_contained_in_itemst.h"
#include "df/viewscreen_dwarfmodest.h" #include "df/viewscreen_dwarfmodest.h"
#include "df/viewscreen_justicest.h"
#include "df/viewscreen_layer_militaryst.h" #include "df/viewscreen_layer_militaryst.h"
#include "df/viewscreen_locationsst.h" #include "df/viewscreen_locationsst.h"
#include "df/viewscreen_tradegoodsst.h" #include "df/viewscreen_tradegoodsst.h"
@ -479,6 +480,7 @@ DEFINE_CONFIRMATION(uniform_delete, viewscreen_layer_militaryst);
DEFINE_CONFIRMATION(note_delete, viewscreen_dwarfmodest); DEFINE_CONFIRMATION(note_delete, viewscreen_dwarfmodest);
DEFINE_CONFIRMATION(route_delete, viewscreen_dwarfmodest); DEFINE_CONFIRMATION(route_delete, viewscreen_dwarfmodest);
DEFINE_CONFIRMATION(location_retire, viewscreen_locationsst); DEFINE_CONFIRMATION(location_retire, viewscreen_locationsst);
DEFINE_CONFIRMATION(convict, viewscreen_justicest);
DFhackCExport command_result plugin_init (color_ostream &out, vector <PluginCommand> &commands) DFhackCExport command_result plugin_init (color_ostream &out, vector <PluginCommand> &commands)
{ {

@ -204,6 +204,21 @@ end
location_retire.title = "Retire location" location_retire.title = "Retire location"
location_retire.message = "Are you sure you want to retire this location?" location_retire.message = "Are you sure you want to retire this location?"
convict = defconf('convict')
convict.title = "Confirm conviction"
function convict.intercept_key(key)
return key == keys.SELECT and
screen.cur_column == df.viewscreen_justicest.T_cur_column.ConvictChoices
end
function convict.get_message()
name = dfhack.TranslateName(screen.convict_choices[screen.cursor_right].name)
if name == "" then
name = "this creature"
end
return "Are you sure you want to convict " .. name .. "?\n" ..
"This action is irreversible."
end
-- End of confirmation definitions -- End of confirmation definitions
function check() function check()