ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/server/hiscore.C
(Generate patch)

Comparing deliantra/server/server/hiscore.C (file contents):
Revision 1.5 by root, Sun Sep 10 15:59:57 2006 UTC vs.
Revision 1.6 by root, Tue Sep 12 18:17:34 2006 UTC

1
2/*
3 * static char *rcsid_hiscore_c =
4 * "$Id: hiscore.C,v 1.5 2006/09/10 15:59:57 root Exp $";
5 */
6
7/* 1/*
8 CrossFire, A Multiplayer game for X-windows 2 CrossFire, A Multiplayer game for X-windows
9 3
10 Copyright (C) 2002 Mark Wedel & Crossfire Development Team 4 Copyright (C) 2002 Mark Wedel & Crossfire Development Team
11 Copyright (C) 1992 Frank Tore Johansen 5 Copyright (C) 1992 Frank Tore Johansen
86 * Does what it says, copies the contents of the first score structure 80 * Does what it says, copies the contents of the first score structure
87 * to the second one. 81 * to the second one.
88 */ 82 */
89 83
90static void 84static void
91copy_score (score * sc1, score * sc2) 85copy_score (score *sc1, score *sc2)
92{ 86{
93 strncpy (sc2->name, sc1->name, BIG_NAME); 87 strncpy (sc2->name, sc1->name, BIG_NAME);
94 sc2->name[BIG_NAME - 1] = '\0'; 88 sc2->name[BIG_NAME - 1] = '\0';
95 strncpy (sc2->title, sc1->title, BIG_NAME); 89 strncpy (sc2->title, sc1->title, BIG_NAME);
96 sc2->title[BIG_NAME - 1] = '\0'; 90 sc2->title[BIG_NAME - 1] = '\0';
107 * Writes the given score structure to a static buffer, and returns 101 * Writes the given score structure to a static buffer, and returns
108 * a pointer to it. 102 * a pointer to it.
109 */ 103 */
110 104
111static char * 105static char *
112put_score (score * sc) 106put_score (score *sc)
113{ 107{
114 static char buf[MAX_BUF]; 108 static char buf[MAX_BUF];
115 109
116 sprintf (buf, "%s:%s:%lld:%s:%s:%d:%d:%d", sc->name, sc->title, (long long) sc->exp, sc->killer, sc->maplevel, 110 sprintf (buf, "%s:%s:%lld:%s:%s:%d:%d:%d", sc->name, sc->title, (long long) sc->exp, sc->killer, sc->maplevel,
117 sc->maxhp, sc->maxsp, sc->maxgrace); 111 sc->maxhp, sc->maxsp, sc->maxgrace);
172 sscanf (cp, "%d", &sc.maxgrace); 166 sscanf (cp, "%d", &sc.maxgrace);
173 return ≻ 167 return ≻
174} 168}
175 169
176static char * 170static char *
177draw_one_high_score (score * sc) 171draw_one_high_score (score *sc)
178{ 172{
179 static char retbuf[MAX_BUF]; 173 static char retbuf[MAX_BUF];
180 174
181 if (!strncmp (sc->killer, "quit", MAX_NAME)) 175 if (!strncmp (sc->killer, "quit", MAX_NAME))
182 sprintf (retbuf, "%3d %10lld %s the %s quit the game on map %s [%d][%d][%d].", 176 sprintf (retbuf, "%3d %10lld %s the %s quit the game on map %s [%d][%d][%d].",
194 * add_score() adds the given score-structure to the high-score list, but 188 * add_score() adds the given score-structure to the high-score list, but
195 * only if it was good enough to deserve a place. 189 * only if it was good enough to deserve a place.
196 */ 190 */
197 191
198static score * 192static score *
199add_score (score * new_score) 193add_score (score *new_score)
200{ 194{
201 FILE *fp; 195 FILE *fp;
202 static score old_score; 196 static score old_score;
203 score *tmp_score, pscore[HIGHSCORE_LENGTH]; 197 score *tmp_score, pscore[HIGHSCORE_LENGTH];
204 char buf[MAX_BUF], filename[MAX_BUF], *bp; 198 char buf[MAX_BUF], filename[MAX_BUF], *bp;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines