From 2ff06051dee41fe46bcf5c4962aa662f2aaaf328 Mon Sep 17 00:00:00 2001 From: jeefo Date: Mon, 8 May 2023 23:11:17 +0300 Subject: [PATCH] game: clamp correctly money amount --- src/message.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/message.cpp b/src/message.cpp index f024734..c571a1a 100644 --- a/src/message.cpp +++ b/src/message.cpp @@ -222,7 +222,15 @@ void MessageDispatcher::netMsgMoney () { if (m_args.length () < min || !m_bot) { return; } - m_bot->m_moneyAmount = cr::clamp (m_args[money].long_, 160000, INT32_MAX); + auto amount = m_args[money].long_; + + if (amount < 0) { + amount = 800; + } + else if (amount > INT32_MAX) { + amount = 16000; + } + m_bot->m_moneyAmount = amount; } void MessageDispatcher::netMsgStatusIcon () {