Crossfire Server, Trunk
toolkit_common.cpp File Reference
#include <global.h>
#include <stdlib.h>
#include <check.h>
#include "../include/toolkit_common.h"
#include <assets.h>
+ Include dependency graph for toolkit_common.cpp:

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)
 
void cctk_init_std_archetypes (void)
 
void cctk_set_object_strings (object *op, const char *string)
 
void cctk_setdatadir (const char *datadir)
 
void cctk_setlog (const char *logfile)
 

Variables

static int status_flag = 0
 

Macro Definition Documentation

◆ CCTK_ASSERT

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

Definition at line 54 of file toolkit_common.cpp.

◆ CHECK_TKFLAG

#define CHECK_TKFLAG (   __flag)    (status_flag&__flag)

Definition at line 53 of file toolkit_common.cpp.

◆ SET_TKFLAG

#define SET_TKFLAG (   __flag)    (status_flag |= __flag)

Definition at line 52 of file toolkit_common.cpp.

◆ STATUS_ANIM

#define STATUS_ANIM   0x4000

Definition at line 50 of file toolkit_common.cpp.

◆ STATUS_ARCH

#define STATUS_ARCH   0x8000

Definition at line 51 of file toolkit_common.cpp.

◆ STATUS_BLOCK

#define STATUS_BLOCK   0x1000

Definition at line 48 of file toolkit_common.cpp.

◆ STATUS_BMAP

#define STATUS_BMAP   0x2000

Definition at line 49 of file toolkit_common.cpp.

◆ STATUS_CONFDIR

#define STATUS_CONFDIR   0x0004

Definition at line 42 of file toolkit_common.cpp.

◆ STATUS_DATADIR

#define STATUS_DATADIR   0x0002

Definition at line 41 of file toolkit_common.cpp.

◆ STATUS_GLOBALS

#define STATUS_GLOBALS   0x0100

Definition at line 44 of file toolkit_common.cpp.

◆ STATUS_HASHTABLE

#define STATUS_HASHTABLE   0x0200

Definition at line 45 of file toolkit_common.cpp.

◆ STATUS_LOGDIR

#define STATUS_LOGDIR   0x0001

Definition at line 40 of file toolkit_common.cpp.

◆ STATUS_OBJECTS

#define STATUS_OBJECTS   0x0400

Definition at line 46 of file toolkit_common.cpp.

◆ STATUS_VARS

#define STATUS_VARS   0x0800

Definition at line 47 of file toolkit_common.cpp.

Function Documentation

◆ cctk_create_game_object()

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 105 of file toolkit_common.cpp.

References archininventory::arch, CCTK_ASSERT, CLEAR_FLAG, find_archetype(), FLAG_FREED, altar_valkyrie::obj, 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:

◆ cctk_init_std_archetypes()

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.cpp.

References ASSETS_ALL, assets_collect(), assets_init(), CCTK_ASSERT, Settings::datadir, init_block(), init_globals(), init_hash_table(), init_objects(), init_stats(), SET_TKFLAG, settings, STATUS_ANIM, STATUS_ARCH, STATUS_BLOCK, STATUS_BMAP, STATUS_DATADIR, STATUS_GLOBALS, STATUS_HASHTABLE, STATUS_LOGDIR, STATUS_OBJECTS, and STATUS_VARS.

Referenced by setup().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cctk_set_object_strings()

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 127 of file toolkit_common.cpp.

References add_string(), and give::op.

Referenced by START_TEST().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cctk_setdatadir()

void cctk_setdatadir ( const char *  datadir)

Definition at line 69 of file toolkit_common.cpp.

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

Referenced by main(), and setup().

+ Here is the caller graph for this function:

◆ cctk_setlog()

void cctk_setlog ( const char *  logfile)

set the logdir to use

Definition at line 64 of file toolkit_common.cpp.

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

Referenced by setup().

+ Here is the caller graph for this function:

Variable Documentation

◆ status_flag

int status_flag = 0
static

Definition at line 59 of file toolkit_common.cpp.

CHECK_TKFLAG
#define CHECK_TKFLAG(__flag)
Definition: toolkit_common.cpp:53