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

Method subtractGroupActionTimers

library/modules/Units.cpp:2222–2236  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2220}
2221
2222void Units::subtractGroupActionTimers(color_ostream &out, df::unit *unit,
2223 int32_t amount, df::unit_action_type_group affectedActionTypeGroup)
2224{
2225 CHECK_NULL_POINTER(unit);
2226 for (auto action : unit->actions) {
2227 auto list = ENUM_ATTR(unit_action_type, group, action->type);
2228 for (size_t i = 0; i < list.size; i++) {
2229 if (list.items[i] == affectedActionTypeGroup)
2230 {
2231 mutateActionTimerCore(action, [=](double timerValue){ return max(timerValue - amount, 1.0); });
2232 break;
2233 }
2234 }
2235 }
2236}
2237
2238static bool validateMultiplyActionTimerAmount(color_ostream &out, float amount) {
2239 if (amount < 0) {

Callers

nothing calls this directly

Calls 1

mutateActionTimerCoreFunction · 0.85

Tested by

no test coverage detected