New tweak: kitchen-prefs-empty

Fixes a layout issue on the kitchen prefs viewscreen with empty tabs
http://www.bay12games.com/dwarves/mantisbt/view.php?id=9000

See #526
develop
lethosor 2015-06-26 21:16:27 -04:00
parent 790f967120
commit 8d21dd0a23
5 changed files with 43 additions and 0 deletions

@ -16,6 +16,7 @@ DFHack Future
item-descriptions: holds a default description for every item type and subtype
warn-starving: check for starving, thirsty, or very drowsy units and pause with warning if any are found
New tweaks
kitchen-prefs-empty: Fixes a layout issue with empty kitchen tabs
Fixes
Plugins with vmethod hooks can now be reloaded on OS X
Lua's os.system() now works on OS X

@ -1313,6 +1313,7 @@ Subcommands that persist until disabled or DF quits:
:fps-min: Fixes the in-game minimum FPS setting
:import-priority-category: Allows changing the priority of all goods in a
category when discussing an import agreement with the liaison
:kitchen-prefs-empty: Fixes a layout issue with empty kitchen tabs (bug 9000)
:manager-quantity: Removes the limit of 30 jobs per manager order
:max-wheelbarrow: Allows assigning more than 3 wheelbarrows to a stockpile
:military-color-assigned: Color squad candidates already assigned to other squads in yellow/green

@ -181,6 +181,7 @@ tweak import-priority-category
# Misc. UI tweaks
tweak civ-view-agreement
tweak fps-min
tweak kitchen-prefs-empty
tweak max-wheelbarrow
tweak shift-8-scroll
tweak tradereq-pet-gender

@ -34,6 +34,7 @@
#include "df/crime.h"
#include "df/unit_inventory_item.h"
#include "df/viewscreen_dwarfmodest.h"
#include "df/viewscreen_kitchenprefst.h"
#include "df/viewscreen_layer_unit_actionst.h"
#include "df/squad_order_trainst.h"
#include "df/ui_build_selector.h"
@ -83,6 +84,7 @@
#include "tweaks/fast-trade.h"
#include "tweaks/fps-min.h"
#include "tweaks/import-priority-category.h"
#include "tweaks/kitchen-prefs-empty.h"
#include "tweaks/manager-quantity.h"
#include "tweaks/max-wheelbarrow.h"
#include "tweaks/military-assign.h"
@ -184,6 +186,8 @@ DFhackCExport command_result plugin_init (color_ostream &out, std::vector <Plugi
" tweak import-priority-category [disable]\n"
" When meeting with a liaison, makes Shift+Left/Right arrow adjust\n"
" the priority of an entire category of imports.\n"
" tweak kitchen-prefs-empty [disable]\n"
" Fixes a layout issue with empty kitchen tabs (bug 9000)\n"
" tweak manager-quantity [disable]\n"
" Removes the limit of 30 jobs per manager order\n"
" tweak max-wheelbarrow [disable]\n"
@ -235,6 +239,8 @@ DFhackCExport command_result plugin_init (color_ostream &out, std::vector <Plugi
TWEAK_HOOK("import-priority-category", takerequest_hook, feed);
TWEAK_HOOK("import-priority-category", takerequest_hook, render);
TWEAK_HOOK("kitchen-prefs-empty", kitchen_prefs_empty_hook, render);
TWEAK_HOOK("manager-quantity", manager_quantity_hook, feed);
TWEAK_HOOK("max-wheelbarrow", max_wheelbarrow_hook, render);

@ -0,0 +1,34 @@
using namespace DFHack;
using df::global::gps;
struct kitchen_prefs_empty_hook : df::viewscreen_kitchenprefst {
typedef df::viewscreen_kitchenprefst interpose_base;
DEFINE_VMETHOD_INTERPOSE(void, render, ())
{
static const char *state_names[] = {
"Vegetables/fruit/leaves",
"Seeds",
"Drinks",
"Meat/fish/other"
};
static int tab_x[] = {2, 30, 45, 60};
static Screen::Pen pen(' ', COLOR_WHITE, COLOR_BLACK);
INTERPOSE_NEXT(render)();
for (int x = 1; x < gps->dimx - 2; x++)
Screen::paintTile(pen, x, 2);
for (int i = 0; i < 4; i++)
{
pen.bold = (page == i);
Screen::paintString(pen, tab_x[i], 2, state_names[i]);
}
if (!item_type[page].size())
{
pen.bold = true;
Screen::paintString(pen, 2, 4, "You have no appropriate ingredients.");
}
}
};
IMPLEMENT_VMETHOD_INTERPOSE(kitchen_prefs_empty_hook, render);