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

Go to the source code of this file.

Functions

static void race_add_corpse (shstr *race_name, archetype *at)
static void race_add (shstr *race_name, object *ob)
static int race_compare (const void *one, const void *two)
ob_racerace_find (shstr *name)
ob_racerace_get_random ()
void race_init ()
void race_dump ()
void race_free ()

Variables

const char * item_races [NROF_ITEM_RACES]
static ob_raceraces = NULL
static size_t num_races = 0

Detailed Description

Handles code related to races.

Definition in file race.c.


Function Documentation

static void race_add ( shstr race_name,
object ob 
) [static]

Add an object to the racelist.

Parameters:
race_nameRace name.
obWhat object to add to the race.

Definition at line 75 of file race.c.

static void race_add_corpse ( shstr race_name,
archetype at 
) [static]

Link corpse to a race.

Parameters:
race_nameRace name.
atArchetype of the corpse.

Definition at line 52 of file race.c.

static int race_compare ( const void *  one,
const void *  two 
) [static]

Comparison function for binary search in race_find().

Definition at line 126 of file race.c.

void race_dump ( )

Dumps all race information.

Definition at line 236 of file race.c.

ob_race* race_find ( shstr name)

Find a race.

Parameters:
nameThe name of the race to look for.
Returns:
The race if found, NULL otherwise.

Definition at line 158 of file race.c.

void race_free ( )

Frees all race related information.

Definition at line 256 of file race.c.

ob_race* race_get_random ( )

Randomly select a race.

Returns:
Race, NULL if there are no races available.

Definition at line 175 of file race.c.

void race_init ( )

Initialize races by looking through all the archetypes and checking if the archetype is a MONSTER or PLAYER.

Definition at line 188 of file race.c.


Variable Documentation

const char* item_races[NROF_ITEM_RACES]
Initial value:
{
    "", "dwarven ", "elven ", "gnomish ", "drow ", "orcish ", "goblin ",
    "kobold ", "giant ", "tiny ", "demonish ", "draconish ", "ogre "
}

This list is used for the item prefixes ('dwarven bolt', 'elven arrow', etc).

Definition at line 35 of file race.c.

size_t num_races = 0 [static]

Number of all the monster races.

Definition at line 46 of file race.c.

ob_race* races = NULL [static]

Array of all the monster races.

Definition at line 43 of file race.c.