diff --git a/src/bank.cpp b/src/bank.cpp index 19069d9..ff5e770 100644 --- a/src/bank.cpp +++ b/src/bank.cpp @@ -191,7 +191,7 @@ BankResponse Bank::SetBal(const std::string &name, int64_t amount) noexcept amount -= u.balance; u.balance += amount; #if MAX_LOG_SIZE > 0 - u.log.AddTrans("Ω", (amount > 0), amount, time(NULL)); + u.log.AddTrans("Ω", (amount > 0), std::abs(amount), time(NULL)); #endif })) { @@ -211,10 +211,10 @@ BankResponse Bank::ImpactBal(const std::string &name, int64_t amount) noexcept } uint32_t bal; if (ValidUsername(name) && Bank::users.modify_if(name, [&bal, &amount](User &u) { - amount += (u.balance < (amount * -1)) * (amount + u.balance); + if (u.balance < (amount * -1)) { amount = -u.balance; }; bal = u.balance += amount; #if MAX_LOG_SIZE > 0 - u.log.AddTrans("Ω", (amount > 0), amount, time(NULL)); + u.log.AddTrans("Ω", (amount > 0), std::abs(amount), time(NULL)); #endif })) {