Re: Re:demon_summon spec_proc

From: Niese-Petersen (Tenp@cris.com)
Date: 01/15/97


On Wed, 15 Jan 1997, Daniel Durnin wrote:

> SPECIAL(Instructor);
> 
>  else {
>     for (tch = world[instructor->in_room].people; tch; tch =
> tch->next_in_room) {
>       if (IS_NPC(tch))
>         if ((GET_MOB_VNUM(tch) == 11118) || (GET_MOB_VNUM(tch) == 11119)) {
>            return (FALSE);
>         } else {
>            r_num =
> (world[world[world[world[ch->in_room].dir_option[2]->to_room].dir_option[2]-
> >
>            to_room].dir_option[2]->to_room].dir_option[2]->to_room);
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    A very very very dangerous code part. if just one of those
    dir_option[2] don't exists, then *BANG BUM CRASH*

<--snip-->
>            r_num = (world[r_num].dir_option[2]->to_room);
             ^^^^^^^^^^^
             Same for this.

Now people may say "Well. if the mob don't move around and it is loaded in
the right room all the time.", then I say "Well. Players could charm it,
or a immortal play around [loading them everywhere], then the crashes will
come."
Try something like this:
  if ((r_num = (EXIT(r_num, 2) ? EXIT(r_num, 2)->to_room : -1)) != -1)
  {
    /* Was exit code */
  } else {
    /* Wasn't exit code */
  }


Enjoy.

Erik Niese-Petersen
AKA Quint the typo dane
Realms of Darkness IMP


+-----------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
|   http://cspo.queensu.ca/~fletcher/Circle/list_faq.html   |
+-----------------------------------------------------------+



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