Complete.Org: Mailing Lists: Archives: freeciv-dev: January 2000:
[Freeciv-Dev] patch:fix calculation of player.score.techout (PR#229)
Home

[Freeciv-Dev] patch:fix calculation of player.score.techout (PR#229)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Cc: bugs@xxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] patch:fix calculation of player.score.techout (PR#229)
From: mike_jing@xxxxxxxxx
Date: Sun, 9 Jan 2000 21:08:29 -0800 (PST)

Just a small patch to fix the calculation of player.score.techout. Because I only started playing Freeciv since 1.9.0 came out, I had a hard time trying to figure out what the "Research Speed" in the Demographics Report actually means. It turned out it was not calculated correctly -- the science bonus of 1 bulb per city per turn was not removed when calculating player.score.techout during the change to 1.9.0, and the attached patch fixes this.

I also removed the extra "1+" in the denominator in the calculation of the percentage because I think that'll give the correct result, and AFAICS research_time() should not and could not be zero or negative anyway. Maybe an "assert()" should be added to just make sure?

Finally, I have to mention this: The term "techlevel" is used to mean different things in different places. The server option "techlevel" is the "Number of initial advances per player", and it goes into the variable "game.tech", while the server option "researchspeed" corresponds to the variable "game.techlevel". This is confusing to say the least, but that's another story.

Mike


diff -r -u ../freeciv-cvs/common/game.c ./common/game.c
--- ../freeciv-cvs/common/game.c        Mon Jan  3 09:55:31 2000
+++ ./common/game.c     Sun Jan  9 21:25:35 2000
@@ -552,7 +552,7 @@
    pplayer->score.population+=city_population(pcity);
    pplayer->score.cities++;
    pplayer->score.pollution+=pcity->pollution;
-    pplayer->score.techout+=(1+pcity->science_total);
+    pplayer->score.techout+=pcity->science_total;
    pplayer->score.bnp+=pcity->trade_prod;
    pplayer->score.mfg+=pcity->shield_surplus;
    if (city_got_building(pcity, B_UNIVERSITY))
diff -r -u ../freeciv-cvs/server/plrhand.c ./server/plrhand.c
--- ../freeciv-cvs/server/plrhand.c     Sun Jan  9 12:38:24 2000
+++ ./server/plrhand.c  Sun Jan  9 21:27:23 2000
@@ -289,7 +289,7 @@

static int rank_calc_research(struct player *pplayer)
{
-  return (pplayer->score.techout*100)/(1+research_time(pplayer));
+  return (pplayer->score.techout*100)/(research_time(pplayer));
}

static int rank_research(struct player *pplayer)

______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com



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