Complete.Org: Mailing Lists: Archives: freeciv-dev: January 2005:
[Freeciv-Dev] Re: (PR#12014) Observers in score
Home

[Freeciv-Dev] Re: (PR#12014) Observers in score

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: paul@xxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#12014) Observers in score
From: "Per I. Mathisen" <per@xxxxxxxxxxx>
Date: Tue, 25 Jan 2005 15:19:51 -0800
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=12014 >

On Tue, 25 Jan 2005, ue80@xxxxxxxxxxxxxxxxxxxxx wrote:
> > Observer shouldn't show up in the score output during the game or at the
> > end. (And how does an observer get 2 points?)
>
> Tech none is counted as tech ... so every player gets 2 points...

Patch.

 - Per

Index: server/score.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/score.c,v
retrieving revision 1.15
diff -u -r1.15 score.c
--- server/score.c      22 Jan 2005 19:45:44 -0000      1.15
+++ server/score.c      25 Jan 2005 23:16:20 -0000
@@ -368,6 +368,7 @@
   struct city *pcity;
   int landarea, settledarea;
   static struct claim_map cmap = { NULL, NULL, NULL,NULL };
+  static int turn = 0;
 
   pplayer->score.happy = 0;
   pplayer->score.content = 0;
@@ -390,10 +391,7 @@
   pplayer->score.literacy = 0;
   pplayer->score.spaceship = 0;
 
-  if (is_barbarian(pplayer)) {
-    if (pplayer->player_no == game.nplayers - 1) {
-      free_landarea_map(&cmap);
-    }
+  if (is_barbarian(pplayer) || pplayer->is_observer) {
     return;
   }
 
@@ -418,19 +416,17 @@
     pplayer->score.literacy += (city_population(pcity) * bonus) / 100;
   } city_list_iterate_end;
 
-  if (pplayer->player_no == 0) {
+  /* rebuild map only once per turn */
+  if (game.turn != turn) {
     free_landarea_map(&cmap);
     build_landarea_map(&cmap);
   }
   get_player_landarea(&cmap, pplayer, &landarea, &settledarea);
   pplayer->score.landarea = landarea;
   pplayer->score.settledarea = settledarea;
-  if (pplayer->player_no == game.nplayers - 1) {
-    free_landarea_map(&cmap);
-  }
 
   tech_type_iterate(i) {
-    if (get_invention(pplayer, i)==TECH_KNOWN) {
+    if (i > A_NONE && get_invention(pplayer, i) == TECH_KNOWN) {
       pplayer->score.techs++;
     }
   } tech_type_iterate_end;

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