|
|
@ -2037,11 +2037,8 @@ void Units::subtractCategoryActionTimers(df::unit *unit, int32_t amount, df::uni
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Units::multiplyActionTimer(df::unit *unit, float amount, df::unit_action_type affectedActionType)
|
|
|
|
void multiplyActionTimerCore(df::unit_action *action, float amount)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
CHECK_NULL_POINTER(unit);
|
|
|
|
|
|
|
|
for (auto action : unit->actions) {
|
|
|
|
|
|
|
|
if (affectedActionType != action->type) continue;
|
|
|
|
|
|
|
|
int32_t *timer = getActionTimerPointer(action);
|
|
|
|
int32_t *timer = getActionTimerPointer(action);
|
|
|
|
if (timer != nullptr && *timer != 0) {
|
|
|
|
if (timer != nullptr && *timer != 0) {
|
|
|
|
double value = *timer;
|
|
|
|
double value = *timer;
|
|
|
@ -2052,6 +2049,14 @@ void Units::multiplyActionTimer(df::unit *unit, float amount, df::unit_action_ty
|
|
|
|
*timer = value;
|
|
|
|
*timer = value;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void Units::multiplyActionTimer(df::unit *unit, float amount, df::unit_action_type affectedActionType)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
CHECK_NULL_POINTER(unit);
|
|
|
|
|
|
|
|
for (auto action : unit->actions) {
|
|
|
|
|
|
|
|
if (affectedActionType != action->type) continue;
|
|
|
|
|
|
|
|
multiplyActionTimerCore(action, amount);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Units::multiplyCategoryActionTimers(df::unit *unit, float amount, df::unit_action_type_group affectedActionTypes)
|
|
|
|
void Units::multiplyCategoryActionTimers(df::unit *unit, float amount, df::unit_action_type_group affectedActionTypes)
|
|
|
@ -2061,15 +2066,7 @@ void Units::multiplyCategoryActionTimers(df::unit *unit, float amount, df::unit_
|
|
|
|
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) {
|
|
|
|
int32_t *timer = getActionTimerPointer(action);
|
|
|
|
multiplyActionTimerCore(action, amount);
|
|
|
|
if (timer != nullptr && *timer != 0) {
|
|
|
|
|
|
|
|
double value = *timer;
|
|
|
|
|
|
|
|
value = max(value * amount, 1.0);
|
|
|
|
|
|
|
|
if (value > INT32_MAX) {
|
|
|
|
|
|
|
|
value = INT32_MAX;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
*timer = value;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|