--- deliantra/server/include/define.h 2006/12/15 20:08:45 1.17 +++ deliantra/server/include/define.h 2006/12/18 17:10:07 1.20 @@ -397,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 */ @@ -495,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 */