Jan 19th 2013, 6:00:55
Yes Lymz.
As an example, a 1-byte integer's range is -128 to +127 (that is, 1 byte has 8 bits, which can represent 2^8 = 256 integers, including the integer 0).
If you have 120 units, and 50 more returned from the market, you would now have 170 units, but it wraps around to -86 jets.
The checks to prevent this from happening obviously is to check if the 120+50 results in a number that is less than the original amount of 120, but you have to do this for every single thing in the game (every unit, cash amount, pci amount, food amount, tech amount, etc), and the code gets very convoluted quickly.
As an example, a 1-byte integer's range is -128 to +127 (that is, 1 byte has 8 bits, which can represent 2^8 = 256 integers, including the integer 0).
If you have 120 units, and 50 more returned from the market, you would now have 170 units, but it wraps around to -86 jets.
The checks to prevent this from happening obviously is to check if the 120+50 results in a number that is less than the original amount of 120, but you have to do this for every single thing in the game (every unit, cash amount, pci amount, food amount, tech amount, etc), and the code gets very convoluted quickly.