Re: Load room for players.

From: Kras Kresh (kras_kresh@hotmail.com)
Date: 03/25/02


>From: Moppe Sewerin <mans@graphiclife.com>
>Reply-To: Circle Discussion List <CIRCLE@post.queensu.ca>

>When my players rent, they don't end up in the room they rented. They
>end up in the starting room for mortals. This is really annoying =). I'm
>using Circle bpl19. Any1 who think they could help me with this?

I can explain the problem to you and give a solution, but I don't know if
its the best solution.

The problem is, in objsave.c when a player rents, that player's loadroom
becomes the room he is in, but when extract_char() is called, that player
gets saved again, but this time, in NOWHERE.

Here is my fix. In db.c:

void save_char(struct char_data *ch, room_rnum load_room)
{
  struct char_file_u st;

  if (IS_NPC(ch) || !ch->desc || GET_PFILEPOS(ch) < 0)
    return;

  char_to_store(ch, &st);

  strncpy(st.host, ch->desc->host, HOST_LENGTH);
  st.host[HOST_LENGTH] = '\0';

-  if (!PLR_FLAGGED(ch, PLR_LOADROOM)) {
-    if (load_room == NOWHERE)
-      st.player_specials_saved.load_room = NOWHERE;
-    else
-      st.player_specials_saved.load_room = GET_ROOM_VNUM(load_room);
-  }
+  if (!PLR_FLAGGED(ch, PLR_LOADROOM) && load_room != NOWHERE)
+    st.player_specials_saved.load_room = GET_ROOM_VNUM(load_room);

  fseek(player_fl, GET_PFILEPOS(ch) * sizeof(struct char_file_u), SEEK_SET);
  fwrite(&st, sizeof(struct char_file_u), 1, player_fl);
}

Then, in your other commands where they leave the game, you put in stuff
like:
In act.other.c: do_quit():
    if (free_rent)
      Crash_rentsave(ch, 0);

    extract_char(ch);           /* Char is saved in extract char */

+    /* Char return to mortal_start_room on login */
+    if (!PLR_FLAGGED(ch, PLR_LOADROOM))
+      GET_LOADROOM(ch) = NOWHERE;
+
    /* If someone is quitting in their house, let them load back here */
    if (ROOM_FLAGGED(loadroom, ROOM_HOUSE))
      save_char(ch, loadroom);

In objsave.c: gen_receptionist():

    mudlog(buf, NRM, MAX(LVL_IMMORT, GET_INVIS_LEV(ch)), TRUE);
    act("$n helps $N into $S private chamber.", FALSE, recep, 0, ch,
TO_NOTVICT);
    save_room = ch->in_room;
    extract_char(ch);
    save_char(ch, save_room);
+
+    /* This allows player to reload in INN if re-enter game. */
+    if (!PLR_FLAGGED(ch, PLR_LOADROOM))
+      GET_LOADROOM(ch) = GET_ROOM_VNUM(save_room);
  } else {
    Crash_offer_rent(ch, recep, TRUE, mode);
    act("$N gives $n an offer.", FALSE, ch, 0, recep, TO_ROOM);
  }

There is one other way they can leave the game - dying. You can set their
loadroom to NOWHERE if you want.

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   | Newbie List:  http://groups.yahoo.com/group/circle-newbies/   |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 06/25/03 PDT