| 519 | } |
| 520 | |
| 521 | static void printStatus(color_ostream &out) { |
| 522 | DEBUG(control,out).print("entering buildingplan_printStatus\n"); |
| 523 | out.print("buildingplan is {}\n\n", is_enabled ? "enabled" : "disabled"); |
| 524 | out.print("Current settings:\n"); |
| 525 | out.print(" use blocks: {}\n", config.get_bool(CONFIG_BLOCKS) ? "yes" : "no"); |
| 526 | out.print(" use boulders: {}\n", config.get_bool(CONFIG_BOULDERS) ? "yes" : "no"); |
| 527 | out.print(" use logs: {}\n", config.get_bool(CONFIG_LOGS) ? "yes" : "no"); |
| 528 | out.print(" use bars: {}\n", config.get_bool(CONFIG_BARS) ? "yes" : "no"); |
| 529 | out.print(" plan constructions on tiles with existing constructed floors/ramps when using box select: {}\n", |
| 530 | config.get_bool(CONFIG_RECONSTRUCT) ? "yes" : "no"); |
| 531 | auto burrow = df::burrow::find(config.get_int(CONFIG_BURROW)); |
| 532 | out.print(" ignore building materials in burrow: {}\n", burrow ? burrow->name.c_str() : "none"); |
| 533 | out.print("\n"); |
| 534 | |
| 535 | size_t bld_count = 0; |
| 536 | map<string, int32_t> counts; |
| 537 | int32_t total = 0; |
| 538 | for (auto &entry : planned_buildings) { |
| 539 | auto &pb = entry.second; |
| 540 | // don't actually remove bad buildings from the list while we're |
| 541 | // actively iterating through that list |
| 542 | auto bld = pb.getBuildingIfValidOrRemoveIfNot(out, true); |
| 543 | if (!bld || bld->jobs.size() != 1) |
| 544 | continue; |
| 545 | auto &job_items = bld->jobs[0]->job_items.elements; |
| 546 | const size_t num_job_items = job_items.size(); |
| 547 | if (num_job_items != pb.vector_ids.size()) |
| 548 | continue; |
| 549 | ++bld_count; |
| 550 | int job_item_idx = 0; |
| 551 | for (auto &vec_ids : pb.vector_ids) { |
| 552 | auto &jitem = job_items[num_job_items - (job_item_idx+1)]; |
| 553 | int32_t quantity = jitem->quantity; |
| 554 | if (quantity) { |
| 555 | counts[get_desc_string(out, jitem, vec_ids)] += quantity; |
| 556 | total += quantity; |
| 557 | } |
| 558 | ++job_item_idx; |
| 559 | } |
| 560 | } |
| 561 | |
| 562 | if (bld_count) { |
| 563 | out.print("Waiting for {} item(s) to be produced for {} building(s):\n", |
| 564 | total, bld_count); |
| 565 | for (auto &count : counts) |
| 566 | out.print(" {:3} {}{}\n", count.second, count.first, count.second == 1 ? "" : "s"); |
| 567 | } else { |
| 568 | out.print("Currently no planned buildings\n"); |
| 569 | } |
| 570 | out.print("\n"); |
| 571 | } |
| 572 | |
| 573 | static bool setSetting(color_ostream &out, string name, bool value) { |
| 574 | DEBUG(control,out).print("entering setSetting ({} -> {})\n", name, value ? "true" : "false"); |
nothing calls this directly
no test coverage detected