Re: ACT() variable arguments

From: d. hall (dhall@OOI.NET)
Date: 08/29/98


>>>>>> thus on Sat, 29 Aug 1998 16:19:50 -0400, Eric wrote:

> I changed act() from

> void act(const char *str, int hide_invisible, struct char_data *ch, struct
> obj_data *obj, const void *vict_obj, int type);

> void act(int hide_invisible, struct char_data *ch, struct obj_data *obj,
> const void *vict_obj, int type, char *fmt, ...);

> I was wondering if anyone else has tried this.

I worked on a similiar act that attempted to emulate printf as much as
possible.  I figured the 'escaped characters' in the string would call the
objects needed.

So essentially you can condense act to the following:

void act (struct char_data *ch, int hide_invis, int type char *fmt, ...);

Instead of $n, $N, $m, $M, $s, $S, there was just $n, $m, $s.  You would
just pass the (struct char_data) to the appropriate one.

I thought myself clever until I realized that in a really complex act, you
would be passing reference to the same structure, 3 and maybe 4 times.

Proof of concept:
        if you find $n:
        CHECK_NULL (vict_obj, PERS (vararg (va, (struct char_data *))));
        if you find $o:
        CHECK_NULL (vict_obj, OBJN (vararg (va, (struct obj_data *)), ch));

d.


     +------------------------------------------------------------+
     | 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/15/00 PST