Crossfire Server, Trunk  1.75.0
races.cpp File Reference
#include "global.h"
#include "compat.h"
#include "string.h"
#include "malloc.h"
#include <map>
#include "sproto.h"
#include "assets.h"
#include "AssetsManager.h"
#include "Archetypes.h"
+ Include dependency graph for races.cpp:

Go to the source code of this file.

Functions

void dump_races (void)
 Dumps all race information to stderr. More...
 
void finish_races ()
 
void free_races (void)
 Frees all race-related information. More...
 
void load_races (BufferReader *reader, const char *)
 Reads the races file in the lib/ directory, then overwrites old 'race' entries. More...
 
objectraces_get_random_monster (const char *race, int level)
 Get a random monster of specified race and level at most the specified one. More...
 

Variables

std::map< std::string, std::vector< std::string > > addToRace
 
std::map< std::string, std::vector< object * > > races
 

Function Documentation

◆ dump_races()

void dump_races ( void  )

Dumps all race information to stderr.

Definition at line 81 of file races.cpp.

References races.

Referenced by init_beforeplay().

+ Here is the caller graph for this function:

◆ finish_races()

void finish_races ( )

Definition at line 98 of file races.cpp.

References addToRace, AssetsManager::archetypes(), AssetsCollection< T, Key >::find(), FLAG_MONSTER, getManager(), llevError, LOG(), name, QUERY_FLAG, and races.

Referenced by init_beforeplay().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ free_races()

void free_races ( void  )

Frees all race-related information.

Definition at line 93 of file races.cpp.

References llevDebug, LOG(), and races.

Referenced by free_server().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ load_races()

void load_races ( BufferReader reader,
const char *   
)

Reads the races file in the lib/ directory, then overwrites old 'race' entries.

This routine allow us to quickly re-configure the 'alignment' of monsters, objects. Useful for putting together lists of creatures, etc that belong to gods.

Definition at line 47 of file races.cpp.

References addToRace, buf, bufferreader_next_line(), llevDebug, LOG(), MAX_BUF, and variable.

Referenced by add_server_collect_hooks().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ races_get_random_monster()

object* races_get_random_monster ( const char *  race,
int  level 
)

Get a random monster of specified race and level at most the specified one.

Parameters
racerace, must not be NULL. If invalid, then logs as an error.
levelmaximum number, included.
Returns
random monster, NULL if none available for the level.

Definition at line 22 of file races.cpp.

References it, level, llevError, LOG(), races, and rndm().

Referenced by choose_cult_monster().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ addToRace

std::map<std::string, std::vector<std::string> > addToRace

Definition at line 13 of file races.cpp.

Referenced by finish_races(), and load_races().

◆ races

std::map<std::string, std::vector<object *> > races

Definition at line 14 of file races.cpp.

Referenced by dump_races(), finish_races(), free_races(), and races_get_random_monster().