From f296095191c7b5c6b10f79c2b1433dc227a462f5 Mon Sep 17 00:00:00 2001 From: Praetonus Date: Wed, 14 May 2014 16:42:34 +0200 Subject: Fix various warnings. The core, the scripts and the tools now compile without warnings with -Wall -Wextra -pedantic. -Fix warnings from -Woverflow on implicit constant conversion. -Fix warnings from -pedantic. -Fix warnings from -pedantic. -Fix warnings from -Wformat. Two minor changes in addition : -Replace a defined value equal to 2^31 - 1 by std::numeric_limits::max(). -Remove useless null-check on pointer returned by new. New doesn't returns nullptr on failure, it throws std::bad_alloc. --- src/server/scripts/Commands/cs_modify.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'src/server/scripts/Commands') diff --git a/src/server/scripts/Commands/cs_modify.cpp b/src/server/scripts/Commands/cs_modify.cpp index f2f11801229..5dbe95b3e54 100644 --- a/src/server/scripts/Commands/cs_modify.cpp +++ b/src/server/scripts/Commands/cs_modify.cpp @@ -1020,7 +1020,7 @@ public: } else { - if (newmoney > MAX_MONEY_AMOUNT) + if (newmoney > static_cast(MAX_MONEY_AMOUNT)) newmoney = MAX_MONEY_AMOUNT; handler->PSendSysMessage(LANG_YOU_TAKE_MONEY, abs(moneyToAdd), handler->GetNameLink(target).c_str()); @@ -1035,10 +1035,7 @@ public: if (handler->needReportToTarget(target)) ChatHandler(target->GetSession()).PSendSysMessage(LANG_YOURS_MONEY_GIVEN, handler->GetNameLink().c_str(), moneyToAdd); - if (moneyToAdd >= MAX_MONEY_AMOUNT) - moneyToAdd = MAX_MONEY_AMOUNT; - - if (targetMoney >= uint32(MAX_MONEY_AMOUNT) - moneyToAdd) + if (targetMoney >= MAX_MONEY_AMOUNT - moneyToAdd) moneyToAdd -= targetMoney; target->ModifyMoney(moneyToAdd); -- cgit v1.2.3