New tweak: import-priority-category

develop
lethosor 2014-09-27 18:14:25 -04:00
parent aeb9ea54ec
commit 999d265d50
2 changed files with 47 additions and 0 deletions

@ -17,6 +17,7 @@
#include "DataDefs.h"
#include <VTableInterpose.h>
#include "../uicommon.h"
#include "df/ui.h"
#include "df/world.h"
#include "df/squad.h"
@ -75,6 +76,7 @@
#include "tweaks/craft-age-wear.h"
#include "tweaks/fast-heat.h"
#include "tweaks/fast-trade.h"
#include "tweaks/import-priority-category.h"
#include "tweaks/manager-quantity.h"
#include "tweaks/military-assign.h"
#include "tweaks/stable-cursor.h"
@ -153,6 +155,9 @@ DFhackCExport command_result plugin_init (color_ostream &out, std::vector <Plugi
// " Speed up melee squad training, removing inverse dependency on unit count.\n"
" tweak manager-quantity [disable]\n"
" Removes the limit of 30 jobs per manager order\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"
" tweak craft-age-wear [disable]\n"
" Makes cloth and leather items wear out at the correct rate (bug 6003).\n"
" tweak adamantine-cloth-wear [disable]\n"
@ -176,6 +181,9 @@ DFhackCExport command_result plugin_init (color_ostream &out, std::vector <Plugi
TWEAK_HOOK("fast-trade", fast_trade_assign_hook, feed);
TWEAK_HOOK("fast-trade", fast_trade_select_hook, feed);
TWEAK_HOOK("import-priority-category", takerequest_hook, feed);
TWEAK_HOOK("import-priority-category", takerequest_hook, render);
TWEAK_HOOK("manager-quantity", manager_quantity_hook, feed);
TWEAK_HOOK("military-color-assigned", military_assign_hook, render);

@ -0,0 +1,39 @@
#include "df/meeting_diplomat_info.h"
#include "df/entity_sell_requests.h"
#include "df/viewscreen_topicmeeting_takerequestsst.h"
using namespace std;
using namespace DFHack;
using namespace df::enums;
struct takerequest_hook : df::viewscreen_topicmeeting_takerequestsst {
typedef df::viewscreen_topicmeeting_takerequestsst interpose_base;
DEFINE_VMETHOD_INTERPOSE(void, feed, (set<df::interface_key>* input))
{
if (input->count(interface_key::CURSOR_RIGHT_FAST) ||
input->count(interface_key::CURSOR_LEFT_FAST))
{
int delta = 0 + input->count(interface_key::CURSOR_RIGHT_FAST)
- input->count(interface_key::CURSOR_LEFT_FAST);
vector<int8_t> &cur_priorities = meeting->sell_requests->priority[type_categories[type_idx]];
for (size_t i = 0; i < cur_priorities.size(); i++)
{
cur_priorities[i] += delta;
if (cur_priorities[i] > 4)
cur_priorities[i] = 4;
if (cur_priorities[i] < 0)
cur_priorities[i] = 0;
}
}
INTERPOSE_NEXT(feed)(input);
}
DEFINE_VMETHOD_INTERPOSE(void, render, ())
{
INTERPOSE_NEXT(render)();
int x = 45, y = 23;
OutputString(COLOR_LIGHTRED, x, y, "Shift+Left/Right");
OutputString(COLOR_GREY, x, y, ": Adjust category");
}
};
IMPLEMENT_VMETHOD_INTERPOSE(takerequest_hook, feed);
IMPLEMENT_VMETHOD_INTERPOSE(takerequest_hook, render);