MCPcopy Create free account
hub / github.com/DFHack/dfhack / do_cycle

Method do_cycle

plugins/suspendmanager.cpp:699–725  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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;

Callers 2

do_cycleFunction · 0.45
suspendmanager_runOnceFunction · 0.45

Calls 5

filterFunction · 0.85
isExternalReasonFunction · 0.85
containsMethod · 0.80
clearMethod · 0.45
printMethod · 0.45

Tested by

no test coverage detected