[CODE] More race questions from me.. :>

From: Steve Reeves (dormammu@voicenet.com)
Date: 10/15/96


First, I'd like to thank everyone for answering my previous question.
Several people told me about "invisible characters" which could be screwing
something up.  Apparently, they were there, as I backspaced over the parts I
pasted in, and the problem went away.  However, I know have an even worse
problem.  When compiling, I get many, many, many errors in comm.c ... a file
I didn't change at all.  As well as errors in lines I didn't touch in
utils.h.  I'm a semi-new coder, so these errors are giving me trouble.
Anyway, since there are so many errors, I attached the files in MIME format
to this message.. :>  I attached a log of all the errors, as well as utils.h
[comm.c is totally 100% stock code.]  I looked and can't find anything
wrong.  Also, as a side note, I replaced my modified utils.h with the stock
utils.h, and comm.c didn't have any errors.
Also, the lines it complains about in the modified utils.h are the same as
in the stock.  I dunno what's wrong.  

Anyway, I'm hoping someone can help me out.. so, take a look at the attached
files, and tell me what you think..  [Assuming this stupid mail program
attaches the files properly :> ]

Steve -- who hopes he isn't being to big an annoyance with this.  :>

--8<--
nolta:(ttyp1)~/circle30bpl11/src {3}>make
make ../bin/circle
make[1]: Entering directory `/home/dormammu/circle30bpl11/src'
gcc -c -g -O -Wall -fno-strict-prototypes  comm.c
In file included from comm.c:29:
utils.h:129: parse error before `if'
utils.h:129: stray '\' in program
utils.h:130: conflicting types for `abort'
/usr/include/stdlib.h:244: previous declaration of `abort'
utils.h:130: warning: data definition has no type or storage class
utils.h:130: parse error before `}'
utils.h:133: stray '\' in program
utils.h:134: warning: data definition has no type or storage class
utils.h:134: parse error before `}'
utils.h:146: stray '\' in program
utils.h:147: stray '\' in program
utils.h:148: stray '\' in program
utils.h:149: stray '\' in program
utils.h:150: stray '\' in program
utils.h:151: stray '\' in program
utils.h:152: stray '\' in program
utils.h:153: stray '\' in program
utils.h:154: stray '\' in program
utils.h:193: `room' undeclared here (not in a function)
utils.h:193: parse error before `.'
utils.h:193: stray '\' in program
utils.h:194: stray '\' in program
utils.h:195: stray '\' in program
utils.h:196: stray '\' in program
utils.h:222: stray '\' in program
utils.h:292: stray '\' in program
utils.h:293: stray '\' in program
utils.h:294: stray '\' in program
utils.h:295: stray '\' in program
utils.h:296: stray '\' in program
utils.h:314: stray '\' in program
utils.h:334: `obj' undeclared here (not in a function)
utils.h:334: parse error before `.'
utils.h:357: stray '\' in program
utils.h:360: stray '\' in program
utils.h:366: stray '\' in program
utils.h:366: stray '\' in program
utils.h:372: stray '\' in program
utils.h:372: stray '\' in program
utils.h:383: stray '\' in program
utils.h:383: stray '\' in program
utils.h:386: stray '\' in program
utils.h:386: stray '\' in program
utils.h:390: stray '\' in program
utils.h:390: stray '\' in program
utils.h:391: stray '\' in program
utils.h:406: stray '\' in program
comm.c: In function `write_to_q':
comm.c:860: stray '\' in program
comm.c:861: stray '\' in program
comm.c:878: parse error before `int'
comm.c:884: warning: `return' with a value, in function returning void
comm.c:886: `tmp' undeclared (first use this function)
comm.c:886: (Each undeclared identifier is reported only once
comm.c:886: for each function it appears in.)
comm.c:887: `dest' undeclared (first use this function)
comm.c:888: invalid type argument of `unary *'
comm.c:894: warning: `return' with a value, in function returning void
comm.c:900: parse error before `void'
comm.c:904: `d' undeclared (first use this function)
comm.c:908: `dummy' undeclared (first use this function)
comm.c:858: warning: `new' might be used uninitialized in this function
comm.c: In function `write_to_output':
comm.c:946: stray '\' in program
comm.c:947: stray '\' in program
comm.c:951: parse error before `strcpy'
comm.c:969: parse error before `int'
comm.c:983: `desc' undeclared (first use this function)
comm.c:983: `s' undeclared (first use this function)
comm.c:985: warning: `return' with a value, in function returning void
comm.c:997: warning: `return' with a value, in function returning void
comm.c:1000: stray '\' in program
comm.c:1027: warning: `return' with a value, in function returning void
comm.c:1054: warning: `return' with a value, in function returning void
comm.c:1059: parse error before `int'
comm.c:1065: warning: passing arg 1 of `strcpy' makes pointer from integer witho
ut a cast
comm.c:1068: warning: passing arg 1 of `strcpy' makes pointer from integer witho
ut a cast
comm.c:1072: warning: passing arg 1 of `strcat' makes pointer from integer witho
ut a cast
comm.c:1076: warning: passing arg 1 of `strcat' makes pointer from integer witho
ut a cast
comm.c:1083: `result' undeclared (first use this function)
comm.c:1083: warning: passing arg 2 of `write_to_descriptor' makes pointer from
integer without a cast
comm.c:1085: warning: passing arg 2 of `write_to_descriptor' makes pointer from
integer without a cast
comm.c:1108: warning: `return' with a value, in function returning void
comm.c:1113: parse error before `int'
comm.c:1117: `total' undeclared (first use this function)
comm.c:1124: `bytes_written' undeclared (first use this function)
comm.c:1134: warning: `return' with a value, in function returning void
comm.c:1141: warning: `return' with a value, in function returning void
comm.c: In function `close_socket':
comm.c:1371: stray '\' in program
comm.c:1371: parse error before `)'
comm.c:1376: stray '\' in program
comm.c:1376: parse error before `?'
comm.c:1376: warning: format argument is not a pointer (arg 3)
comm.c:1376: parse error before `)'
comm.c:1376: stray '\' in program
comm.c:1387: stray '\' in program
comm.c:1352: warning: unused variable `temp'
comm.c: In function `perform_act':
comm.c:1663: stray '\' in program
comm.c:1663: parse error before `?'
comm.c:1663: parse error before `)'
comm.c:1663: stray '\' in program
comm.c:1666: stray '\' in program
comm.c:1666: parse error before `?'
comm.c:1666: parse error before `)'
comm.c:1666: stray '\' in program
comm.c:1687: stray '\' in program
comm.c:1687: parse error before `?'
comm.c:1687: stray '\' in program
comm.c:1690: parse error before `)'
comm.c:1690: stray '\' in program
comm.c:1690: stray '\' in program
comm.c:1693: stray '\' in program
comm.c:1693: parse error before `?'
comm.c:1693: stray '\' in program
comm.c:1696: parse error before `)'
comm.c:1696: stray '\' in program
comm.c:1696: stray '\' in program
comm.c: In function `act':
comm.c:1783: stray '\' in program
comm.c:1783: parse error before `)'
comm.c:1785: parse error before `perform_act'
make[1]: *** [comm.o] Error 1
make[1]: Leaving directory `/home/dormammu/circle30bpl11/src'
make: *** [default] Error 2

