Re: Problems with Ferry Snippet

From: Torgny Bjers (
Date: 03/30/02

On 02-03-31 02.43, "Moppe Sewerin" <mans@GRAPHICLIFE.COM> wrote:

> Hi again!
> Perhaps any of you who tried the ferry snippet would like to help me
> with this one?
> Function Create Exit screws the whole room up if you already have an
> exit there:
> /* Beginning of Code */
> void create_exit(room_vnum vnum_from, room_vnum vnum_to, int from_dir)
> {
>  char cebuf[128];
>  room_rnum rnum_from, rnum_to;
>  if ((rnum_from = real_room(vnum_from)) == NOWHERE) {
>    sprintf(cebuf, "SYSERR: Ferry: Couldn't find the 'from' room #%d.",
> vnum_from);
>    log(cebuf);
>  } else if ((rnum_to = real_room(vnum_to)) == NOWHERE) {
>    sprintf(cebuf, "SYSERR: Ferry: Couldn't find the 'to' room #%d.",
> vnum_to);
>    log(cebuf);
>  } else if (world[rnum_from].dir_option[from_dir] == NULL) {
>    CREATE(world[rnum_from].dir_option[from_dir], struct
> room_direction_data, 1);
>    world[rnum_from].dir_option[from_dir]->to_room = rnum_to;
>  } else {
>    sprintf(cebuf, "SYSERR: Ferry overwriting exit in room #%d.",
> world[rnum_from].number);
>    log(cebuf);
>    world[rnum_from].dir_option[from_dir]->to_room = rnum_to;
>  }
> }
> /* End of Code */
> Any real hacker who could localize the problem? I'd be really glad if
> you could help me.
> Regards
> Måns Sewerin

Hello Måns,

Before we can localize the problem we need some kind of error to go with the
code.  You say that it screws up the room, how?  Does it crash?  In that
case, on what line, and can you please provide debugger output as well?

From looking at the code I see that the ferry creates exits through CREATE,
and perhaps it shouldn't do that, seems a trifle bad to me, especially if
you run a redit save on that zone afterwards by mistake. ;)  Wouldn't it be
easier to just swipe all the players from the ferry and move them to the new
room instead of going through the whole exit stuff?  I haven't seen the rest
of the code, but from a design point of view, this solution seems to be
quite dangerous to me.

So, the code checks to see if the room has an exit, if it does, it
overwrites it.  So, that's not really a bug.  It is supposed to do that.

Kind regards,
Torgny Bjers

   | FAQ: |
   | Archives: |
   | Newbie List:   |

This archive was generated by hypermail 2b30 : 06/25/03 PDT