ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/include/define.h
(Generate patch)

Comparing deliantra/server/include/define.h (file contents):
Revision 1.18 by root, Mon Dec 18 02:35:01 2006 UTC vs.
Revision 1.19 by root, Mon Dec 18 03:00:02 2006 UTC

395#define SIZEOFFREE2 24 395#define SIZEOFFREE2 24
396#define SIZEOFFREE 49 396#define SIZEOFFREE 49
397 397
398#define NROF_SOUNDS (23 + NROFREALSPELLS) /* Number of sounds */ 398#define NROF_SOUNDS (23 + NROFREALSPELLS) /* Number of sounds */
399 399
400/* Flag structure now changed. 400/*
401 * Each flag is now a bit offset, starting at zero. The macros
402 * will update/read the appropriate flag element in the object
403 * structure.
404 *
405 * Hopefully, since these offsets are integer constants set at run time,
406 * the compiler will reduce the macros something as simple as the
407 * old system was.
408 *
409 * Flags now have FLAG as the prefix. This to be clearer, and also
410 * to make sure F_ names are not still being used anyplace.
411 *
412 * The macros below assume that the flag size for each element is 32
413 * bits. IF it is smaller, bad things will happen. See structs.h
414 * for more info.
415 *
416 * All functions should use the macros below. In process of converting
417 * to the new system, I find several files that did not use the previous
418 * macros.
419 *
420 * If any FLAG's are or changed, make sure the flag_names structure in 401 * If any FLAG's are added or changed, make sure the flag_names structure in
421 * common/loader.l is updated. 402 * common/loader.l is updated.
422 *
423 * flags[0] is 0 to 31
424 * flags[1] is 32 to 63
425 * flags[2] is 64 to 95
426 * flags[3] is 96 to 127
427 */ 403 */
428 404
429/* Basic routines to do above */ 405/* Basic routines to do above */
430#define SET_FLAG(obj, flag) (obj)->flags[flag] = 1 406#define SET_FLAG(obj, flag) (obj)->flags[flag] = 1
431#define CLEAR_FLAG(obj, flag) (obj)->flags[flag] = 0 407#define CLEAR_FLAG(obj, flag) (obj)->flags[flag] = 0
432#define QUERY_FLAG(obj, flag) (obj)->flags[flag] 408#define QUERY_FLAG(obj, flag) (obj)->flags[flag]
433
434/* convenience macros to determine what kind of things we are dealing with */
435
436#define IS_WEAPON(op) \
437 (op->type == ARROW || op->type == BOW || op->type == WEAPON)
438
439#define IS_ARMOR(op) \
440 (op->type == ARMOUR || op->type == SHIELD || op->type == HELMET || \
441 op->type == CLOAK || op->type == BOOTS || op->type == GLOVES || \
442 op->type == BRACERS || op->type == GIRDLE)
443
444#define IS_LIVE(op) \
445 ((op->type == PLAYER || QUERY_FLAG(op, FLAG_MONSTER) || \
446 (QUERY_FLAG(op, FLAG_ALIVE) && !QUERY_FLAG(op, FLAG_GENERATOR) && \
447 !op->type == DOOR)) && (!QUERY_FLAG(op,FLAG_IS_A_TEMPLATE)))
448
449#define IS_ARROW(op) \
450 (op->type==ARROW || \
451 (op->type==SPELL_EFFECT && \
452 (op->subtype == SP_BULLET || op->subtype == SP_MAGIC_MISSILE)))
453
454/* This return TRUE if object has still randomitems which
455 * could be expanded.
456 */
457#define HAS_RANDOM_ITEMS(op) (op->randomitems && (!QUERY_FLAG(op,FLAG_IS_A_TEMPLATE)))
458 409
459/* the flags */ 410/* the flags */
460 411
461#define FLAG_ALIVE 0 /* Object can fight (or be fought) */ 412#define FLAG_ALIVE 0 /* Object can fight (or be fought) */
462#define FLAG_WIZ 1 /* Object has special privilegies */ 413#define FLAG_WIZ 1 /* Object has special privilegies */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines