| 320 | } |
| 321 | |
| 322 | void DFHack::Job::setJobCooldown(df::building *workshop, df::unit *worker, int cooldown) |
| 323 | { |
| 324 | CHECK_NULL_POINTER(workshop); |
| 325 | CHECK_NULL_POINTER(worker); |
| 326 | |
| 327 | if (cooldown <= 0) |
| 328 | return; |
| 329 | |
| 330 | int idx = linear_index(workshop->job_claim_suppress, &df::job_restrictionst::unit, worker); |
| 331 | |
| 332 | if (idx < 0) |
| 333 | { |
| 334 | auto obj = new df::job_restrictionst; |
| 335 | obj->unit = worker; |
| 336 | obj->timer = cooldown; |
| 337 | workshop->job_claim_suppress.push_back(obj); |
| 338 | } |
| 339 | else |
| 340 | { |
| 341 | auto obj = workshop->job_claim_suppress[idx]; |
| 342 | obj->timer = std::max(obj->timer, cooldown); |
| 343 | } |
| 344 | } |
| 345 | |
| 346 | void DFHack::Job::disconnectJobItem(df::job *job, df::job_item_ref *item_ref) { |
| 347 | if (!item_ref) return; |
nothing calls this directly
no test coverage detected