summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-01-12 14:59:13 +0300
committerAndrei Karas <akaras@inbox.ru>2016-01-12 14:59:13 +0300
commit4e441e9826be68d8329fd54e4b5e7878f511d91a (patch)
treee0788e863264b0042db4298bdd9cdf7e3610d534
parentb697b14764f18978c7894113adbad86637cbcdcc (diff)
downloadevol-hercules-4e441e9826be68d8329fd54e4b5e7878f511d91a.tar.gz
evol-hercules-4e441e9826be68d8329fd54e4b5e7878f511d91a.tar.bz2
evol-hercules-4e441e9826be68d8329fd54e4b5e7878f511d91a.tar.xz
evol-hercules-4e441e9826be68d8329fd54e4b5e7878f511d91a.zip
Add additional validation before creating craft object.
-rw-r--r--src/emap/craft.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/emap/craft.c b/src/emap/craft.c
index 8ad8633..331d415 100644
--- a/src/emap/craft.c
+++ b/src/emap/craft.c
@@ -93,6 +93,7 @@ bool craft_checkstr(TBL_PC *sd, const char *craftstr)
continue;
}
int slot;
+ int item_id = 0;
for (slot = 0; slot < slotdata->len; slot ++)
{
const char *itemstr = VECTOR_INDEX(slotdata->parts, slot + 1);
@@ -112,6 +113,15 @@ bool craft_checkstr(TBL_PC *sd, const char *craftstr)
strutil_free(craftdata);
return false;
}
+ const int new_item = sd->status.inventory[index].nameid;
+ if (item_id != 0 && new_item != item_id)
+ { // different item id in same slot
+ strutil_free(slotdata);
+ strutil_free(craftdata);
+ return false;
+ }
+ if (new_item != 0)
+ item_id = new_item;
amounts[index] += amount;
if (amounts[index] > 32000)
{ // slot overflow