Complete.Org:
Mailing Lists:
Archives:
freeciv-dev:
September 2003: [Freeciv-Dev] (PR#5431) Unecessary Global Variable in mapgen.c |
![]() |
[Freeciv-Dev] (PR#5431) Unecessary Global Variable in mapgen.c[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
[glip - Thu Aug 28 23:06:09 2003]: > [cameron - Thu Aug 28 17:08:58 2003]: > > > [glip - Thu Aug 28 13:08:55 2003]: > > > > > 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! > > > > This patch doesn't use static variables, and fixes the incredibly ugly > > code in gen4. This single line will do exactly the same thing as what > > was there before, and is vastly more transparent to what it's doing. > > > > I am fairly certain my arithmetic is correct. > > I am fairly cerain it isn't. > > totalweight = (30 + bigweight) * game.nplayers; > totalweight += (game.nplayers == 1 ? 2 * bigweight : 0); > > would be more correct I think. It's quite ridiculous but so it is > written. You're correct in that if nplayers==1 the totalweight += bigweight * 3 line will be executed, so there's an extra 2*bigweight involved. But gen4 doesn't run with less than 2 players. So I think this little change is okay. jason
|