summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJedzkie <jedzkie13@rocketmail.com>2020-06-24 11:23:09 +0800
committerJedzkie <jedzkie13@rocketmail.com>2020-06-24 11:23:09 +0800
commitcd7797c85ab5c496c10f9f209c5db43d81b54cf0 (patch)
tree9dd67e3664c45c3b71a114b5c7d33130de27b76b
parent9a06857cc3ad2ad8f00b52ccc33f6c07342ad985 (diff)
downloadhercules-cd7797c85ab5c496c10f9f209c5db43d81b54cf0.tar.gz
hercules-cd7797c85ab5c496c10f9f209c5db43d81b54cf0.tar.bz2
hercules-cd7797c85ab5c496c10f9f209c5db43d81b54cf0.tar.xz
hercules-cd7797c85ab5c496c10f9f209c5db43d81b54cf0.zip
Fix item selling if price is over INT_MAX.
-rw-r--r--src/map/npc.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/map/npc.c b/src/map/npc.c
index 6ba088a80..e15fd7e72 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -2861,6 +2861,9 @@ static int npc_selllist(struct map_session_data *sd, struct itemlist *item_list)
return npc->selllist_sub(sd, item_list, nd->master_nd);
}
+ if (z + sd->status.zeny > MAX_ZENY && nd->master_nd == NULL)
+ return 1;
+
// delete items
for (i = 0; i < VECTOR_LENGTH(*item_list); i++) {
struct itemlist_entry *entry = &VECTOR_INDEX(*item_list, i);
@@ -2879,9 +2882,6 @@ static int npc_selllist(struct map_session_data *sd, struct itemlist *item_list)
}
- if (z + sd->status.zeny > MAX_ZENY && nd->master_nd == NULL)
- return 1;
-
if (z > MAX_ZENY)
z = MAX_ZENY;