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

Method setGroupActionTimers

library/modules/Units.cpp:2294–2310  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2292}
2293
2294void 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`
2313df::unit* Units::get_cached_unit_by_global_id(int32_t id, int32_t& index)

Callers

nothing calls this directly

Calls 2

mutateActionTimerCoreFunction · 0.85

Tested by

no test coverage detected