Complete.Org: Mailing Lists: Archives: freeciv-dev: November 2004:
[Freeciv-Dev] (PR#11132) Change to scorelog
Home

[Freeciv-Dev] (PR#11132) Change to scorelog

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#11132) Change to scorelog
From: "Daniil Ivanov" <divanov@xxxxxxxxx>
Date: Sun, 21 Nov 2004 11:42:08 -0800
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=11132 >

Hello!

  I propose a very small change in scorelog file format.
  Instead of having "data" command in such format

 >  data <turn> <tag-id> <player-id> <value>
 >     give the value of the given tag for the given
 >     player for the given turn.

  I propose make it more efficient, and have one line per player

 >  <turn> <player-id> <value0> <value1> ... <value26>

  Such format reduces size of the scorelog significantly,
  and make it more regular, so that it is easier to process
  it in order to have statistics plots/charts.

Thanks, Daniil

--- report.c.old        2004-11-12 00:51:14.000000000 +0200
+++ report.c    2004-11-21 19:11:12.000000000 +0200
@@ -758,7 +758,7 @@
                           char **player_names)
 {
   int line_nr;
-  char line[80];
+  char line[200];
   char *ptr;
 
   *last_turn = -1;
@@ -1010,16 +1010,17 @@
     }
   } players_iterate_end;
 
-  for (i = 0; i<ARRAY_SIZE(score_tags); i++) {
-    players_iterate(pplayer) {
-      if (!GOOD_PLAYER(pplayer)) {
-       continue;
-      }
+  players_iterate(pplayer) {
+    if (!GOOD_PLAYER(pplayer)) {
+      continue;
+    }
 
-      fprintf(fp, "data %d %d %d %d\n", game.turn, i, pplayer->player_no,
-             score_tags[i].get_value(pplayer));
-    } players_iterate_end;
-  }
+    fprintf(fp, "%d %d", game.turn, pplayer->player_no);
+    for (i = 0; i<ARRAY_SIZE(score_tags); i++) {
+      fprintf(fp, " %d", score_tags[i].get_value(pplayer));
+    }
+    fprintf(fp, "\n");
+  } players_iterate_end;
 
   fflush(fp);
 

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#11132) Change to scorelog, Daniil Ivanov <=