---8<---

/* ************************************************************************
*   File: utils.h                                       Part of CircleMUD *
*  Usage: header file: utility macros and prototypes of utility funcs     *
*                                                                         *
*  All rights reserved.  See license.doc for complete information.        *
*                                                                         *
*  Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University *
*  CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991.               *
************************************************************************ */


/* external declarations and prototypes **********************************/

extern struct weather_data weather_info;

#undef log

#ifdef CIRCLE_WINDOWS
#define log(x) basic_mud_log(x)
#endif

/* public functions in utils.c */
char    *str_dup(const char *source);
int     str_cmp(char *arg1, char *arg2);
int     strn_cmp(char *arg1, char *arg2, int n);
void    log(char *str);
int     touch(char *path);
void    mudlog(char *str, char type, int level, byte file);
void    log_death_trap(struct char_data *ch);
int     number(int from, int to);
int     dice(int number, int size);
void    sprintbit(long vektor, char *names[], char *result);
void    sprinttype(int type, char *names[], char *result);
int     get_line(FILE *fl, char *buf);
int     get_filename(char *orig_name, char *filename, int mode);
struct time_info_data age(struct char_data *ch);
int     num_pc_in_room(struct room_data *room);

/* undefine MAX and MIN so that our functions are used instead */
#ifdef MAX
#undef MAX
#endif

