 |
Crossfire Server, Trunk
1.75.0
|
Go to the documentation of this file.
13 std::map<std::string, std::vector<std::string> >
addToRace;
14 std::map<std::string, std::vector<object *> >
races;
23 auto r =
races.find(race);
24 if (r ==
races.end()) {
25 LOG(
llevError,
"races_get_random_monster: requested non-existent aligned race %s!\n", race);
29 std::vector<object *> valid;
30 for (
auto it = (*r).second.begin();
it != (*r).second.end();
it++) {
31 if ((*it)->level <=
level) {
38 return valid[
rndm(0, valid.size() - 1)];
57 if (sscanf(cp,
"RACE %s",
variable)) {
63 for (cp1 = cp; *cp1 ==
' '; cp1++)
66 for (cp1 = cp+strlen(cp)-1; *cp1 ==
' '; cp1--) {
82 for (
auto race =
races.cbegin(); race !=
races.cend(); race++) {
83 fprintf(stderr,
"\nRACE %s:\t", (*race).first.c_str());
84 for (
auto mon = (*race).second.cbegin(); mon != (*race).second.cend(); mon++) {
85 fprintf(stderr,
"%s (%d), ", (*mon)->arch->name, (*mon)->level);
100 for (
const auto&
name : add.second) {
103 races[add.first].push_back(&mon->clone);
105 LOG(
llevError,
"races: %s %s\n",
name.c_str(), mon ?
"is not a monster" :
"does not exist");
@ llevError
Error, serious thing.
void LOG(LogLevel logLevel, const char *format,...)
Logs a message to stderr, or to file.
#define QUERY_FLAG(xyz, p)
object * races_get_random_monster(const char *race, int level)
Get a random monster of specified race and level at most the specified one.
std::map< std::string, std::vector< std::string > > addToRace
int rndm(int min, int max)
Returns a number between min and max.
AssetsManager * getManager()
T * find(const Key &name)
Get a named asset if it exists.
Plugin animator file specs[Config] name
#define FLAG_MONSTER
Will attack players.
Archetypes * archetypes()
Get archetypes.
#define MAX_BUF
Used for all kinds of things.
std::map< std::string, std::vector< object * > > races
void load_races(BufferReader *reader, const char *)
Reads the races file in the lib/ directory, then overwrites old 'race' entries.
void free_races(void)
Frees all race-related information.
if you malloc the data for the make sure to free it when done There is also the newclient h file which is shared between the client and server This file contains the definition of the as well as many defined values for constants of varying you will need to grab these constant values for yourself Many of the constants in this file are used in the protocol to denote types Image Caching ~ Image caching has been implemented on the with necessary server support to handle it This section will briefly describe how image caching works on the protocol as well as how the current client does it the client checks for an option denoting the image caching is desired If we initialize all the images to a default value this means we don t need to put special checks into the drawing code to see if we have an image we just draw the default we know what filename to store it as we request the server to do image caching This is done by or ing the cache directive to the image mode we want C when the server finds an image number that it has not send to the it sends us a name command information us the number to name and there is no space between that the and the name Such formating is difficult but the above example illustrates the data is sent The client then checks for the existence of the image locally It is up to the client to organize images and then splits them into sub directories based on the first letters in the above the file would be crossfire images CS CSword If the client does not have the image or otherwise needs a copy from the it then requests it
@ llevDebug
Only for debugging purposes.
void dump_races(void)
Dumps all race information to stderr.
*envar *is the environment variable
char * bufferreader_next_line(BufferReader *br)
Return the next line in the buffer, as separated by a newline.