Re: Lets test those coding skills of your...

From: Daniel A. Koepke (dkoepke@circlemud.org)
Date: 12/03/01


On Sun, 2 Dec 2001, David Cole wrote:

>     if (PRF_FLAGGED(d->character, PRF_TANKNAME) && FIGHTING(d->character)) {
>  if (CAN_SEE(d->character, FIGHTING(d->character))) {

You're not checking if FIGHTING(FIGHTING(d->character)) is != NULL; you're
also checking if the wrong person is visible.  You want:

  if (PRF_FLAGGED(d->character, PRF_TANKNAME) &&
      FIGHTING(d->character) && /* We're fighting someone... */
      FIGHTING(FIGHTING(d->character))) /* ...victim fighting someone. */
    sprintf(prompt + strlen(prompt), " T: %s ",
            CAP(PERS(FIGHTING(FIGHTING(d->character))), d->character));

Desk-checking is your friend.  Read your code carefully and consider what
you're doing[1], especially before you send a message to 300+ people
asking for help.  It's the only decent thing to do.


-dak

[1] Not to imply that you didn't do these things -- only to remind
everyone that it's a very good idea.

--
   +---------------------------------------------------------------+
   | 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 : 06/24/03 PDT