61 if (!strcmp(reg->
name, region_name))
66 LOG(
llevDebug,
"region called %s requested, but not found, fallback used.\n", region_name);
70 LOG(
llevInfo,
"Got no region or fallback for region %s.\n", region_name);
112 LOG(
llevInfo,
"map %s had no region and I couldn't find a fallback to use.\n", m->
name);
146 p = strchr(name,
'\n');
162 substr = strstr(reg->
longname, name);
174 substr = strstr(reg->
name, name);
179 substr = strstr(reg->
name, name);
209 else if (child->
parent != NULL)
232 else if (r->
parent != NULL)
235 LOG(
llevDebug,
"NOTICE region %s has no parent and no longname.\n", r->
name);
236 return "no name can be found for the current region";
253 else if (r->
parent != NULL)
257 return "no description can be found for the current region";
277 LOG(
llevError,
"region.c: get_jail_exit called against non-player object.\n");
282 while (reg != NULL) {
294 LOG(
llevDebug,
"No suitable jailmap for region %s was found.\n", reg->
name);
310 LOG(
llevDebug,
"Reading regions from %s...\n", filename);
312 LOG(
llevError,
" Can't open regions file %s in init_regions.\n", filename);
343 memset(
new,
'\0',
sizeof(
region));
363 while (fgets(buf,
HUGE_BUF-1, fp) != NULL) {
366 while (isspace(*key))
370 value = strchr(key,
' ');
372 end = strchr(key,
'\n');
377 while (isspace(*value))
379 end = strchr(value,
'\n');
395 if (!strcmp(key,
"region")) {
399 }
else if (!strcmp(key,
"parent")) {
407 }
else if (!strcmp(key,
"longname")) {
410 }
else if (!strcmp(key,
"jail")) {
415 if (sscanf(value,
"%[^ ] %d %d\n", path, &x, &y) != 3) {
416 LOG(
llevError,
"region.c: malformated regions entry: jail %s\n", value);
422 }
else if (!strcmp(key,
"msg")) {
423 while (fgets(buf,
HUGE_BUF-1, fp) != NULL) {
424 if (!strcmp(buf,
"endmsg\n"))
427 strcpy(msgbuf+msgpos, buf);
428 msgpos += strlen(buf);
441 }
else if (!strcmp(key,
"fallback")) {
443 new->fallback = atoi(value);
444 }
else if (!strcmp(key,
"end")) {
454 }
else if (!strcmp(key,
"nomore")) {
459 LOG(
llevError,
"Got unknown value in region file: %s %s\n", key, value);
462 if (!key || strcmp(key,
"nomore"))
481 LOG(
llevDebug,
"Assigned %u regions with %u parents.\n", region_count, parent_count);
region * get_region_by_name(const char *region_name)
int region_is_child_of_region(const region *child, const region *r)
region * get_region_by_map(mapstruct *m)
void close_and_delete(FILE *fp, int compressed)
object * get_jail_exit(object *op)
region * get_region_from_string(const char *name)
const char * get_region_longname(const region *r)
region * get_region_struct(void)
struct regiondef * parent
char * strdup_local(const char *str)
object * get_object(void)
int snprintf(char *dest, int max, const char *format,...)
sstring add_string(const char *str)
const char * get_name_of_region_for_map(const mapstruct *m)
int strcasecmp(const char *s1, const char *s2)
void LOG(LogLevel logLevel, const char *format,...)
EXTERN region * first_region
static void assign_region_parents(void)
static void parse_regions(FILE *fp)
struct regiondef * region
FILE * open_and_uncompress(const char *name, int flag, int *compressed)
const char * get_region_msg(const region *r)