Rename [xyz]ActionTimer functions to [xyz]ActionTimers

develop
Tachytaenius 2022-11-27 17:07:47 +00:00
parent f863b9807a
commit a925c34413
3 changed files with 18 additions and 18 deletions

@ -1779,11 +1779,11 @@ static const LuaWrapper::FunctionReg dfhack_units_module[] = {
WRAPM(Units, getMainSocialEvent), WRAPM(Units, getMainSocialEvent),
WRAPM(Units, getStressCategory), WRAPM(Units, getStressCategory),
WRAPM(Units, getStressCategoryRaw), WRAPM(Units, getStressCategoryRaw),
WRAPM(Units, subtractActionTimer), WRAPM(Units, subtractActionTimers),
WRAPM(Units, subtractCategoryActionTimers), WRAPM(Units, subtractCategoryActionTimers),
WRAPM(Units, multiplyActionTimer), WRAPM(Units, multiplyActionTimers),
WRAPM(Units, multiplyCategoryActionTimers), WRAPM(Units, multiplyCategoryActionTimers),
WRAPM(Units, setActionTimer), WRAPM(Units, setActionTimers),
WRAPM(Units, setCategoryActionTimers), WRAPM(Units, setCategoryActionTimers),
{ NULL, NULL } { NULL, NULL }
}; };

@ -226,11 +226,11 @@ DFHACK_EXPORT extern const std::vector<int32_t> stress_cutoffs;
DFHACK_EXPORT int getStressCategory(df::unit *unit); DFHACK_EXPORT int getStressCategory(df::unit *unit);
DFHACK_EXPORT int getStressCategoryRaw(int32_t stress_level); DFHACK_EXPORT int getStressCategoryRaw(int32_t stress_level);
DFHACK_EXPORT void subtractActionTimer(color_ostream &out, df::unit *unit, int32_t amount, df::unit_action_type affectedActionType); DFHACK_EXPORT void subtractActionTimers(color_ostream &out, df::unit *unit, int32_t amount, df::unit_action_type affectedActionType);
DFHACK_EXPORT void subtractCategoryActionTimers(color_ostream &out, df::unit *unit, int32_t amount, df::unit_action_type_group affectedActionTypes); DFHACK_EXPORT void subtractCategoryActionTimers(color_ostream &out, df::unit *unit, int32_t amount, df::unit_action_type_group affectedActionTypes);
DFHACK_EXPORT void multiplyActionTimer(color_ostream &out, df::unit *unit, float amount, df::unit_action_type affectedActionType); DFHACK_EXPORT void multiplyActionTimers(color_ostream &out, df::unit *unit, float amount, df::unit_action_type affectedActionType);
DFHACK_EXPORT void multiplyCategoryActionTimers(color_ostream &out, df::unit *unit, float amount, df::unit_action_type_group affectedActionTypes); DFHACK_EXPORT void multiplyCategoryActionTimers(color_ostream &out, df::unit *unit, float amount, df::unit_action_type_group affectedActionTypes);
DFHACK_EXPORT void setActionTimer(color_ostream &out, df::unit *unit, int32_t amount, df::unit_action_type affectedActionType); DFHACK_EXPORT void setActionTimers(color_ostream &out, df::unit *unit, int32_t amount, df::unit_action_type affectedActionType);
DFHACK_EXPORT void setCategoryActionTimers(color_ostream &out, df::unit *unit, int32_t amount, df::unit_action_type_group affectedActionTypes); DFHACK_EXPORT void setCategoryActionTimers(color_ostream &out, df::unit *unit, int32_t amount, df::unit_action_type_group affectedActionTypes);
} }

