1 | /* |
1 | /* |
2 | * CrossFire, A Multiplayer game for X-windows |
2 | * This file is part of Deliantra, the Roguelike Realtime MMORPG. |
3 | * |
3 | * |
4 | * Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team |
4 | * Copyright (©) 2005,2006,2007 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
5 | * Copyright (C) 2002 Mark Wedel & Crossfire Development Team |
5 | * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team |
6 | * Copyright (C) 1992 Frank Tore Johansen |
6 | * Copyright (©) 1992,2007 Frank Tore Johansen |
7 | * |
7 | * |
8 | * This program is free software; you can redistribute it and/or modify |
8 | * Deliantra is free software: you can redistribute it and/or modify |
9 | * it under the terms of the GNU General Public License as published by |
9 | * it under the terms of the GNU General Public License as published by |
10 | * the Free Software Foundation; either version 2 of the License, or |
10 | * the Free Software Foundation, either version 3 of the License, or |
11 | * (at your option) any later version. |
11 | * (at your option) any later version. |
12 | * |
12 | * |
13 | * This program is distributed in the hope that it will be useful, |
13 | * This program is distributed in the hope that it will be useful, |
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | * GNU General Public License for more details. |
16 | * GNU General Public License for more details. |
17 | * |
17 | * |
18 | * You should have received a copy of the GNU General Public License |
18 | * You should have received a copy of the GNU General Public License |
19 | * along with this program; if not, write to the Free Software |
19 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
20 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
|
|
21 | * |
20 | * |
22 | * The authors can be reached via e-mail at <crossfire@schmorp.de> |
21 | * The authors can be reached via e-mail to <support@deliantra.net> |
23 | */ |
22 | */ |
24 | |
23 | |
25 | #include <global.h> |
24 | #include <global.h> |
26 | #include <sproto.h> |
25 | #include <sproto.h> |
27 | |
26 | |
… | |
… | |
265 | if (op->stats.exp == 0) |
264 | if (op->stats.exp == 0) |
266 | return; |
265 | return; |
267 | |
266 | |
268 | assign (new_score.name, op->name); |
267 | assign (new_score.name, op->name); |
269 | assign (new_score.title, op->title.length () ? &op->title : op->contr->title); |
268 | assign (new_score.title, op->title.length () ? &op->title : op->contr->title); |
270 | assign (new_score.killer, op->contr->killer[0] ? op->contr->killer : "a dungeon collapse"); |
269 | assign (new_score.killer, op->contr->killer_name ()); |
271 | assign (new_score.maplevel, op->map ? op->map->name ? &op->map->name : &op->map->path : ""); |
270 | assign (new_score.maplevel, op->map ? op->map->name ? &op->map->name : &op->map->path : ""); |
272 | |
271 | |
273 | new_score.exp = op->stats.exp; |
272 | new_score.exp = op->stats.exp; |
274 | new_score.maxhp = op->stats.maxhp; |
273 | new_score.maxhp = op->stats.maxhp; |
275 | new_score.maxsp = op->stats.maxsp; |
274 | new_score.maxsp = op->stats.maxsp; |
… | |
… | |
323 | LOG (llevError, "Cannot open highscore file %s: %s\n", buf, strerror (errno)); |
322 | LOG (llevError, "Cannot open highscore file %s: %s\n", buf, strerror (errno)); |
324 | if (op != NULL) |
323 | if (op != NULL) |
325 | new_draw_info (NDI_UNIQUE, 0, op, "There is no highscore file."); |
324 | new_draw_info (NDI_UNIQUE, 0, op, "There is no highscore file."); |
326 | return; |
325 | return; |
327 | } |
326 | } |
328 | if (op != NULL) |
327 | |
329 | clear_win_info (op); |
|
|
330 | new_draw_info (NDI_UNIQUE, 0, op, "Nr Score Who [max hp][max sp][max grace]"); |
328 | new_draw_info (NDI_UNIQUE, 0, op, "Nr Score Who [max hp][max sp][max grace]"); |
331 | |
329 | |
332 | while (fgets (buf, MAX_BUF, fp) != NULL) |
330 | while (fgets (buf, MAX_BUF, fp) != NULL) |
333 | { |
331 | { |
334 | if (j >= HIGHSCORE_LENGTH || i >= (max - 1)) |
332 | if (j >= HIGHSCORE_LENGTH || i >= (max - 1)) |
335 | break; |
333 | break; |
|
|
334 | |
336 | if ((sc = get_score (buf)) == NULL) |
335 | if ((sc = get_score (buf)) == NULL) |
337 | break; |
336 | break; |
|
|
337 | |
338 | sc->position = ++j; |
338 | sc->position = ++j; |
339 | if (match == NULL) |
339 | if (match == NULL) |
340 | { |
340 | { |
341 | scorebuf = draw_one_high_score (sc); |
341 | scorebuf = draw_one_high_score (sc); |
342 | i++; |
342 | i++; |
… | |
… | |
349 | i++; |
349 | i++; |
350 | } |
350 | } |
351 | else |
351 | else |
352 | continue; |
352 | continue; |
353 | } |
353 | } |
|
|
354 | |
354 | /* Replaced what seemed to an overly complicated word wrap method |
355 | /* Replaced what seemed to an overly complicated word wrap method |
355 | * still word wraps, but assumes at most 2 lines of data. |
356 | * still word wraps, but assumes at most 2 lines of data. |
356 | * mw - 2-12-97 |
357 | * mw - 2-12-97 |
357 | */ |
358 | */ |
358 | assign (buf, scorebuf); |
359 | assign (buf, scorebuf); |
… | |
… | |
381 | new_draw_info (NDI_UNIQUE, 0, op, buf); |
382 | new_draw_info (NDI_UNIQUE, 0, op, buf); |
382 | } |
383 | } |
383 | |
384 | |
384 | close_and_delete (fp, comp); |
385 | close_and_delete (fp, comp); |
385 | } |
386 | } |
|
|
387 | |