Loadroom Routines

From: Brian Roach (brian@tardis-house.com)
Date: 02/08/96

(CC:'d to the mailing list because i see many requests for how to do this)
This is applicable to circle30bpl9.
If you are not interested in how loadroom is saved - skip the rest of this

I don't know how to start this letter...hmm, it's not that PLR_LOADROOM flag
doesn't work... it does. It's just limiting in what happens otherwise ->

The loadroom routines currently will do this:
If you flag a player with PLR_LOADROOM "on" they will always go to whatever
room you set as their loadroom. This will never change unless you turn off
the flag, or set their loadroom to something else. The problem is if you
want people to go back to where they quit when they enter the mud again. 
Even if someone quits in their "house", they are not going to go back there. 
(I have not gone through all the "house" code, but the only way it would
save their loadroom is if the house routine manually saves their loadroom to
the playerfile, then  flags them with PLR_LOADROOM)

Let me explain:

When you quit the game, do_quit sends you to extract_char which does a
save_char(ch, NOWHERE). Then back in do_quit, I see code has been added to
save your loadroom if you are in your "house". Unfortunatly this won't help ->

If the player does NOT have PLR_LOADROOM set to on, this is in save_char:

    if (load_room == NOWHERE)
      st.player_specials_saved.load_room = NOWHERE;
      st.player_specials_saved.load_room = world[load_room].number;

This works fine if you are in your house, and it's called from do_quit,
since load_room != NOWHERE, it's been set to your house rnum. And one would
assume it would be easy just to change extract_char to not send NOWHERE, but
ch->in_room if you always wanted to save a player's position.

The problem is this - save_char(ch, NOWHERE) is called all over the place in
interpreter.c as you log into the mud.  If you do not have PLR_LOADROOM set
"on", you're going to the mortal start room.  

Easy to fix, right? Just set PLR_LOADROOM "on" as the default for characters. 
Nope. The routine above from save_char does nothing to
st.player_specials_saved.load_room if PLR_LOADROOM is turned on.

Basically it's a catch 22: If PLR_LOADROOM is turned on, NOWHERE will never
be saved to the playerfile, but neither will anything else. If it's not set,
NOWHERE is saved there everytime you enter the MUD:

entering your password
entering the wrong password
changing your password
entering the mud

So now... you've read this long message... how do you fix it?

replace the 4 save_char(d->character, NOWHERE) calls listed above with:
save_char(d->character, real_room(GET_LOADROOM(d->character)));

(save_char saves the virtual number, but expects a rnum to be passed to it)
If you want character positions to ALWAYS be saved when they quit, Just
remove the IF condition at the end do_quit which checks if you are in your
"house", leaving save_char(ch, save_room); intact.

(You could also add it before the house check, letting characters with
houses still always start in their house)

- Brian

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