| 2292 | } |
| 2293 | |
| 2294 | void Units::setGroupActionTimers(color_ostream &out, df::unit *unit, |
| 2295 | int32_t amount, df::unit_action_type_group affectedActionTypeGroup) |
| 2296 | { |
| 2297 | CHECK_NULL_POINTER(unit); |
| 2298 | if (!validateSetActionTimerAmount(out, amount)) |
| 2299 | return; |
| 2300 | for (auto action : unit->actions) { |
| 2301 | auto list = ENUM_ATTR(unit_action_type, group, action->type); |
| 2302 | for (size_t i = 0; i < list.size; i++) { |
| 2303 | if (list.items[i] == affectedActionTypeGroup) |
| 2304 | { |
| 2305 | mutateActionTimerCore(action, [=](double timerValue){ return amount; }); |
| 2306 | break; |
| 2307 | } |
| 2308 | } |
| 2309 | } |
| 2310 | } |
| 2311 | |
| 2312 | // this is a (loose) reimplementation of df's `unit_handlerst::get_cached_unit_by_global_id` |
| 2313 | df::unit* Units::get_cached_unit_by_global_id(int32_t id, int32_t& index) |
nothing calls this directly
no test coverage detected