Re: god/mortwho again...

trice@dstar.california.com
Date: 06/04/96


On Tue, 4 Jun 1996, Brian Williams wrote:

> anything wrong with this you can see? when morts are logged on, it says 
> "$n leaves east." on the who listing.. dunno why though, and it works 
> fine when only immorts are logged on.. thanks ahead of time

No offense, but that's some ugly code bound to present problems that are 
difficult to find/debug.  Here is what I'd do:

/* in the beginning of do_who */
  char immbuf [MAX_STRING_LENGTH];
  char mortbuf [MAX_STRING_LENGTH];

  char *WizLevels [] = {
    "   Immortal    ",
    "      God      ",
    "  Greater God  ",
    "* Implementor *"
  };


/* within the loop */
  if (GET_LEVEL(tch) >= LVL_IMMORT)
    sprintf(immbuf, "%s%s[%s] %s %s", immbuf, CCYEL(ch, C_NRM), 
	    WizLevels[GET_LEVEL(tch) - LVL_IMMORT], GET_NAME(tch), 
	    GET_TITLE(tch));
  else
    sprintf(mortbuf, "%s[%2d %s] %s %s", mortbuf, GET_LEVEL(tch),
	    CLASS_ABBR(tch), GET_NAME(tch), GET_TITLE(tch));

/* have the flags and things print to a general buffer (eg., buf)
   then append it to either immbuf or mortbuf depending upon whether
   the person (tch) is immortal or not (respectively).  Do not send
   either immbuf or mortbuf out yet, instead, send them after the
   loop is over */


Anyways, I realize that wasn't exactly clear, so I'll write the code and 
send the patch to cambot.



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