Atrinik Server 2.5
Functions | Variables
server/statistics.c File Reference
#include <global.h>

Go to the source code of this file.

Functions

void statistics_init ()
void statistic_update (const char *type, object *op, sint64 i, const char *buf)
void statistics_player_logout (player *pl)

Variables

static int fd = -1
static struct sockaddr_in insock

Detailed Description

Handles player statistics.

Many statistics are currently cached in the player's structure as uint64 for performance reasons, as it's not very efficient to send a statistic update each time the player plays for another second, or casts a spell, or regenerates some health/mana/grace. Thus, such statistics are only updated in statistics_player_logout(), which is called when the player logs out.

Definition in file statistics.c.


Function Documentation

void statistic_update ( const char *  type,
object op,
sint64  i,
const char *  buf 
)

Update a particular statistic of a player.

Parameters:
typeThe statistic type - a string that will be recognized by the statistics server and stored appropriately.
opThe player.
iInteger value to store. If 0, will not do any updating.
bufOptional string buffer to send.

Definition at line 76 of file statistics.c.

void statistics_init ( )

Initialize statistics; sets up the datagram file descriptor, etc.

Definition at line 46 of file statistics.c.

void statistics_player_logout ( player pl)

Handle player logging out, in order to update cached statistics from the player's data structure.

Parameters:
plThe player.

Definition at line 105 of file statistics.c.


Variable Documentation

int fd = -1 [static]

File descriptor used for sending datagrams.

Definition at line 40 of file statistics.c.

struct sockaddr_in insock [static]

Destination address.

Definition at line 42 of file statistics.c.