[Freeciv-Dev] Population overflow (PR#987)
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Full_Name: Alexander Wilkins
Version: 1.11.4
Distribution: Redhat binary
Client: Both (or N/A)
OS: Redhat Linux 7.1
Submission from: (NULL) (128.12.194.114)
When playing with a 200x100 world in such a manner as to maximize the
number and size of my cities, I achieved a total population of more than
2^31 (2,147,483,648) people. This overflowed the population counter, so
that I now apparently have -2,133,487,296 people, rather than
2,161,480,000.
To reproduce: Create a civilization with 250 size 41 cities. :) As might
be expected, this takes time and terraforming (or editing the save file).
To fix:
1) Store population as a 32-bit unsigned int rather than a 32-bit signed
int. Problem: This can probably be overflowed as well, since 500 size
41 cities is still possible.
2) Since every city has a population that is a multiple of 10,000, only
store the total population / 10,000. 40 trillion people probably isn't
possible.
3) Ignore. Only obsessive-compulsives get civilizations this big anyway.
:) The only visible effect of having having a negatively-sized
population is that you are last in the population demographics instead
of first.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] Population overflow (PR#987),
awilkins <=
|
|