Crossfire Server, Trunk
races.cpp File Reference
#include "global.h"
#include "compat.h"
#include "string.h"
#include "malloc.h"
#include <string>
#include <map>
#include <vector>
#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)
 
void finish_races ()
 
void free_races (void)
 
void load_races (BufferReader *reader, const char *)
 
objectraces_get_random_monster (const char *race, int level)
 

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 84 of file races.cpp.

References mon, and races.

Referenced by init_beforeplay().

+ Here is the caller graph for this function:

◆ finish_races()

void finish_races ( )

Definition at line 101 of file races.cpp.

References addToRace, AssetsManager::archetypes(), AssetsCollection< T, Key >::find(), FLAG_MONSTER, getManager(), llevError, LOG(), mon, give::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 96 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 50 of file races.cpp.

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

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 25 of file races.cpp.

References llevError, LOG(), ring_occidental_mages::r, 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 16 of file races.cpp.

Referenced by finish_races(), and load_races().

◆ races

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

Definition at line 17 of file races.cpp.

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