|
|
|
@ -52,6 +52,7 @@
|
|
|
|
|
#include "df/reaction.h"
|
|
|
|
|
#include "df/reaction_reagent_itemst.h"
|
|
|
|
|
#include "df/reaction_reagent_flags.h"
|
|
|
|
|
#include "df/viewscreen_setupdwarfgamest.h"
|
|
|
|
|
#include "df/viewscreen_layer_assigntradest.h"
|
|
|
|
|
#include "df/viewscreen_tradegoodsst.h"
|
|
|
|
|
#include "df/viewscreen_layer_militaryst.h"
|
|
|
|
@ -120,6 +121,8 @@ DFhackCExport command_result plugin_init (color_ostream &out, std::vector <Plugi
|
|
|
|
|
" when soldiers go off-duty (i.e. civilian).\n"
|
|
|
|
|
" tweak readable-build-plate [disable]\n"
|
|
|
|
|
" Fixes rendering of creature weight limits in pressure plate build menu.\n"
|
|
|
|
|
" tweak confirm-embark [disable]\n"
|
|
|
|
|
" Asks for confirmation on the embark setup screen before embarking\n"
|
|
|
|
|
" tweak stable-temp [disable]\n"
|
|
|
|
|
" Fixes performance bug 6012 by squashing jitter in temperature updates.\n"
|
|
|
|
|
" tweak fast-heat <max-ticks>\n"
|
|
|
|
@ -331,6 +334,83 @@ struct readable_build_plate_hook : df::viewscreen_dwarfmodest
|
|
|
|
|
|
|
|
|
|
IMPLEMENT_VMETHOD_INTERPOSE(readable_build_plate_hook, render);
|
|
|
|
|
|
|
|
|
|
enum confirm_embark_states
|
|
|
|
|
{
|
|
|
|
|
ECS_INACTIVE = 0,
|
|
|
|
|
ECS_CONFIRM,
|
|
|
|
|
ECS_ACCEPTED
|
|
|
|
|
};
|
|
|
|
|
static confirm_embark_states confirm_embark_state = ECS_INACTIVE;
|
|
|
|
|
|
|
|
|
|
struct confirm_embark_hook : df::viewscreen_setupdwarfgamest
|
|
|
|
|
{
|
|
|
|
|
typedef df::viewscreen_setupdwarfgamest interpose_base;
|
|
|
|
|
|
|
|
|
|
DEFINE_VMETHOD_INTERPOSE(void, feed, (set<df::interface_key> *input))
|
|
|
|
|
{
|
|
|
|
|
bool intercept = false;
|
|
|
|
|
df::viewscreen * top = Gui::getCurViewscreen();
|
|
|
|
|
VIRTUAL_CAST_VAR(screen, df::viewscreen_setupdwarfgamest, top);
|
|
|
|
|
if (screen)
|
|
|
|
|
{
|
|
|
|
|
if (screen->anon_14 == 0) // Advanced embark screen
|
|
|
|
|
{
|
|
|
|
|
if (confirm_embark_state == ECS_INACTIVE)
|
|
|
|
|
{
|
|
|
|
|
if (input->count(df::interface_key::SETUP_EMBARK))
|
|
|
|
|
{
|
|
|
|
|
confirm_embark_state = ECS_CONFIRM;
|
|
|
|
|
intercept = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (confirm_embark_state == ECS_CONFIRM)
|
|
|
|
|
{
|
|
|
|
|
intercept = true;
|
|
|
|
|
if (input->count(df::interface_key::MENU_CONFIRM))
|
|
|
|
|
confirm_embark_state = ECS_ACCEPTED;
|
|
|
|
|
else if (input->size())
|
|
|
|
|
confirm_embark_state = ECS_INACTIVE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!intercept)
|
|
|
|
|
INTERPOSE_NEXT(feed)(input);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DEFINE_VMETHOD_INTERPOSE(void, render, ())
|
|
|
|
|
{
|
|
|
|
|
INTERPOSE_NEXT(render)();
|
|
|
|
|
df::viewscreen * top = Gui::getCurViewscreen();
|
|
|
|
|
VIRTUAL_CAST_VAR(screen, df::viewscreen_setupdwarfgamest, top);
|
|
|
|
|
auto dim = Screen::getWindowSize();
|
|
|
|
|
Screen::Pen pen(' ', COLOR_WHITE, COLOR_BLACK);
|
|
|
|
|
if (confirm_embark_state != ECS_INACTIVE)
|
|
|
|
|
{
|
|
|
|
|
Screen::fillRect(Screen::Pen(' ', COLOR_BLACK, COLOR_BLACK), 0, 0, dim.x - 1, dim.y - 1);
|
|
|
|
|
}
|
|
|
|
|
if (confirm_embark_state == ECS_CONFIRM)
|
|
|
|
|
{
|
|
|
|
|
Screen::paintString(pen, 2, 2, "Really embark?");
|
|
|
|
|
Screen::paintString(Screen::Pen(' ', COLOR_LIGHTGREEN),
|
|
|
|
|
2, 4, Screen::getKeyDisplay(df::interface_key::MENU_CONFIRM));
|
|
|
|
|
Screen::paintString(pen, 3, 4, ": Confirm, Other: Cancel");
|
|
|
|
|
Screen::paintString(pen, dim.x - 10, dim.y - 1, "DFHack");
|
|
|
|
|
}
|
|
|
|
|
else if (confirm_embark_state == ECS_ACCEPTED)
|
|
|
|
|
{
|
|
|
|
|
Screen::paintString(pen, 2, 2, "Embarking...");
|
|
|
|
|
std::set<df::interface_key> input;
|
|
|
|
|
input.insert(df::interface_key::SETUP_EMBARK);
|
|
|
|
|
screen->feed(&input);
|
|
|
|
|
confirm_embark_state = ECS_INACTIVE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
IMPLEMENT_VMETHOD_INTERPOSE(confirm_embark_hook, feed);
|
|
|
|
|
IMPLEMENT_VMETHOD_INTERPOSE(confirm_embark_hook, render);
|
|
|
|
|
|
|
|
|
|
struct stable_temp_hook : df::item_actual {
|
|
|
|
|
typedef df::item_actual interpose_base;
|
|
|
|
|
|
|
|
|
@ -1216,6 +1296,11 @@ static command_result tweak(color_ostream &out, vector <string> ¶meters)
|
|
|
|
|
|
|
|
|
|
enable_hook(out, INTERPOSE_HOOK(readable_build_plate_hook, render), parameters);
|
|
|
|
|
}
|
|
|
|
|
else if (cmd == "confirm-embark")
|
|
|
|
|
{
|
|
|
|
|
enable_hook(out, INTERPOSE_HOOK(confirm_embark_hook, feed), parameters);
|
|
|
|
|
enable_hook(out, INTERPOSE_HOOK(confirm_embark_hook, render), parameters);
|
|
|
|
|
}
|
|
|
|
|
else if (cmd == "stable-temp")
|
|
|
|
|
{
|
|
|
|
|
enable_hook(out, INTERPOSE_HOOK(stable_temp_hook, adjustTemperature), parameters);
|
|
|
|
|