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

Method listNewlyCreated

library/modules/Job.cpp:574–600  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

572}
573
574bool DFHack::Job::listNewlyCreated(std::vector<df::job*> *pvec, int *id_var)
575{
576 using df::global::world;
577 using df::global::job_next_id;
578
579 pvec->clear();
580
581 if (!job_next_id || *job_next_id <= *id_var)
582 return false;
583
584 int old_id = *id_var;
585 int cur_id = *job_next_id;
586
587 *id_var = cur_id;
588
589 pvec->reserve(std::min(20,cur_id - old_id));
590
591 df::job_list_link *link = world->jobs.list.next;
592 for (; link; link = link->next)
593 {
594 int id = link->item->id;
595 if (id >= old_id)
596 pvec->push_back(link->item);
597 }
598
599 return true;
600}
601
602bool DFHack::Job::attachJobItem(df::job *job, df::item *item,
603 df::job_role_type role,

Callers

nothing calls this directly

Calls 2

reserveMethod · 0.80
clearMethod · 0.45

Tested by

no test coverage detected