| 697 | } |
| 698 | |
| 699 | void do_cycle (color_ostream &out, bool unsuspend_everything = false) |
| 700 | { |
| 701 | if (unsuspend_everything){ |
| 702 | suspensions.clear(); |
| 703 | } else { |
| 704 | refresh(out); |
| 705 | } |
| 706 | num_suspend = 0, num_unsuspend = 0; |
| 707 | |
| 708 | Reason reason; |
| 709 | |
| 710 | |
| 711 | for (auto job : df::global::world->jobs.list | std::views::filter(isConstructionJob)) |
| 712 | { |
| 713 | if (job->flags.bits.suspend && !suspensions.contains(job->id)) { |
| 714 | unsuspend(job); // suspended for no reason |
| 715 | ++num_unsuspend; |
| 716 | } else if (!job->flags.bits.suspend && tryGetReason(job,reason)) { |
| 717 | if (!isExternalReason(reason)) { |
| 718 | suspend(job); // has internal reason to be suspended |
| 719 | ++num_suspend; |
| 720 | } |
| 721 | } |
| 722 | } |
| 723 | DEBUG(cycle,out).print("suspended {} constructions and unsuspended {} constructions\n", |
| 724 | num_suspend, num_unsuspend); |
| 725 | } |
| 726 | |
| 727 | static bool isConstructionJob(df::job *job) { |
| 728 | return job->job_type == job_type::ConstructBuilding; |
no test coverage detected