comparison src/getstats.c @ 4:aa38447a4b21

First entry of Paradise Server 2.9 patch 10 Beta
author darius
date Sat, 06 Dec 1997 04:37:03 +0000
parents
children
comparison
equal deleted inserted replaced
3:cafa94d86546 4:aa38447a4b21
1 /*--------------------------------------------------------------------------
2 NETREK II -- Paradise
3
4 Permission to use, copy, modify, and distribute this software and its
5 documentation, or any derivative works thereof, for any NON-COMMERCIAL
6 purpose and without fee is hereby granted, provided that this copyright
7 notice appear in all copies. No representations are made about the
8 suitability of this software for any purpose. This software is provided
9 "as is" without express or implied warranty.
10
11 Xtrek Copyright 1986 Chris Guthrie
12 Netrek (Xtrek II) Copyright 1989 Kevin P. Smith
13 Scott Silvey
14 Paradise II (Netrek II) Copyright 1993 Larry Denys
15 Kurt Olsen
16 Brandon Gillespie
17 --------------------------------------------------------------------------*/
18
19 #include "config.h"
20 #include <stdio.h>
21 #include <stdlib.h>
22
23 struct stats
24 {
25 int st_genocides; /* number of genocides participated in */
26 float st_tmaxkills; /* max kills ever */
27 float st_di; /* total destruction inflicted for all time */
28 int st_tkills; /* Kills in tournament play */
29 int st_tlosses; /* Losses in tournament play */
30 int st_tarmsbomb; /* Tournament armies bombed */
31 int st_tresbomb; /* resources bombed off */
32 int st_tdooshes; /* armies killed while being carried */
33 int st_tplanets; /* Tournament planets conquered */
34 int st_tticks; /* Tournament ticks */
35 /* SB/WB/JS stats are entirely separate */
36 int st_sbkills; /* Kills as starbase */
37 int st_sblosses; /* Losses as starbase */
38 int st_sbticks; /* Time as starbase */
39 float st_sbmaxkills; /* Max kills as starbase */
40 int st_wbkills; /* Kills as warbase */
41 int st_wblosses; /* Losses as warbase */
42 int st_wbticks; /* Time as warbase */
43 float st_wbmaxkills; /* Max kills as warbase */
44 int st_jsplanets; /* planets assisted with in JS */
45 int st_jsticks; /* ticks played as a JS */
46 long st_lastlogin; /* Last time this player was played */
47 int st_flags; /* Misc option flags */
48 char st_keymap[96]; /* keymap for this player */
49 int st_rank; /* Ranking of the player */
50 int st_royal; /* royaly, specialty, rank */
51 };
52
53 struct statentry
54 {
55 char name[16]; /* player's name */
56 char password[16]; /* player's password */
57 struct stats stats; /* player's stats */
58 };
59
60
61 main(argn, argv)
62 int argn;
63 char **argv;
64 {
65 FILE *f;
66 struct statentry s;
67
68 f = fopen(argv[1], "r");
69 if (f == NULL)
70 {
71 printf("Cannot open players file\n");
72 exit(1);
73 }
74 while (fread(&s, sizeof(struct statentry), 1, f) == 1)
75 {
76 printf("\nPlayer: %s\n", s.name);
77 printf("Genocides: %d\n", s.stats.st_genocides);
78 printf("Maxkills: %f\n", s.stats.st_tmaxkills);
79 printf("DI: %f\n", s.stats.st_di);
80 printf("Kills: %d\n", s.stats.st_tkills);
81 printf("Losses: %d\n", s.stats.st_tlosses);
82 printf("Armies bombed: %d\n", s.stats.st_tarmsbomb);
83 printf("Resources bombed: %d\n", s.stats.st_tresbomb);
84 printf("Dooshes: %d\n", s.stats.st_tdooshes);
85 printf("Planets: %d\n", s.stats.st_tplanets);
86 printf("Time: %f\n", (float) s.stats.st_tticks / 36000.0);
87 printf("Rank: %d\n", s.stats.st_rank);
88 printf("Royalty: %d\n", s.stats.st_royal);
89
90 printf("SB kills: %d\n", s.stats.st_sbkills);
91 printf("SB losses: %d\n", s.stats.st_sblosses);
92 printf("SB time: %f\n", (float) s.stats.st_sbticks / 36000.0);
93 printf("SB maxkills: %f\n", s.stats.st_sbmaxkills);
94
95 printf("WB kills: %d\n", s.stats.st_wbkills);
96 printf("WB losses: %d\n", s.stats.st_wblosses);
97 printf("WB time: %f\n", (float) s.stats.st_wbticks / 36000.0);
98 printf("WB maxkills: %f\n", s.stats.st_wbmaxkills);
99
100 printf("JS planets: %f\n", s.stats.st_jsplanets);
101 printf("JS time: %f\n", (float) s.stats.st_jsticks / 36000.0);
102 }
103 fclose(f);
104 }