version 1.8 | | version 1.9 |
---|
| | |
/* | | /* |
* static char *rcsid_map_c = | | * static char *rcsid_map_c = |
* "$Id: region.c,v 1.8 2005/12/05 23:34:03 akirschbaum Exp $"; | | * "$Id: region.c,v 1.9 2006/02/08 01:52:58 cavesomething Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
} | | } |
} | | } |
| | |
| | /** Returns an object which is an exit through which the player represented by op should be |
| | * sent in order to be imprisoned. If there is no suitable place to which an exit can be |
| | * constructed, then NULL will be returned. The caller is responsible for freeing the object |
| | * created by this function. |
| | */ |
| | object *get_jail_exit(object *op) { |
| | region *reg; |
| | object *exit; |
| | if (op->type != PLAYER) { |
| | LOG(llevError, "region.c: get_jail_exit called against non-player object.\n"); |
| | return NULL; |
| | } |
| | reg=get_region_by_map(op->map); |
| | while (reg!=NULL) { |
| | if (reg->jailmap) { |
| | exit=get_object(); |
| | EXIT_PATH(exit)=add_string(reg->jailmap); |
| | /* damned exits reset savebed and remove teleports, so the prisoner can't escape */ |
| | SET_FLAG(exit, FLAG_DAMNED); |
| | EXIT_X(exit) = reg->jailx; |
| | EXIT_Y(exit) = reg->jaily; |
| | return exit; |
| | } |
| | else reg=reg->parent; |
| | } |
| | LOG(llevDebug,"No suitable jailmap for region %s was found.\n", reg->name); |
| | return NULL; |
| | } |
| | |
/* | | /* |
* First initialises the archtype hash-table (init_archetable()). | | * First initialises the archtype hash-table (init_archetable()). |
* Reads and parses the archetype file (with the first and second-pass | | * Reads and parses the archetype file (with the first and second-pass |
| | |
*end=0; | | *end=0; |
new->longname = strdup_local(value); | | new->longname = strdup_local(value); |
} | | } |
| | else if (!strcmp(key,"jail")) { |
| | /* jail entries are of the form: /path/to/map x y */ |
| | char path[MAX_BUF]; |
| | int x,y; |
| | if (sscanf(value, "%[^ ] %d %d\n", path, &x, &y) != 3) { |
| | LOG(llevError, "region.c: malformated regions entry: jail %s\n", value); |
| | continue; |
| | } |
| | new->jailmap = strdup_local(path); |
| | new->jailx = x; |
| | new->jaily = y; |
| | } |
else if (!strcmp(key,"msg")) { | | else if (!strcmp(key,"msg")) { |
while (fgets(buf, HUGE_BUF-1, fp)!=NULL) { | | while (fgets(buf, HUGE_BUF-1, fp)!=NULL) { |
if (!strcmp(buf,"endmsg\n")) break; | | if (!strcmp(buf,"endmsg\n")) break; |