diff --git a/docs/changelog.txt b/docs/changelog.txt index 2ab2f3a51..edbb6e853 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -40,6 +40,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences: - Core: ``alt`` keydown state is now cleared when DF loses and regains focus, ensuring the ``alt`` modifier state is not stuck on for systems that don't send standard keyup events in response to ``alt-tab`` window manager events ## Misc Improvements +- `buildingplan`: now displays which items are attached and which items are still missing for planned buildings - `tiletypes-here`, `tiletypes-here-point`: add --cursor and --quiet options to support non-interactive use cases ## Documentation diff --git a/plugins/buildingplan.cpp b/plugins/buildingplan.cpp index 08888f2c7..1eb1dd9e6 100644 --- a/plugins/buildingplan.cpp +++ b/plugins/buildingplan.cpp @@ -498,6 +498,17 @@ struct buildingplan_query_hook : public df::viewscreen_dwarfmodest INTERPOSE_NEXT(feed)(input); } + static bool is_filter_satisfied(df::building *bld, int filter_idx) + { + if (!bld + || bld->jobs.size() < 1 + || bld->jobs[0]->job_items.size() <= filter_idx) + return false; + + // if all items for this filter are attached, the quantity will be 0 + return bld->jobs[0]->job_items[filter_idx]->quantity == 0; + } + DEFINE_VMETHOD_INTERPOSE(void, render, ()) { INTERPOSE_NEXT(render)(); @@ -515,10 +526,12 @@ struct buildingplan_query_hook : public df::viewscreen_dwarfmodest Screen::Pen pen(' ', COLOR_BLACK); Screen::fillRect(pen, x, y, dims.menu_x2, y); + bool attached = is_filter_satisfied(pb->getBuilding(), filter_idx); + auto & filter = pb->getFilters()[filter_idx]; y = 24; std::string item_label = - stl_sprintf("Item %d of %d", filter_count - filter_idx, filter_count); + stl_sprintf("Item %d of %d (%s)", filter_count - filter_idx, filter_count, attached ? "attached" : "pending"); OutputString(COLOR_WHITE, x, y, "Planned Building Filter", true, left_margin + 1); OutputString(COLOR_WHITE, x, y, item_label.c_str(), true, left_margin + 1); OutputString(COLOR_WHITE, x, y, get_item_label(toBuildingTypeKey(bld), filter_idx).c_str(), true, left_margin);