diff options
author | ultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2007-10-21 02:18:15 +0000 |
---|---|---|
committer | ultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2007-10-21 02:18:15 +0000 |
commit | c7bce63ecd9fb5d44c442791c13591aebd4dbb88 (patch) | |
tree | 8afbe2d04a3ca929c0484fec61958c6b2948ae69 /src/map/script.c | |
parent | 5e3de661f276eb2eb3a06bd0c4197dc847a36d50 (diff) | |
download | hercules-c7bce63ecd9fb5d44c442791c13591aebd4dbb88.tar.gz hercules-c7bce63ecd9fb5d44c442791c13591aebd4dbb88.tar.bz2 hercules-c7bce63ecd9fb5d44c442791c13591aebd4dbb88.tar.xz hercules-c7bce63ecd9fb5d44c442791c13591aebd4dbb88.zip |
* Fixed 'unequip' removing items in the wrong position (bugreport:252)
* Fixed #refine unequpping the caller's item by mistake (bugreport:265)
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11534 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/script.c')
-rw-r--r-- | src/map/script.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/map/script.c b/src/map/script.c index e1e3a02cf..9de888e31 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -11941,11 +11941,11 @@ BUILDIN_FUNC(unequip) size_t num; TBL_PC *sd; - num = script_getnum(st,2) - 1; - sd=script_rid2sd(st); - if(sd!=NULL && num > 0 && num <= ARRAYLENGTH(equip)) + num = script_getnum(st,2); + sd = script_rid2sd(st); + if( sd != NULL && num >= 1 && num <= ARRAYLENGTH(equip) ) { - i=pc_checkequip(sd,equip[num-1]); + i = pc_checkequip(sd,equip[num-1]); if (i >= 0) pc_unequipitem(sd,i,2); return 0; @@ -11968,10 +11968,10 @@ BUILDIN_FUNC(equip) ShowError("wrong item ID : equipitem(%i)\n",nameid); return 1; } - for(i=0;i<MAX_INVENTORY && sd->status.inventory[i].nameid!=nameid;i++); - if(i==MAX_INVENTORY) return 0; + ARR_FIND( 0, MAX_INVENTORY, i, sd->status.inventory[i].nameid == nameid ); + if( i < MAX_INVENTORY ) + pc_equipitem(sd,i,item_data->equip); - pc_equipitem(sd,i,item_data->equip); return 0; } |