#ifdef MIN
#undef MIN
#endif

int MAX(int a, int b);
int MIN(int a, int b);

/* in magic.c */
bool    circle_follow(struct char_data *ch, struct char_data * victim);

/* in act.informative.c */
void    look_at_room(struct char_data *ch, int mode);

/* in act.movmement.c */
int     do_simple_move(struct char_data *ch, int dir, int following);
int     perform_move(struct char_data *ch, int dir, int following);

/* in limits.c */
int     mana_limit(struct char_data *ch);
int     hit_limit(struct char_data *ch);
int     move_limit(struct char_data *ch);
int     mana_gain(struct char_data *ch);
int     hit_gain(struct char_data *ch);
int     move_gain(struct char_data *ch);
void    advance_level(struct char_data *ch);
void    set_title(struct char_data *ch, char *title);
void    gain_exp(struct char_data *ch, int gain);
void    gain_exp_regardless(struct char_data *ch, int gain);
void    gain_condition(struct char_data *ch, int condition, int value);
void    check_idling(struct char_data *ch);
void    point_update(void);
void    update_pos(struct char_data *victim);


/* various constants *****************************************************/


/* defines for mudlog() */
#define OFF     0
#define BRF     1
#define NRM     2
#define CMP     3

/* get_filename() */
#define CRASH_FILE      0
#define ETEXT_FILE      1

/* breadth-first searching */
#define BFS_ERROR               -1
#define BFS_ALREADY_THERE       -2
#define BFS_NO_PATH             -3

/* mud-life time */
#define SECS_PER_MUD_HOUR       75
#define SECS_PER_MUD_DAY        (24*SECS_PER_MUD_HOUR)
#define SECS_PER_MUD_MONTH      (35*SECS_PER_MUD_DAY)
#define SECS_PER_MUD_YEAR       (17*SECS_PER_MUD_MONTH)

/* real-life time (remember Real Life?) */
#define SECS_PER_REAL_MIN       60
#define SECS_PER_REAL_HOUR      (60*SECS_PER_REAL_MIN)
#define SECS_PER_REAL_DAY       (24*SECS_PER_REAL_HOUR)
#define SECS_PER_REAL_YEAR      (365*SECS_PER_REAL_DAY)


/* string utils **********************************************************/


#define YESNO(a) ((a) ? "YES" : "NO")
#define ONOFF(a) ((a) ? "ON" : "OFF")

#define LOWER(c)   (((c)>='A'  && (c) <= 'Z') ? ((c)+('a'-'A')) : (c))
#define UPPER(c)   (((c)>='a'  && (c) <= 'z') ? ((c)+('A'-'a')) : (c) )

#define ISNEWL(ch) ((ch) == '\n' || (ch) == '\r') 
#define IF_STR(st) ((st) ? (st) : "\0")
#define CAP(st)  (*(st) = UPPER(*(st)), st)

#define AN(string) (strchr("aeiouAEIOU", *string) ? "an" : "a")


/* memory utils **********************************************************/


#define CREATE(result, type, number)  do {\
	if (!((result) = (type *) calloc ((number), sizeof(type))))\
		{ perror("malloc failure"); abort(); } } while(0)

#define RECREATE(result,type,number) do {\
  if (!((result) = (type *) realloc ((result), sizeof(type) * (number))))\
		{ perror("realloc failure"); abort(); } } while(0)

/*
 * the source previously used the same code in many places to remove an item
 * from a list: if it's the list head, change the head, else traverse the
 * list looking for the item before the one to be removed.  Now, we have a
 * macro to do this.  To use, just make sure that there is a variable 'temp'
 * declared as the same type as the list to be manipulated.  BTW, this is
 * a great application for C++ templates but, alas, this is not C++.  Maybe
 * CircleMUD 4.0 will be...
 */
#define REMOVE_FROM_LIST(item, head, next)      \
   if ((item) == (head))                \
      head = (item)->next;              \
   else {                               \
      temp = head;                      \
      while (temp && (temp->next != (item))) \
	 temp = temp->next;             \
      if (temp)                         \
	 temp->next = (item)->next;     \
   }                                    \


/* basic bitvector utils *************************************************/


