--- deliantra/server/include/define.h 2006/12/03 00:59:58 1.13 +++ deliantra/server/include/define.h 2006/12/18 17:10:07 1.20 @@ -18,7 +18,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - The authors can be reached via e-mail at crossfire-devel@real-time.com + The authors can be reached via e-mail at crossfire@schmorp.de */ /* This file is best viewed with a window width of about 100 character */ @@ -45,9 +45,7 @@ error - Your ANSI C compiler should be defining __STDC__; #endif -#ifndef WIN32 /* ---win32 exclude unix configuration part */ -# include -#endif +#include #define FONTDIR "" #define FONTNAME "" @@ -399,74 +397,15 @@ #define NROF_SOUNDS (23 + NROFREALSPELLS) /* Number of sounds */ -/* Flag structure now changed. - * Each flag is now a bit offset, starting at zero. The macros - * will update/read the appropriate flag element in the object - * structure. - * - * Hopefully, since these offsets are integer constants set at run time, - * the compiler will reduce the macros something as simple as the - * old system was. - * - * Flags now have FLAG as the prefix. This to be clearer, and also - * to make sure F_ names are not still being used anyplace. - * - * The macros below assume that the flag size for each element is 32 - * bits. IF it is smaller, bad things will happen. See structs.h - * for more info. - * - * All functions should use the macros below. In process of converting - * to the new system, I find several files that did not use the previous - * macros. - * - * If any FLAG's are or changed, make sure the flag_names structure in +/* + * If any FLAG's are added or changed, make sure the flag_names structure in * common/loader.l is updated. - * - * flags[0] is 0 to 31 - * flags[1] is 32 to 63 - * flags[2] is 64 to 95 - * flags[3] is 96 to 127 */ /* Basic routines to do above */ -#define SET_FLAG(xyz, p) \ - ((xyz)->flags[p/32] |= (1U << (p % 32))) -#define CLEAR_FLAG(xyz, p) \ - ((xyz)->flags[p/32] &= ~(1U << (p % 32))) -#define QUERY_FLAG(xyz, p) \ - ((xyz)->flags[p/32] & (1U << (p % 32))) -#define COMPARE_FLAGS(p,q) \ - ( \ - ((p)->flags[0] == (q)->flags[0]) && \ - ((p)->flags[1] == (q)->flags[1]) && \ - ((p)->flags[2] == (q)->flags[2]) && \ - ((p)->flags[3] == (q)->flags[3]) \ - ) - -/* convenience macros to determine what kind of things we are dealing with */ - -#define IS_WEAPON(op) \ - (op->type == ARROW || op->type == BOW || op->type == WEAPON) - -#define IS_ARMOR(op) \ - (op->type == ARMOUR || op->type == SHIELD || op->type == HELMET || \ - op->type == CLOAK || op->type == BOOTS || op->type == GLOVES || \ - op->type == BRACERS || op->type == GIRDLE) - -#define IS_LIVE(op) \ - ((op->type == PLAYER || QUERY_FLAG(op, FLAG_MONSTER) || \ - (QUERY_FLAG(op, FLAG_ALIVE) && !QUERY_FLAG(op, FLAG_GENERATOR) && \ - !op->type == DOOR)) && (!QUERY_FLAG(op,FLAG_IS_A_TEMPLATE))) - -#define IS_ARROW(op) \ - (op->type==ARROW || \ - (op->type==SPELL_EFFECT && \ - (op->subtype == SP_BULLET || op->subtype == SP_MAGIC_MISSILE))) - -/* This return TRUE if object has still randomitems which - * could be expanded. - */ -#define HAS_RANDOM_ITEMS(op) (op->randomitems && (!QUERY_FLAG(op,FLAG_IS_A_TEMPLATE))) +#define SET_FLAG(obj, flag) (obj)->flags[flag] = 1 +#define CLEAR_FLAG(obj, flag) (obj)->flags[flag] = 0 +#define QUERY_FLAG(obj, flag) (obj)->flags[flag] /* the flags */ @@ -497,7 +436,7 @@ #define FLAG_IS_THROWN 17 /* Object is designed to be thrown. */ #define FLAG_AUTO_APPLY 18 /* Will be applied when created */ -#define FLAG_TREASURE 19 /* Will generate treasure when applied */ + // not used anywhere in the code // #define FLAG_TREASURE 19 /* Will generate treasure when applied */ #define FLAG_PLAYER_SOLD 20 /* Object was sold to a shop by a player. */ #define FLAG_SEE_INVISIBLE 21 /* Will see invisible player */ #define FLAG_CAN_ROLL 22 /* Object can be rolled */ @@ -1034,22 +973,8 @@ * here. */ -#ifdef HAVE_SRANDOM -# define RANDOM() random() -# define SRANDOM(xyz) srandom(xyz) -#else -# ifdef HAVE_SRAND48 -# define RANDOM() lrand48() -# define SRANDOM(xyz) srand48(xyz) -# else -# ifdef HAVE_SRAND -# define RANDOM() rand() -# define SRANDOM(xyz) srand(xyz) -# else -# error "Could not find a usable random routine" -# endif -# endif -#endif +#define RANDOM() random() +#define SRANDOM(xyz) srandom(xyz) /* Returns the weight of the given object. Note: it does not take the number of * items (nrof) into account.