New tweak: hide-priority

Adds an option to hide designation priority indicators
develop
lethosor 2016-01-04 19:29:30 -05:00
parent 06b3b94e8d
commit 2acdede03b
5 changed files with 71 additions and 0 deletions

@ -58,6 +58,7 @@ New Features
- `tweak`:
- ``tweak hide-priority``: Adds an option to hide designation priority indicators
- ``tweak title-start-rename``: Adds a safe rename option to the title screen "Start Playing" menu
Fixes

@ -181,10 +181,12 @@ tweak import-priority-category
# Misc. UI tweaks
tweak civ-view-agreement
tweak fps-min
tweak hide-priority
tweak kitchen-keys
tweak kitchen-prefs-empty
tweak max-wheelbarrow
tweak shift-8-scroll
tweak title-start-rename
tweak tradereq-pet-gender
###########################

@ -294,6 +294,7 @@ Subcommands that persist until disabled or DF quits:
:fast-trade: Makes Shift-Down in the Move Goods to Depot and Trade screens select
the current item (fully, in case of a stack), and scroll down one line.
:fps-min: Fixes the in-game minimum FPS setting
:hide-priority: Adds an option to hide designation priority indicators
:import-priority-category:
Allows changing the priority of all goods in a
category when discussing an import agreement with the liaison

@ -87,6 +87,7 @@
#include "tweaks/fast-heat.h"
#include "tweaks/fast-trade.h"
#include "tweaks/fps-min.h"
#include "tweaks/hide-priority.h"
#include "tweaks/import-priority-category.h"
#include "tweaks/kitchen-keys.h"
#include "tweaks/kitchen-prefs-color.h"
@ -195,6 +196,8 @@ DFhackCExport command_result plugin_init (color_ostream &out, std::vector <Plugi
" the current item (fully, in case of a stack), and scroll down one line.\n"
" tweak fps-min [disable]\n"
" Fixes the in-game minimum FPS setting (bug 6277)\n"
" tweak hide-priority [disable]\n"
" Adds an option to hide designation priority indicators\n"
" 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"
@ -256,6 +259,9 @@ DFhackCExport command_result plugin_init (color_ostream &out, std::vector <Plugi
TWEAK_ONUPDATE_HOOK("fps-min", fps_min_hook);
TWEAK_HOOK("hide-priority", hide_priority_hook, feed);
TWEAK_HOOK("hide-priority", hide_priority_hook, render);
TWEAK_HOOK("import-priority-category", takerequest_hook, feed);
TWEAK_HOOK("import-priority-category", takerequest_hook, render);

@ -0,0 +1,61 @@
#include "modules/Gui.h"
#include "df/viewscreen_dwarfmodest.h"
using namespace DFHack;
using df::global::gps;
using df::global::ui_sidebar_menus;
struct hide_priority_hook : df::viewscreen_dwarfmodest {
typedef df::viewscreen_dwarfmodest interpose_base;
inline bool valid_mode ()
{
switch (ui->main.mode)
{
case df::ui_sidebar_mode::DesignateMine:
case df::ui_sidebar_mode::DesignateRemoveRamps:
case df::ui_sidebar_mode::DesignateUpStair:
case df::ui_sidebar_mode::DesignateDownStair:
case df::ui_sidebar_mode::DesignateUpDownStair:
case df::ui_sidebar_mode::DesignateUpRamp:
case df::ui_sidebar_mode::DesignateChannel:
case df::ui_sidebar_mode::DesignateGatherPlants:
case df::ui_sidebar_mode::DesignateRemoveDesignation:
case df::ui_sidebar_mode::DesignateSmooth:
case df::ui_sidebar_mode::DesignateCarveTrack:
case df::ui_sidebar_mode::DesignateEngrave:
case df::ui_sidebar_mode::DesignateCarveFortification:
case df::ui_sidebar_mode::DesignateChopTrees:
case df::ui_sidebar_mode::DesignateToggleEngravings:
case df::ui_sidebar_mode::DesignateToggleMarker:
case df::ui_sidebar_mode::DesignateRemoveConstruction:
return true;
default:
return false;
}
}
DEFINE_VMETHOD_INTERPOSE(void, render, ())
{
INTERPOSE_NEXT(render)();
if (valid_mode())
{
auto dims = Gui::getDwarfmodeViewDims();
if (dims.menu_on)
{
int x = dims.menu_x1 + 1, y = gps->dimy - (gps->dimy > 26 ? 8 : 7);
OutputToggleString(x, y, "Show priorities", df::interface_key::CUSTOM_ALT_P,
ui_sidebar_menus->designation.priority_set, true, 0,
COLOR_WHITE, COLOR_LIGHTRED);
}
}
}
DEFINE_VMETHOD_INTERPOSE(void, feed, (std::set<df::interface_key> *input))
{
if (valid_mode() && input->count(df::interface_key::CUSTOM_ALT_P))
ui_sidebar_menus->designation.priority_set = !ui_sidebar_menus->designation.priority_set;
else
INTERPOSE_NEXT(feed)(input);
}
};
IMPLEMENT_VMETHOD_INTERPOSE(hide_priority_hook, feed);
IMPLEMENT_VMETHOD_INTERPOSE(hide_priority_hook, render);