#define IS_SET(flag,bit)  ((flag) & (bit))
#define SET_BIT(var,bit)  ((var) |= (bit))
#define REMOVE_BIT(var,bit)  ((var) &= ~(bit))
#define TOGGLE_BIT(var,bit) ((var) = (var) ^ (bit))

#define MOB_FLAGS(ch) ((ch)->char_specials.saved.act)
#define PLR_FLAGS(ch) ((ch)->char_specials.saved.act)
#define PRF_FLAGS(ch) ((ch)->player_specials->saved.pref)
#define AFF_FLAGS(ch) ((ch)->char_specials.saved.affected_by)
#define ROOM_FLAGS(loc) (world[(loc)].room_flags)

#define IS_NPC(ch)  (IS_SET(MOB_FLAGS(ch), MOB_ISNPC))
#define IS_MOB(ch)  (IS_NPC(ch) && ((ch)->nr >-1))

#define MOB_FLAGGED(ch, flag) (IS_NPC(ch) && IS_SET(MOB_FLAGS(ch), (flag)))
#define PLR_FLAGGED(ch, flag) (!IS_NPC(ch) && IS_SET(PLR_FLAGS(ch), (flag)))
#define AFF_FLAGGED(ch, flag) (IS_SET(AFF_FLAGS(ch), (flag)))
#define PRF_FLAGGED(ch, flag) (IS_SET(PRF_FLAGS(ch), (flag)))
#define ROOM_FLAGGED(loc, flag) (IS_SET(ROOM_FLAGS(loc), (flag)))

/* IS_AFFECTED for backwards compatibility */
#define IS_AFFECTED(ch, skill) (AFF_FLAGGED((ch), (skill)))

#define PLR_TOG_CHK(ch,flag) ((TOGGLE_BIT(PLR_FLAGS(ch), (flag))) & (flag))
#define PRF_TOG_CHK(ch,flag) ((TOGGLE_BIT(PRF_FLAGS(ch), (flag))) & (flag))


/* room utils ************************************************************/


#define SECT(room)      (world[(room)].sector_type)

#define IS_DARK(room)  ( !world[room].light && \
			 (ROOM_FLAGGED(room, ROOM_DARK) || \
			  ( ( SECT(room) != SECT_INSIDE && \
			      SECT(room) != SECT_CITY ) && \
			    (weather_info.sunlight == SUN_SET || \
			     weather_info.sunlight == SUN_DARK)) ) )

#define IS_LIGHT(room)  (!IS_DARK(room))

#define GET_ROOM_SPEC(room) ((room) >= 0 ? world[(room)].func : NULL)

/* char utils ************************************************************/


#define IN_ROOM(ch)     ((ch)->in_room)
#define GET_WAS_IN(ch)  ((ch)->was_in_room)
#define GET_AGE(ch)     (age(ch).year)

#define GET_NAME(ch)    (IS_NPC(ch) ? \
			 (ch)->player.short_descr : (ch)->player.name)
#define GET_TITLE(ch)   ((ch)->player.title)
#define GET_LEVEL(ch)   ((ch)->player.level)
#define GET_PASSWD(ch)  ((ch)->player.passwd)
#define GET_PFILEPOS(ch)((ch)->pfilepos)

/*
 * I wonder if this definition of GET_REAL_LEVEL should be the definition
 * of GET_LEVEL?  JE
 */
#define GET_REAL_LEVEL(ch) \
   (ch->desc && ch->desc->original ? GET_LEVEL(ch->desc->original) : \
    GET_LEVEL(ch))

#define GET_CLASS(ch)   ((ch)->player.class)
#define GET_RACE(ch)    ((ch)->player.race)
#define GET_HOME(ch)    ((ch)->player.hometown)
#define GET_HEIGHT(ch)  ((ch)->player.height)
#define GET_WEIGHT(ch)  ((ch)->player.weight)
#define GET_SEX(ch)     ((ch)->player.sex)

#define GET_STR(ch)     ((ch)->aff_abils.str)
#define GET_ADD(ch)     ((ch)->aff_abils.str_add)
#define GET_DEX(ch)     ((ch)->aff_abils.dex)
#define GET_INT(ch)     ((ch)->aff_abils.intel)
#define GET_WIS(ch)     ((ch)->aff_abils.wis)
#define GET_CON(ch)     ((ch)->aff_abils.con)
#define GET_CHA(ch)     ((ch)->aff_abils.cha)

