autofarm: fix repetition in status output

because C++ std::map is not the same as a ruby table
develop
Kelly Kinkade 2023-01-18 16:24:01 -06:00
parent 74d311c00c
commit 1a283eaf47
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.find(th.first) != lastCounts.end())
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';