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.17 by root, Fri Dec 15 20:08:45 2006 UTC vs.
Revision 1.20 by elmex, Mon Dec 18 17:10:07 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(xyz, p) \ 406#define SET_FLAG(obj, flag) (obj)->flags[flag] = 1
431 ((xyz)->flags[p/32] |= (1U << (p % 32))) 407#define CLEAR_FLAG(obj, flag) (obj)->flags[flag] = 0
432#define CLEAR_FLAG(xyz, p) \ 408#define QUERY_FLAG(obj, flag) (obj)->flags[flag]
433 ((xyz)->flags[p/32] &= ~(1U << (p % 32)))
434#define QUERY_FLAG(xyz, p) \
435 ((xyz)->flags[p/32] & (1U << (p % 32)))
436#define COMPARE_FLAGS(p,q) \
437 ( \
438 ((p)->flags[0] == (q)->flags[0]) && \
439 ((p)->flags[1] == (q)->flags[1]) && \
440 ((p)->flags[2] == (q)->flags[2]) && \
441 ((p)->flags[3] == (q)->flags[3]) \
442 )
443
444/* convenience macros to determine what kind of things we are dealing with */
445
446#define IS_WEAPON(op) \
447 (op->type == ARROW || op->type == BOW || op->type == WEAPON)
448
449#define IS_ARMOR(op) \
450 (op->type == ARMOUR || op->type == SHIELD || op->type == HELMET || \
451 op->type == CLOAK || op->type == BOOTS || op->type == GLOVES || \
452 op->type == BRACERS || op->type == GIRDLE)
453
454#define IS_LIVE(op) \
455 ((op->type == PLAYER || QUERY_FLAG(op, FLAG_MONSTER) || \
456 (QUERY_FLAG(op, FLAG_ALIVE) && !QUERY_FLAG(op, FLAG_GENERATOR) && \
457 !op->type == DOOR)) && (!QUERY_FLAG(op,FLAG_IS_A_TEMPLATE)))
458
459#define IS_ARROW(op) \
460 (op->type==ARROW || \
461 (op->type==SPELL_EFFECT && \
462 (op->subtype == SP_BULLET || op->subtype == SP_MAGIC_MISSILE)))
463
464/* This return TRUE if object has still randomitems which
465 * could be expanded.
466 */
467#define HAS_RANDOM_ITEMS(op) (op->randomitems && (!QUERY_FLAG(op,FLAG_IS_A_TEMPLATE)))
468 409
469/* the flags */ 410/* the flags */
470 411
471#define FLAG_ALIVE 0 /* Object can fight (or be fought) */ 412#define FLAG_ALIVE 0 /* Object can fight (or be fought) */
472#define FLAG_WIZ 1 /* Object has special privilegies */ 413#define FLAG_WIZ 1 /* Object has special privilegies */
493 434
494#define FLAG_GENERATOR 16 /* Will generate type ob->stats.food */ 435#define FLAG_GENERATOR 16 /* Will generate type ob->stats.food */
495#define FLAG_IS_THROWN 17 /* Object is designed to be thrown. */ 436#define FLAG_IS_THROWN 17 /* Object is designed to be thrown. */
496#define FLAG_AUTO_APPLY 18 437#define FLAG_AUTO_APPLY 18
497 /* Will be applied when created */ 438 /* Will be applied when created */
498#define FLAG_TREASURE 19 /* Will generate treasure when applied */ 439 // not used anywhere in the code // #define FLAG_TREASURE 19 /* Will generate treasure when applied */
499#define FLAG_PLAYER_SOLD 20 /* Object was sold to a shop by a player. */ 440#define FLAG_PLAYER_SOLD 20 /* Object was sold to a shop by a player. */
500#define FLAG_SEE_INVISIBLE 21 /* Will see invisible player */ 441#define FLAG_SEE_INVISIBLE 21 /* Will see invisible player */
501#define FLAG_CAN_ROLL 22 /* Object can be rolled */ 442#define FLAG_CAN_ROLL 22 /* Object can be rolled */
502#define FLAG_OVERLAY_FLOOR 23 /* Object is an overlay floor */ 443#define FLAG_OVERLAY_FLOOR 23 /* Object is an overlay floor */
503#define FLAG_IS_TURNABLE 24 /* Object can change face with direction */ 444#define FLAG_IS_TURNABLE 24 /* Object can change face with direction */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines