Atrinik Server  4.0
Functions | Variables
region.c File Reference
#include <global.h>
#include <toolkit/string.h>
#include <object.h>

Go to the source code of this file.


static region_structregion_get (void)
static void region_free (region_struct *region)
static void region_add (region_struct *region)
static void region_assign_parents (void)
void regions_init (void)
void regions_free (void)
region_structregion_find_by_name (const char *region_name)
const region_structregion_find_with_map (const region_struct *region)
const char * region_get_longname (const region_struct *region)
const char * region_get_msg (const region_struct *region)
int region_enter_jail (object *op)


region_structfirst_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 region_add ( region_struct region)

Add the specified region to the linked list of all regions.

regionRegion to add.

Definition at line 225 of file region.c.

static void region_assign_parents ( void  )

Links children regions with their parent from the parent_name field.

Definition at line 244 of file region.c.

int region_enter_jail ( object op)

Attempts to jail the specified object.

opObject we want to jail.
1 if jailed successfully, 0 otherwise.

Definition at line 350 of file region.c.

region_struct* region_find_by_name ( const char *  region_name)

Finds a region by name.

Used by the map parsing code.

region_nameName of region.
Matching region, NULL if it can't be found.

Definition at line 264 of file region.c.

const region_struct* region_find_with_map ( const region_struct region)

Find a region that has a generated client map, searching parents as well.

regionRegion to start at.
Region or NULL if none found.

Definition at line 285 of file region.c.

static void region_free ( region_struct region)

Frees the specified region and all the data associated with it.

regionRegion to free.

Definition at line 204 of file region.c.

static region_struct * region_get ( void  )

Allocates and zeros a region struct.

Initialized region structure.

Definition at line 194 of file region.c.

const char* region_get_longname ( const region_struct region)

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.

regionRegion we're searching the longname.
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 309 of file region.c.

const char* region_get_msg ( const region_struct region)

Gets a message for a region.

regionRegion. Can't be NULL.
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 330 of file region.c.

void regions_free ( void  )

Deinitializes all regions.

Definition at line 179 of file region.c.

void regions_init ( void  )

Initializes regions from the regions file.

Definition at line 47 of file region.c.

Variable Documentation

region_struct* first_region = NULL

First region.

Definition at line 37 of file region.c.