Re: Latest DG script (pl8) -> BUG?

From: Thomas Arp (t_arp@stofanet.dk)
Date: 07/22/02


From: "Mathew Earle Reuther" <graymere@zipcon.net>
> > Looks like a bug, I think that should actually be:
> > if ((real_num = real_room(number)) == NOWHERE) {
>
> Would the other cases then want to == NOWHERE or NOTHING as well?  It
> would seem from the context that that would make sense and they all used
> to be < 0 (which is equivalent to == NOWHERE/NOTHING) . . . Or is it just
> the ZEDIT SCMD?
>
> For example:
>
>   case SCMD_OASIS_OEDIT:
>     if ((real_num = real_object(number)) != NOTHING)
>       oedit_setup_existing(d, real_num);
>     else
>       oedit_setup_new(d);
>     STATE(d) = CON_OEDIT;
>     break;
>
The other cases check if the room/obj/mob exists (!= NOTHING), and if
so, calls the 'setup_existing'. Otherwise it sets up a new one.

> As opposed to what the zedit scmd looks like after the fix in the last
> email:
>
>   case SCMD_OASIS_ZEDIT:
>     if ((real_num = real_room(number)) == NOWHERE) {
>       send_to_char(ch, "That room does not exist.\r\n");
>       free(d->olc);
>       d->olc = NULL;
>       return;
>     }
>     zedit_setup(d, real_num);
>     STATE(d) = CON_ZEDIT;
>     break;

Zedit isn't supposed to set up a new zone if one doesn't exist. And you were
right; It was a typo.

The correct solution is using '== NOWHERE' in the zedit case, and '!=
NOTHING'
in the others, or if you wish them to be uniform:

   case SCMD_OASIS_ZEDIT:
     if ((real_num = real_room(number)) != NOWHERE) {
       zedit_setup(d, real_num);
       STATE(d) = CON_ZEDIT;
     } else {
       send_to_char(ch, "That room does not exist.\r\n");
       free(d->olc);
       d->olc = NULL;
       return;
     }
     break;

Welcor, whu throvz up hiz handz ind dizgust off hiz lousi tiping skilz

--
   +---------------------------------------------------------------+
   | 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