#define GET_EXP(ch)       ((ch)->points.exp)
#define GET_AC(ch)        ((ch)->points.armor)
#define GET_HIT(ch)       ((ch)->points.hit)
#define GET_MAX_HIT(ch)   ((ch)->points.max_hit)
#define GET_MOVE(ch)      ((ch)->points.move)
#define GET_MAX_MOVE(ch)  ((ch)->points.max_move)
#define GET_MANA(ch)      ((ch)->points.mana)
#define GET_MAX_MANA(ch)  ((ch)->points.max_mana)
#define GET_GOLD(ch)      ((ch)->points.gold)
#define GET_BANK_GOLD(ch) ((ch)->points.bank_gold)
#define GET_HITROLL(ch)   ((ch)->points.hitroll)
#define GET_DAMROLL(ch)   ((ch)->points.damroll)

#define GET_POS(ch)       ((ch)->char_specials.position)
#define GET_IDNUM(ch)     ((ch)->char_specials.saved.idnum)
#define IS_CARRYING_W(ch) ((ch)->char_specials.carry_weight)
#define IS_CARRYING_N(ch) ((ch)->char_specials.carry_items)
#define FIGHTING(ch)      ((ch)->char_specials.fighting)
#define HUNTING(ch)       ((ch)->char_specials.hunting)
#define GET_SAVE(ch, i)   ((ch)->char_specials.saved.apply_saving_throw[i])
#define GET_ALIGNMENT(ch) ((ch)->char_specials.saved.alignment)

#define GET_COND(ch, i)         ((ch)->player_specials->saved.conditions[(i)])
#define GET_LOADROOM(ch)        ((ch)->player_specials->saved.load_room)
#define GET_PRACTICES(ch)       ((ch)->player_specials->saved.spells_to_learn)
#define GET_INVIS_LEV(ch)       ((ch)->player_specials->saved.invis_level)
#define GET_WIMP_LEV(ch)        ((ch)->player_specials->saved.wimp_level)
#define GET_FREEZE_LEV(ch)      ((ch)->player_specials->saved.freeze_level)
#define GET_BAD_PWS(ch)         ((ch)->player_specials->saved.bad_pws)
#define GET_TALK(ch, i)         ((ch)->player_specials->saved.talks[i])
#define POOFIN(ch)              ((ch)->player_specials->poofin)
#define POOFOUT(ch)             ((ch)->player_specials->poofout)
#define GET_LAST_OLC_TARG(ch)   ((ch)->player_specials->last_olc_targ)
#define GET_LAST_OLC_MODE(ch)   ((ch)->player_specials->last_olc_mode)
#define GET_ALIASES(ch)         ((ch)->player_specials->aliases)
#define GET_LAST_TELL(ch)       ((ch)->player_specials->last_tell)

#define GET_SKILL(ch, i)        ((ch)->player_specials->saved.skills[i])
#define SET_SKILL(ch, i, pct)   { (ch)->player_specials->saved.skills[i] = pct; }

#define GET_EQ(ch, i)           ((ch)->equipment[i])

#define GET_MOB_SPEC(ch) (IS_MOB(ch) ? (mob_index[(ch->nr)].func) : NULL)
#define GET_MOB_RNUM(mob)       ((mob)->nr)
#define GET_MOB_VNUM(mob)       (IS_MOB(mob) ? \
				 mob_index[GET_MOB_RNUM(mob)].virtual : -1)

#define GET_MOB_WAIT(ch)        ((ch)->mob_specials.wait_state)
#define GET_DEFAULT_POS(ch)     ((ch)->mob_specials.default_pos)
#define MEMORY(ch)              ((ch)->mob_specials.memory)

#define STRENGTH_APPLY_INDEX(ch) \
	( ((GET_ADD(ch)==0) || (GET_STR(ch) != 18)) ? GET_STR(ch) :\
	  (GET_ADD(ch) <= 50) ? 26 :( \
	  (GET_ADD(ch) <= 75) ? 27 :( \
	  (GET_ADD(ch) <= 90) ? 28 :( \
	  (GET_ADD(ch) <= 99) ? 29 :  30 ) ) )                   \
	)

