![]() |
Crossfire Server, Trunk
1.75.0
|
#include "global.h"
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <map>
Go to the source code of this file.
Functions | |
object * | get_jail_exit (object *op) |
Returns an object which is an exit through which the player represented by op should be sent in order to be imprisoned. More... | |
const char * | get_name_of_region_for_map (const mapstruct *m) |
Gets the name of a region for a map. More... | |
region * | get_region_by_map (mapstruct *m) |
Gets a region from a map. More... | |
region * | get_region_by_name (const char *region_name) |
Gets a region by name. More... | |
region * | get_region_from_string (const char *name) |
Tries to find a region that 'name' corresponds to. More... | |
const char * | get_region_longname (const region *r) |
Gets the longname of a region. More... | |
const char * | get_region_msg (const region *r) |
Gets a message for a region. More... | |
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.... More... | |
void | init_regions (BufferReader *reader, const char *filename) |
Reads/parses the region file, and copies into a linked list of region structs. More... | |
int | region_is_child_of_region (const region *child, const region *r) |
Checks if a region is a child of another. More... | |
Region management.
A region is a group of maps. It includes a "parent" region.
Definition in file region.cpp.
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 252 of file region.cpp.
References add_string(), EXIT_PATH, EXIT_X, EXIT_Y, FLAG_DAMNED, get_region_by_map(), region::jailmap, region::jailx, region::jaily, llevDebug, llevError, LOG(), object::map, region::name, object_new(), region::parent, PLAYER, SET_FLAG, and object::type.
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 89 of file region.cpp.
References all_regions, llevInfo, LOG(), and m.
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 71 of file region.cpp.
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 45 of file region.cpp.
References all_regions, llevDebug, llevInfo, and LOG().
Referenced by current_region_info(), get_region_by_map(), init_regions(), and load_map_header().
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 116 of file region.cpp.
References all_regions, region::longname, name, region::name, region::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 209 of file region.cpp.
References get_region_longname(), llevDebug, LOG(), region::longname, region::name, and region::parent.
Referenced by command_whereabouts(), current_map_info(), current_region_info(), get_region_longname(), and get_who_escape_code_value().
const char* get_region_msg | ( | const region * | r | ) |
Gets a message for a region.
r | region. Can't be NULL. |
Definition at line 230 of file region.cpp.
References get_region_msg(), llevDebug, LOG(), region::msg, region::name, and region::parent.
Referenced by current_region_info(), and get_region_msg().
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 293 of file region.cpp.
References fatal(), and OUT_OF_MEMORY.
Referenced by init_regions(), and main().
void init_regions | ( | BufferReader * | reader, |
const char * | filename | ||
) |
Reads/parses the region file, and copies into a linked list of region structs.
reader | buffer to read from. |
filename | file being read. |
Definition at line 310 of file region.cpp.
References all_regions, buf, bufferreader_next_line(), region::fallback, fatal(), get_region_by_name(), get_region_struct(), HUGE_BUF, region::jailmap, region::jailx, region::jaily, llevError, LOG(), region::longname, MAX_BUF, region::msg, msgbuf, region::name, path(), SEE_LAST_ERROR, and strdup_local.
Referenced by assets_collect().
Checks if a region is a child of another.
child | region we want to test. |
r | potential parent. |
Definition at line 182 of file region.cpp.
References region::name, region::parent, and region_is_child_of_region().
Referenced by list_players(), and region_is_child_of_region().