From 9e934f3608a4a67667573514909911130493e174 Mon Sep 17 00:00:00 2001 From: Ibrahim Zidan Date: Mon, 8 Apr 2019 22:14:16 +0200 Subject: Fix an issue with named/brewed/forged items getting saved with the wrong character id The isue was triggered by the refactoring of old undocumented code that relied on the overflow behavior during assignment from int32 to int16 and from uint16 to int16, and by a subsequent clamping to SMALLINT range operated by the SQL server. Credits: Haru Fixes #2409 Signed-off-by: Ibrahim Zidan --- src/map/script.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/map/script.c') diff --git a/src/map/script.c b/src/map/script.c index fe8638ac3..76b07fa37 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -8177,12 +8177,12 @@ static BUILDIN(getnameditem) } memset(&item_tmp,0,sizeof(item_tmp)); - item_tmp.nameid=nameid; - item_tmp.amount=1; - item_tmp.identify=1; - item_tmp.card[0]=CARD0_CREATE; //we don't use 255! because for example SIGNED WEAPON shouldn't get TOP10 BS Fame bonus [Lupus] - item_tmp.card[2]=tsd->status.char_id; - item_tmp.card[3]=tsd->status.char_id >> 16; + item_tmp.nameid = nameid; + item_tmp.amount = 1; + item_tmp.identify = 1; + item_tmp.card[0] = CARD0_CREATE; //we don't use 255! because for example SIGNED WEAPON shouldn't get TOP10 BS Fame bonus [Lupus] + item_tmp.card[2] = GetWord(tsd->status.char_id, 0); + item_tmp.card[3] = GetWord(tsd->status.char_id, 1); if(pc->additem(sd,&item_tmp,1,LOG_TYPE_SCRIPT)) { script_pushint(st,0); return true; //Failed to add item, we will not drop if they don't fit -- cgit v1.2.3-60-g2f50