Crossfire Server, Trunk
|
Go to the source code of this file.
Functions | |
static void | assign_region_parents (void) |
object * | get_jail_exit (object *op) |
const char * | get_name_of_region_for_map (const mapstruct *m) |
region * | get_region_by_map (mapstruct *m) |
region * | get_region_by_name (const char *region_name) |
region * | get_region_from_string (const char *name) |
const char * | get_region_longname (const region *r) |
const char * | get_region_msg (const region *r) |
region * | get_region_struct (void) |
int | init_regions (void) |
static void | parse_regions (FILE *fp) |
int | region_is_child_of_region (const region *child, const region *r) |
Region management.
A region is a group of maps. It includes a "parent" region.
Definition in file region.c.
|
static |
Links child with their parent from the parent_name field.
Definition at line 509 of file region.c.
References first_region, get_region_by_name(), llevDebug, llevError, LOG(), regiondef::name, regiondef::next, regiondef::parent, regiondef::parent_name, and region_count.
Referenced by init_regions().
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.
op | Object we want to jail. Must be a player. |
Definition at line 260 of file region.c.
References add_string(), EXIT_PATH, EXIT_X, EXIT_Y, FLAG_DAMNED, get_region_by_map(), regiondef::jailmap, regiondef::jailx, regiondef::jaily, llevDebug, llevError, LOG(), regiondef::name, object_new(), give::op, regiondef::parent, PLAYER, and SET_FLAG.
Referenced by player_arrest().
const char* get_name_of_region_for_map | ( | const mapstruct * | m | ) |
Gets the name of a region for a map.
Since we won't assume all maps have a region set properly, we need an explicit check that it is, this is much nicer here than scattered throughout the map code.
m | map |
Definition at line 92 of file region.c.
References regiondef::fallback, first_region, llevInfo, LOG(), m, regiondef::name, and regiondef::next.
Referenced by current_region_info(), get_region_by_map(), get_who_escape_code_value(), and pick_bg_music().
Gets a region from a map.
m | map we want the region of. |
Definition at line 74 of file region.c.
References get_name_of_region_for_map(), get_region_by_name(), and m.
Referenced by add_region_link(), cfapi_map_get_map_property(), command_whereabouts(), current_map_info(), enter_random_map(), enter_random_template_map(), get_jail_exit(), get_who_escape_code_value(), list_players(), process_map(), and ring_bell().
region* get_region_by_name | ( | const char * | region_name | ) |
Gets a region by name.
Used by the map parsing code.
region_name | name of region. |
Definition at line 46 of file region.c.
References regiondef::fallback, first_region, llevDebug, llevInfo, LOG(), regiondef::name, and regiondef::next.
Referenced by assign_region_parents(), current_region_info(), get_region_by_map(), load_map_header(), and CREMainWindow::mapAdded().
region* get_region_from_string | ( | const char * | name | ) |
Tries to find a region that 'name' corresponds to. It looks, in order, for:
name | region we're searching. |
Definition at line 121 of file region.c.
References first_region, regiondef::longname, give::name, regiondef::name, regiondef::next, regiondef::parent, and strcasecmp().
Referenced by command_who().
const char* get_region_longname | ( | const region * | r | ) |
Gets the longname of a region.
The longname of a region is not a required field, any given region may want to not set it and use the parent's one instead.
r | region we're searching the longname. |
Definition at line 217 of file region.c.
References get_region_longname(), llevDebug, LOG(), and ring_occidental_mages::r.
Referenced by command_whereabouts(), current_map_info(), current_region_info(), get_region_longname(), get_who_escape_code_value(), and RegionWrapper::longName().
const char* get_region_msg | ( | const region * | r | ) |
Gets a message for a region.
r | region. Can't be NULL. |
Definition at line 238 of file region.c.
References get_region_msg(), llevDebug, LOG(), and ring_occidental_mages::r.
Referenced by current_region_info(), get_region_msg(), and RegionWrapper::message().
region* get_region_struct | ( | void | ) |
Allocates and zeros a region struct, this isn't free()'d anywhere, so might be a memory leak, but it shouldn't matter too much since it isn't called that often....
Definition at line 326 of file region.c.
References fatal(), and OUT_OF_MEMORY.
Referenced by main(), and parse_regions().
int init_regions | ( | void | ) |
Initialises regions from the regions file.
Definition at line 293 of file region.c.
References assign_region_parents(), Settings::datadir, npc_dialog::filename, first_region, llevError, LOG(), Settings::mapdir, MAX_BUF, parse_regions(), Settings::regions, and settings.
Referenced by init_beforeplay(), init_library(), and main().
|
static |
Reads/parses the region file, and copies into a linked list of region structs.
fp | opened file to read from. |
Definition at line 341 of file region.c.
References buf, fatal(), first_region, get_region_struct(), HUGE_BUF, castle_read::key, llevError, LOG(), MAX_BUF, msgbuf, regiondef::next, python_event::path, SEE_LAST_ERROR, strdup_local, autojail::value, diamondslots::x, and diamondslots::y.
Referenced by init_regions().
Checks if a region is a child of another.
child | region we want to test. |
r | potential parent. |
Definition at line 190 of file region.c.
References regiondef::name, regiondef::parent, ring_occidental_mages::r, and region_is_child_of_region().
Referenced by list_players(), and region_is_child_of_region().