#define CAN_CARRY_W(ch) (str_app[STRENGTH_APPLY_INDEX(ch)].carry_w)
#define CAN_CARRY_N(ch) (5 + (GET_DEX(ch) >> 1) + (GET_LEVEL(ch) >> 1))
#define AWAKE(ch) (GET_POS(ch) > POS_SLEEPING)
#define CAN_SEE_IN_DARK(ch) \
   (AFF_FLAGGED(ch, AFF_INFRAVISION) || PRF_FLAGGED(ch, PRF_HOLYLIGHT))

#define IS_GOOD(ch)    (GET_ALIGNMENT(ch) >= 350)
#define IS_EVIL(ch)    (GET_ALIGNMENT(ch) <= -350)
#define IS_NEUTRAL(ch) (!IS_GOOD(ch) && !IS_EVIL(ch))


/* descriptor-based utils ************************************************/


#define WAIT_STATE(ch, cycle) { \
	if ((ch)->desc) (ch)->desc->wait = (cycle); \
	else if (IS_NPC(ch)) GET_MOB_WAIT(ch) = (cycle); }

#define CHECK_WAIT(ch)  (((ch)->desc) ? ((ch)->desc->wait > 1) : 0)
#define STATE(d)        ((d)->connected)


/* object utils **********************************************************/


#define GET_OBJ_TYPE(obj)       ((obj)->obj_flags.type_flag)
#define GET_OBJ_COST(obj)       ((obj)->obj_flags.cost)
#define GET_OBJ_RENT(obj)       ((obj)->obj_flags.cost_per_day)
#define GET_OBJ_EXTRA(obj)      ((obj)->obj_flags.extra_flags)
#define GET_OBJ_WEAR(obj)       ((obj)->obj_flags.wear_flags)
#define GET_OBJ_VAL(obj, val)   ((obj)->obj_flags.value[(val)])
#define GET_OBJ_WEIGHT(obj)     ((obj)->obj_flags.weight)
#define GET_OBJ_TIMER(obj)      ((obj)->obj_flags.timer)
#define GET_OBJ_RNUM(obj)       ((obj)->item_number)
#define GET_OBJ_VNUM(obj)       (GET_OBJ_RNUM(obj) >= 0 ? \
				 obj_index[GET_OBJ_RNUM(obj)].virtual : -1)
#define IS_OBJ_STAT(obj,stat)   (IS_SET((obj)->obj_flags.extra_flags,stat))

#define GET_OBJ_SPEC(obj) ((obj)->item_number >= 0 ? \
	(obj_index[(obj)->item_number].func) : NULL)

#define CAN_WEAR(obj, part) (IS_SET((obj)->obj_flags.wear_flags, (part)))


/* compound utilities and other macros **********************************/


#define HSHR(ch) (GET_SEX(ch) ? (GET_SEX(ch)==SEX_MALE ? "his":"her") :"its")
#define HSSH(ch) (GET_SEX(ch) ? (GET_SEX(ch)==SEX_MALE ? "he" :"she") : "it")
#define HMHR(ch) (GET_SEX(ch) ? (GET_SEX(ch)==SEX_MALE ? "him":"her") : "it")

#define ANA(obj) (strchr("aeiouyAEIOUY", *(obj)->name) ? "An" : "A")
#define SANA(obj) (strchr("aeiouyAEIOUY", *(obj)->name) ? "an" : "a")


/* Various macros building up to CAN_SEE */

#define LIGHT_OK(sub)   (!IS_AFFECTED(sub, AFF_BLIND) && \
   (IS_LIGHT((sub)->in_room) || IS_AFFECTED((sub), AFF_INFRAVISION)))

#define INVIS_OK(sub, obj) \
 ((!IS_AFFECTED((obj),AFF_INVISIBLE) || IS_AFFECTED(sub,AFF_DETECT_INVIS)) && \
 (!IS_AFFECTED((obj), AFF_HIDE) || IS_AFFECTED(sub, AFF_SENSE_LIFE)))

#define MORT_CAN_SEE(sub, obj) (LIGHT_OK(sub) && INVIS_OK(sub, obj))

#define IMM_CAN_SEE(sub, obj) \
   (MORT_CAN_SEE(sub, obj) || PRF_FLAGGED(sub, PRF_HOLYLIGHT))

#define SELF(sub, obj)  ((sub) == (obj))

/* Can subject see character "obj"? */
#define CAN_SEE(sub, obj) (SELF(sub, obj) || \
   ((GET_REAL_LEVEL(sub) >= GET_INVIS_LEV(obj)) && IMM_CAN_SEE(sub, obj)))

