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

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

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#11160) [PR#11132] Change to scorelog v 2.0
From: "Daniil Ivanov" <daniil.ivanov@xxxxxxxxx>
Date: Tue, 23 Nov 2004 09:59:49 -0800
Reply-to: rt@xxxxxxxxxxx

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

> 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

Also a new command added to the previous change

nation <player-id> <player-nation-string>

This command printed into logfile always after addplayer command.
This is quite important, when you make a statistics plot to have a
legend with nations, rather then with player names. Since you see
players flags all the time, but read their names quite rare. Nations are
more easily recognizable.

Thanks, Daniil.

--- report.c.orig       2004-11-12 00:51:14.000000000 +0200
+++ report.c    2004-11-23 02:24:17.000000000 +0200
@@ -758,7 +758,7 @@
                           char **player_names)
 {
   int line_nr;
-  char line[80];
+  char line[200];
   char *ptr;
 
   *last_turn = -1;
@@ -994,6 +994,8 @@
        && strlen(player_names[pplayer->player_no]) == 0) {
       fprintf(fp, "addplayer %d %d %s\n", game.turn, pplayer->player_no,
              pplayer->name);
+      fprintf(fp, "nation %d %s\n", pplayer->player_no,
+             get_nation_name(pplayer->nation));
       mystrlcpy(player_name_ptrs[pplayer->player_no], pplayer->name,
                MAX_LEN_NAME);
     }
@@ -1005,21 +1007,24 @@
       fprintf(fp, "delplayer %d %d\n", game.turn - 1, pplayer->player_no);
       fprintf(fp, "addplayer %d %d %s\n", game.turn, pplayer->player_no,
              pplayer->name);
+      fprintf(fp, "nation %d %s\n", pplayer->player_no,
+             get_nation_name(pplayer->nation));
       mystrlcpy(player_names[pplayer->player_no], pplayer->name,
                MAX_LEN_NAME);
     }
   } 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#11160) [PR#11132] Change to scorelog v 2.0, Daniil Ivanov <=