Re: Saving the locattion of where someone rente

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


At 12:39 AM 1/4/96 -0600, you wrote:
>On Wed, 3 Jan 1996, Nick wrote:
>
>> On Wed, 3 Jan 1996, Ben Leibig wrote:
>> 
>> > For some reason when someone(Well a immortal atleast(Our mud doesnt have 
>> > mortals yet)) rents they dont come back into the game where the rented 
>> > but in the immortal starting room.  Any idea why this is and how i can 
>> > fix it.
>> 
>> In the case of Immortals, each Immortal+ character has a defined starting 
>> room.  Since Immortals aren't really "renting", they just get put in 
>> their designated starting room upon entering the MUD.
>> 
>
>Actually, there's a simple way to fix this.
>
>Assuming you're using the QUIT command to exit the mud:
>
>edit act.other.c, searching do_quit for the line that reads
>extract_char(ch);  /*Char is saved in extract char*/
>
>Insert the following just before extract_char(ch); :
>      GET_LOADROOM(ch) = world[ch->in_room].number;
>
>This will set the player's loadroom to the room from which they left the
>game.  
>
>(Fix is for circle3 pl8)
>

(THis is in reference to 3.0 bpl8, the example is from the "stock" code) 
There's quite a few things in 3.0 that prevent that from working as it
should for some reason... My first code hack was to correct this, and it was
not as easy at it should have been.

The first problem is the routine in interpreter.c that sets load_room when
you enter the game:

----------------------------------------------------
if (GET_LEVEL(d->character) >= LVL_IMMORT) {
	if (PLR_FLAGGED(d->character, PLR_LOADROOM)) {
	  if ((load_room = real_room(GET_LOADROOM(d->character))) < 0)
	    load_room = r_immort_start_room;
	} else
	  load_room = r_immort_start_room;
      } else {
	if (PLR_FLAGGED(d->character, PLR_FROZEN))
	  load_room = r_frozen_start_room;
	else {
	  if (d->character->in_room == NOWHERE)
	    load_room = r_mortal_start_room;
	  else if ((load_room = real_room(d->character->in_room)) < 0)
	    load_room = r_mortal_start_room;
	}
      }
      char_to_room(d->character, load_room);
----------------------------------------------------------------
In regards to immort characters - they will always be put in
r_immort_start_room no matter what. This is easy to fix obviously by just
omitting that IF/ELSE.
There's some real problems here though. First, nowhere does it ever set
load_room to anything saved in the playerfile. That's easy to add of course,
but it's referencing d->character->in_room, where it should be
d->character->player_specials->saved.load_room as a comparison case. This is
just one part of the problem though, as I found various other little
glitches in other places that would either prevent the last room you were in
being saved, or overwrite it at some point with 0. 

As I said, it was my first hack, so I'd have to do some diffs to see exactly
what i did to fix everything, BUT...

I have a backup of my code at that point. The only changes to the stock code
are that it fixes the load_room problems, and will support diaginal compass
points for directionals (nw,ne,sw,se) in the game (and .wld files). (This
will not affect anything, except give you the option of using those
directions in your own world :) )

If you would like, I would be more than happy to send you the .c and .h
files, just drop me some e-mail.

- Brian 



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