Re: send_to_charf, Take 2

From: George Greer (greerga@circlemud.org)
Date: 07/09/01


On Mon, 9 Jul 2001, Peter Ajamian wrote:

>George Greer wrote:
>
><snip>
>
>I'd say that we should go with one of these two possibilities for act():
>
>>   act("$n says, '%s'", FALSE, ch, 0, 0, TO_ROOM, argument);
>>
>>   act(FALSE, TO_ROOM, "$n says, '%s'", ch, argument);
>
>and not:
>
>>   act(FALSE, ch, 0, 0, TO_ROOM, "$n says, '%s'", argument);

Train of thought there.  I thought it rather useless to keep the three
arguments when they're used as *printf()-style variables anyway.

>As a compromise a new actf() could be created in the secondary format
>above.  Doing this virtually eliminates the need to have variable-arg
>functions for anything else (actf(FALSE, TO_CHAR, "...", ch) becomes
>quite as usefull as send_to_char("...", ch)).

act() does a lot of processing garbage we don't need 69.4% of the time.
(Quick egrep+wc+bc calculation on bpl18.)

>What you do then is depreciate usage of the old send_to_... and act()
>functions in favor of the newer actf() and eventually can drop support
>for them alltogether.

Going that route I'd propose:

  actf(int target, int flags, const char *format, ...);

  flags := ( TO_SLEEP | TO_INVISIBLE )
  target := ( TO_ROOM, TO_VICT, TO_NOTVICT, TO_CHAR, TO_OUTDOOR, TO_ALL )

Then we fix the apologized hack ("Warning: the following TO_SLEEP code is a
hack"), get variable arguments, get rid of some (not all) loops over the
world, and open the way for more flags.

Due to various problems with the parameterization, I would recommend
keeping send_to_char(). Where does the pointer of the person to send the
message to go for a static string with actf?

--
George Greer
greerga@circlemud.org

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/06/01 PST