Crossfire Server, Trunk  R20513
Macros | Functions | Variables
toolkit_common.c File Reference
#include <global.h>
#include <stdlib.h>
#include <check.h>
#include "../include/toolkit_common.h"
Include dependency graph for toolkit_common.c:

Go to the source code of this file.

Macros

#define CCTK_ASSERT(__flag)
 
#define CHECK_TKFLAG(__flag)   (status_flag&__flag)
 
#define SET_TKFLAG(__flag)   (status_flag |= __flag)
 
#define STATUS_ANIM   0x4000
 
#define STATUS_ARCH   0x8000
 
#define STATUS_BLOCK   0x1000
 
#define STATUS_BMAP   0x2000
 
#define STATUS_CONFDIR   0x0004
 
#define STATUS_DATADIR   0x0002
 
#define STATUS_GLOBALS   0x0100
 
#define STATUS_HASHTABLE   0x0200
 
#define STATUS_LOGDIR   0x0001
 
#define STATUS_OBJECTS   0x0400
 
#define STATUS_VARS   0x0800
 

Functions

objectcctk_create_game_object (const char *archname)
 Initialize a simple object. More...
 
void cctk_init_std_archetypes (void)
 Loads up to archetype initialisation using standard crossfire files in source tree. More...
 
void cctk_set_object_strings (object *op, const char *string)
 Set all strings in given object to given parameter string, used for checking cleaning of objects, mainly. More...
 
void cctk_setconfdir (const char *confdir)
 
void cctk_setdatadir (const char *datadir)
 
void cctk_setlog (const char *logfile)
 set the logdir to use More...
 

Variables

static int status_flag = 0
 

Macro Definition Documentation

#define CCTK_ASSERT (   __flag)
Value:
{ \
if (!CHECK_TKFLAG(__flag)) \
fail("Improper initialisation, flag 0x%H", __flag);\
}
#define CHECK_TKFLAG(__flag)

Definition at line 53 of file toolkit_common.c.

Referenced by cctk_create_game_object(), and cctk_init_std_archetypes().

#define CHECK_TKFLAG (   __flag)    (status_flag&__flag)

Definition at line 52 of file toolkit_common.c.

#define SET_TKFLAG (   __flag)    (status_flag |= __flag)
#define STATUS_ANIM   0x4000

Definition at line 49 of file toolkit_common.c.

Referenced by cctk_init_std_archetypes().

#define STATUS_ARCH   0x8000

Definition at line 50 of file toolkit_common.c.

Referenced by cctk_create_game_object(), and cctk_init_std_archetypes().

#define STATUS_BLOCK   0x1000

Definition at line 47 of file toolkit_common.c.

Referenced by cctk_init_std_archetypes().

#define STATUS_BMAP   0x2000

Definition at line 48 of file toolkit_common.c.

Referenced by cctk_init_std_archetypes().

#define STATUS_CONFDIR   0x0004

Definition at line 41 of file toolkit_common.c.

Referenced by cctk_setconfdir().

#define STATUS_DATADIR   0x0002

Definition at line 40 of file toolkit_common.c.

Referenced by cctk_init_std_archetypes(), and cctk_setdatadir().

#define STATUS_GLOBALS   0x0100

Definition at line 43 of file toolkit_common.c.

Referenced by cctk_init_std_archetypes().

#define STATUS_HASHTABLE   0x0200

Definition at line 44 of file toolkit_common.c.

Referenced by cctk_init_std_archetypes().

#define STATUS_LOGDIR   0x0001

Definition at line 39 of file toolkit_common.c.

Referenced by cctk_init_std_archetypes(), and cctk_setlog().

#define STATUS_OBJECTS   0x0400

Definition at line 45 of file toolkit_common.c.

Referenced by cctk_create_game_object(), and cctk_init_std_archetypes().

#define STATUS_VARS   0x0800

Definition at line 46 of file toolkit_common.c.

Referenced by cctk_init_std_archetypes().

Function Documentation

object* cctk_create_game_object ( const char *  archname)

Initialize a simple object.

Make it appear as an actual ingame object by setting appropriate flags (so it is part of game, not just a storage) Requires arch and object initialized in status flag

Parameters
archnamethe archetype name to use (NULL= default one)
Returns
created object, including its more parts, or NULL if archetype doesn't exist.

Definition at line 106 of file toolkit_common.c.

References CCTK_ASSERT, CLEAR_FLAG, find_archetype(), FLAG_FREED, object_create_arch(), STATUS_ARCH, and STATUS_OBJECTS.

Referenced by START_TEST().

Here is the call graph for this function:

Here is the caller graph for this function:

void cctk_init_std_archetypes ( void  )

Loads up to archetype initialisation using standard crossfire files in source tree.

This function requires that cctk_setlog and cctk_setdatadir have both been run already.

Definition at line 83 of file toolkit_common.c.

References Settings::archetypes, CCTK_ASSERT, FALSE, init_anim(), init_archetypes(), init_block(), init_globals(), init_hash_table(), init_objects(), init_stats(), read_bmap_names(), read_smooth(), SET_TKFLAG, settings, STATUS_ANIM, STATUS_ARCH, STATUS_BLOCK, STATUS_BMAP, STATUS_DATADIR, STATUS_GLOBALS, STATUS_HASHTABLE, STATUS_LOGDIR, STATUS_OBJECTS, STATUS_VARS, and Settings::treasures.

Referenced by setup().

Here is the call graph for this function:

Here is the caller graph for this function:

void cctk_set_object_strings ( object op,
const char *  string 
)

Set all strings in given object to given parameter string, used for checking cleaning of objects, mainly.

Parameters
opThe object to initialize
stringThe string to set in all object's char *fields

Definition at line 128 of file toolkit_common.c.

References add_string(), obj::lore, obj::materialname, obj::msg, obj::name, obj::name_pl, obj::race, obj::skill, obj::slaying, and obj::title.

Referenced by START_TEST().

Here is the call graph for this function:

Here is the caller graph for this function:

void cctk_setconfdir ( const char *  confdir)

Definition at line 73 of file toolkit_common.c.

References Settings::confdir, SET_TKFLAG, settings, and STATUS_CONFDIR.

Referenced by setup().

Here is the caller graph for this function:

void cctk_setdatadir ( const char *  datadir)

Definition at line 68 of file toolkit_common.c.

References Settings::datadir, SET_TKFLAG, settings, and STATUS_DATADIR.

Referenced by setup().

Here is the caller graph for this function:

void cctk_setlog ( const char *  logfile)

set the logdir to use

Definition at line 63 of file toolkit_common.c.

References logfile, Settings::logfilename, SET_TKFLAG, settings, and STATUS_LOGDIR.

Referenced by setup().

Here is the caller graph for this function:

Variable Documentation

int status_flag = 0
static

Definition at line 58 of file toolkit_common.c.