From 8fea062a3f17e46369e2c28076fa07da4790d2d5 Mon Sep 17 00:00:00 2001 From: EntireTwix Date: Mon, 9 Jan 2023 18:37:40 -0800 Subject: [PATCH] :bug: fixed --- src/bank.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 })) {