Complete.Org: Mailing Lists: Archives: freeciv-dev: August 2003:
[Freeciv-Dev] Re: (PR#5431) Unecessary Global Variable in mapgen.c
Home

[Freeciv-Dev] Re: (PR#5431) Unecessary Global Variable in mapgen.c

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: cameron@xxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#5431) Unecessary Global Variable in mapgen.c
From: "Gregory Berkolaiko" <Gregory.Berkolaiko@xxxxxxxxxxxx>
Date: Thu, 28 Aug 2003 06:08:55 -0700
Reply-to: rt@xxxxxxxxxxxxxx

On Wed, 27 Aug 2003, Jason Short wrote:

> [cameron - Tue Aug 26 19:41:46 2003]:
> 
> > totalweight is a global variable, but there is no reason for it to be
> > so. And the way it is treated in mapgenerator2 is both bizarre and
> > useless. This patch makes the code easier to read, and is separate from
> > a gen2 bug I'm trying to track down.
> 
> But you still make it static?

In two places!

> This code is just amazing:
> 
> -  totalweight= 0;
> -  for (i = game.nplayers; i > 0; i--)
> -    totalweight+= 70;
> -  for (i = game.nplayers; i > 0; i--)
> -    totalweight+= 20;
> -  for (i = game.nplayers; i > 0; i--)
> -    totalweight+= 10;
> +  totalweight = 100 * game.nplayers;
> 
> Is there something I'm missing?  Seems like it's worth a patch all on
> its own.

The code is produced by good intentions, if you look down to see how 
totalweight is used.  But I agree it should be removed.  The same, 
however, should be done to the similar code in mapgenerator4, in the same 
patch!

G.





[Prev in Thread] Current Thread [Next in Thread]