Go to the documentation of this file.
50 if (!strcmp(reg->
name, region_name))
55 LOG(
llevDebug,
"region called %s requested, but not found, fallback used.\n", region_name);
59 LOG(
llevInfo,
"Got no region or fallback for region %s.\n", region_name);
95 if (
m->region != NULL)
96 return m->region->name;
101 LOG(
llevInfo,
"map %s had no region and I couldn't find a fallback to use.\n",
m->name);
135 p = strchr(
name,
'\n');
195 if (!strcmp(child->
name,
r->name))
197 else if (child->
parent != NULL)
218 if (
r->longname != NULL)
220 else if (
r->parent != NULL)
223 LOG(
llevDebug,
"NOTICE region %s has no parent and no longname.\n",
r->name);
224 return "no name can be found for the current region";
241 else if (
r->parent != NULL)
244 LOG(
llevDebug,
"NOTICE region %s has no parent and no msg.\n",
r->name);
245 return "no description can be found for the current region";
265 LOG(
llevError,
"region.c: get_jail_exit called against non-player object.\n");
271 while (reg != NULL) {
283 LOG(
llevDebug,
"No suitable jailmap for region %s was found.\n", orig ? orig->
name :
"(unknown region?)");
301 if ((fp = fopen(
filename,
"r")) == NULL) {
352 while (isspace(*
key))
358 end = strchr(
key,
'\n');
368 end = strchr(
value,
'\n');
384 if (!strcmp(
key,
"region")) {
388 }
else if (!strcmp(
key,
"parent")) {
397 LOG(
llevError,
"region.c: malformated regions file: \"parent\" before \"region\".\n");
401 LOG(
llevError,
"region.c: malformated regions file: No value given for \"parent\" key.\n");
405 }
else if (!strcmp(
key,
"longname")) {
408 LOG(
llevError,
"region.c: malformated regions file: \"longname\" before \"region\".\n");
412 LOG(
llevError,
"region.c: malformated regions file: No value given for \"longname\" key.\n");
416 }
else if (!strcmp(
key,
"jail")) {
422 LOG(
llevError,
"region.c: malformated regions file: \"jail\" before \"region\".\n");
426 LOG(
llevError,
"region.c: malformated regions file: No value given for \"jail\" key.\n");
430 if (sscanf(
value,
"%[^ ] %d %d\n",
path, &
x, &
y) != 3) {
437 }
else if (!strcmp(
key,
"msg")) {
439 LOG(
llevError,
"region.c: malformated regions file: \"msg\" before \"region\".\n");
444 while (isspace(*
key))
446 if (strcmp(
key,
"endmsg\n") == 0)
450 msgpos += strlen(
key);
463 }
else if (!strcmp(
key,
"fallback")) {
466 LOG(
llevError,
"region.c: malformated regions file: \"fallback\" before \"region\".\n");
470 LOG(
llevError,
"region.c: malformated regions file: No value given for \"fallback\" key.\n");
473 new->fallback = atoi(
value);
474 }
else if (!strcmp(
key,
"end")) {
476 LOG(
llevError,
"region.c: Ignoring spurious \"end\" between regions.\n");
488 }
else if (!strcmp(
key,
"nomore")) {
490 LOG(
llevError,
"region.c: Last region not properly closed.\n");
500 if (!
key || strcmp(
key,
"nomore")) {
511 uint32_t parent_count = 0;
517 if (reg->
parent == NULL) {
sstring add_string(const char *str)
region * get_region_from_string(const char *name)
object * object_new(void)
const char * get_name_of_region_for_map(const mapstruct *m)
const char * get_region_longname(const region *r)
static char msgbuf[HUGE_BUF]
static void parse_regions(FILE *fp)
static event_registration m
void fatal(enum fatal_error err)
region * get_region_by_name(const char *region_name)
object * get_jail_exit(object *op)
region * get_region_by_map(mapstruct *m)
struct regiondef * parent
void LOG(LogLevel logLevel, const char *format,...)
region * get_region_struct(void)
static void assign_region_parents(void)
static size_t region_count
int strcasecmp(const char *s1, const char *s2)
const char * get_region_msg(const region *r)
EXTERN region * first_region
int region_is_child_of_region(const region *child, const region *r)