> Howdy all! > > I've got two problems that have plagued me since day one... > > 1) When a player quits or rents (quiting is ok on my mud) then returns > immediately from the main menu they end up back where they originally > entered the game rather than where they quit/rented. I have replaced > almost every instance of save_char(ch, NOWHERE) with ch->in_room, but to > no avail... anybody else experience this? > I can't remember if I added this or not... utils.h:#define GET_LOADROOM(ch) ((ch)->player_specials->saved.load_room) act.movement.c: (inside the death trap function) GET_LOADROOM(ch)=NOWHERE; save_char(ch,NOWHERE); act.other.c: do_quit() - at the topish. if (!IS_SET(PLR_FLAGS(ch),PLR_LOADROOM)) { GET_LOADROOM(ch)=ch->in_room; } act.other.c: (lower in do_quit right after the line sending "you die before your time") GET_LOADROOM(ch)=NOWHERE; act.other.c: (lower yet - before the extract from free_rent check) if(!IS_SET(PLR_FLAGS(ch),PLR_LOADROOM)) { save_room=ch->in_room; } else { save_room=GET_LOADROOM(ch); } REMOVE_BIT(PLR_FLAGS(ch),PLR_IN_ARENA); save_char(ch, save_room); act.other.c: do_save (right after the message saying "you have been saved or something") if(!IS_SET(PLR_FLAGS(ch),PLR_LOADROOM)) { GET_LOADROOM(ch)=ch->in_room; save_char(ch, ch->in_room); } else { save_char(ch, GET_LOADROOM(ch)); } db.c, in save_char: if (!IS_SET(PLR_FLAGS(ch), PLR_LOADROOM)) { if (load_room == NOWHERE) player.player_specials_saved.load_room = NOWHERE; else player.player_specials_saved.load_room = world[load_room].number; } then grep for save_char( change them all to save_char(d->character, GET_LOADROOM(d->character)); or save_char(ch, GET_LOADROOM(ch)); Yes, this code is repitive.. and I might add, incomplete. This is deliberate. I had lots of fun writing this in as obfuscated of a pattern as I could. I wouldn't want to deprive you of this joy. It really is not hard at all to do this. As a matter of fact, its rather simplistic. here's what you have to do. 1) check if the person has a LOADROOM - if so, save them with their loadroom as the entrance room. 2) if they don't have a loadroom, set their entrance room to the room they quit in. 3) if they die, or something, make sure they don't load in that room. 4) default to nowhere, and make load_char put char in room --- where if the room is nowhere, either immortal or mortal start_room.. this is default behavior i believe. It should take you 15 minutes, w/o looking at my slightly mixed up code. probably 25 if you do. :) PjD +-----------------------------------------------------------+ | 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/08/00 PST