Re: Alright I'm lost.... Quitting in House.

From: Modem Burn (modem-burn@GEOCITIES.COM)
Date: 09/22/98


Okay if I understand the question correctly you asked why quit in your
house because you loose/drop all you eq? correct?
Well the eq isn't really taken out of the game. it's droped then crashed
saved every 5 mins. it's faster than rem all, drop all, save, quit.
Anyways the eq is still in the game wich causes another problem with
reloading times but thats a different question. All that stuff is under
objsave.c and there should be something under the do_save function if I
rember correctly where it does the statement and sees weather or not you
are in a room flagged house. if you are it crash saves your house.

the rest of the stuff where it says
    if (ROOM_FLAGGED(save_room, ROOM_HOUSE))
       save_char(ch, save_room);
that just saves the room the character automaticly loads in when they
log back in.


>
> While I'm very experienced at programming, I am new to C.  And I may be
> getting lost in the code somewhere.
>
> If someone goes into thier house, and types 'quit' they drop their
> equipment.  I've followed the code in the do_quit, and it is exactly
> right.  extract_char dropped the equipment then calls save_char...
> I've checked the FTp site and compared my version (modified bpl14) with
> the bpl14 and the bpl13a stocks...  there are no differences.  The
> stock code droppes equipment when quitting in a house also.
>
> What am I missing??  Am I doing something wrong?
>
> I trimmed a little to save lines.  My version doesn't differ from the
> website if you need the few lines I snipped.
> >From act.other.c:
> ACMD(do_quit)
> {
>   sh_int save_room;
>   struct descriptor_data *d, *next_d;
>
>   if (IS_NPC(ch) || !ch->desc)
>     return;
>
>   if    /* I can't quit legally then don't-- snipped /*  {
>   } else {
>     if (!GET_INVIS_LEV(ch))
>       act("$n has left this existance.", TRUE, ch, 0, 0, TO_ROOM);
>     sprintf(buf, "%s has left this existance.", GET_NAME(ch));
>     mudlog(buf, NRM, MAX(LVL_IMMORT, GET_INVIS_LEV(ch)), TRUE);
>     send_to_char("Goodbye, friend.. Come back soon!\r\n", ch);
>
>     /* kill off all sockets connected to the same player as the one who is
>      * trying to quit.  Helps to maintain sanity as well as prevent duping.
>      *  FOR/NEXT snipped. */
>
>    save_room = ch->in_room;
>    if (free_rent)
>       Crash_rentsave(ch, 0);
>     extract_char(ch);           /* Char is saved in extract char */
>
>     /* If someone is quitting in their house, let them load back here */
>     if (ROOM_FLAGGED(save_room, ROOM_HOUSE))
>       save_char(ch, save_room);
>   }
> }
>
> And from handler.c:
> /* Extract a ch completely from the world, and leave his stuff behind */
> void extract_char(struct char_data * ch)
> {
>   struct char_data *k, *temp;
>   struct descriptor_data *t_desc;
>   struct obj_data *obj;
>   int i, freed = 0;
>
>   if (!IS_NPC(ch) && !ch->desc) {
>     for (t_desc = descriptor_list; t_desc; t_desc = t_desc->next)
>       if (t_desc->original == ch)
>         do_return(t_desc->character, NULL, 0, 0);
>   }
>   if (ch->in_room == NOWHERE) {
>     log("SYSERR: NOWHERE extracting char %s. (%s, extract_char)",
>         GET_NAME(ch), __FILE__);
>     exit(1);
>   }
>   if (ch->followers || ch->master)
>     die_follower(ch);
>
>   /* Forget snooping, if applicable */
>   if (ch->desc) {/* Snipped-- Stops Snooping/* }
>
>   /* transfer objects to room, if any */
>   while (ch->carrying) {
>     obj = ch->carrying;
>     obj_from_char(obj);
>     obj_to_room(obj, ch->in_room);
>   }
>
>   /* transfer equipment to room, if any */
>   for (i = 0; i < NUM_WEARS; i++)
>     if (GET_EQ(ch, i))
>       obj_to_room(unequip_char(ch, i), ch->in_room);
>
>   if (FIGHTING(ch))
>     stop_fighting(ch);  /* And stop everyone else too -snipped */
>
>   char_from_room(ch);
>
>   /* pull the char from the list */
>   REMOVE_FROM_LIST(ch, character_list, next);
>
>   if (ch->desc && ch->desc->original)
>     do_return(ch, NULL, 0, 0);
>
>   if (!IS_NPC(ch)) {
>     save_char(ch, NOWHERE);
>     Crash_delete_crashfile(ch);
>   } else {
>     if (GET_MOB_RNUM(ch) > -1)          /* if mobile */
>       mob_index[GET_MOB_RNUM(ch)].number--;
>     clearMemory(ch);            /* Only NPC's can have memory */
>     if (SCRIPT(ch))
>       extract_script(SCRIPT(ch));
>     if (SCRIPT_MEM(ch))
>       extract_script_mem(SCRIPT_MEM(ch));
>     free_char(ch);
>     freed = 1;
>   }
>
>   if (!freed && ch->desc != NULL) {
>     STATE(ch->desc) = CON_MENU;
>     SEND_TO_Q(MENU, ch->desc);
>   } else {  /* if a player gets purged from within the game */
>     if (!freed)
>       free_char(ch);
>   }
> }
>


     +------------------------------------------------------------+
     | 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