/* End of CAN_SEE */


#define INVIS_OK_OBJ(sub, obj) \
  (!IS_OBJ_STAT((obj), ITEM_INVISIBLE) || IS_AFFECTED((sub), AFF_DETECT_INVIS))

#define MORT_CAN_SEE_OBJ(sub, obj) (LIGHT_OK(sub) && INVIS_OK_OBJ(sub, obj))

#define CAN_SEE_OBJ(sub, obj) \
   (MORT_CAN_SEE_OBJ(sub, obj) || PRF_FLAGGED((sub), PRF_HOLYLIGHT))

#define CAN_CARRY_OBJ(ch,obj)  \
   (((IS_CARRYING_W(ch) + GET_OBJ_WEIGHT(obj)) <= CAN_CARRY_W(ch)) &&   \
    ((IS_CARRYING_N(ch) + 1) <= CAN_CARRY_N(ch)))

#define CAN_GET_OBJ(ch, obj)   \
   (CAN_WEAR((obj), ITEM_WEAR_TAKE) && CAN_CARRY_OBJ((ch),(obj)) && \
    CAN_SEE_OBJ((ch),(obj)))


#define PERS(ch, vict)   (CAN_SEE(vict, ch) ? GET_NAME(ch) : "someone")

#define OBJS(obj, vict) (CAN_SEE_OBJ((vict), (obj)) ? \
	(obj)->short_description  : "something")

#define OBJN(obj, vict) (CAN_SEE_OBJ((vict), (obj)) ? \
	fname((obj)->name) : "something")


#define EXIT(ch, door)  (world[(ch)->in_room].dir_option[door])

#define CAN_GO(ch, door) (EXIT(ch,door) && \
			 (EXIT(ch,door)->to_room != NOWHERE) && \
			 !IS_SET(EXIT(ch, door)->exit_info, EX_CLOSED))


#define CLASS_ABBR(ch) (IS_NPC(ch) ? "--" : class_abbrevs[(int)GET_CLASS(ch)])

#define IS_MAGIC_USER(ch)       (!IS_NPC(ch) && \
				(GET_CLASS(ch) == CLASS_MAGIC_USER))
#define IS_CLERIC(ch)           (!IS_NPC(ch) && \
				(GET_CLASS(ch) == CLASS_CLERIC))
#define IS_THIEF(ch)            (!IS_NPC(ch) && \
				(GET_CLASS(ch) == CLASS_THIEF))
#define IS_WARRIOR(ch)          (!IS_NPC(ch) && \
				(GET_CLASS(ch) == CLASS_WARRIOR))
#define IS_BARD(ch)             (!IS_NPC(ch) && \
				(GET_CLASS(ch) == CLASS_BARD))
#define IS_NINJA(ch)            (!IS_NPC(ch) && \
				(GET_CLASS(ch) == CLASS_NINJA))

#define IS_HUMAN(ch)            (!IS_NPC(ch) && \
				(GET_RACE(ch) == RACE_HUMAN))
							      
#define IS_ELF(ch)              (!IS_NPC(ch) && \
				(GET_RACE(ch) == RACE_ELF))
							      
#define IS_GNOME(ch)            (!IS_NPC(ch) && \
				(GET_RACE(ch) == RACE_GNOME))
							      
#define IS_FAIRY(ch)            (!IS_NPC(ch) && \
				(GET_RACE(ch) == RACE_FAIRY))


#define OUTSIDE(ch) (!ROOM_FLAGGED((ch)->in_room, ROOM_INDOORS))


/* OS compatibility ******************************************************/


/* there could be some strange OS which doesn't have NULL... */
#ifndef NULL
#define NULL (void *)0
#endif

#if !defined(FALSE)
#define FALSE 0
#endif

#if !defined(TRUE)
#define TRUE  (!FALSE)
#endif

/* defines for fseek */
#ifndef SEEK_SET
#define SEEK_SET        0
#define SEEK_CUR        1
#define SEEK_END        2
#endif

#if defined(NOCRYPT) || !defined(HAVE_CRYPT)
#define CRYPT(a,b) (a)
#else
#define CRYPT(a,b) ((char *) crypt((a),(b)))
#endif



This archive was generated by hypermail 2b30 : 12/18/00 PST