Atrinik Server  4.0
Functions | Variables
race.c File Reference
#include <global.h>
#include <arch.h>

Go to the source code of this file.

Functions

static void race_add_corpse (shstr *race_name, archetype_t *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)
 
void race_init (void)
 
void race_free (void)
 

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 82 of file race.c.

static void race_add_corpse ( shstr *  race_name,
archetype_t at 
)
static

Link corpse to a race.

Parameters
race_nameRace name.
atArchetype of the corpse.

Definition at line 58 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 130 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 157 of file race.c.

void race_free ( void  )

Frees all race related information.

Definition at line 225 of file race.c.

ob_race* race_get_random ( void  )

Randomly select a race.

Returns
Race, NULL if there are no races available.

Definition at line 175 of file race.c.

void race_init ( void  )

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 37 of file race.c.

size_t num_races = 0
static

Number of all the monster races.

Definition at line 49 of file race.c.

ob_race* races = NULL
static

Array of all the monster races.

Definition at line 45 of file race.c.