Merge pull request #2658 from ab9rf/autofarm-5005-alpha2

autofarm: fix repetition in status output
develop
Myk 2023-01-18 15:51:36 -08:00 committed by GitHub
commit 4e88a9f562
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

@ -36,6 +36,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences:
## New Plugins ## New Plugins
## Fixes ## 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) - `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 ## Misc Improvements

@ -332,6 +332,7 @@ public:
void status(color_ostream& out) void status(color_ostream& out)
{ {
out << "Autofarm is " << (enabled ? "Active." : "Stopped.") << '\n'; out << "Autofarm is " << (enabled ? "Active." : "Stopped.") << '\n';
for (auto& lc : lastCounts) for (auto& lc : lastCounts)
{ {
auto plant = world->raws.plants.all[lc.first]; auto plant = world->raws.plants.all[lc.first];
@ -340,7 +341,7 @@ public:
for (auto& th : thresholds) for (auto& th : thresholds)
{ {
if (lastCounts[th.first] > 0) if (lastCounts.count(th.first) > 0)
continue; continue;
auto plant = world->raws.plants.all[th.first]; auto plant = world->raws.plants.all[th.first];
out << plant->id << " limit " << getThreshold(th.first) << " current 0" << '\n'; out << plant->id << " limit " << getThreshold(th.first) << " current 0" << '\n';