View Single Post
  #27  
Old August 3rd, 2008, 11:50 PM

Loren Loren is offline
First Lieutenant
 
Join Date: Nov 2006
Posts: 739
Thanks: 1
Thanked 8 Times in 8 Posts
Loren is on a distinguished road
Default Re: Population Resets to Zero

Quote:
sector24 said:
There's a really tiny chance that the variable used to keep track of the population is two unsigned chars. "Unsigned" meaning it goes from 0-512 instead of -256 to 256, then the value multiply by some constant to get the actual value displayed in the game. If that was the case then the population would overflow to 0 at 512, but a char is not the optimal data type to store this kind of value so it's not likely.
What?!?!?!

An unsigned byte goes from 0 to 255. A signed byte goes from -127 to 127.

An unsigned word goes from 0 to 65535. A signed word goes from -32767 to 32767.

This latter is what I think they used and they are adding an extra zero for display purposes.
Reply With Quote