Complete.Org: Mailing Lists: Archives: freeciv-dev: October 2001:
[Freeciv-Dev] Re: Population overflow (PR#987)
Home

[Freeciv-Dev] Re: Population overflow (PR#987)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: awilkins@xxxxxxxxxxxx
Cc: freeciv-dev@xxxxxxxxxxx, bugs@xxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: Population overflow (PR#987)
From: Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 1 Oct 2001 10:30:03 +0200
Reply-to: rf13@xxxxxxxxxxxxxxxxxxxxxx

On Sun, Sep 30, 2001 at 09:06:11PM -0700, awilkins@xxxxxxxxxxxx wrote:
> 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.

Good news: this issue was identified in the past and is fixed in the
current CVS version. We choose 2) with a factor of 1000. So you can
have a population of 2^31*10^3=2,147,483,648,000.

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
 checking for the vaidity of the Maxwell laws on this machine... ok
 checking if e=mc^2... ok
 checking if we can safely swap on /dev/fd0... yes
    -- kvirc 2.0.0's configure 


[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] Re: Population overflow (PR#987), Raimar Falke <=