Page 1 of 1

Bag Slot ID signed/or unsigned

Posted: Sun Mar 24, 2019 3:00 pm
by Ememjr
i use greatbig 255 slot bags

now that it is starting to get fuller , i am getting errors when server is trying to write character items to the dbthat the 'slot' is of the wrong type and the values is a negative number

the db has slot as unsigned tinyint
the server has sint16 i think this is it

Code: Select all

struct ItemCore{ 
	int32	item_id;
	sint32	soe_id;
	int32	bag_id;
	sint32	inv_slot_id;
	sint16	slot_id;
	int8	index;
	int16	icon;
	int16	count;
	int8	tier;
	int8	num_slots;
	int32	unique_id;
	int8	num_free_slots;
	int16	recommended_level;
};
which is correct

Re: Bag Slot ID signed/or unsigned

Posted: Sun Mar 24, 2019 3:44 pm
by Jabantiz
slot_id should always be positive for stuff in your inventory, however for overflow it is negative. So signed is what the server needs but as it is a sint16 and the db is a uint8 they should never conflict.

Re: Bag Slot ID signed/or unsigned

Posted: Sun Mar 24, 2019 3:50 pm
by Ememjr
well what should be and what is, is the problem,
itemsave.JPG
it is triying to save the item as -78

Re: Bag Slot ID signed/or unsigned

Posted: Sun Mar 24, 2019 4:03 pm
by Jabantiz
So the server has to be going over 255 in the slot, that is odd especially as that shouldn't happen if the bag has a max slots of 255...

Re: Bag Slot ID signed/or unsigned

Posted: Sun Mar 24, 2019 4:07 pm
by Ememjr
isnt the range for int8 signed -128 to +128

Re: Bag Slot ID signed/or unsigned

Posted: Sun Mar 24, 2019 4:16 pm
by Jabantiz
yes but the db uses the int8 and it is unsigned, the server uses the sint16, unless it is getting converted somewhere else in the code before it hits the db.

Re: Bag Slot ID signed/or unsigned

Posted: Sun Mar 24, 2019 4:31 pm
by Ememjr
ok i ll trace it back