From 4e441e9826be68d8329fd54e4b5e7878f511d91a Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 12 Jan 2016 14:59:13 +0300 Subject: Add additional validation before creating craft object. --- src/emap/craft.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/emap') 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 -- cgit v1.2.3-70-g09d2