[CODE] Possible Fix to act()

From: Rasdan (rasdan@PEAK.ORG)
Date: 07/25/97


Looking through the act function the other day, as I needed to add a new
argument to it, I noticed that TO_SLEEP was a hack of sorts (comments in
code).

To me, this didn't make a lot of sense so I converted TO_CHAR, TO_VICT,
TO_NOTVICT, and TO_ROOM to bitvectors, and also TO_SLEEP as well.

So, here's the way I did it, works very well and makes adding arguments
to act easy, because then you don't really need to add an argument, just
pass it a new bitvector along with TO_CHAR, TO_VICT, TO_NOTVICT, and
TO_ROOM:

In comm.h, change the defines for TO_CHAR, etc to:

#define TO_CHAR                 (1 << 0)        /* To Char ACT Bit */
#define TO_VICT                 (1 << 1)        /* To Vict ACT Bit */
#define TO_NOTVICT              (1 << 2)        /* To Notvict ACT Bit */
#define TO_ROOM                 (1 << 3)        /* To Room ACT Bit */
#define TO_SLEEP                (1 << 4)        /* If sleeping, send message */

Then in comm.c in act(),

Where it checks if sleep is there and removes it, delete that whole block
of code, and add:

if (IS_SET(type, TO_SLEEP))
  sleep = TRUE;

Then just replace all the if (type == TO_<whatever>) to:
  if (IS_SET(type, TO_<whatever))

It's what I did, works like a charm and then you can pass whatever else
you want to act by doing:

act("$n smiles at $N.", FALSE, ch, 0, vict, TO_ROOM | TO_<new act define>)

Makes passing this easier :)

Rasdan


=--=--=--=--=--=--=--=--=--=--=
  I have done so much,
  with so little,                         James C. Thomas Jr.
  for so long,                                 Rasdan
  That I can do anything                Head Coder of Finality!
  with nothing.
=--=--=--=--=--=--=--=--=--=--=
Finality is based upon CircleMUD 3.0, check us out:
                   finality.mudservices.com 5555


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



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