@ -2008,7 +2008,7 @@ int32_t *getActionTimerPointer(df::unit_action *action) {
return nullptr; return nullptr;
} }
void subtractActionTimerCore(df::unit_action *action, int32_t amount) void subtractActionTimersCore(df::unit_action *action, int32_t amount)
{ {
int32_t *timer = getActionTimerPointer(action); int32_t *timer = getActionTimerPointer(action);
if (timer != nullptr && *timer > 0) { if (timer != nullptr && *timer > 0) {
@ -2021,7 +2021,7 @@ void subtractActionTimerCore(df::unit_action *action, int32_t amount)
} }
} }
void multiplyActionTimerCore(df::unit_action *action, float amount) void multiplyActionTimersCore(df::unit_action *action, float amount)
{ {
int32_t *timer = getActionTimerPointer(action); int32_t *timer = getActionTimerPointer(action);
if (timer != nullptr && *timer > 0) { if (timer != nullptr && *timer > 0) {
@ -2034,19 +2034,19 @@ void multiplyActionTimerCore(df::unit_action *action, float amount)
} }
} }
void setActionTimerCore(df::unit_action *action, int32_t amount) { void setActionTimersCore(df::unit_action *action, int32_t amount) {
int32_t *timer = getActionTimerPointer(action); int32_t *timer = getActionTimerPointer(action);
if (timer != nullptr && *timer > 0) { if (timer != nullptr && *timer > 0) {
*timer = amount; *timer = amount;
} }
} }
void Units::subtractActionTimer(color_ostream &out, df::unit *unit, int32_t amount, df::unit_action_type affectedActionType) void Units::subtractActionTimers(color_ostream &out, df::unit *unit, int32_t amount, df::unit_action_type affectedActionType)
{ {
CHECK_NULL_POINTER(unit); CHECK_NULL_POINTER(unit);
for (auto action : unit->actions) { for (auto action : unit->actions) {
if (affectedActionType != action->type) continue; if (affectedActionType != action->type) continue;
subtractActionTimerCore(action, amount); subtractActionTimersCore(action, amount);
} }
} }
@ -2057,7 +2057,7 @@ void Units::subtractCategoryActionTimers(color_ostream &out, df::unit *unit, int
auto list = ENUM_ATTR(unit_action_type, group, action->type); auto list = ENUM_ATTR(unit_action_type, group, action->type);
for (size_t i = 0; i < list.size; i++) { for (size_t i = 0; i < list.size; i++) {
if (list.items[i] == affectedActionTypes) { if (list.items[i] == affectedActionTypes) {
subtractActionTimerCore(action, amount); subtractActionTimersCore(action, amount);
break; break;
} }
} }
@ -2072,14 +2072,14 @@ bool validateMultiplyActionTimerAmount(color_ostream &out, float amount) {
return true; return true;
} }
void Units::multiplyActionTimer(color_ostream &out, df::unit *unit, float amount, df::unit_action_type affectedActionType) void Units::multiplyActionTimers(color_ostream &out, df::unit *unit, float amount, df::unit_action_type affectedActionType)
{ {
CHECK_NULL_POINTER(unit); CHECK_NULL_POINTER(unit);
if (!validateMultiplyActionTimerAmount(out, amount)) if (!validateMultiplyActionTimerAmount(out, amount))
return; return;
for (auto action : unit->actions) { for (auto action : unit->actions) {
if (affectedActionType != action->type) continue; if (affectedActionType != action->type) continue;
multiplyActionTimerCore(action, amount); multiplyActionTimersCore(action, amount);
} }
} }
@ -2092,7 +2092,7 @@ void Units::multiplyCategoryActionTimers(color_ostream &out, df::unit *unit, flo
auto list = ENUM_ATTR(unit_action_type, group, action->type); auto list = ENUM_ATTR(unit_action_type, group, action->type);
for (size_t i = 0; i < list.size; i++) { for (size_t i = 0; i < list.size; i++) {
if (list.items[i] == affectedActionTypes) { if (list.items[i] == affectedActionTypes) {
multiplyActionTimerCore(action, amount); multiplyActionTimersCore(action, amount);
break; break;
} }
} }
@ -2107,14 +2107,14 @@ bool validateSetActionTimerAmount(color_ostream &out, int32_t amount) {
return true; return true;
} }
void Units::setActionTimer(color_ostream &out, df::unit *unit, int32_t amount, df::unit_action_type affectedActionType) void Units::setActionTimers(color_ostream &out, df::unit *unit, int32_t amount, df::unit_action_type affectedActionType)
{ {
CHECK_NULL_POINTER(unit); CHECK_NULL_POINTER(unit);
if (!validateSetActionTimerAmount(out, amount)) if (!validateSetActionTimerAmount(out, amount))
return; return;
for (auto action : unit->actions) { for (auto action : unit->actions) {
if (affectedActionType != action->type) continue; if (affectedActionType != action->type) continue;
setActionTimerCore(action, amount); setActionTimersCore(action, amount);
} }
} }
@ -2127,7 +2127,7 @@ void Units::setCategoryActionTimers(color_ostream &out, df::unit *unit, int32_t
auto list = ENUM_ATTR(unit_action_type, group, action->type); auto list = ENUM_ATTR(unit_action_type, group, action->type);
for (size_t i = 0; i < list.size; i++) { for (size_t i = 0; i < list.size; i++) {
if (list.items[i] == affectedActionTypes) { if (list.items[i] == affectedActionTypes) {
setActionTimerCore(action, amount); setActionTimersCore(action, amount);
break; break;
} }
} }