Re: [Newbie] [CODE] [LONG] Room Saves

From: John Evans (evansj@HI-LINE.NET)
Date: 05/20/98


On Wed, 20 May 1998, Lord Kyu wrote:

> > I added this to do_quit, but it didn't work. The mortals started at the
> > mortal_start_room and the immortals at the immortal_start_room. I then
> > added the GET_LOADROOM(ch) function. Now, it looks like this:
> >
> > if (free_rent) {
> >   Crash_rent(blah blah.....
> >   save_char(ch, save_room);
> >   GET_LOADROOM(ch) = save_room;
> > }
> >

When someone quits, something like so happens:

/* Save the VNUM of the room that they are in. */
if (!PLR_FLAGGED(ch, PLR_LOADROOM))
  GET_LOADROOM(ch) = world[ch->in_room].number;


When they are placed back into the game (new connection or otherwise),
something like the following is used in nanny():

load_room = GET_LOADROOM(d->character);
if (load_room != NOWHERE)
  load_room = real_room(load_room);

Then it does the normal checks to make sure that they are not being placed
in NOWHERE because of a room being removed. If they are going to be
placed in NOWHERE, then they are stuck in the proper start_room. Then the
final check for frozen is done. Once all of that is done, you have the
start room that they saved with.

Pretty simple, no?

This works for the following conditions:

quit
At the menu: 1

-and-

quit
At the menu: 0
<new connection>
At the menu: 1

John Evans <evansj@hi-line.net>  --  http://www.hi-line.net/~evansj/

Any sufficiently advanced technology is indistinguishable from magic.
--Arthur C. Clarke


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



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