MCPcopy Create free account
hub / github.com/DFHack/dfhack / workflow_cmd

Function workflow_cmd

plugins/workflow.cpp:1667–1836  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1665}
1666
1667static command_result workflow_cmd(color_ostream &out, vector <string> & parameters)
1668{
1669 if (!Core::getInstance().isWorldLoaded()) {
1670 out.printerr("World is not loaded: please load a game first.\n");
1671 return CR_FAILURE;
1672 }
1673
1674 update_data_structures(out);
1675
1676 df::building *workshop = NULL;
1677 //FIXME: unused variable!
1678 //df::job *job = NULL;
1679
1680 if (Gui::dwarfmode_hotkey(Core::getTopViewscreen()) &&
1681 plotinfo->main.mode == ui_sidebar_mode::QueryBuilding)
1682 {
1683 workshop = world->selected_building;
1684 //job = Gui::getSelectedWorkshopJob(out, true);
1685 }
1686
1687 std::string cmd = parameters.empty() ? "list" : parameters[0];
1688
1689 if (cmd == "enable" || cmd == "disable")
1690 {
1691 bool enable = (cmd == "enable");
1692 if (enable)
1693 plugin_enable(out, true);
1694 else if (parameters.size() == 1)
1695 {
1696 plugin_enable(out, false);
1697
1698 out << "The plugin is disabled." << endl;
1699 return CR_OK;
1700 }
1701
1702 for (size_t i = 1; i < parameters.size(); i++)
1703 {
1704 if (parameters[i] == "drybuckets")
1705 setOptionEnabled(CF_DRYBUCKETS, enable);
1706 else if (parameters[i] == "auto-melt")
1707 setOptionEnabled(CF_AUTOMELT, enable);
1708 else
1709 return CR_WRONG_USAGE;
1710 }
1711
1712 if (enabled)
1713 out << "The plugin is enabled." << endl;
1714 else
1715 out << "The plugin is disabled." << endl;
1716
1717 if (isOptionEnabled(CF_DRYBUCKETS))
1718 out << "Option drybuckets is enabled." << endl;
1719 if (isOptionEnabled(CF_AUTOMELT))
1720 out << "Option auto-melt is enabled." << endl;
1721
1722 return CR_OK;
1723 }
1724 else if (cmd == "count" || cmd == "amount")

Callers

nothing calls this directly

Calls 15

update_data_structuresFunction · 0.85
print_jobFunction · 0.85
get_knownFunction · 0.85
print_constraintFunction · 0.85
get_constraintFunction · 0.85
process_constraintsFunction · 0.85
deleteConstraintFunction · 0.85
delete_constraintFunction · 0.85
isLiveMethod · 0.80
goalByCountMethod · 0.80
goalCountMethod · 0.80
goalGapMethod · 0.80

Tested by

no test coverage detected