 |
Crossfire Server, Trunk
1.75.0
|
Go to the documentation of this file.
47 if (!strcmp(reg->name, region_name))
52 LOG(
llevDebug,
"region called %s requested, but not found, fallback used.\n", region_name);
56 LOG(
llevInfo,
"Got no region or fallback for region %s.\n", region_name);
90 if (
m->region != NULL)
91 return m->region->name;
96 LOG(
llevInfo,
"map %s had no region and I couldn't find a fallback to use.\n",
m->name);
189 else if (child->
parent != NULL)
212 else if (r->
parent != NULL)
215 LOG(
llevDebug,
"NOTICE region %s has no parent and no longname.\n", r->
name);
216 return "no name can be found for the current region";
233 else if (r->
parent != NULL)
237 return "no description can be found for the current region";
257 LOG(
llevError,
"region.c: get_jail_exit called against non-player object.\n");
263 while (reg != NULL) {
275 LOG(
llevDebug,
"No suitable jailmap for region %s was found.\n", orig ? orig->
name :
"(unknown region?)");
321 std::map<region *, std::string> parents;
325 while (isspace(*
buf))
329 value = strchr(
buf,
' ');
333 while (isspace(*value))
350 if (!strcmp(
buf,
"region")) {
353 }
else if (!strcmp(
buf,
"parent")) {
361 LOG(
llevError,
"region.c: malformated regions file: \"parent\" before \"region\".\n");
365 LOG(
llevError,
"region.c: malformated regions file: No value given for \"parent\" key.\n");
368 parents[add] = value;
369 }
else if (!strcmp(
buf,
"longname")) {
371 LOG(
llevError,
"region.c: malformated regions file: \"longname\" before \"region\".\n");
375 LOG(
llevError,
"region.c: malformated regions file: No value given for \"longname\" key.\n");
379 }
else if (!strcmp(
buf,
"jail")) {
385 LOG(
llevError,
"region.c: malformated regions file: \"jail\" before \"region\".\n");
389 LOG(
llevError,
"region.c: malformated regions file: No value given for \"jail\" key.\n");
393 if (sscanf(value,
"%[^ ] %d %d\n", path, &x, &y) != 3) {
394 LOG(
llevError,
"region.c: malformated regions entry: jail %s\n", value);
400 }
else if (!strcmp(
buf,
"msg")) {
402 LOG(
llevError,
"region.c: malformated regions file: \"msg\" before \"region\".\n");
407 while (isspace(*other))
409 if (strcmp(other,
"endmsg") == 0)
412 strcpy(
msgbuf+msgpos, other);
413 msgpos += strlen(other);
414 strcpy(
msgbuf+msgpos,
"\n");
428 }
else if (!strcmp(
buf,
"fallback")) {
430 LOG(
llevError,
"region.c: malformated regions file %s: \"fallback\" before \"region\".\n", filename);
434 LOG(
llevError,
"region.c: malformated regions file %s: No value given for \"fallback\" key.\n", filename);
438 }
else if (!strcmp(
buf,
"end")) {
440 LOG(
llevError,
"region.c: Ignoring spurious \"end\" between regions.\n");
445 }
else if (!strcmp(
buf,
"nomore")) {
447 LOG(
llevError,
"region.c: Last region not properly closed.\n");
454 LOG(
llevError,
"Got unknown value in region file %s: %s %s\n", filename,
buf, value);
457 if (!
buf || strcmp(
buf,
"nomore")) {
458 LOG(
llevError,
"Got premature eof on regions file %s!\n", filename);
462 for (
auto p : parents) {
464 if (!p.first->parent) {
465 LOG(
llevError,
"Couldn't find parent %s for region %s\n", p.second.c_str(), p.first->name);
const char * get_name_of_region_for_map(const mapstruct *m)
Gets the name of a region for a map.
@ llevError
Error, serious thing.
region * get_region_struct(void)
Allocates and zeros a region struct, this isn't free()'d anywhere, so might be a memory leak,...
int8_t fallback
Whether, in the event of a region not existing, this should be the one we fall back on as the default...
void LOG(LogLevel logLevel, const char *format,...)
Logs a message to stderr, or to file.
region * get_region_by_name(const char *region_name)
Gets a region by name.
void init_regions(BufferReader *reader, const char *filename)
Reads/parses the region file, and copies into a linked list of region structs.
int region_is_child_of_region(const region *child, const region *r)
Checks if a region is a child of another.
struct mapstruct * map
Pointer to the map in which this object is present.
char * name
Shortend name of the region as maps refer to it.
const char * get_region_longname(const region *r)
Gets the longname of a region.
#define HUGE_BUF
Used for messages - some can be quite long.
Plugin animator file specs[Config] name
char * longname
Official title of the region, this might be defined to be the same as name.
static event_registration m
sstring add_string(const char *str)
This will add 'str' to the hash table.
region * parent
Pointer to the region that is a parent of the current region, if a value isn't defined in the current...
const char * get_region_msg(const region *r)
Gets a message for a region.
char * msg
The description of the region.
char * jailmap
Where a player that is arrested in this region should be imprisoned.
uint8_t type
PLAYER, BULLET, etc.
#define FLAG_DAMNED
The object is very cursed.
void fatal(enum fatal_error err)
fatal() is meant to be called whenever a fatal signal is intercepted.
#define MAX_BUF
Used for all kinds of things.
object * object_new(void)
Grabs an object from the list of unused objects, makes sure it is initialised, and returns it.
std::vector< region * > all_regions
object * get_jail_exit(object *op)
Returns an object which is an exit through which the player represented by op should be sent in order...
static char msgbuf[HUGE_BUF]
region * get_region_from_string(const char *name)
Tries to find a region that 'name' corresponds to.
int strcasecmp(const char *s1, const char *s2)
region * get_region_by_map(mapstruct *m)
Gets a region from a map.
@ llevDebug
Only for debugging purposes.
int16_t jaily
The coodinates in jailmap to which the player should be sent.
char * bufferreader_next_line(BufferReader *br)
Return the next line in the buffer, as separated by a newline.