diff --git a/docs/changelog.txt b/docs/changelog.txt index 23839e179a..310c538652 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -61,7 +61,7 @@ Template for new versions: - `dig-now`: fix cases where boulders/rough gems of incorrect material were being generated when digging through walls - `dig-now`: properly generate ice boulders when digging through ice walls - `gui/teleport`: now properly handles teleporting units that are currently falling or being flung -- ``Core.cpp``: now properly handles "load", "unload", and "reload" plugin commands given to Core::runCommand() +- `unload`: fix recent regression where `unload` would immediately `reload` the target ## Misc Improvements - `spectate`: show dwarves' activities (like prayer) diff --git a/library/Core.cpp b/library/Core.cpp index 2b02c46fe4..6e875648fb 100644 --- a/library/Core.cpp +++ b/library/Core.cpp @@ -818,19 +818,22 @@ command_result Core::runCommand(color_ostream &con, const std::string &first_, s ret = CR_FAILURE; else if (unload && !plug_mgr->unloadAll()) ret = CR_FAILURE; - else if (!plug_mgr->reloadAll()) + else if (reload && !plug_mgr->reloadAll()) ret = CR_FAILURE; } - for (auto p = parts.begin(); p != parts.end(); p++) + else { - if (!p->size() || (*p)[0] == '-') - continue; - if (load && !plug_mgr->load(*p)) - ret = CR_FAILURE; - else if (unload && !plug_mgr->unload(*p)) - ret = CR_FAILURE; - else if (reload && !plug_mgr->reload(*p)) - ret = CR_FAILURE; + for (auto p = parts.begin(); p != parts.end(); p++) + { + if (!p->size() || (*p)[0] == '-') + continue; + if (load && !plug_mgr->load(*p)) + ret = CR_FAILURE; + else if (unload && !plug_mgr->unload(*p)) + ret = CR_FAILURE; + else if (reload && !plug_mgr->reload(*p)) + ret = CR_FAILURE; + } } if (ret != CR_OK) con.printerr("%s failed\n", first.c_str());