Here's a question for the list. In a drunken fit of inspiration, I implemented variable arguments for act(). I was wondering if there could be consequences down the road by doing this. 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); to void act(int hide_invisible, struct char_data *ch, struct obj_data *obj, const void *vict_obj, int type, char *fmt, ...); I then went through all of the source code and changed the existing act() statements to my new format, deleting some of the sprintf(buf) lines. Everything seems to work correctly. I was wondering if anyone else has tried this. the only changes to the actually code for my new act() was the variables, and the addition of these 4 lines: va_list args; va_start(args, fmt); vsprintf(buf, fmt, args); va_end(args); Now I can have an act statement in the code that looks like this: act(FALSE, ch, 0, 0, TO_ROOM, "$n says, '%s'", argument); instead of sprintf(buf, "$n says, '%s'", argument); act(buf, FALSE, ch, 0, 0, TO_ROOM); Am I missing an obvious problem, or will this work as coded? It seems to for me anyway. +------------------------------------------------------------+ | 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