summaryrefslogtreecommitdiff
path: root/src/map/trade.c
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2015-01-20 04:36:08 +0100
committerHaru <haru@dotalux.com>2015-01-20 04:41:33 +0100
commit4ae2b9b72dd4fce3d7a7778222d1c39abbb564a4 (patch)
treedab9d12a6a4b95a37598e27e6e86d6047360d61b /src/map/trade.c
parent03709c136ad300be631adfd38dc36c2433bda718 (diff)
downloadhercules-4ae2b9b72dd4fce3d7a7778222d1c39abbb564a4.tar.gz
hercules-4ae2b9b72dd4fce3d7a7778222d1c39abbb564a4.tar.bz2
hercules-4ae2b9b72dd4fce3d7a7778222d1c39abbb564a4.tar.xz
hercules-4ae2b9b72dd4fce3d7a7778222d1c39abbb564a4.zip
Minor fixes and tweaks suggested by cppcheck
- Variable scopes reduced - Parenthesized ambiguous expressions - Removed or added NULL checks where (un)necessary - Corrected format strings - Fixed typos potentially leading to bugs Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/map/trade.c')
-rw-r--r--src/map/trade.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/map/trade.c b/src/map/trade.c
index 46acb4e16..379756394 100644
--- a/src/map/trade.c
+++ b/src/map/trade.c
@@ -239,7 +239,6 @@ int trade_check(struct map_session_data *sd, struct map_session_data *tsd)
struct item inventory2[MAX_INVENTORY];
struct item_data *data;
int trade_i, i, n;
- short amount;
// check zenys value against hackers (Zeny was already checked on time of adding, but you never know when you lost some zeny since then.
if(sd->deal.zeny > sd->status.zeny || (tsd->status.zeny > MAX_ZENY - sd->deal.zeny))
@@ -252,8 +251,8 @@ int trade_check(struct map_session_data *sd, struct map_session_data *tsd)
memcpy(&inventory2, &tsd->status.inventory, sizeof(struct item) * MAX_INVENTORY);
// check free slot in both inventory
- for(trade_i = 0; trade_i < 10; trade_i++) {
- amount = sd->deal.item[trade_i].amount;
+ for (trade_i = 0; trade_i < 10; trade_i++) {
+ short amount = sd->deal.item[trade_i].amount;
if (amount) {
n = sd->deal.item[trade_i].index;
if (amount > inventory[n].amount)