[Circle] [Code / Newbie] Saving locations not working

From: DJ Pure (pure@ozramp.net.au)
Date: 11/23/96


G'Day,
	I'm trying to save the players location when they type the word "quit",
but it seems to be saving the location as -1 (ie NOWHERE). I have modified
the code in a number of places. (listed below). This is for win95 also. and
rent is for free.

<in act.other.c ...>
ACMD(do_quit)
{
....
// STOCK CODE HERE
    /*
     * 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 (d = descriptor_list; d; d = next_d) {
      next_d = d->next;
      if (d == ch->desc)
        continue;
      if (d->character && (GET_IDNUM(d->character) == GET_IDNUM(ch)))
        close_socket(d);
    }

// MY ADDITIONS HERE
   // Saves the player to the room they are in - Jus.
   save_room = ch->in_room;
   ch->player_specials->saved.load_room = IN_ROOM(ch);
   save_char (ch, save_room);

// STOCK CODE CONTINUES HERE .....
   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);
  }
}

<now in handler.c, in extract_char>
  /* pull the char from the list */
  REMOVE_FROM_LIST(ch, character_list, next);

  if (ch->desc && ch->desc->original)
    do_return(ch, "", 0, 0);

  if (!IS_NPC(ch)) {
    // MY ADDITION
    save_char(ch, ch->player_specials->saved.load_room);
    // save_char(ch, NOWHERE)   .... OLD LINE. NEW ONE ABOVE.
   // STOCK CODE CONTINUES ..
    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 */
    free_char(ch);
    freed = 1;
  }
// STOCK CODE CONTINUES ..

this is as much as I can remember. Please please .. help   =~~~~~~~(

a crying jussy.
+-----------------------------------------------------------+
| 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/18/00 PST