--- deliantra/server/include/global.h 2006/02/03 07:12:49 1.1 +++ deliantra/server/include/global.h 2006/12/11 19:46:46 1.20 @@ -1,9 +1,4 @@ /* - * static char *rcsid_global_h = - * "$Id$"; - */ - -/* CrossFire, A Multiplayer game for X-windows Copyright (C) 2002 Mark Wedel & Crossfire Development Team @@ -77,23 +72,8 @@ typedef signed char sint8; #define SINT8_MAX 127 - typedef unsigned short Fontindex; -#ifdef WIN32 -/* Python plugin stuff defines SIZEOF_LONG_LONG as 8, and besides __int64 is a 64b type on MSVC... - * So let's force the typedef */ -typedef unsigned __int64 uint64; -typedef signed __int64 sint64; -/* Needed for experience */ -#define atoll _atoi64 - -/* To reduce number of warnings */ -#pragma warning( disable: 4244 ) /* conversion from 'xxx' to 'yyy', possible loss of data */ -#pragma warning( disable: 4305 ) /* initializing float f = 0.05; instead of f = 0.05f; */ - -#else /* WIN32 */ - #if SIZEOF_LONG == 8 typedef unsigned long uint64; typedef signed long sint64; @@ -105,7 +85,16 @@ #error correct and send mail to crossfire-devel on how to do this #endif -#endif +#include + +#define ACC_CLASS(name) +#define ACC(meta,member) member + +#include "keyword.h" +#include "traits.h" +#include "dynbuf.h" +#include "util.h" +#include "shstr.h" /* This blob, in this order, is needed to actually define maps */ #include "face.h" @@ -136,11 +125,11 @@ * So far only used when dealing with artifacts. * (now used by alchemy and other code too. Nov 95 b.t). */ -typedef struct linked_char { - const char *name; +struct linked_char +{ + shstr name; struct linked_char *next; -} linked_char; - +}; /* Pull in artifacts */ #include "artifact.h" @@ -169,7 +158,7 @@ * These are the beginnings of linked lists: */ EXTERN player *first_player; -EXTERN mapstruct *first_map; +EXTERN maptile *first_map; EXTERN region *first_region; EXTERN treasurelist *first_treasurelist; EXTERN artifactlist *first_artifactlist; @@ -178,8 +167,6 @@ EXTERN godlink *first_god; EXTERN racelink *first_race; -#define NROF_COMPRESS_METHODS 4 -EXTERN char *uncomp[NROF_COMPRESS_METHODS][3]; /* * The editor uses these (will get them out of here later): */ @@ -191,13 +178,13 @@ */ EXTERN long warn_archetypes; /* If true, write warnings when failing */ - /* to find archetypes when loading from file */ + /* to find archetypes when loading from file */ EXTERN long init_done; /* Ignores signals until init_done is true */ EXTERN long trying_emergency_save; /* True when emergency_save() is reached */ EXTERN long nroferrors; /* If it exceeds MAX_ERRORS, call fatal() */ extern long pticks; /* used by various function to determine */ - /* how often to save the character */ + /* how often to save the character */ /* * Misc global variables: */ @@ -210,6 +197,7 @@ EXTERN archetype *empty_archetype; /* Nice to have fast access to it */ EXTERN archetype *map_archeytpe; EXTERN char first_map_path[MAX_BUF]; /* The start-level */ +EXTERN char first_map_ext_path[MAX_BUF]; /* Path used for per-race start maps */ EXTERN char errmsg[HUGE_BUF]; EXTERN long ob_count; @@ -217,9 +205,8 @@ * Used in treasure.c */ EXTERN archetype *ring_arch,*amulet_arch,*staff_arch,*crown_arch; -EXTERN const char *undead_name; /* Used in hit_player() in main.c */ -EXTERN Animations *animations; +extern std::vector animations; EXTERN int num_animations,animations_allocated, bmaps_checksum; /* Rotate right from bsd sum. This is used in various places for checksumming */ @@ -266,14 +253,6 @@ * makes the code a bit cleaner when doing so. */ #define FREE_AND_CLEAR(xyz) {free(xyz); xyz=NULL; } -#define FREE_AND_CLEAR_STR(xyz) {free_string(xyz); xyz=NULL; } - -/* FREE_AND_COPY is for the shared string - it is handy enough - * to use all over the place. - */ -#define FREE_AND_COPY(sv,nv) { if (sv) free_string(sv); sv=add_string(nv); } - -#define DELETE_STRING(__str_) free_string(__str_);__str_=NULL; #ifdef CALLOC #undef CALLOC @@ -287,7 +266,6 @@ # define CFREE(x) free(x) #endif -#ifndef WIN32 /* ---win32 we define this stuff in win32.h */ #if HAVE_DIRENT_H # include # define NAMLEN(dirent) strlen((dirent)->d_name) @@ -304,7 +282,6 @@ # include # endif #endif -#endif typedef struct Settings { char *logfilename; /* logfile to use */ @@ -328,7 +305,9 @@ char *tmpdir; /* Directory to use for temporary files */ uint8 stat_loss_on_death; /* If true, chars lose a random stat when they die */ sint16 pk_luck_penalty; /* Amount by which player luck is reduced if they PK */ - uint8 use_permanent_experience; /* If true, players can gain perm exp */ + uint8 permanent_exp_ratio; /* how much exp should be 'permenant' and unable to be lost*/ + uint8 death_penalty_ratio; /* how much exp should be lost at death */ + uint8 death_penalty_level; /* how many levels worth of exp may be lost on one death */ uint8 balanced_stat_loss; /* If true, Death stat depletion based on level etc */ uint8 not_permadeth; /* if true, death is non-permament */ uint8 simple_exp; /* If true, use the simple experience system */ @@ -338,7 +317,7 @@ uint8 search_items; /* search_items command */ uint8 spell_encumbrance; /* encumbrance effects spells */ uint8 spell_failure_effects; /* nasty backlash to spell failures */ - uint16 set_friendly_fire; /* Percent of damage done by peaceful player vs player damage */ + uint16 set_friendly_fire; /* Percent of damage done by peaceful player vs player damage */ uint8 casting_time; /* it takes awhile to cast a spell */ uint8 real_wiz; /* use mud-like wizards */ uint8 recycle_tmp_maps; /* re-use tmp maps. */ @@ -381,6 +360,7 @@ int armor_speed_improvement; /* Speed improvement */ uint8 armor_speed_linear; /* If 1, speed improvement is linear, else exponantiel */ uint8 no_player_stealing; /* If 1, can not steal from other players */ + uint8 create_home_portals; /* If 1, can create portals in personal maps */ } Settings; extern Settings settings; @@ -399,11 +379,24 @@ #define GETTIMEOFDAY(last_time) gettimeofday(last_time); #endif -/* GROS: Those are used by plugin events (argument fixthem) */ -#define SCRIPT_FIX_ACTIVATOR 2 -#define SCRIPT_FIX_ALL 1 -#define SCRIPT_FIX_NOTHING 0 - #include "plugin.h" +#include "cfperl.h" + +//TODO: various TEMPORARY link guards to avoid doing the wrong thing +void free (object *); +void free (archetype *); +void free (recipe *); +void free (linked_char *); +void free (godlink *); +void free (objectlink *); +void free (oblinkpt *); +void free (maptile *); +void free (key_value *); +void free (treasure *); +void free (materialtype_t *); +void free (player *); +void free (New_Face *); +void free (racelink *); #endif /* GLOBAL_H */ +