We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 852c133 commit 9f31bb7Copy full SHA for 9f31bb7
src/map/script.c
@@ -18030,10 +18030,12 @@ static BUILDIN(npcshopdelitem)
18030
unsigned int nameid = script_getnum(st,i);
18031
18032
ARR_FIND(0, size, n, nd->u.shop.shop_item[n].nameid == nameid);
18033
- if (n < size) {
18034
- memmove(&nd->u.shop.shop_item[n], &nd->u.shop.shop_item[n+1], sizeof(nd->u.shop.shop_item[0])*(size-n));
18035
- size--;
+ if (n == size) {
+ continue;
+ } else if (n < size) {
18036
+ memmove(&nd->u.shop.shop_item[n], &nd->u.shop.shop_item[n+1], sizeof(nd->u.shop.shop_item[0])*(size-n-1));
18037
}
18038
+ size--;
18039
18040
18041
RECREATE(nd->u.shop.shop_item, struct npc_item_list, size);
0 commit comments