| 149 | } |
| 150 | |
| 151 | void buildings_onUpdate(color_ostream &out) |
| 152 | { |
| 153 | buildings_do_onupdate = false; |
| 154 | |
| 155 | df::job_list_link *link = world->jobs.list.next; |
| 156 | for (; link; link = link->next) { |
| 157 | df::job *job = link->item; |
| 158 | |
| 159 | if (job->job_type != job_type::ConstructBuilding) |
| 160 | continue; |
| 161 | if (job->job_items.elements.empty()) |
| 162 | continue; |
| 163 | |
| 164 | buildings_do_onupdate = true; |
| 165 | |
| 166 | for (size_t i = 0; i < job->items.size(); i++) |
| 167 | { |
| 168 | df::job_item_ref *iref = job->items[i]; |
| 169 | if (iref->role != df::job_role_type::Reagent) |
| 170 | continue; |
| 171 | df::job_item *item = vector_get(job->job_items.elements, iref->job_item_idx); |
| 172 | if (!item) |
| 173 | continue; |
| 174 | // Convert Reagent to Hauled, while decrementing quantity |
| 175 | item->quantity = std::max(0, item->quantity-1); |
| 176 | iref->role = df::job_role_type::Hauled; |
| 177 | iref->job_item_idx = -1; |
| 178 | } |
| 179 | } |
| 180 | } |
| 181 | |
| 182 | static void building_into_zone_unidir(df::building* bld, df::building_civzonest* zone) |
| 183 | { |
no test coverage detected