diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-01-12 14:59:13 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-01-12 14:59:13 +0300 |
commit | 4e441e9826be68d8329fd54e4b5e7878f511d91a (patch) | |
tree | e0788e863264b0042db4298bdd9cdf7e3610d534 | |
parent | b697b14764f18978c7894113adbad86637cbcdcc (diff) | |
download | plugin-4e441e9826be68d8329fd54e4b5e7878f511d91a.tar.gz plugin-4e441e9826be68d8329fd54e4b5e7878f511d91a.tar.bz2 plugin-4e441e9826be68d8329fd54e4b5e7878f511d91a.tar.xz plugin-4e441e9826be68d8329fd54e4b5e7878f511d91a.zip |
Add additional validation before creating craft object.
-rw-r--r-- | src/emap/craft.c | 10 |
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 |