Go to the documentation of this file.
48 if (!strcmp(reg->name, region_name))
53 LOG(
llevDebug,
"region called %s requested, but not found, fallback used.\n", region_name);
57 LOG(
llevInfo,
"Got no region or fallback for region %s.\n", region_name);
91 if (
m->region != NULL)
92 return m->region->name;
97 LOG(
llevInfo,
"map %s had no region and I couldn't find a fallback to use.\n",
m->name);
188 if (!strcmp(child->
name,
r->name))
190 else if (child->
parent != NULL)
211 if (
r->longname != NULL)
213 else if (
r->parent != NULL)
216 LOG(
llevDebug,
"NOTICE region %s has no parent and no longname.\n",
r->name);
217 return "no name can be found for the current region";
234 else if (
r->parent != NULL)
237 LOG(
llevDebug,
"NOTICE region %s has no parent and no msg.\n",
r->name);
238 return "no description can be found for the current region";
258 LOG(
llevError,
"region.c: get_jail_exit called against non-player object.\n");
264 while (reg != NULL) {
276 LOG(
llevDebug,
"No suitable jailmap for region %s was found.\n", orig ? orig->
name :
"(unknown region?)");
322 std::map<region *, std::string> parents;
326 while (isspace(*
buf))
334 while (isspace(*
value))
351 if (!strcmp(
buf,
"region")) {
354 }
else if (!strcmp(
buf,
"parent")) {
362 LOG(
llevError,
"region.c: malformated regions file: \"parent\" before \"region\".\n");
366 LOG(
llevError,
"region.c: malformated regions file: No value given for \"parent\" key.\n");
369 parents[add] =
value;
370 }
else if (!strcmp(
buf,
"longname")) {
372 LOG(
llevError,
"region.c: malformated regions file: \"longname\" before \"region\".\n");
376 LOG(
llevError,
"region.c: malformated regions file: No value given for \"longname\" key.\n");
380 }
else if (!strcmp(
buf,
"jail")) {
386 LOG(
llevError,
"region.c: malformated regions file: \"jail\" before \"region\".\n");
390 LOG(
llevError,
"region.c: malformated regions file: No value given for \"jail\" key.\n");
394 if (sscanf(
value,
"%[^ ] %d %d\n",
path, &
x, &
y) != 3) {
401 }
else if (!strcmp(
buf,
"msg")) {
403 LOG(
llevError,
"region.c: malformated regions file: \"msg\" before \"region\".\n");
408 while (isspace(*other))
410 if (strcmp(other,
"endmsg") == 0)
413 strcpy(
msgbuf+msgpos, other);
414 msgpos += strlen(other);
415 strcpy(
msgbuf+msgpos,
"\n");
429 }
else if (!strcmp(
buf,
"fallback")) {
431 LOG(
llevError,
"region.c: malformated regions file %s: \"fallback\" before \"region\".\n",
filename);
435 LOG(
llevError,
"region.c: malformated regions file %s: No value given for \"fallback\" key.\n",
filename);
439 }
else if (!strcmp(
buf,
"end")) {
441 LOG(
llevError,
"region.c: Ignoring spurious \"end\" between regions.\n");
446 }
else if (!strcmp(
buf,
"nomore")) {
448 LOG(
llevError,
"region.c: Last region not properly closed.\n");
458 if (!
buf || strcmp(
buf,
"nomore")) {
463 for (
auto p : parents) {
465 if (!p.first->parent) {
466 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)
region * get_region_struct(void)
void LOG(LogLevel logLevel, const char *format,...)
region * get_region_by_name(const char *region_name)
void init_regions(BufferReader *reader, const char *filename)
int region_is_child_of_region(const region *child, const region *r)
const char * get_region_longname(const region *r)
static event_registration m
sstring add_string(const char *str)
const char * get_region_msg(const region *r)
void fatal(enum fatal_error err)
object * object_new(void)
std::vector< region * > all_regions
object * get_jail_exit(object *op)
static char msgbuf[HUGE_BUF]
region * get_region_from_string(const char *name)
int strcasecmp(const char *s1, const char *s2)
region * get_region_by_map(mapstruct *m)
char * bufferreader_next_line(BufferReader *br)