Change != 0 to > 0 in action timer API core functions

develop
Tachytaenius 2022-11-23 13:31:16 +00:00
parent 5e0c0d22cb
commit 6148307e9b
1 changed files with 3 additions and 3 deletions

@ -2011,7 +2011,7 @@ int32_t *getActionTimerPointer(df::unit_action *action) {
void subtractActionTimerCore(df::unit_action *action, int32_t amount)
{
int32_t *timer = getActionTimerPointer(action);
if (timer != nullptr && *timer != 0) {
if (timer != nullptr && *timer > 0) {
*timer = max(*timer - amount, 1);
}
}
@ -2019,7 +2019,7 @@ void subtractActionTimerCore(df::unit_action *action, int32_t amount)
void multiplyActionTimerCore(df::unit_action *action, float amount)
{
int32_t *timer = getActionTimerPointer(action);
if (timer != nullptr && *timer != 0) {
if (timer != nullptr && *timer > 0) {
double value = *timer;
value = max(value * amount, 1.0);
if (value > INT32_MAX) {
@ -2031,7 +2031,7 @@ void multiplyActionTimerCore(df::unit_action *action, float amount)
void setActionTimerCore(df::unit_action *action, int32_t amount) {
int32_t *timer = getActionTimerPointer(action);
if (timer != nullptr && *timer != 0) {
if (timer != nullptr && *timer > 0) {
*timer = amount;
}
}