Atrinik Server  4.0
Data Structures | Enumerations | Functions | Variables
arch.h File Reference
#include <object.h>
#include <decls.h>

Go to the source code of this file.

Data Structures

struct  archetype
 

Enumerations

enum  {
  ARCH_WAYPOINT, ARCH_EMPTY_ARCHETYPE, ARCH_BASE_INFO, ARCH_LEVEL_UP,
  ARCH_RING_NORMAL, ARCH_RING_GENERIC, ARCH_AMULET_NORMAL, ARCH_AMULET_GENERIC,
  ARCH_INV_GROUP_NEXT, ARCH_INV_GROUP_PREV, ARCH_INV_START, ARCH_INV_END,
  ARCH_MAX
}
 

Functions

void arch_init (void)
 
void arch_deinit (void)
 
void arch_add (archetype_t *at)
 
archetype_tarch_find (const char *name)
 
objectarch_get (const char *name)
 
objectarch_to_object (archetype_t *at)
 
archetype_tarch_clone (archetype_t *at)
 

Variables

archetype_tarch_table
 
archetype_tarches [ARCH_MAX]
 
bool arch_in_init
 
archetype_twp_archetype
 

Detailed Description

Arch related structures and definitions.

Definition in file arch.h.

Enumeration Type Documentation

anonymous enum

IDs of archetype pointers cached in arches.

Enumerator
ARCH_WAYPOINT 

The 'waypoint' archetype.

ARCH_EMPTY_ARCHETYPE 

The 'empty_archetype' archetype.

ARCH_BASE_INFO 

The 'base_info' archetype.

ARCH_LEVEL_UP 

The 'level_up' archetype.

ARCH_RING_NORMAL 

The 'ring_normal' archetype.

ARCH_RING_GENERIC 

The 'ring_generic' archetype.

ARCH_AMULET_NORMAL 

The 'amulet_normal' archetype.

ARCH_AMULET_GENERIC 

The 'amulet_generic' archetype.

ARCH_INV_GROUP_NEXT 

The 'inv_group_next' archetype.

ARCH_INV_GROUP_PREV 

The 'inv_group_prev' archetype.

ARCH_INV_START 

The 'inv_start' archetype.

ARCH_INV_END 

The 'inv_end' archetype.

ARCH_MAX 

Maximum number of cached archetype pointers.

Definition at line 54 of file arch.h.

Function Documentation

void arch_add ( archetype_t at)

Adds an archetype to the hashtable.

Must be called within archetypes initialization time-frame (arch_in_init == true).

Parameters
atArchetype to add.

Definition at line 390 of file arch.c.

archetype_t* arch_clone ( archetype_t at)

Clones the specified archetype.

Parameters
atThe archetype to clone.
Returns
New archetype.
Warning
The archetype's name is not cloned.

Definition at line 464 of file arch.c.

void arch_deinit ( void  )

Frees all memory allocated to archetypes.

After calling this, it's possible to call arch_init() again to reload data.

Definition at line 104 of file arch.c.

archetype_t* arch_find ( const char *  name)

Finds, using the hashtable, which archetype matches the given name.

Parameters
nameArchetype name to find. Can be NULL.
Returns
Pointer to the found archetype, otherwise NULL.

Definition at line 407 of file arch.c.

object* arch_get ( const char *  name)

Finds which archetype matches the given name, and returns a new object containing a copy of the archetype.

If the archetype cannot be found, object_create_singularity() is used to create a singularity. Thus the return value is never NULL.

Parameters
nameArchetype name. Can be NULL.
Returns
Object of specified archetype, or a singularity. Will never be NULL.

Definition at line 430 of file arch.c.

void arch_init ( void  )

Initializes the archetypes hash table (read from file).

arches are also initialized.

Definition at line 78 of file arch.c.

object* arch_to_object ( archetype_t at)

Creates and returns a new object which is a copy of the given archetype.

Parameters
atArchetype from which to get an object.
Returns
New object, never NULL.

Definition at line 446 of file arch.c.