Atrinik Server 2.5
Functions | Variables
server/region.c File Reference
#include <global.h>

Go to the source code of this file.

Functions

static regionget_region_struct ()
static void assign_region_parents ()
regionget_region_by_name (const char *region_name)
char * get_region_longname (const region *r)
char * get_region_msg (const region *r)
objectget_jail_exit (object *op)
void init_regions ()
void free_regions ()

Variables

regionfirst_region = NULL

Detailed Description

Region management.

A region is a group of maps. It includes a "parent" region.

Definition in file region.c.


Function Documentation

static void assign_region_parents ( ) [static]

Links child with their parent from the parent_name field.

Definition at line 328 of file region.c.

void free_regions ( )

Deinitializes all regions.

Definition at line 349 of file region.c.

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. If there is no suitable place to which an exit can be constructed, then NULL will be returned.

Parameters:
opObject we want to jail. Must be a player.
Returns:
Exit to jail, or NULL, in which case a message is LOG()ged .

Definition at line 114 of file region.c.

region* get_region_by_name ( const char *  region_name)

Gets a region by name.

Used by the map parsing code.

Parameters:
region_nameName of region.
Returns:
  • Matching region
  • If no match, returns the first region with the 'fallback' property set and LOG()s to debug.
  • If it can't find a matching name and a fallback region it LOG()s an info message and returns NULL.

Definition at line 49 of file region.c.

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.

Parameters:
rRegion we're searching the longname.
Returns:
Long name of a region if found. Will also search recursively in parents. NULL is never returned, instead a fake region name is returned.

Definition at line 73 of file region.c.

char* get_region_msg ( const region r)

Gets a message for a region.

Parameters:
rRegion. Can't be NULL.
Returns:
Message of a region if found. Will also search recursively in parents. NULL is never returned, instead a fake region message is returned.

Definition at line 93 of file region.c.

static region * get_region_struct ( ) [static]

Allocates and zeros a region struct.

Returns:
Initialized region structure.

Definition at line 313 of file region.c.

void init_regions ( )

Initializes regions from the regions file.

Definition at line 156 of file region.c.


Variable Documentation

First region.

Definition at line 35 of file region.c.