- case 1:case 2://consumible and etc
- {
- if((items[slot].itemnum == thisitem.itemnum && items[slot].count<999)
- ||(items[slot].itemnum==0 && items[slot].count<1))
- return slot;
- }
- break;
bean bullets and Sapphire(1) have one thing in common. They both have an item number of 321.
That is where the similarity ends though.
Somehow the type (12 for bullets) is being changed on pick up (to 11 for gems)
I am investigating it.
ABE
Found it.
The error is in PlaterFunctions GetNewItemSlot.
this piece of code is the culprit.
It doesn't differentiate between item types 11 and 12 here. so when you pick up some bean bullets and you already have the right kind of gem in your inventory, it will just stack them on top.
try this instead.
- case 1:case 2://consumible and etc
- {
- if((items[slot].itemnum == thisitem.itemnum && items[slot].itemtype == thisitem.itemtype && items[slot].count<999)
- ||(items[slot].itemnum==0 && items[slot].count<1))
- return slot;
- }
- break;
That should fix it.
In fact, what the heck, why not just replace the entire function with this. It fixes issues items with not stacking also. I developed this for my evo server and since the code is identical in this spot. here it is.
- // Returns a free slot in the inventory (0xffff if is full)
- UINT CPlayer::GetNewItemSlot( CItem thisitem )
- {
- UINT tabsize = 30;
- UINT itemtab = 0;
- switch(thisitem.itemtype)
- {
- case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9://equip
- itemtab=0;
- break;
- case 10://consumibles
- itemtab=1;
- break;
- case 11:case 12://etc
- itemtab=2;
- break;
- case 14://pat
- itemtab=3;
- break;
- default:
- Log(MSG_WARNING,"unknown itemtype %i", thisitem.itemtype);
- return 0xffff;
- break;
- }
- //useitems and natural
- //first we try to find a slot that already contains some of this item
- //this way the items will always stack if possible.
- if(itemtab == 1 || itemtab == 2)
- {
- for(int i=0;i<30;i++)
- {
- UINT slot=12;
- slot += (tabsize*itemtab)+i;
- if(items[slot].itemnum == thisitem.itemnum && items[slot].itemtype == thisitem.itemtype)
- {
- int totcount=thisitem.count + items[slot].count;
- if(totcount<999)
- return slot;
- }
- }
- }
- //now scan again to find a fully empty slot for mats, useitems and equipable stuff
- //doesn't matter what tab type
- for(int i=0;i<30;i++)
- {
- UINT slot=12;
- slot += (tabsize*itemtab)+i;
- if(items[slot].itemnum==0 &items[slot].count<1)
- return slot;
- }
- return 0xffff;
- }