Angband
Functions
score.c File Reference

Highscore handling for Angband. More...

#include "angband.h"
#include "buildid.h"
#include "game-world.h"
#include "init.h"
#include "score.h"

Functions

static long total_points (void)
 Calculates the total number of points earned (wow - NRM)
size_t highscore_read (high_score scores[], size_t sz)
 Read in a highscore file.
size_t highscore_where (const high_score *entry, const high_score scores[], size_t sz)
 Just determine where a new score would be placed Return the location (0 is best) or -1 on failure.
size_t highscore_add (const high_score *entry, high_score scores[], size_t sz)
static size_t highscore_count (const high_score scores[], size_t sz)
static void highscore_write (const high_score scores[], size_t sz)
 Actually place an entry into the high score file Return the location (0 is best) or -1 on "failure".
void build_score (high_score *entry, const char *died_from, time_t *death_time)
void enter_score (time_t *death_time)
 Enters a players name on a hi-score table, if "legal".

Detailed Description

Highscore handling for Angband.

Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke

This work is free software; you can redistribute it and/or modify it under the terms of either:

a) the GNU General Public License as published by the Free Software Foundation, version 2, or

b) the "Angband licence": This software may be copied and distributed for educational, research, and not for profit purposes provided that this copyright and statement are included in all such copies. Other copyrights may also apply.

Function Documentation

void build_score ( high_score entry,
const char *  died_from,
time_t *  death_time 
)
void enter_score ( time_t *  death_time)
size_t highscore_add ( const high_score entry,
high_score  scores[],
size_t  sz 
)

References highscore_where().

Referenced by enter_score(), and predict_score().

static size_t highscore_count ( const high_score  scores[],
size_t  sz 
)
static

References i.

Referenced by highscore_write().

size_t highscore_read ( high_score  scores[],
size_t  sz 
)
size_t highscore_where ( const high_score entry,
const high_score  scores[],
size_t  sz 
)

Just determine where a new score would be placed Return the location (0 is best) or -1 on failure.

References i, and high_score::pts.

Referenced by highscore_add(), and predict_score().

static void highscore_write ( const high_score  scores[],
size_t  sz 
)
static

Actually place an entry into the high score file Return the location (0 is best) or -1 on "failure".

References ANGBAND_DIR_APEX, file_close(), file_delete(), file_exists(), file_lock(), file_move(), file_open(), file_write(), FTYPE_RAW, highscore_count(), MODE_WRITE, msg, path_build(), safe_setuid_drop(), and safe_setuid_grab().

Referenced by enter_score().

static long total_points ( void  )
static

Calculates the total number of points earned (wow - NRM)

References player::max_depth, and player::max_exp.

Referenced by build_score().