Skip to content

Commit

Permalink
Merge pull request #4588 from myk002/myk_nosite
Browse files Browse the repository at this point in the history
check for fortress mode instead of a loaded site
  • Loading branch information
myk002 committed May 12, 2024
2 parents 24359d5 + 53d544a commit 2a5b5e5
Show file tree
Hide file tree
Showing 21 changed files with 40 additions and 40 deletions.
4 changes: 2 additions & 2 deletions plugins/autobutcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ DFhackCExport command_result plugin_init(color_ostream &out, vector <PluginComma
}

DFhackCExport command_result plugin_enable(color_ostream &out, bool enable) {
if (!Core::getInstance().isMapLoaded() || !World::IsSiteLoaded()) {
if (!Core::getInstance().isMapLoaded() || !World::isFortressMode()) {
out.printerr("Cannot enable %s without a loaded fort.\n", plugin_name);
return CR_FAILURE;
}
Expand Down Expand Up @@ -393,7 +393,7 @@ static void autobutcher_modify_watchlist(color_ostream &out, const autobutcher_o
static command_result df_autobutcher(color_ostream &out, vector<string> &parameters) {
CoreSuspender suspend;

if (!Core::getInstance().isMapLoaded() || !World::IsSiteLoaded()) {
if (!Core::getInstance().isMapLoaded() || !World::isFortressMode()) {
out.printerr("Cannot run %s without a loaded fort.\n", plugin_name);
return CR_FAILURE;
}
Expand Down
4 changes: 2 additions & 2 deletions plugins/autochop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ DFhackCExport command_result plugin_init(color_ostream &out, std::vector <Plugin
}

DFhackCExport command_result plugin_enable(color_ostream &out, bool enable) {
if (!Core::getInstance().isMapLoaded() || !World::IsSiteLoaded()) {
if (!Core::getInstance().isMapLoaded() || !World::isFortressMode()) {
out.printerr("Cannot enable %s without a loaded fort.\n", plugin_name);
return CR_FAILURE;
}
Expand Down Expand Up @@ -201,7 +201,7 @@ DFhackCExport command_result plugin_onupdate(color_ostream &out) {
static command_result do_command(color_ostream &out, vector<string> &parameters) {
CoreSuspender suspend;

if (!Core::getInstance().isMapLoaded() || !World::IsSiteLoaded()) {
if (!Core::getInstance().isMapLoaded() || !World::isFortressMode()) {
out.printerr("Cannot run %s without a loaded fort.\n", plugin_name);
return CR_FAILURE;
}
Expand Down
4 changes: 2 additions & 2 deletions plugins/autoclothing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ DFhackCExport command_result plugin_save_site_data (color_ostream &out)
}

DFhackCExport command_result plugin_enable(color_ostream& out, bool enable) {
if (!Core::getInstance().isMapLoaded() || !World::IsSiteLoaded()) {
if (!Core::getInstance().isMapLoaded() || !World::isFortressMode()) {
out.printerr("Cannot enable %s without a loaded fort.\n", plugin_name);
return CR_FAILURE;
}
Expand Down Expand Up @@ -441,7 +441,7 @@ command_result autoclothing(color_ostream &out, vector <string> & parameters)
// be sure to suspend the core if any DF state is read or modified
CoreSuspender suspend;

if (!Core::getInstance().isMapLoaded() || !World::IsSiteLoaded()) {
if (!Core::getInstance().isMapLoaded() || !World::isFortressMode()) {
out.printerr("Cannot run %s without a loaded fort.\n", plugin_name);
return CR_FAILURE;
}
Expand Down
4 changes: 2 additions & 2 deletions plugins/autofarm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ DFhackCExport command_result plugin_onupdate(color_ostream& out)

DFhackCExport command_result plugin_enable(color_ostream& out, bool enable)
{
if (!Core::getInstance().isMapLoaded() || !World::IsSiteLoaded()) {
if (!Core::getInstance().isMapLoaded() || !World::isFortressMode()) {
out.printerr("Cannot enable %s without a loaded fort.\n", plugin_name);
return CR_FAILURE;
}
Expand Down Expand Up @@ -511,7 +511,7 @@ static command_result setThresholds(color_ostream& out, std::vector<std::string>

static command_result autofarm(color_ostream& out, std::vector<std::string>& parameters)
{
if (!Core::getInstance().isMapLoaded() || !World::IsSiteLoaded()) {
if (!Core::getInstance().isMapLoaded() || !World::isFortressMode()) {
out.printerr("Cannot run %s without a loaded fort.\n", plugin_name);
return CR_FAILURE;
}
Expand Down
4 changes: 2 additions & 2 deletions plugins/autolabor/autolabor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1072,7 +1072,7 @@ void print_labor (df::unit_labor labor, color_ostream &out)

DFhackCExport command_result plugin_enable ( color_ostream &out, bool enable )
{
if (!Core::getInstance().isMapLoaded() || !World::IsSiteLoaded()) {
if (!Core::getInstance().isMapLoaded() || !World::isFortressMode()) {
out.printerr("Cannot enable %s without a loaded fort.\n", plugin_name);
return CR_FAILURE;
}
Expand All @@ -1093,7 +1093,7 @@ command_result autolabor (color_ostream &out, std::vector <std::string> & parame
{
CoreSuspender suspend;

if (!Core::getInstance().isMapLoaded() || !World::IsSiteLoaded()) {
if (!Core::getInstance().isMapLoaded() || !World::isFortressMode()) {
out.printerr("Cannot run %s without a loaded fort.\n", plugin_name);
return CR_FAILURE;
}
Expand Down
4 changes: 2 additions & 2 deletions plugins/autonestbox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ DFhackCExport command_result plugin_init(color_ostream &out, std::vector <Plugin
}

DFhackCExport command_result plugin_enable(color_ostream &out, bool enable) {
if (!Core::getInstance().isMapLoaded() || !World::IsSiteLoaded()) {
if (!Core::getInstance().isMapLoaded() || !World::isFortressMode()) {
out.printerr("Cannot enable %s without a loaded fort.\n", plugin_name);
return CR_FAILURE;
}
Expand Down Expand Up @@ -139,7 +139,7 @@ struct_identity autonestbox_options::_identity(sizeof(autonestbox_options), &df:
static command_result df_autonestbox(color_ostream &out, vector<string> &parameters) {
CoreSuspender suspend;

if (!Core::getInstance().isMapLoaded() || !World::IsSiteLoaded()) {
if (!Core::getInstance().isMapLoaded() || !World::isFortressMode()) {
out.printerr("Cannot run %s without a loaded fort.\n", plugin_name);
return CR_FAILURE;
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/autoslab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ DFhackCExport command_result plugin_init(color_ostream &out, std::vector<PluginC

DFhackCExport command_result plugin_enable(color_ostream &out, bool enable)
{
if (!Core::getInstance().isMapLoaded() || !World::IsSiteLoaded())
if (!Core::getInstance().isMapLoaded() || !World::isFortressMode())
{
out.printerr("Cannot enable %s without a loaded fort.\n", plugin_name);
return CR_FAILURE;
Expand Down
6 changes: 3 additions & 3 deletions plugins/buildingplan/buildingplan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ static void do_cycle(color_ostream &out) {
}

DFhackCExport command_result plugin_onupdate(color_ostream &out) {
if (!Core::getInstance().isMapLoaded() || !World::IsSiteLoaded())
if (!Core::getInstance().isMapLoaded() || !World::isFortressMode())
return CR_OK;

if (is_enabled &&
Expand All @@ -343,7 +343,7 @@ DFhackCExport command_result plugin_onupdate(color_ostream &out) {
static command_result do_command(color_ostream &out, vector<string> &parameters) {
CoreSuspender suspend;

if (!Core::getInstance().isMapLoaded() || !World::IsSiteLoaded()) {
if (!Core::getInstance().isMapLoaded() || !World::isFortressMode()) {
out.printerr("Cannot configure %s without a loaded fort.\n", plugin_name);
return CR_FAILURE;
}
Expand Down Expand Up @@ -756,7 +756,7 @@ static int countAvailableItems(color_ostream &out, df::building_type type, int16

static bool hasFilter(color_ostream &out, df::building_type type, int16_t subtype, int32_t custom, int index) {
TRACE(control,out).print("entering hasFilter\n");
if (!Core::getInstance().isMapLoaded() || !World::IsSiteLoaded())
if (!Core::getInstance().isMapLoaded() || !World::isFortressMode())
return false;
BuildingTypeKey key(type, subtype, custom);
auto &filters = get_item_filters(out, key);
Expand Down
4 changes: 2 additions & 2 deletions plugins/burrow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ DFhackCExport command_result plugin_onstatechange(color_ostream &out, state_chan
static command_result do_command(color_ostream &out, vector<string> &parameters) {
CoreSuspender suspend;

if (!Core::getInstance().isMapLoaded() || !World::IsSiteLoaded()) {
if (!Core::getInstance().isMapLoaded() || !World::isFortressMode()) {
out.printerr("Cannot run %s without a loaded fort.\n", plugin_name);
return CR_FAILURE;
}
Expand All @@ -112,7 +112,7 @@ static command_result do_command(color_ostream &out, vector<string> &parameters)
//

static void init_diggers(color_ostream& out) {
if (!Core::getInstance().isMapLoaded() || !World::IsSiteLoaded()) {
if (!Core::getInstance().isMapLoaded() || !World::isFortressMode()) {
DEBUG(status, out).print("map not yet loaded; not scanning jobs\n");
return;
}
Expand Down
4 changes: 2 additions & 2 deletions plugins/dwarfvet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ DFhackCExport command_result plugin_init(color_ostream &out, vector <PluginComma
}

DFhackCExport command_result plugin_enable(color_ostream &out, bool enable) {
if (!Core::getInstance().isMapLoaded() || !World::IsSiteLoaded()) {
if (!Core::getInstance().isMapLoaded() || !World::isFortressMode()) {
out.printerr("Cannot enable %s without a loaded fort.\n", plugin_name);
return CR_FAILURE;
}
Expand Down Expand Up @@ -121,7 +121,7 @@ DFhackCExport command_result plugin_onupdate(color_ostream &out) {
static command_result do_command(color_ostream &out, vector<string> &parameters) {
CoreSuspender suspend;

if (!Core::getInstance().isMapLoaded() || !World::IsSiteLoaded()) {
if (!Core::getInstance().isMapLoaded() || !World::isFortressMode()) {
out.printerr("Cannot run %s without a loaded fort.\n", plugin_name);
return CR_FAILURE;
}
Expand Down
4 changes: 2 additions & 2 deletions plugins/logistics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ DFhackCExport command_result plugin_load_site_data(color_ostream &out) {
}

DFhackCExport command_result plugin_onupdate(color_ostream &out) {
if (!is_enabled || !Core::getInstance().isMapLoaded() || !World::IsSiteLoaded())
if (!is_enabled || !Core::getInstance().isMapLoaded() || !World::isFortressMode())
return CR_OK;
if (world->frame_counter - cycle_timestamp >= CYCLE_TICKS) {
int32_t melt_count = 0, trade_count = 0, dump_count = 0, train_count = 0;
Expand All @@ -198,7 +198,7 @@ DFhackCExport command_result plugin_onupdate(color_ostream &out) {
static command_result do_command(color_ostream &out, vector<string> &parameters) {
CoreSuspender suspend;

if (!Core::getInstance().isMapLoaded() || !World::IsSiteLoaded()) {
if (!Core::getInstance().isMapLoaded() || !World::isFortressMode()) {
out.printerr("Cannot run %s without a loaded fort.\n", plugin_name);
return CR_FAILURE;
}
Expand Down
4 changes: 2 additions & 2 deletions plugins/misery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ DFhackCExport command_result plugin_init(color_ostream &out, std::vector <Plugin
}

DFhackCExport command_result plugin_enable(color_ostream &out, bool enable) {
if (!Core::getInstance().isMapLoaded() || !World::IsSiteLoaded()) {
if (!Core::getInstance().isMapLoaded() || !World::isFortressMode()) {
out.printerr("Cannot enable %s without a loaded fort.\n", plugin_name);
return CR_FAILURE;
}
Expand Down Expand Up @@ -124,7 +124,7 @@ DFhackCExport command_result plugin_onupdate(color_ostream &out) {
static command_result do_command(color_ostream &out, vector<string> &parameters) {
CoreSuspender suspend;

if (!Core::getInstance().isMapLoaded() || !World::IsSiteLoaded()) {
if (!Core::getInstance().isMapLoaded() || !World::isFortressMode()) {
out.printerr("Cannot run %s without a loaded fort.\n", plugin_name);
return CR_FAILURE;
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/nestboxes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ DFhackCExport command_result plugin_init(color_ostream &out, std::vector <Plugin
}

DFhackCExport command_result plugin_enable(color_ostream &out, bool enable) {
if (!Core::getInstance().isMapLoaded() || !World::IsSiteLoaded()) {
if (!Core::getInstance().isMapLoaded() || !World::isFortressMode()) {
out.printerr("Cannot enable %s without a loaded fort.\n", plugin_name);
return CR_FAILURE;
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/orders.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ static command_result orders_command(color_ostream & out, std::vector<std::strin
return orders_list_command(out);
}

if (!Core::getInstance().isMapLoaded() || !World::IsSiteLoaded()) {
if (!Core::getInstance().isMapLoaded() || !World::isFortressMode()) {
out.printerr("Cannot run %s without a loaded fort.\n", plugin_name);
return CR_FAILURE;
}
Expand Down
4 changes: 2 additions & 2 deletions plugins/pet-uncapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ void impregnateMany(color_ostream &out, bool verbose = false) {
command_result do_command(color_ostream &out, vector<string> & parameters) {
CoreSuspender suspend;

if (!Core::getInstance().isMapLoaded() || !World::IsSiteLoaded()) {
if (!Core::getInstance().isMapLoaded() || !World::isFortressMode()) {
out.printerr("Cannot run %s without a loaded fort.\n", plugin_name);
return CR_FAILURE;
}
Expand Down Expand Up @@ -166,7 +166,7 @@ DFhackCExport command_result plugin_init(color_ostream &out, vector<PluginComman
}

DFhackCExport command_result plugin_enable(color_ostream &out, bool enable) {
if (!Core::getInstance().isMapLoaded() || !World::IsSiteLoaded()) {
if (!Core::getInstance().isMapLoaded() || !World::isFortressMode()) {
out.printerr("Cannot enable %s without a loaded fort.\n", plugin_name);
return CR_FAILURE;
}
Expand Down
4 changes: 2 additions & 2 deletions plugins/preserve-tombs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ DFhackCExport command_result plugin_init(color_ostream &out, std::vector <Plugin
}

static command_result do_command(color_ostream& out, std::vector<std::string>& params) {
if (!Core::getInstance().isMapLoaded() || !World::IsSiteLoaded()) {
if (!Core::getInstance().isMapLoaded() || !World::isFortressMode()) {
out.printerr("Cannot use %s without a loaded fort.\n", plugin_name);
return CR_FAILURE;
}
Expand Down Expand Up @@ -88,7 +88,7 @@ static command_result do_command(color_ostream& out, std::vector<std::string>& p
EventManager::EventHandler assign_tomb_handler(plugin_self, onUnitDeath, 0);

DFhackCExport command_result plugin_enable(color_ostream &out, bool enable) {
if (!Core::getInstance().isMapLoaded() || !World::IsSiteLoaded()) {
if (!Core::getInstance().isMapLoaded() || !World::isFortressMode()) {
out.printerr("Cannot enable %s without a loaded fort.\n", plugin_name);
return CR_FAILURE;
}
Expand Down
4 changes: 2 additions & 2 deletions plugins/seedwatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ DFhackCExport command_result plugin_init(color_ostream &out, std::vector <Plugin
}

DFhackCExport command_result plugin_enable(color_ostream &out, bool enable) {
if (!Core::getInstance().isMapLoaded() || !World::IsSiteLoaded()) {
if (!Core::getInstance().isMapLoaded() || !World::isFortressMode()) {
out.printerr("Cannot enable %s without a loaded fort.\n", plugin_name);
return CR_FAILURE;
}
Expand Down Expand Up @@ -235,7 +235,7 @@ DFhackCExport command_result plugin_onupdate(color_ostream &out) {
static command_result do_command(color_ostream &out, vector<string> &parameters) {
CoreSuspender suspend;

if (!Core::getInstance().isMapLoaded() || !World::IsSiteLoaded()) {
if (!Core::getInstance().isMapLoaded() || !World::isFortressMode()) {
out.printerr("Cannot run %s without a loaded fort.\n", plugin_name);
return CR_FAILURE;
}
Expand Down
4 changes: 2 additions & 2 deletions plugins/spectate/spectate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ DFhackCExport command_result plugin_load_site_data (color_ostream &out) {
}

DFhackCExport command_result plugin_enable(color_ostream &out, bool enable) {
if (!Core::getInstance().isMapLoaded() || !World::IsSiteLoaded()) {
if (!Core::getInstance().isMapLoaded() || !World::isFortressMode()) {
out.printerr("Cannot run %s without a loaded fort.\n", plugin_name);
return CR_FAILURE;
}
Expand Down Expand Up @@ -433,7 +433,7 @@ DFhackCExport command_result plugin_onupdate(color_ostream &out) {
}

command_result spectate (color_ostream &out, std::vector <std::string> & parameters) {
if (!Core::getInstance().isMapLoaded() || !World::IsSiteLoaded()) {
if (!Core::getInstance().isMapLoaded() || !World::isFortressMode()) {
out.printerr("Cannot run %s without a loaded fort.\n", plugin_name);
return CR_FAILURE;
}
Expand Down
4 changes: 2 additions & 2 deletions plugins/suspendmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -777,7 +777,7 @@ DFhackCExport command_result plugin_init(color_ostream &out, std::vector <Plugin
}

DFhackCExport command_result plugin_enable(color_ostream &out, bool enable) {
if (!Core::getInstance().isMapLoaded() || !World::IsSiteLoaded()) {
if (!Core::getInstance().isMapLoaded() || !World::isFortressMode()) {
out.printerr("Cannot enable %s without a loaded fort.\n", plugin_name);
return CR_FAILURE;
}
Expand Down Expand Up @@ -859,7 +859,7 @@ static command_result do_command(color_ostream &out, vector<string> &parameters)
// be sure to suspend the core if any DF state is read or modified
CoreSuspender suspend;

if (!Core::getInstance().isMapLoaded() || !World::IsSiteLoaded()) {
if (!Core::getInstance().isMapLoaded() || !World::isFortressMode()) {
out.printerr("Cannot run %s without a loaded fort.\n", plugin_name);
return CR_FAILURE;
}
Expand Down
4 changes: 2 additions & 2 deletions plugins/tailor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,7 @@ DFhackCExport command_result plugin_init(color_ostream &out, std::vector <Plugin
}

DFhackCExport command_result plugin_enable(color_ostream &out, bool enable) {
if (!Core::getInstance().isMapLoaded() || !World::IsSiteLoaded()) {
if (!Core::getInstance().isMapLoaded() || !World::isFortressMode()) {
out.printerr("Cannot enable %s without a loaded fort.\n", plugin_name);
return CR_FAILURE;
}
Expand Down Expand Up @@ -712,7 +712,7 @@ DFhackCExport command_result plugin_onupdate(color_ostream &out) {
static command_result do_command(color_ostream &out, vector<string> &parameters) {
CoreSuspender suspend;

if (!Core::getInstance().isMapLoaded() || !World::IsSiteLoaded()) {
if (!Core::getInstance().isMapLoaded() || !World::isFortressMode()) {
out.printerr("Cannot run %s without a loaded fort.\n", plugin_name);
return CR_FAILURE;
}
Expand Down
4 changes: 2 additions & 2 deletions plugins/work-now.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ static void cleanup() {
}

DFhackCExport command_result plugin_enable(color_ostream &out, bool enable) {
if (!Core::getInstance().isMapLoaded() || !World::IsSiteLoaded()) {
if (!Core::getInstance().isMapLoaded() || !World::isFortressMode()) {
out.printerr("Cannot enable %s without a loaded fort.\n", plugin_name);
return CR_FAILURE;
}
Expand Down Expand Up @@ -110,7 +110,7 @@ DFhackCExport command_result plugin_onstatechange(color_ostream &out, state_chan
}

static command_result work_now(color_ostream& out, vector<string>& parameters) {
if (!Core::getInstance().isMapLoaded() || !World::IsSiteLoaded()) {
if (!Core::getInstance().isMapLoaded() || !World::isFortressMode()) {
out.printerr("Cannot run %s without a loaded fort.\n", plugin_name);
return CR_FAILURE;
}
Expand Down

0 comments on commit 2a5b5e5

Please sign in to comment.