|
|
@ -28,6 +28,9 @@ using namespace DFHack;
|
|
|
|
using namespace df::enums;
|
|
|
|
using namespace df::enums;
|
|
|
|
|
|
|
|
|
|
|
|
bool show_help = false;
|
|
|
|
bool show_help = false;
|
|
|
|
|
|
|
|
bool quickfort_mode = false;
|
|
|
|
|
|
|
|
bool in_dummy_screen = false;
|
|
|
|
|
|
|
|
std::map<df::building_type, bool> planmode_enabled;
|
|
|
|
|
|
|
|
|
|
|
|
class ViewscreenChooseMaterial : public dfhack_viewscreen
|
|
|
|
class ViewscreenChooseMaterial : public dfhack_viewscreen
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -316,7 +319,7 @@ struct buildingplan_hook : public df::viewscreen_dwarfmodest
|
|
|
|
return ui->main.mode == ui_sidebar_mode::Build &&
|
|
|
|
return ui->main.mode == ui_sidebar_mode::Build &&
|
|
|
|
df::global::ui_build_selector &&
|
|
|
|
df::global::ui_build_selector &&
|
|
|
|
df::global::ui_build_selector->stage < 2 &&
|
|
|
|
df::global::ui_build_selector->stage < 2 &&
|
|
|
|
planner.isPlanableBuilding(ui_build_selector->building_type);
|
|
|
|
planner.isPlannableBuilding(ui_build_selector->building_type);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
std::vector<Units::NoblePosition> getNoblePositionOfSelectedBuildingOwner()
|
|
|
|
std::vector<Units::NoblePosition> getNoblePositionOfSelectedBuildingOwner()
|
|
|
@ -357,11 +360,16 @@ struct buildingplan_hook : public df::viewscreen_dwarfmodest
|
|
|
|
auto type = ui_build_selector->building_type;
|
|
|
|
auto type = ui_build_selector->building_type;
|
|
|
|
if (input->count(interface_key::CUSTOM_SHIFT_P))
|
|
|
|
if (input->count(interface_key::CUSTOM_SHIFT_P))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
if (planmode_enabled.find(type) == planmode_enabled.end())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
planmode_enabled[type] = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
planmode_enabled[type] = !planmode_enabled[type];
|
|
|
|
planmode_enabled[type] = !planmode_enabled[type];
|
|
|
|
if (!planmode_enabled[type])
|
|
|
|
if (!planmode_enabled[type])
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Gui::refreshSidebar();
|
|
|
|
Gui::refreshSidebar();
|
|
|
|
planner.in_dummmy_screen = false;
|
|
|
|
in_dummy_screen = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -375,12 +383,12 @@ struct buildingplan_hook : public df::viewscreen_dwarfmodest
|
|
|
|
|
|
|
|
|
|
|
|
if (is_planmode_enabled(type))
|
|
|
|
if (is_planmode_enabled(type))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (planner.inQuickFortMode() && planner.in_dummmy_screen)
|
|
|
|
if (quickfort_mode && in_dummy_screen)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (input->count(interface_key::SELECT) || input->count(interface_key::SEC_SELECT)
|
|
|
|
if (input->count(interface_key::SELECT) || input->count(interface_key::SEC_SELECT)
|
|
|
|
|| input->count(interface_key::LEAVESCREEN))
|
|
|
|
|| input->count(interface_key::LEAVESCREEN))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
planner.in_dummmy_screen = false;
|
|
|
|
in_dummy_screen = false;
|
|
|
|
send_key(interface_key::LEAVESCREEN);
|
|
|
|
send_key(interface_key::LEAVESCREEN);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -392,9 +400,9 @@ struct buildingplan_hook : public df::viewscreen_dwarfmodest
|
|
|
|
if (ui_build_selector->errors.size() == 0 && planner.allocatePlannedBuilding(type))
|
|
|
|
if (ui_build_selector->errors.size() == 0 && planner.allocatePlannedBuilding(type))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Gui::refreshSidebar();
|
|
|
|
Gui::refreshSidebar();
|
|
|
|
if (planner.inQuickFortMode())
|
|
|
|
if (quickfort_mode)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
planner.in_dummmy_screen = true;
|
|
|
|
in_dummy_screen = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -402,14 +410,7 @@ struct buildingplan_hook : public df::viewscreen_dwarfmodest
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (input->count(interface_key::CUSTOM_SHIFT_F))
|
|
|
|
else if (input->count(interface_key::CUSTOM_SHIFT_F))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (!planner.inQuickFortMode())
|
|
|
|
quickfort_mode = !quickfort_mode;
|
|
|
|
{
|
|
|
|
|
|
|
|
planner.enableQuickfortMode();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
planner.disableQuickfortMode();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (input->count(interface_key::CUSTOM_SHIFT_M))
|
|
|
|
else if (input->count(interface_key::CUSTOM_SHIFT_M))
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -509,7 +510,7 @@ struct buildingplan_hook : public df::viewscreen_dwarfmodest
|
|
|
|
auto type = ui_build_selector->building_type;
|
|
|
|
auto type = ui_build_selector->building_type;
|
|
|
|
if (plannable)
|
|
|
|
if (plannable)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (planner.inQuickFortMode() && planner.in_dummmy_screen)
|
|
|
|
if (quickfort_mode && in_dummy_screen)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Screen::Pen pen(' ',COLOR_BLACK);
|
|
|
|
Screen::Pen pen(' ',COLOR_BLACK);
|
|
|
|
int y = dims.y1 + 1;
|
|
|
|
int y = dims.y1 + 1;
|
|
|
@ -533,7 +534,7 @@ struct buildingplan_hook : public df::viewscreen_dwarfmodest
|
|
|
|
|
|
|
|
|
|
|
|
if (is_planmode_enabled(type))
|
|
|
|
if (is_planmode_enabled(type))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
OutputToggleString(x, y, "Quickfort Mode", "F", planner.inQuickFortMode(), true, left_margin);
|
|
|
|
OutputToggleString(x, y, "Quickfort Mode", "F", quickfort_mode, true, left_margin);
|
|
|
|
|
|
|
|
|
|
|
|
auto filter = planner.getDefaultItemFilterForType(type);
|
|
|
|
auto filter = planner.getDefaultItemFilterForType(type);
|
|
|
|
|
|
|
|
|
|
|
@ -552,13 +553,13 @@ struct buildingplan_hook : public df::viewscreen_dwarfmodest
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
planner.in_dummmy_screen = false;
|
|
|
|
in_dummy_screen = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (isInPlannedBuildingQueryMode())
|
|
|
|
else if (isInPlannedBuildingQueryMode())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
planner.in_dummmy_screen = false;
|
|
|
|
in_dummy_screen = false;
|
|
|
|
|
|
|
|
|
|
|
|
// Hide suspend toggle option
|
|
|
|
// Hide suspend toggle option
|
|
|
|
int y = 20;
|
|
|
|
int y = 20;
|
|
|
@ -597,7 +598,7 @@ struct buildingplan_hook : public df::viewscreen_dwarfmodest
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
planner.in_dummmy_screen = false;
|
|
|
|
in_dummy_screen = false;
|
|
|
|
show_help = false;
|
|
|
|
show_help = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -690,7 +691,7 @@ DFhackCExport command_result plugin_shutdown(color_ostream &)
|
|
|
|
// Lua API section
|
|
|
|
// Lua API section
|
|
|
|
|
|
|
|
|
|
|
|
static bool isPlannableBuilding(df::building_type type) {
|
|
|
|
static bool isPlannableBuilding(df::building_type type) {
|
|
|
|
return planner.isPlanableBuilding(type);
|
|
|
|
return planner.isPlannableBuilding(type);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void addPlannedBuilding(df::building *bld) {
|
|
|
|
static void addPlannedBuilding(df::building *bld) {
|
|
|
|