Crossfire Server, Branches 1.12
R18729
|
Go to the source code of this file.
Data Structures | |
struct | scr |
Typedefs | |
typedef struct scr | score |
Functions | |
static score * | add_score (score *new_score) |
void | check_score (object *op, int quiet) |
static void | copy_score (const score *sc1, score *sc2) |
void | display_high_score (object *op, int max, const char *match) |
static char * | draw_one_high_score (const score *sc, char *buf, int size) |
static score * | get_score (char *bp) |
static void | put_score (const score *sc, char *buf, int size) |
static char * | spool (char *bp, const char *error) |
Hiscore handling functions.
Definition in file hiscore.c.
Adds the given score-structure to the high-score list, but only if it was good enough to deserve a place.
new_score | score to add. |
Definition at line 217 of file hiscore.c.
References close_and_delete(), copy_score(), scr::exp, get_score(), HIGHSCORE, HIGHSCORE_LENGTH, llevError, Settings::localdir, LOG(), MAX_BUF, scr::name, open_and_uncompress(), scr::position, put_score(), settings, snprintf(), and strerror_local().
Referenced by check_score().
void check_score | ( | object * | op, |
int | quiet | ||
) |
Checks if player should enter the hiscore, and if so writes her into the list.
op | player to check. |
quiet | If set, don't print anything out - used for periodic updates during game play or when player unexpected quits - don't need to print anything in those cases |
Definition at line 289 of file hiscore.c.
References add_score(), BIG_NAME, obj::contr, draw_ext_info(), draw_ext_info_format(), draw_one_high_score(), scr::exp, liv::exp, pl::explore, FLAG_WAS_WIZ, HIGHSCORE_LENGTH, scr::killer, pl::killer, obj::map, scr::maplevel, MAX_BUF, scr::maxgrace, liv::maxgrace, scr::maxhp, liv::maxhp, scr::maxsp, liv::maxsp, MSG_TYPE_ADMIN, MSG_TYPE_ADMIN_HISCORE, MSG_TYPE_APPLY, MSG_TYPE_APPLY_ERROR, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, scr::name, obj::name, mapdef::name, pl::name_changed, NDI_UNIQUE, pl::own_title, mapdef::path, scr::position, QUERY_FLAG, obj::stats, scr::title, and pl::title.
Referenced by apply_savebed(), command_kick(), command_shutdown(), emergency_save(), key_confirm_quit(), kill_player(), leave(), and process_players1().
Does what it says, copies the contents of the first score structure to the second one.
sc1 | what to copy. |
sc2 | where to copy to. |
Definition at line 97 of file hiscore.c.
References BIG_NAME, scr::exp, scr::killer, scr::maplevel, scr::maxgrace, scr::maxhp, scr::maxsp, scr::name, and scr::title.
Referenced by add_score().
void display_high_score | ( | object * | op, |
int | max, | ||
const char * | match | ||
) |
Displays the high score file.
op | player asking for the score file. |
max | maximum number of scores to display. |
match | if set, will only print players with name or title containing the string (non case-sensitive). |
Definition at line 402 of file hiscore.c.
References close_and_delete(), draw_ext_info(), draw_one_high_score(), get_score(), HIGHSCORE, HIGHSCORE_LENGTH, llevDebug, llevError, Settings::localdir, LOG(), MAX_BUF, MSG_TYPE_ADMIN, MSG_TYPE_ADMIN_HISCORE, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR, scr::name, NDI_UNIQUE, open_and_uncompress(), scr::position, settings, snprintf(), strcasestr_local(), strerror_local(), and scr::title.
Referenced by command_hiscore(), showscores(), and showscoresparm().
|
static |
Formats one score to display to a player.
sc | score to format. |
buf | buffer to write to. Will contain suitably formatted score. |
size | length of buf. |
Definition at line 194 of file hiscore.c.
References scr::exp, scr::killer, scr::maplevel, MAX_NAME, scr::maxgrace, scr::maxhp, scr::maxsp, scr::name, scr::position, snprintf(), and scr::title.
Referenced by check_score(), and display_high_score().
|
static |
The opposite of put_score(), get_score reads from the given buffer into a static score structure, and returns a pointer to it.
bp | string to parse. |
Definition at line 136 of file hiscore.c.
References BIG_NAME, scr::exp, scr::killer, scr::maplevel, scr::maxgrace, scr::maxhp, scr::maxsp, scr::name, spool(), and scr::title.
Referenced by add_score(), and display_high_score().
|
static |
Writes the given score structure to specified buffer.
sc | score to write. |
buf | buffer to write to. |
size | buf's size. |
Definition at line 121 of file hiscore.c.
References scr::exp, scr::killer, scr::maplevel, scr::maxgrace, scr::maxhp, scr::maxsp, scr::name, snprintf(), and scr::title.
Referenced by add_score().
|
static |
Spool works mostly like strtok(char *, ":"), but it can also log a specified error message if something goes wrong.
bp | string to search into. Should be non NULL for first call, NULL for subsequent calls. |
error | message to display in case there is an error. |
Definition at line 65 of file hiscore.c.
References llevError, and LOG().
Referenced by get_score().