From 8292f56f63af1f1e8038309f99f2d38cbc7a07a0 Mon Sep 17 00:00:00 2001 From: lethosor Date: Tue, 25 Aug 2015 10:12:31 -0400 Subject: [PATCH] New tweak: embark-profile-name --- NEWS | 1 + Readme.rst | 1 + plugins/tweak/tweak.cpp | 5 +++++ plugins/tweak/tweaks/embark-profile-name.h | 22 ++++++++++++++++++++++ 4 files changed, 29 insertions(+) create mode 100644 plugins/tweak/tweaks/embark-profile-name.h diff --git a/NEWS b/NEWS index 02eb33839..4e20592e2 100644 --- a/NEWS +++ b/NEWS @@ -28,6 +28,7 @@ DFHack Future warn-starving: check for starving, thirsty, or very drowsy units and pause with warning if any are found points: set number of points available at embark screen New tweaks + embark-profile-name: Allows the use of lowercase letters when saving embark profiles kitchen-keys: Fixes DF kitchen meal keybindings kitchen-prefs-color: Changes color of enabled items to green in kitchen preferences kitchen-prefs-empty: Fixes a layout issue with empty kitchen tabs diff --git a/Readme.rst b/Readme.rst index 66ec5106c..d68755cb2 100644 --- a/Readme.rst +++ b/Readme.rst @@ -1368,6 +1368,7 @@ Subcommands that persist until disabled or DF quits: :civ-view-agreement: Fixes overlapping text on the "view agreement" screen :craft-age-wear: Fixes the behavior of crafted items wearing out over time (bug 6003). With this tweak, items made from cloth and leather will gain a level of wear every 20 years. +:embark-profile-name: Allows the use of lowercase letters when saving embark profiles :eggs-fertile: Displays a fertility indicator on nestboxes :farm-plot-select: Adds "Select all" and "Deselect all" options to farm plot menus :fast-heat: Further improves temperature update performance by ensuring that 1 degree diff --git a/plugins/tweak/tweak.cpp b/plugins/tweak/tweak.cpp index fa2810d5d..98ec21eb3 100644 --- a/plugins/tweak/tweak.cpp +++ b/plugins/tweak/tweak.cpp @@ -81,6 +81,7 @@ #include "tweaks/civ-agreement-ui.h" #include "tweaks/craft-age-wear.h" #include "tweaks/eggs-fertile.h" +#include "tweaks/embark-profile-name.h" #include "tweaks/farm-plot-select.h" #include "tweaks/fast-heat.h" #include "tweaks/fast-trade.h" @@ -177,6 +178,8 @@ DFhackCExport command_result plugin_init (color_ostream &out, std::vector *input)) + { + int ch = -1; + for (auto it = input->begin(); ch == -1 && it != input->end(); ++it) + ch = Screen::keyToChar(*it); + if (in_save_profile && ch >= 32 && ch <= 126) + { + profile_name.push_back((char)ch); + } + else + { + if (input->count(df::interface_key::LEAVESCREEN)) + input->insert(df::interface_key::SETUPGAME_SAVE_PROFILE_ABORT); + INTERPOSE_NEXT(feed)(input); + } + } +}; +IMPLEMENT_VMETHOD_INTERPOSE(embark_profile_name_hook, feed);