diff --git a/plugins/3dveins.cpp b/plugins/3dveins.cpp index d57a80662..3e51e6582 100644 --- a/plugins/3dveins.cpp +++ b/plugins/3dveins.cpp @@ -10,6 +10,7 @@ #include "PluginManager.h" #include "modules/MapCache.h" #include "modules/Random.h" +#include "modules/World.h" #include "MiscUtils.h" @@ -1626,7 +1627,7 @@ command_result cmd_3dveins(color_ostream &con, std::vector & parame return CR_FAILURE; } - if (*gametype != game_type::DWARF_MAIN && *gametype != game_type::DWARF_RECLAIM) + if (!World::isFortressMode()) { con.printerr("Must be used in fortress mode!\n"); return CR_FAILURE; diff --git a/plugins/createitem.cpp b/plugins/createitem.cpp index 1fc663d07..da793ac0d 100644 --- a/plugins/createitem.cpp +++ b/plugins/createitem.cpp @@ -11,6 +11,7 @@ #include "modules/Gui.h" #include "modules/Items.h" #include "modules/Materials.h" +#include "modules/World.h" #include "DataDefs.h" #include "df/game_type.h" @@ -84,7 +85,7 @@ bool makeItem (df::reaction_product_itemst *prod, df::unit *unit, bool second_it prod->produce(unit, &out_items, &in_reag, &in_items, 1, job_skill::NONE, df::historical_entity::find(unit->civ_id), - ((*gametype == game_type::DWARF_MAIN) || (*gametype == game_type::DWARF_RECLAIM)) ? df::world_site::find(ui->site_id) : NULL); + (World::isFortressMode()) ? df::world_site::find(ui->site_id) : NULL); if (!out_items.size()) return false; // if we asked to make shoes and we got twice as many as we asked, then we're okay @@ -348,7 +349,7 @@ command_result df_createitem (color_ostream &out, vector & parameters) df::unit *unit = Gui::getSelectedUnit(out, true); if (!unit) { - if (*gametype == game_type::ADVENTURE_ARENA || *gametype == game_type::ADVENTURE_MAIN) + if (*gametype == game_type::ADVENTURE_ARENA || World::isAdventureMode()) { // Use the adventurer unit unit = world->units.active[0]; diff --git a/plugins/reveal.cpp b/plugins/reveal.cpp index c6b7cafbf..55608ef23 100644 --- a/plugins/reveal.cpp +++ b/plugins/reveal.cpp @@ -346,7 +346,7 @@ command_result revflood(color_ostream &out, vector & params) } t_gamemodes gm; World::ReadGameMode(gm); - if(gm.g_type != game_type::DWARF_MAIN && gm.g_mode != game_mode::DWARF ) + if(!World::isFortressMode(gm.g_type) || gm.g_mode != game_mode::DWARF ) { out.printerr("Only in proper dwarf mode.\n"); return CR_FAILURE; diff --git a/plugins/seedwatch.cpp b/plugins/seedwatch.cpp index 00b09be87..4fcef60e1 100755 --- a/plugins/seedwatch.cpp +++ b/plugins/seedwatch.cpp @@ -119,8 +119,7 @@ command_result df_seedwatch(color_ostream &out, vector& parameters) World::ReadGameMode(gm);// FIXME: check return value // if game mode isn't fortress mode - if(gm.g_mode != game_mode::DWARF || - !(gm.g_type == game_type::DWARF_MAIN || gm.g_type == game_type::DWARF_RECLAIM)) + if(gm.g_mode != game_mode::DWARF || !World::isFortressMode(gm.g_type)) { // just print the help printHelp(out); @@ -310,8 +309,7 @@ DFhackCExport command_result plugin_onupdate(color_ostream &out) t_gamemodes gm; World::ReadGameMode(gm);// FIXME: check return value // if game mode isn't fortress mode - if(gm.g_mode != game_mode::DWARF || - !(gm.g_type == game_type::DWARF_MAIN || gm.g_type == game_type::DWARF_RECLAIM)) + if(gm.g_mode != game_mode::DWARF || !World::isFortressMode(gm.g_type)) { // stop running. running = false;