[LONG!] 32 bit limit possible fix :)

From: Niese-Petersen (Tenp@cris.com)
Date: 01/22/97


This should give you the changes needed for creating bitflags to an array,
in Room Flags, Player Flags, Mobile Flags, Pref. Flags, Take/Wear Flags,
Extra Obj. Flags and Affect Flags.

One thing you have to take notice of, is that multi-bit sets like:
ROOM_DEATH | ROOM_NOMOB is not possible to use with the new bit functions
like IS_SET_AR, SET_BIT_AR, etc..
So an old code line like:

 SET_BIT(obj->obj_flags.extra_flags, ITEM_GLOW | ITEM_HUM);

can't be done with SET_BIT_AR, so what you have to do is:

 SET_BIT_AR(obj->obj_flags.extra_flags, ITEM_GLOW);
 SET_BIT_AR(obj->obj_flags.extra_flags, ITEM_HUM);


If I missed something, or any questions, then email me..

tenp@cris.com   Add [128 bits] first in Subject..

Enjoy,

Erik Niese-Petersen
AKA Quint to typo Dane.
Realms of Darkness IMP


Remember!! Everything following now, is taken from Circle 3.0 bpl 11 stock
code, so your own code can be different....

------------------------------------------------------------------------------
                                  utils.h
------------------------------------------------------------------------------

Insert following line around declare of public functions for utils.c:

void	sprintbitarray(long bitvector[], char *names[], int maxar, char *result);

Then insert following at the basic bitvector utils:

#define Q_FIELD(x)  ((int) (x) / 32)
#define Q_BIT(x)    (1 << ((x) % 32))

#define IS_SET_AR(var, bit)       ((var)[Q_FIELD(bit)] & Q_BIT(bit))
#define SET_BIT_AR(var. bit)      ((var)[Q_FIELD(bit)] |= Q_BIT(bit))
#define REMOVE_BIT_AR(var, bit)   ((var)[Q_FIELD(bit)] &= ~Q_BIT(bit))
#define TOGGLE_BIT_AR(var, bit)   ((var)[Q_FIELD(bit)] = \
                                   (var)[Q_FIELD(bit)] ^ Q_BIT(bit))
Then find and change following:

#define IS_NPC(ch)  (IS_SET_AR(MOB_FLAGS(ch), MOB_ISNPC))

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

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

#define GET_OBJ_EXTRA(obj, i)   ((obj)->obj_flags.extra_flags[(i)])

#define IS_OBJ_STAT(obj,stat)	(IS_SET_AR((obj)->obj_flags.extra_flags, \
                                 (stat)))

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


------------------------------------------------------------------------------
                                 structs.h
------------------------------------------------------------------------------

