Page 1 of 1

Prices - BigInt

Posted: Tue Sep 13, 2016 7:35 pm
by Gangrenous
I ran into something today that may be of note. While importing in prices from EQ1 I started getting overflow errors. I starting looking into why and had some thoughts. I could be wrong though.

Lets say in EQemu 1,000,000 plat would be stored like this ....

plat gold silver copper
1000000 0 0 0

In Eq2Emu I am pretty sure it is stored like this, because you use an extra integer for gold, silver and copper
plat gold silver copper
1000000 00 00 00

So because of the need of the extra zeros, we get quite a large number
1,000,000,000,000

So if we are using an unsigned int I think the max is 4294967295, quite a few digits off. Looking at the items table I noticed the sell price is int(10) unsigned. I changed mine, but I have not tested any C++ goings on yet to see if there will be a problem when a BigInt transfers over to the actual game.

Re: Prices - BigInt

Posted: Thu Sep 15, 2016 3:49 pm
by John Adams
If you change the database to bigint(20), the C++ would have to be changed as well to int64's. I can't remember how EQ2Emu does it, but pretty sure the values would get trunc'd in code, too. Or, just explode.

Re: Prices - BigInt

Posted: Thu Sep 15, 2016 4:42 pm
by xinux
This is also assuming the client and the packet structs support Uint64.

Re: Prices - BigInt

Posted: Thu Sep 15, 2016 5:26 pm
by Gangrenous
Well I will be finding out pretty quick.

If a black hole opens up, you may know if you do not hear from me again.

Re: Prices - BigInt

Posted: Thu Sep 15, 2016 5:56 pm
by Jabantiz
Quick glance at a couple structs shows the price in merchant is an int64, on the char sheet the characters coins are stored as separate int32 for the 4 types, so I don't think there will be a problem client side, not sure about all the server code yet.