From 1a283eaf47167f98c3398ba0c461c4e47721053d Mon Sep 17 00:00:00 2001 From: Kelly Kinkade Date: Wed, 18 Jan 2023 16:24:01 -0600 Subject: [PATCH] autofarm: fix repetition in status output because C++ std::map is not the same as a ruby table --- docs/changelog.txt | 1 + plugins/autofarm.cpp | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/changelog.txt b/docs/changelog.txt index 542c2b54f..c119e0c89 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -36,6 +36,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences: ## New Plugins ## Fixes +- `autofarm`: don't duplicate status line entries for crops with no current supply - `orders`: allow the orders library to be listed and imported properly (if you previously copied the orders library into your ``dfhack-config/orders`` directory to work around this bug, you can remove those files now) ## Misc Improvements diff --git a/plugins/autofarm.cpp b/plugins/autofarm.cpp index 238627c3a..f7acde17f 100644 --- a/plugins/autofarm.cpp +++ b/plugins/autofarm.cpp @@ -332,6 +332,7 @@ public: void status(color_ostream& out) { out << "Autofarm is " << (enabled ? "Active." : "Stopped.") << '\n'; + for (auto& lc : lastCounts) { auto plant = world->raws.plants.all[lc.first]; @@ -340,7 +341,7 @@ public: for (auto& th : thresholds) { - if (lastCounts[th.first] > 0) + if (lastCounts.find(th.first) != lastCounts.end()) continue; auto plant = world->raws.plants.all[th.first]; out << plant->id << " limit " << getThreshold(th.first) << " current 0" << '\n';