Change all "(1 << bit)" to "bit" [without the "s ofcoz] in following
places, like this [ATTENTION!! Affect bits got a special change!] :

/* Room flags: used in room_data.room_flags */
#define ROOM_DARK		0   /* Dark			*/
#define ROOM_DEATH		1   /* Death trap		*/
#define ROOM_NOMOB		2   /* MOBs not allowed		*/
etc..

/* Player flags: used by char_data.char_specials.saved.act */
#define PLR_KILLER	0   /* Player is a player-killer		*/
#define PLR_THIEF	1   /* Player is a player-thief		*/
#define PLR_FROZEN	2   /* Player is frozen			*/
etc..

/* Mobile flags: used by char_data.char_specials.saved.act */
#define MOB_SPEC          0  /* Mob has a callable spec-proc	*/
#define MOB_SENTINEL      1  /* Mob should not move		*/
#define MOB_SCAVENGER     2  /* Mob picks up stuff on the ground	*/
etc..

/* Preference flags: used by char_data.player_specials.saved.pref */
#define PRF_BRIEF       0  /* Room descs won't normally be shown	*/
#define PRF_COMPACT     1  /* No extra CRLF pair before prompts	*/
#define PRF_DEAF	2  /* Can't hear shouts			*/
etc..

/* Affect bits: used in char_data.char_specials.saved.affected_by */
#define AFF_DONTUSE           0  /* Do NOT use!!!!  */
#define AFF_BLIND             1  /* (R) Char is blind		*/
#define AFF_INVISIBLE         2  /* Char is invisible		*/
#define AFF_DETECT_ALIGN      3  /* Char is sensitive to align*/
etc..

/* Take/Wear flags: used by obj_data.obj_flags.wear_flags */
#define ITEM_WEAR_TAKE		 0  /* Item can be takes		*/
#define ITEM_WEAR_FINGER	 1  /* Can be worn on finger	*/
#define ITEM_WEAR_NECK		 2  /* Can be worn around neck 	*/
etc..

/* Extra object flags: used by obj_data.obj_flags.extra_flags */
#define ITEM_GLOW           0	/* Item is glowing		*/
#define ITEM_HUM            1	/* Item is humming		*/
#define ITEM_NORENT         2	/* Item cannot be rented	*/
etc..


Insert following defines in misc. defines :

#define RF_ARRAY_MAX    4
#define PM_ARRAY_MAX    4
#define PR_ARRAY_MAX    4
#define AF_ARRAY_MAX    4
#define TW_ARRAY_MAX    4
#define EF_ARRAY_MAX    4


Change inside following structures:

struct obj_flag_data {
   ..
   ..
   int	wear_flags[TW_ARRAY_MAX];	/* Where you can wear it	    */
   int	extra_flags[EF_ARRAY_MAX];	/* If it hums, glows, etc.	    */
   ..
   ..
   int	bitvector[AF_ARRAY_MAX];	/* To set chars bits                */
};

-----------------------------------------------------------------------------
 WARNING!! Changing obj_file_elem will corrupt your rent files!!
-----------------------------------------------------------------------------
struct obj_file_elem {
   ..
   ..
   int	extra_flags[EF_ARRAY_MAX];
   ..
   int	bitvector[AF_ARRAY_MAX];
   ..
};


struct room_data {
   ..
   ..
   int room_flags[RF_ARRAY_MAX];		/* DEATH,DARK ... etc                 */
   ..
   ..
};

-----------------------------------------------------------------------------
 WARNING!! Changing the next two structures will corrupt your playerfile!!
-----------------------------------------------------------------------------
struct char_special_data_saved {
   ..
   ..
   int	act[PM_ARRAY_MAX];			/* act flag for NPC's; player flag for PC's */

   int	affected_by[AF_ARRAY_MAX]; /* Bitvector for spells/skills affected by */
   ..
};

struct player_special_data_saved {
   ..
   ..
   int	pref[PR_ARRAY_MAX];		/* preference flags for PC's.  */
   ..
   ..
};


------------------------------------------------------------------------------
Now follow the rest of files that need changes and inserts.

Linenumbers from the original stock code are placed with a :number:

A good idea is to start with the highes linenumbers and go down, so the lines
are easier to find, and do the changes before inserting.
------------------------------------------------------------------------------
                             act.informative.c
------------------------------------------------------------------------------

:362:    sprintbit((long) ROOM_FLAGS(ch->in_room), room_bits, buf);
change to:
    sprintbitarray(ROOM_FLAGS(ch->in_room), room_bits, RF_ARRAY_MAX, buf);

:1482:  REMOVE_BIT(PRF_FLAGS(ch), PRF_COLOR_1 | PRF_COLOR_2);
:1483:  SET_BIT(PRF_FLAGS(ch), (PRF_COLOR_1 * (tp & 1)) | (PRF_COLOR_2 * (tp & 2) >> 1));
change to:
  REMOVE_BIT_AR(PRF_FLAGS(ch), PRF_COLOR_1);
  REMOVE_BIT_AR(PRF_FLAGS(ch), PRF_COLOR_2);
  if (tp & 1) SET_BIT_AR(PRF_FLAGS(ch), PRF_COLOR_1);
  if (tp & 2) SET_BIT_AR(PRF_FLAGS(ch), PRF_COLOR_2);


------------------------------------------------------------------------------
                               act.movement.c
------------------------------------------------------------------------------

:116:  if (IS_SET(ROOM_FLAGS(ch->in_room), ROOM_ATRIUM)) {
change to:
  if (IS_SET_AR(ROOM_FLAGS(ch->in_room), ROOM_ATRIUM)) {

:122:  if (IS_SET(ROOM_FLAGS(EXIT(ch, dir)->to_room), ROOM_TUNNEL) &&
change to:
  if (IS_SET_AR(ROOM_FLAGS(EXIT(ch, dir)->to_room), ROOM_TUNNEL) &&

:144:  if (IS_SET(ROOM_FLAGS(ch->in_room), ROOM_DEATH) && GET_LEVEL(ch) < LVL_IMMORT) {
change to:
  if (IS_SET_AR(ROOM_FLAGS(ch->in_room), ROOM_DEATH) && GET_LEVEL(ch) < LVL_IMMORT) {

:458:  IS_SET(ROOM_FLAGS(EXIT(ch, door)->to_room), ROOM_INDOORS)) {
change to:
    IS_SET_AR(ROOM_FLAGS(EXIT(ch, door)->to_room), ROOM_INDOORS)) {

:471:  if (!IS_SET(ROOM_FLAGS(ch->in_room), ROOM_INDOORS))
change to:
  if (!IS_SET_AR(ROOM_FLAGS(ch->in_room), ROOM_INDOORS))

:478:  !IS_SET(ROOM_FLAGS(EXIT(ch, door)->to_room), ROOM_INDOORS)) {
change to:
    !IS_SET_AR(ROOM_FLAGS(EXIT(ch, door)->to_room), ROOM_INDOORS)) {

:688:      REMOVE_BIT(AFF_FLAGS(ch), AFF_GROUP);
change to:
      REMOVE_BIT_AR(AFF_FLAGS(ch), AFF_GROUP);


------------------------------------------------------------------------------
                              act.offensive.c
------------------------------------------------------------------------------

:246:  !IS_SET(ROOM_FLAGS(EXIT(ch, attempt)->to_room), ROOM_DEATH)) {
change to:
     !IS_SET_AR(ROOM_FLAGS(EXIT(ch, attempt)->to_room), ROOM_DEATH)) {


------------------------------------------------------------------------------
                                act.other.c
------------------------------------------------------------------------------

:146:    REMOVE_BIT(AFF_FLAGS(ch), AFF_HIDE);
change to:
    REMOVE_BIT_AR(AFF_FLAGS(ch), AFF_HIDE);

:153:  SET_BIT(AFF_FLAGS(ch), AFF_HIDE);
change to:
  SET_BIT_AR(AFF_FLAGS(ch), AFF_HIDE);

:331:  SET_BIT(AFF_FLAGS(vict), AFF_GROUP);
change to:
  SET_BIT_AR(AFF_FLAGS(vict), AFF_GROUP);

:412:      REMOVE_BIT(AFF_FLAGS(vict), AFF_GROUP);
change to:
      REMOVE_BIT_AR(AFF_FLAGS(vict), AFF_GROUP);

:436:	REMOVE_BIT(AFF_FLAGS(f->follower), AFF_GROUP);
change to:
	REMOVE_BIT_AR(AFF_FLAGS(f->follower), AFF_GROUP);

:443:    REMOVE_BIT(AFF_FLAGS(ch), AFF_GROUP);
change to:
    REMOVE_BIT_AR(AFF_FLAGS(ch), AFF_GROUP);

:461:  REMOVE_BIT(AFF_FLAGS(tch), AFF_GROUP);
change to:
  REMOVE_BIT_AR(AFF_FLAGS(tch), AFF_GROUP);

:694:    SET_BIT(PRF_FLAGS(ch), PRF_DISPHP | PRF_DISPMANA | PRF_DISPMOVE);
:695:  else {
change to:
  { SET_BIT_AR(PRF_FLAGS(ch), PRF_DISPHP);
    SET_BIT_AR(PRF_FLAGS(ch), PRF_DISPMANA);
    SET_BIT_AR(PRF_FLAGS(ch), PRF_DISPMOVE);
  } else {

:696:    REMOVE_BIT(PRF_FLAGS(ch), PRF_DISPHP | PRF_DISPMANA | PRF_DISPMOVE);
change to:
    REMOVE_BIT_AR(PRF_FLAGS(ch), PRF_DISPHP);
    REMOVE_BIT_AR(PRF_FLAGS(ch), PRF_DISPMANA);
    REMOVE_BIT_AR(PRF_FLAGS(ch), PRF_DISPMOVE);

:701:	SET_BIT(PRF_FLAGS(ch), PRF_DISPHP);
change to:
	SET_BIT_AR(PRF_FLAGS(ch), PRF_DISPHP);

:704:	SET_BIT(PRF_FLAGS(ch), PRF_DISPMANA);
change to:
	SET_BIT_AR(PRF_FLAGS(ch), PRF_DISPMANA);

:707:	SET_BIT(PRF_FLAGS(ch), PRF_DISPMOVE);
change to:
	SET_BIT_AR(PRF_FLAGS(ch), PRF_DISPMOVE);

:782:#define PRF_TOG_CHK(ch,flag) ((TOGGLE_BIT(PRF_FLAGS(ch), (flag))) & (flag))
Remove it.. Already defined in utils.h


------------------------------------------------------------------------------
                                act.wizard.c
------------------------------------------------------------------------------

:350:  sprintbit((long) rm->room_flags, room_bits, buf2);
change to:
  sprintbitarray(rm->room_flags, room_bits, RF_ARRAY_MAX, buf2);

:466:  sprintbit(j->obj_flags.wear_flags, wear_bits, buf);
change to:
  sprintbitarray(j->obj_flags.wear_flags, wear_bits, TW_ARRAY_MAX, buf);

:471:  sprintbit(j->obj_flags.bitvector, affected_bits, buf);
change to:
  sprintbitarray(j->obj_flags.bitvector, affected_bits, AF_ARRAY_MAX, buf);

:476:  sprintbit(GET_OBJ_EXTRA(j), extra_bits, buf);
change to:
  sprintbitarray(j->obj_flags.extra_flags, extra_bits, EF_ARRAY_MAX, buf);

:714:    sprintbit(MOB_FLAGS(k), action_bits, buf2);
change to:
    sprintbitarray(MOB_FLAGS(k), action_bits, PM_ARRAY_MAX, buf2);

:718:    sprintbit(PLR_FLAGS(k), player_bits, buf2);
change to:
    sprintbitarray(PLR_FLAGS(k), player_bits, PM_ARRAY_MAX, buf2);

:721:    sprintbit(PRF_FLAGS(k), preference_bits, buf2);
change to:
    sprintbitarray(PRF_FLAGS(k), preference_bits, PR_ARRAY_MAX, buf2);

:768:  sprintbit(AFF_FLAGS(k), affected_bits, buf2);
change to:
  sprintbitarray(AFF_FLAGS(k), affected_bits, AF_ARRAY_MAX, buf2);

:787:	sprintbit(aff->bitvector, affected_bits, buf2);
change to:
	strcpy(buf2, affected_bits[aff->bitvector]);

:1652:	(!PLR_FLAGGED(d->character, PLR_WRITING | PLR_MAILING))
change to:
	(!PLR_FLAGGED(d->character, PLR_MAILING) ||
	 !PLR_FLAGGED(d->character, PLR_WRITING))

:1740:      if (!PLR_FLAGGED(vict, PLR_THIEF | PLR_KILLER)) {
change to:
      if (!PLR_FLAGGED(vict, PLR_THIEF) || !PLR_FLAGGED(vict, PLR_KILLER)) {

:1744:      REMOVE_BIT(PLR_FLAGS(vict), PLR_THIEF | PLR_KILLER);
change to:
      REMOVE_BIT_AR(PLR_FLAGS(vict), PLR_THIEF);
      REMOVE_BIT_AR(PLR_FLAGS(vict), PLR_KILLER);

:1775:      SET_BIT(PLR_FLAGS(vict), PLR_FROZEN);
change to:
      SET_BIT_AR(PLR_FLAGS(vict), PLR_FROZEN);

:1796:      REMOVE_BIT(PLR_FLAGS(vict), PLR_FROZEN);
change to:
      REMOVE_BIT_AR(PLR_FLAGS(vict), PLR_FROZEN);

:1977:      if (IS_SET(ROOM_FLAGS(i), ROOM_DEATH))
change to:
      if (IS_SET_AR(ROOM_FLAGS(i), ROOM_DEATH))

:2013:	if (on) SET_BIT(flagset, flags); \
:2014:	else if (off) REMOVE_BIT(flagset, flags); }
change to:
	if (on) SET_BIT_AR(flagset, flags); \
	else if (off) REMOVE_BIT_AR(flagset, flags); }

:2379:      REMOVE_BIT(PLR_FLAGS(vict), PLR_LOADROOM);
change to:
      REMOVE_BIT_AR(PLR_FLAGS(vict), PLR_LOADROOM);

:2383:        SET_BIT(PLR_FLAGS(vict), PLR_LOADROOM);
change to:
        SET_BIT_AR(PLR_FLAGS(vict), PLR_LOADROOM);

:2395:    SET_OR_REMOVE(PRF_FLAGS(vict), (PRF_COLOR_1 | PRF_COLOR_2));
change to:
    SET_OR_REMOVE(PRF_FLAGS(vict), PRF_COLOR_1);
    SET_OR_REMOVE(PRF_FLAGS(vict), PRF_COLOR_2);

:2478:  REMOVE_BIT(PRF_FLAGS(ch), PRF_LOG1 | PRF_LOG2);
change to:
  REMOVE_BIT_AR(PRF_FLAGS(ch), PRF_LOG1);
  REMOVE_BIT_AR(PRF_FLAGS(ch), PRF_LOG2);

:2479:  SET_BIT(PRF_FLAGS(ch), (PRF_LOG1 * (tp & 1)) | (PRF_LOG2 * (tp & 2) >> 1));
change to:
  if (tp & 1) SET_BIT_AR(PRF_FLAGS(ch), PRF_LOG1);
  if (tp & 2) SET_BIT_AR(PRF_FLAGS(ch), PRF_LOG2);


------------------------------------------------------------------------------
                                  boards.c
------------------------------------------------------------------------------

:237:    SET_BIT(PLR_FLAGS(ch), PLR_WRITING);
change to:
    SET_BIT_AR(PLR_FLAGS(ch), PLR_WRITING);


------------------------------------------------------------------------------
                                  castle.c
------------------------------------------------------------------------------

:282:  if (IS_SET(i->obj_flags.wear_flags, ITEM_WEAR_TAKE) &&
change to:
  if (IS_SET_AR(i->obj_flags.wear_flags, ITEM_WEAR_TAKE) &&


------------------------------------------------------------------------------
                                  class.c
------------------------------------------------------------------------------

:398:    SET_BIT(PRF_FLAGS(ch), PRF_HOLYLIGHT);
change to:
    SET_BIT_AR(PRF_FLAGS(ch), PRF_HOLYLIGHT);


------------------------------------------------------------------------------
                                    db.c
------------------------------------------------------------------------------
 WARNING!!! These changes in db.c, will corrupt your current world, mobile
and objct files.. An idea is to look at the changes and create a converter
program, so set up the flags right, in those files.
Remember one 32 bits block got the ASCII bit-values a to z and A to F, so
by adding 3 more blocks, you have to remember that bits 0 to 31 are the
first block [a to z, A to F] and 32 to 63 are second block [a to z, A to F]
and 64 to 95 are third block [a to z, A to F] and last block 96 to 127
[a to z, A to F].. A better view of this:

        bit number | ascii bitflag | bit value
        -----------+---------------+----------
             0     |      a        |  1 << 0
             1     |      b        |  1 << 1
            ...    |     ...       |    ...
            30     |      E        |  1 << 30
            31     |      F        |  1 << 31
            32     |      a        |  1 << 0
            33     |      b        |  1 << 1
           etc......

-----------------------------------------------------------------------------
:649:  char line[256], flags[128];
change to:
  char line[256], flags[128], flags2[128], flags3[128], flags4[128];

:668:  if (!get_line(fl, line) || sscanf(line, " %d %s %d ", t, flags, t + 2) != 3) {
change to:
  if (!get_line(fl, line) ||
      sscanf(line, " %d %s %s %s %s %d ", t, flags, flags2, flags3,
             flags4, t + 2) != 6) {

:673:  world[room_nr].room_flags = asciiflag_conv(flags);
change to:
  world[room_nr].room_flags[0] = asciiflag_conv(flags);
  world[room_nr].room_flags[1] = asciiflag_conv(flags2);
  world[room_nr].room_flags[2] = asciiflag_conv(flags3);
  world[room_nr].room_flags[3] = asciiflag_conv(flags4);

:1009:  char f1[128], f2[128];
change to:
  char f1[128], f2[128], f3[128], f4[128], f5[128], f6[128], f7[128], f8[128];

:1033:  sscanf(line, "%s %s %d %c", f1, f2, t + 2, &letter);
change to:
  sscanf(line, "%s %s %s %s %s %s %s %s %d %c", f1, f2, f3, f4, f5, f6, f7, f8, t + 2, &letter);

:1034:  MOB_FLAGS(mob_proto + i) = asciiflag_conv(f1);
change to:
  MOB_FLAGS(mob_proto + i)[0] = asciiflag_conv(f1);
  MOB_FLAGS(mob_proto + i)[1] = asciiflag_conv(f2);
  MOB_FLAGS(mob_proto + i)[2] = asciiflag_conv(f3);
  MOB_FLAGS(mob_proto + i)[3] = asciiflag_conv(f4);

:1035:  SET_BIT(MOB_FLAGS(mob_proto + i), MOB_ISNPC);
change to:
  SET_BIT_AR(MOB_FLAGS(mob_proto + i), MOB_ISNPC);

:1036:  AFF_FLAGS(mob_proto + i) = asciiflag_conv(f2);
change to:
  AFF_FLAGS(mob_proto + i)[0] = asciiflag_conv(f5);
  AFF_FLAGS(mob_proto + i)[1] = asciiflag_conv(f6);
  AFF_FLAGS(mob_proto + i)[2] = asciiflag_conv(f7);
  AFF_FLAGS(mob_proto + i)[3] = asciiflag_conv(f8);


:1074:  char f1[256], f2[256];
change to:
  char f1[128], f2[128], f3[128], f4[128];
  char f5[128], f6[128], f7[128], f8[128];

:1105:      (retval = sscanf(line, " %d %s %s", t, f1, f2)) != 3) {
change to:
      (retval = sscanf(line, " %d %s %s %s %s %s %s %s %s",
                  t, f1, f2, f3, f4, f5, f6, f7, f8)) != 9) {

:1106:    fprintf(stderr, "Format error in first numeric line (expecting 3 args, got %d), %s\n", retval, buf2);
change to:
    fprintf(stderr, "Format error in first numeric line (expecting 9 args, got %d), %s\n", retval, buf2);


-----------------------------------------------------------------------------
                                  fight.c
-----------------------------------------------------------------------------

:75:  REMOVE_BIT(AFF_FLAGS(ch), AFF_INVISIBLE | AFF_HIDE);
change to:
  REMOVE_BIT_AR(AFF_FLAGS(ch), AFF_INVISIBLE);
  REMOVE_BIT_AR(AFF_FLAGS(ch), AFF_HIDE);

:170:    SET_BIT(PLR_FLAGS(ch), PLR_KILLER);
change to:
    SET_BIT_AR(PLR_FLAGS(ch), PLR_KILLER);

:223:  int i;
change to:
  int i, x, y;

:241:  GET_OBJ_WEAR(corpse) = ITEM_WEAR_TAKE;
:242:  GET_OBJ_EXTRA(corpse) = ITEM_NODONATE;
change to:
  for(x = y = 0; x < EF_ARRAY_MAX || y < TW_ARRAY_MAX; x++, y++) {
     if (x < EF_ARRAY_MAX)
        GET_OBJ_EXTRA(corpse, x) = 0;
     if (y < TW_ARRAY_MAX)
        corpse->obj_flags.wear_flags[y] = 0;
  }
  SET_BIT_AR(GET_OBJ_WEAR(corpse), ITEM_WEAR_TAKE);
  SET_BIT_AR(GET_OBJ_EXTRA(corpse, -1), ITEM_NODONATE);

:329:  if (!IS_NPC(ch))
:330:    REMOVE_BIT(PLR_FLAGS(ch), PLR_KILLER | PLR_THIEF);
change to:
  if (!IS_NPC(ch)) {
    REMOVE_BIT_AR(PLR_FLAGS(ch), PLR_KILLER);
    REMOVE_BIT_AR(PLR_FLAGS(ch), PLR_THIEF);
  }

-----------------------------------------------------------------------------
                                  graph.c
-----------------------------------------------------------------------------

:46: #define MARK(room) (SET_BIT(ROOM_FLAGS(room), ROOM_BFS_MARK))
:47: #define UNMARK(room) (REMOVE_BIT(ROOM_FLAGS(room), ROOM_BFS_MARK))
:48: #define IS_MARKED(room) (IS_SET(ROOM_FLAGS(room), ROOM_BFS_MARK))
change to:
#define MARK(room) (SET_BIT_AR(ROOM_FLAGS(room), ROOM_BFS_MARK))
#define UNMARK(room) (REMOVE_BIT_AR(ROOM_FLAGS(room), ROOM_BFS_MARK))
#define IS_MARKED(room) (IS_SET_AR(ROOM_FLAGS(room), ROOM_BFS_MARK))


-----------------------------------------------------------------------------
                                 handler.c
-----------------------------------------------------------------------------

:90:    SET_BIT(AFF_FLAGS(ch), bitv);
change to:
    SET_BIT_AR(AFF_FLAGS(ch), bitv);

:92:    REMOVE_BIT(AFF_FLAGS(ch), bitv);
change to:
    REMOVE_BIT_AR(AFF_FLAGS(ch), bitv);

:211:	affect_modify(ch, GET_EQ(ch, i)->affected[j].location,
change to:
	affect_modify_ar(ch, GET_EQ(ch, i)->affected[j].location,

:225:	affect_modify(ch, GET_EQ(ch, i)->affected[j].location,
change to:
	affect_modify_ar(ch, GET_EQ(ch, i)->affected[j].location,

:408:    SET_BIT(PLR_FLAGS(ch), PLR_CRASH);
change to:
    SET_BIT_AR(PLR_FLAGS(ch), PLR_CRASH);

:426:  SET_BIT(PLR_FLAGS(object->carried_by), PLR_CRASH);
change to:
  SET_BIT_AR(PLR_FLAGS(object->carried_by), PLR_CRASH);

:515:    affect_modify(ch, obj->affected[j].location,
change to:
    affect_modify_ar(ch, obj->affected[j].location,

:549:    affect_modify(ch, obj->affected[j].location,
change to:
    affect_modify_ar(ch, obj->affected[j].location,

:657:      SET_BIT(ROOM_FLAGS(room), ROOM_HOUSE_CRASH);
change to:
      SET_BIT_AR(ROOM_FLAGS(room), ROOM_HOUSE_CRASH);

:675:    SET_BIT(ROOM_FLAGS(object->in_room), ROOM_HOUSE_CRASH);
change to:
    SET_BIT_AR(ROOM_FLAGS(object->in_room), ROOM_HOUSE_CRASH);

:1086:
insert line:
  int y;

:1128:  GET_OBJ_WEAR(obj) = ITEM_WEAR_TAKE;
change to:
  for(y = 0; y < TW_ARRAY_MAX; y++)
    obj->obj_flags.wear_flags[y] = 0;
  SET_BIT_AR(GET_OBJ_WEAR(obj), ITEM_WEAR_TAKE);


:199:
insert:
void affect_modify_ar(struct char_data * ch, byte loc, sbyte mod, long bitv[],
		        bool add)
{
  int maxabil, i , j;

  if (add) {
    for(i = 0; i < AF_ARRAY_MAX; i++)
      for(j = 0; j < 32; j++)
        if(IS_SET_AR(bitv, (i*32)+j))
          SET_BIT_AR(AFF_FLAGS(ch), (i*32)+j);
  } else {
    for(i = 0; i < AF_ARRAY_MAX; i++)
      for(j = 0; j < 32; j++)
        if(IS_SET_AR(bitv, (i*32)+j))
          REMOVE_BIT_AR(AFF_FLAGS(ch), (i*32)+j);
    mod = -mod;
  }

  maxabil = (IS_NPC(ch) ? 25 : 18);

  switch (loc) {
  case APPLY_NONE:
    break;

  case APPLY_STR:
    GET_STR(ch) += mod;
    break;
  case APPLY_DEX:
    GET_DEX(ch) += mod;
    break;
  case APPLY_INT:
    GET_INT(ch) += mod;
    break;
  case APPLY_WIS:
    GET_WIS(ch) += mod;
    break;
  case APPLY_CON:
    GET_CON(ch) += mod;
    break;
  case APPLY_CHA:
    GET_CHA(ch) += mod;
    break;

  case APPLY_CLASS:
    /* ??? GET_CLASS(ch) += mod; */
    break;

  case APPLY_LEVEL:
    /* ??? GET_LEVEL(ch) += mod; */
    break;

  case APPLY_AGE:
    ch->player.time.birth -= (mod * SECS_PER_MUD_YEAR);
    break;

  case APPLY_CHAR_WEIGHT:
    GET_WEIGHT(ch) += mod;
    break;

  case APPLY_CHAR_HEIGHT:
    GET_HEIGHT(ch) += mod;
    break;

  case APPLY_MANA:
    GET_MAX_MANA(ch) += mod;
    break;

  case APPLY_HIT:
    GET_MAX_HIT(ch) += mod;
    break;

  case APPLY_MOVE:
    GET_MAX_MOVE(ch) += mod;
    break;

  case APPLY_GOLD:
    break;

  case APPLY_EXP:
    break;

  case APPLY_AC:
    GET_AC(ch) += mod;
    break;

  case APPLY_HITROLL:
    GET_HITROLL(ch) += mod;
    break;

  case APPLY_DAMROLL:
    GET_DAMROLL(ch) += mod;
    break;

  case APPLY_SAVING_PARA:
    GET_SAVE(ch, SAVING_PARA) += mod;
    break;

  case APPLY_SAVING_ROD:
    GET_SAVE(ch, SAVING_ROD) += mod;
    break;

  case APPLY_SAVING_PETRI:
    GET_SAVE(ch, SAVING_PETRI) += mod;
    break;

  case APPLY_SAVING_BREATH:
    GET_SAVE(ch, SAVING_BREATH) += mod;
    break;

  case APPLY_SAVING_SPELL:
    GET_SAVE(ch, SAVING_SPELL) += mod;
    break;

  default:
    log("SYSERR: Unknown apply adjust attempt (handler.c, affect_modify_ar).");
    break;

  } /* switch */
}



-----------------------------------------------------------------------------
                                  house.c
-----------------------------------------------------------------------------

:138:  REMOVE_BIT(ROOM_FLAGS(rnum), ROOM_HOUSE_CRASH);
change to:
  REMOVE_BIT_AR(ROOM_FLAGS(rnum), ROOM_HOUSE_CRASH);

:277:    SET_BIT(ROOM_FLAGS(real_house), ROOM_HOUSE | ROOM_PRIVATE);
change to:
    SET_BIT_AR(ROOM_FLAGS(real_house), ROOM_HOUSE);
    SET_BIT_AR(ROOM_FLAGS(real_house), ROOM_PRIVATE);

:278:    SET_BIT(ROOM_FLAGS(real_atrium), ROOM_ATRIUM);
change to:
    SET_BIT_AR(ROOM_FLAGS(real_atrium), ROOM_ATRIUM);

:423:  SET_BIT(ROOM_FLAGS(real_house), ROOM_HOUSE | ROOM_PRIVATE);
change to:
  SET_BIT_AR(ROOM_FLAGS(real_house), ROOM_HOUSE);
  SET_BIT_AR(ROOM_FLAGS(real_house), ROOM_PRIVATE);

:424:  SET_BIT(ROOM_FLAGS(real_atrium), ROOM_ATRIUM);
change to:
  SET_BIT_AR(ROOM_FLAGS(real_atrium), ROOM_ATRIUM);

:449:    REMOVE_BIT(ROOM_FLAGS(real_atrium), ROOM_ATRIUM);
change to:
    REMOVE_BIT_AR(ROOM_FLAGS(real_atrium), ROOM_ATRIUM);

:453:  else
:454:    REMOVE_BIT(ROOM_FLAGS(real_house),
:455:	       ROOM_HOUSE | ROOM_PRIVATE | ROOM_HOUSE_CRASH);
change to:
  else {
    REMOVE_BIT_AR(ROOM_FLAGS(real_house), ROOM_HOUSE);
    REMOVE_BIT_AR(ROOM_FLAGS(real_house), ROOM_PRIVATE);
    REMOVE_BIT_AR(ROOM_FLAGS(real_house), ROOM_HOUSE_CRASH);
  }

:474:      SET_BIT(ROOM_FLAGS(real_atrium), ROOM_ATRIUM);
change to:
      SET_BIT_AR(ROOM_FLAGS(real_atrium), ROOM_ATRIUM);

:525:  if (!IS_SET(ROOM_FLAGS(ch->in_room), ROOM_HOUSE))
change to:
  if (!IS_SET_AR(ROOM_FLAGS(ch->in_room), ROOM_HOUSE))

:572:      if (IS_SET(ROOM_FLAGS(real_house), ROOM_HOUSE_CRASH))
change to:
      if (IS_SET_AR(ROOM_FLAGS(real_house), ROOM_HOUSE_CRASH))


                               interpreter.c

:572:  REMOVE_BIT(AFF_FLAGS(ch), AFF_HIDE);
change to:
  REMOVE_BIT_AR(AFF_FLAGS(ch), AFF_HIDE);

:1207:  REMOVE_BIT(PLR_FLAGS(d->character), PLR_MAILING | PLR_WRITING);
change to:
  REMOVE_BIT_AR(PLR_FLAGS(d->character), PLR_MAILING);
  REMOVE_BIT_AR(PLR_FLAGS(d->character), PLR_WRITING);

:1293:	  REMOVE_BIT(PLR_FLAGS(d->character),
:1294:		     PLR_WRITING | PLR_MAILING | PLR_CRYO);
change to:
	  REMOVE_BIT_AR(PLR_FLAGS(d->character), PLR_WRITING);
	  REMOVE_BIT_AR(PLR_FLAGS(d->character), PLR_MAILING);
	  REMOVE_BIT_AR(PLR_FLAGS(d->character), PLR_CRYO);

:1645:	SET_BIT(PLR_FLAGS(d->character), PLR_DELETED);
change to:
	SET_BIT_AR(PLR_FLAGS(d->character), PLR_DELETED);


                                  magic.c
:632:   if (IS_NPC(victim) && IS_AFFECTED(victim, af[0].bitvector|af[1].bitvector) &&
change to:
   if (IS_NPC(victim) && (IS_AFFECTED(victim, af[0].bitvector) ||
                          IS_AFFECTED(victim, af[1].bitvector)) &&

:901:    SET_BIT(AFF_FLAGS(mob), AFF_CHARM);
change to:
    SET_BIT_AR(AFF_FLAGS(mob), AFF_CHARM);

:1007:	SET_BIT(GET_OBJ_EXTRA(obj), ITEM_BLESS);
change to:
	SET_BIT_AR(GET_OBJ_EXTRA(obj, -1), ITEM_BLESS);

:1013:	SET_BIT(GET_OBJ_EXTRA(obj), ITEM_NODROP);
change to:
	SET_BIT_AR(GET_OBJ_EXTRA(obj, -1), ITEM_NODROP);

:1021:        SET_BIT(obj->obj_flags.extra_flags, ITEM_INVISIBLE);
change to:
        SET_BIT_AR(obj->obj_flags.extra_flags, ITEM_INVISIBLE);

:1035:        REMOVE_BIT(obj->obj_flags.extra_flags, ITEM_NODROP);
change to:
        REMOVE_BIT_AR(obj->obj_flags.extra_flags, ITEM_NODROP);


-----------------------------------------------------------------------------
                                   mail.c
-----------------------------------------------------------------------------

:475:  SET_BIT(PLR_FLAGS(ch), PLR_MAILING | PLR_WRITING);
change to:
  SET_BIT_AR(PLR_FLAGS(ch), PLR_MAILING);
  SET_BIT_AR(PLR_FLAGS(ch), PLR_WRITING);

:502:
insert line:
  int y;

:516:    GET_OBJ_WEAR(obj) = ITEM_WEAR_TAKE | ITEM_WEAR_HOLD;
change to:
    for(y = 0; y < TW_ARRAY_MAX; y++)
      obj->obj_flags.wear_flags[y] = 0;
    SET_BIT_AR(GET_OBJ_WEAR(obj), ITEM_WEAR_TAKE);
    SET_BIT_AR(GET_OBJ_WEAR(obj), ITEM_WEAR_HOLD);


-----------------------------------------------------------------------------
                                  mobact.c
-----------------------------------------------------------------------------

:54:	REMOVE_BIT(MOB_FLAGS(ch), MOB_SPEC);
change to:
	REMOVE_BIT_AR(MOB_FLAGS(ch), MOB_SPEC);

:80:	!ROOM_FLAGGED(EXIT(ch, door)->to_room, ROOM_NOMOB | ROOM_DEATH) &&
change to:
	(!ROOM_FLAGGED(EXIT(ch, door)->to_room, ROOM_NOMOB) ||
	 !ROOM_FLAGGED(EXIT(ch, door)->to_room, ROOM_DEATH)) &&

:87:    if (MOB_FLAGGED(ch, MOB_AGGRESSIVE | MOB_AGGR_TO_ALIGN)) {
change to:
   if (MOB_FLAGGED(ch, MOB_AGGRESSIVE) || MOB_FLAGGED(ch, MOB_AGGR_TO_ALIGN)) {


-----------------------------------------------------------------------------
                                  modify.c
-----------------------------------------------------------------------------

:98:  if (!IS_NPC(d->character))
:99:	REMOVE_BIT(PLR_FLAGS(d->character), PLR_MAILING | PLR_WRITING);
change to:
      if (!IS_NPC(d->character)) {
	REMOVE_BIT_AR(PLR_FLAGS(d->character), PLR_MAILING);
	REMOVE_BIT_AR(PLR_FLAGS(d->character), PLR_WRITING);
      }

:112:      REMOVE_BIT(PLR_FLAGS(d->character), PLR_WRITING);
change to:
      REMOVE_BIT_AR(PLR_FLAGS(d->character), PLR_WRITING);


-----------------------------------------------------------------------------
                                 objsave.c
-----------------------------------------------------------------------------

:44:  int j;
change to:
  int j, taeller;

:52:    GET_OBJ_EXTRA(obj) = object.extra_flags;
change to:
    for(taeller = 0; taeller < EF_ARRAY_MAX; taeller++)
      obj->obj_flags.extra_flags[taeller] = object.extra_flags[taeller];

:55:    obj->obj_flags.bitvector = object.bitvector;
change to:
    for(taeller = 0; taeller < AF_ARRAY_MAX; taeller++)
      obj->obj_flags.bitvector[taeller] = object.bitvector[taeller];

:69:  int j;
change to:
  int j, taeller;

:77:  object.extra_flags = GET_OBJ_EXTRA(obj);
change to:
  for(taeller = 0; taeller < EF_ARRAY_MAX; taeller++)
    object.extra_flags[taeller] = obj->obj_flags.extra_flags[taeller];

:80:  object.bitvector = obj->obj_flags.bitvector;
change to:
  for(taeller = 0; taeller < AF_ARRAY_MAX; taeller++)
    object.bitvector[taeller] = obj->obj_flags.bitvector[taeller];

:508:  REMOVE_BIT(PLR_FLAGS(ch), PLR_CRASH);
change to:
  REMOVE_BIT_AR(PLR_FLAGS(ch), PLR_CRASH);

:648:  SET_BIT(PLR_FLAGS(ch), PLR_CRYO);
change to:
  SET_BIT_AR(PLR_FLAGS(ch), PLR_CRYO);

:828:      SET_BIT(PLR_FLAGS(ch), PLR_CRYO);
change to:
      SET_BIT_AR(PLR_FLAGS(ch), PLR_CRYO);

:864:	REMOVE_BIT(PLR_FLAGS(d->character), PLR_CRASH);
change to:
	REMOVE_BIT_AR(PLR_FLAGS(d->character), PLR_CRASH);


-----------------------------------------------------------------------------
                                   shop.c
-----------------------------------------------------------------------------

:191:	    push(&vals, IS_SET(GET_OBJ_EXTRA(obj), 1 << index));
change to:
	    push(&vals, IS_SET_AR(GET_OBJ_EXTRA(obj, -1), index));

:259:  if (GET_OBJ_EXTRA(obj1) != GET_OBJ_EXTRA(obj2))
change to:
  if (GET_OBJ_EXTRA(obj1, 0) != GET_OBJ_EXTRA(obj2, 0) ||
      GET_OBJ_EXTRA(obj1, 1) != GET_OBJ_EXTRA(obj2, 1) ||
      GET_OBJ_EXTRA(obj1, 2) != GET_OBJ_EXTRA(obj2, 2) ||
      GET_OBJ_EXTRA(obj1, 3) != GET_OBJ_EXTRA(obj2, 3))


-----------------------------------------------------------------------------
                               spec_assign.c
-----------------------------------------------------------------------------

:304:      if (IS_SET(ROOM_FLAGS(i), ROOM_DEATH))
change to:
      if (IS_SET_AR(ROOM_FLAGS(i), ROOM_DEATH))


-----------------------------------------------------------------------------
                                spec_procs.c
-----------------------------------------------------------------------------

:579:    if (!IS_NPC(tch) && CAN_SEE(ch, tch) && IS_SET(PLR_FLAGS(tch), PLR_KILLER)) {
change to:
    if (!IS_NPC(tch) && CAN_SEE(ch, tch) && IS_SET_AR(PLR_FLAGS(tch), PLR_KILLER)) {

:587:    if (!IS_NPC(tch) && CAN_SEE(ch, tch) && IS_SET(PLR_FLAGS(tch), PLR_THIEF)){
change to:
    if (!IS_NPC(tch) && CAN_SEE(ch, tch) && IS_SET_AR(PLR_FLAGS(tch), PLR_THIEF)){

:647:    SET_BIT(AFF_FLAGS(pet), AFF_CHARM);
change to:
    SET_BIT_AR(AFF_FLAGS(pet), AFF_CHARM);


-----------------------------------------------------------------------------
                                  spells.c
-----------------------------------------------------------------------------

:113:  } while (ROOM_FLAGGED(to_room, ROOM_PRIVATE | ROOM_DEATH));
change to:
  } while (ROOM_FLAGGED(to_room, ROOM_PRIVATE) ||
           ROOM_FLAGGED(to_room, ROOM_DEATH));

:267:      REMOVE_BIT(MOB_FLAGS(victim), MOB_AGGRESSIVE);
:268:      REMOVE_BIT(MOB_FLAGS(victim), MOB_SPEC);
change to:
      REMOVE_BIT_AR(MOB_FLAGS(victim), MOB_AGGRESSIVE);
      REMOVE_BIT_AR(MOB_FLAGS(victim), MOB_SPEC);

:299:      sprintbit(obj->obj_flags.bitvector, affected_bits, buf);
change to:
      sprintbitarray(obj->obj_flags.bitvector, affected_bits, AF_ARRAY_MAX, buf);

:304:    sprintbit(GET_OBJ_EXTRA(obj), extra_bits, buf);
change to:
    sprintbitarray(GET_OBJ_EXTRA(obj, -1), extra_bits, EF_ARRAY_MAX, buf);

:393:      !IS_SET(GET_OBJ_EXTRA(obj), ITEM_MAGIC)) {
change to:
      !IS_SET_AR(GET_OBJ_EXTRA(obj, -1), ITEM_MAGIC)) {

:399:    SET_BIT(GET_OBJ_EXTRA(obj), ITEM_MAGIC);
change to:
    SET_BIT_AR(GET_OBJ_EXTRA(obj, -1), ITEM_MAGIC);

:408:      SET_BIT(GET_OBJ_EXTRA(obj), ITEM_ANTI_EVIL);
change to:
      SET_BIT_AR(GET_OBJ_EXTRA(obj, -1), ITEM_ANTI_EVIL);

:411:      SET_BIT(GET_OBJ_EXTRA(obj), ITEM_ANTI_GOOD);
change to:
      SET_BIT_AR(GET_OBJ_EXTRA(obj, -1), ITEM_ANTI_GOOD);


-----------------------------------------------------------------------------
                               spell_parser.c
-----------------------------------------------------------------------------

:334:  if (IS_SET(ROOM_FLAGS(caster->in_room), ROOM_PEACEFUL) &&
change to:
  if (IS_SET_AR(ROOM_FLAGS(caster->in_room), ROOM_PEACEFUL) &&


-----------------------------------------------------------------------------
                                  utils.c
-----------------------------------------------------------------------------

:342:  REMOVE_BIT(AFF_FLAGS(ch), AFF_CHARM | AFF_GROUP);
change to:
  REMOVE_BIT_AR(AFF_FLAGS(ch), AFF_CHARM);
  REMOVE_BIT_AR(AFF_FLAGS(ch), AFF_GROUP);

:whereever:
insert:

void sprintbitarray(long bitvector[], char *names[], int maxar, char *result)
{
  long nr;
  int teller, found = FALSE;

  *result = '\0';

  for(teller = 0; teller < maxar && !found; teller++)
    for (nr = 0; nr < 32 && !found; nr++) {
      if (IS_SET_AR(bitvector, (teller*32)+nr))
        if (*names[(teller*32)+nr] != '\n') {
	  strcat(result, names[(teller*32)+nr]);
	  strcat(result, " ");
        } else {
	  strcat(result, "UNDEFINED ");
        }
      if (*names[(teller*32)+nr] == '\n')
        found = TRUE;
    }

  if (!*result)
    strcpy(result, "NOBITS ");
}


+-----------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
|   http://cspo.queensu.ca/~fletcher/Circle/list_faq.html   |
+-----------------------------------------------------------+



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