Complete.Org: Mailing Lists: Archives: freeciv-dev: January 2005:
[Freeciv-Dev] Re: (PR#11837) More gamelog problems
Home

[Freeciv-Dev] Re: (PR#11837) More gamelog problems

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: paul@xxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#11837) More gamelog problems
From: "Mike Kaufman" <kaufman@xxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 14 Jan 2005 18:33:23 -0800
Reply-to: bugs@xxxxxxxxxxx

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

On Mon, Jan 10, 2005 at 07:47:11AM -0800, Paul Zastoupil wrote:
> 
> Nations are sorted by scores, as are the scores, but population isn't
> sorted.

attached patch fixes sorting and mismatch between GAMELOG_INFO and
GAMELOG_STATUS.

-mike

? gamelog
? gamelog-new
? gamelog-new2
? gamelog-old
? server/.srv_main.c.swp
Index: server/gamelog.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/gamelog.c,v
retrieving revision 1.38.2.3
diff -u -r1.38.2.3 gamelog.c
--- server/gamelog.c    16 Dec 2004 23:20:29 -0000      1.38.2.3
+++ server/gamelog.c    15 Jan 2005 02:32:54 -0000
@@ -459,7 +459,7 @@
   case GAMELOG_INFO:
     pplayer = va_arg(args, struct player *);
     {
-      int workers = 0, food = 0, shields = 0, trade = 0, settlers = 0;
+      int food = 0, shields = 0, trade = 0, settlers = 0;
 
       unit_list_iterate(pplayer->units, punit) {
         if (unit_flag(punit, F_CITIES)) {
@@ -467,7 +467,6 @@
         }
       } unit_list_iterate_end;
       city_list_iterate(pplayer->cities, pcity) {
-        workers += pcity->size;
         shields += pcity->shield_prod;
         food += pcity->food_prod;
         trade += pcity->trade_prod;
@@ -477,8 +476,8 @@
                   "<pop>%d</pop><food>%d</food><prod>%d</prod>"
                   "<trade>%d</trade><settlers>%d</settlers><units>%d</units>",
                   pplayer->player_no, city_list_size(&pplayer->cities),
-                  workers, food, shields, trade, settlers,
-                  unit_list_size(&pplayer->units));
+                  total_player_citizens(pplayer), food, shields, trade, 
+                  settlers, unit_list_size(&pplayer->units));
     }
     gamelog_put_prefix(buf, sizeof(buf), "info");
     break;
@@ -653,6 +652,6 @@
   for (i = 0; i < count; i++) {
     cat_snprintf(buffer, len, "<plr><no>%d</no><r>%d</r><s>%d</s></plr>",
                 game.players[rank[i].idx].player_no,
-                 rank[i].value, size[i].value);
+                 rank[i].value, size[rank[i].idx].value);
   }
 }
Index: server/srv_main.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/srv_main.c,v
retrieving revision 1.201.2.9
diff -u -r1.201.2.9 srv_main.c
--- server/srv_main.c   9 Dec 2004 16:28:11 -0000       1.201.2.9
+++ server/srv_main.c   15 Jan 2005 02:32:56 -0000
@@ -617,6 +617,13 @@
 {
   freelog(LOG_DEBUG, "Endturn");
 
+  /* Output some ranking and AI debugging info here. */
+  if (game.turn % 10 == 0) {
+    players_iterate(pplayer) {
+      gamelog(GAMELOG_INFO, pplayer);
+    } players_iterate_end;
+  }
+
   /* We build scores at the beginning and end of every turn.  We have to
    * build them at the end so that the history report can be built. */
   players_iterate(pplayer) {
@@ -638,13 +645,6 @@
   stdinhand_turn();
   send_player_turn_notifications(NULL);
 
-  /* Output some ranking and AI debugging info here. */
-  if (game.turn % 10 == 0) {
-    players_iterate(pplayer) {
-      gamelog(GAMELOG_INFO, pplayer);
-    } players_iterate_end;
-  }
-
   freelog(LOG_DEBUG, "Turn ended.");
   game.turn_start = time(NULL);
 

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