| 508 | }; |
| 509 | |
| 510 | static void scan_logs(color_ostream &out, int32_t *usable_logs, |
| 511 | const vector<df::unit *> &citizens, int32_t *inaccessible_logs = NULL) { |
| 512 | static const BadFlags bad_flags; |
| 513 | |
| 514 | TRACE(cycle,out).print("scanning logs\n"); |
| 515 | if (usable_logs) |
| 516 | *usable_logs = 0; |
| 517 | if (inaccessible_logs) |
| 518 | *inaccessible_logs = 0; |
| 519 | |
| 520 | for (auto &item : world->items.other[items_other_id::IN_PLAY]) { |
| 521 | TRACE(cycle,out).print(" scanning log {}\n", item->id); |
| 522 | if (item->flags.whole & bad_flags.whole) |
| 523 | continue; |
| 524 | |
| 525 | if (item->getType() != item_type::WOOD) |
| 526 | continue; |
| 527 | |
| 528 | if (!is_valid_item(item)) |
| 529 | continue; |
| 530 | |
| 531 | if (!is_accessible_item(item, citizens)) { |
| 532 | if (inaccessible_logs) |
| 533 | ++*inaccessible_logs; |
| 534 | } else if (usable_logs) { |
| 535 | ++*usable_logs; |
| 536 | } |
| 537 | } |
| 538 | } |
| 539 | |
| 540 | static int32_t do_cycle(color_ostream &out, bool force_designate) { |
| 541 | DEBUG(cycle,out).print("running {} cycle\n", plugin_name); |
no test coverage detected