Re: Open/Closing/Unlocking/Locking Doors/Objects Message to player.

From: George Greer (greerga@circlemud.org)
Date: 01/30/02


On Wed, 30 Jan 2002, Welcor wrote:

>In other words:
>  First write to a buffer.
>  THEN send to char.
>because
>  send_to_char() doesn't (yet)[1] support variable arguments.
[...]
>[1] I can't recall having read that it ever will, but since it
>    already has been changed to look like the sprintf call, it
>    doesn't seem too far fetched.

ftp://ftp.circlemud.org/pub/CircleMUD/cvs/2002013004-bpl20.patch.gz

--- 8< --- 8< ---
-void send_to_char(const char *messg, struct char_data *ch)
+size_t send_to_char(struct char_data *ch, const char *messg, ...)
 {
-  if (ch->desc && messg)
-    SEND_TO_Q(messg, ch->desc);
+  if (ch->desc && messg && *messg) {
+    size_t left;
+    va_list args;
+
+    va_start(args, messg);
+    left = vwrite_to_output(ch->desc, messg, args);
+    va_end(args);
+    return left;
+  }
+  return 0;
 }
--- 8< --- 8< ---

It's a pretty large patch already but that's mostly due to strdup,
send_to_char, and mudlog re-argumenting.

--
George Greer
greerga@circlemud.org

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   | Newbie List:  http://groups.yahoo.com/group/circle-newbies/   |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 06/25/03 PDT