New tweak: embark-profile-name

develop
lethosor 2015-08-25 10:12:31 -04:00
parent 29a0aee44c
commit 8292f56f63
4 changed files with 29 additions and 0 deletions

@ -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

@ -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

@ -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 <Plugi
" Fixes overlapping text on the \"view agreement\" screen\n"
" tweak craft-age-wear [disable]\n"
" Makes cloth and leather items wear out at the correct rate (bug 6003).\n"
" tweak embark-profile-name [disable]\n"
" Allows the use of lowercase letters when saving embark profiles\n"
" tweak eggs-fertile [disable]\n"
" Displays a fertile/infertile indicator on nestboxes\n"
" tweak farm-plot-select [disable]\n"
@ -235,6 +238,8 @@ DFhackCExport command_result plugin_init (color_ostream &out, std::vector <Plugi
TWEAK_HOOK("eggs-fertile", egg_fertile_hook, render);
TWEAK_HOOK("embark-profile-name", embark_profile_name_hook, feed);
TWEAK_HOOK("farm-plot-select", farm_select_hook, feed);
TWEAK_HOOK("farm-plot-select", farm_select_hook, render);

@ -0,0 +1,22 @@
#include "df/viewscreen_setupdwarfgamest.h"
using namespace DFHack;
struct embark_profile_name_hook : df::viewscreen_setupdwarfgamest {
typedef df::viewscreen_setupdwarfgamest interpose_base;
DEFINE_VMETHOD_INTERPOSE(void, feed, (std::set<df::interface_key> *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);