Re: set loadroom :( (fwd)

From: Belgian Underground Mud (bug@asteriks.rug.ac.be)
Date: 07/06/95


On Thu, 6 Jul 1995, Stefan Rensing wrote:

> All this loadroom stuff is REALLY weird. For example, the syntax mentioned
> BTW, Jeremy, the piece in nanny() where the loadroom is set looks like a
> really dirty hack ;)

We did it like this: we made go_home(ch), that will put the char where it 
belongs:

---------- go_home.c --------
/*********************************************************************
 *                                                                   *
 *   to make characters recall to their houses if not grouped.       *
 *    By Wodan, Gekke Eekhoorn and Sungoku a bit.                    *
 *                                                                   *
 *********************************************************************/

#include <stdio.h>
#include <string.h>
#include "structs.h"
#include "utils.h"
#include "house.h"
#include "db.h"
#include "comm.h"
#include "handler.h"

extern struct house_control_rec house_control[MAX_HOUSES];
extern struct char_data *character_list;
extern int num_of_houses;

void act(char *str, int i, struct char_data * c, struct obj_data * o,
              void *vict_obj, int j);

sh_int get_home(struct char_data *ch)
{
  extern sh_int r_mortal_start_room;
  extern sh_int r_immort_start_room;
  extern sh_int r_frozen_start_room;
  sh_int load_room, i;

  if (PLR_FLAGGED(ch, PLR_FROZEN))
    return r_frozen_start_room;

  if ((load_room = real_room(GET_LOADROOM(ch))) < 0) {
    /* small glitch: if char has non-grouped followers only, he will
       not go to his house. I don't care. Gekke. */
    if (!(AFF_FLAGGED(ch, AFF_GROUP) && (ch->master || ch->followers))
        && num_of_houses) { /* Not in or in one-member group */
      for (i = 0; i < num_of_houses; i++) {
        if (GET_IDNUM(ch) == house_control[i].owner) {
          return real_room(house_control[i].vnum);
        }
      }
    }
    if (GET_LEVEL(ch) >= LVL_IMMORT)
      return r_immort_start_room;
    else
      return r_mortal_start_room;
  } else
    return load_room;
}

void go_home(struct char_data * victim)
{
  if (IN_ROOM(victim)!=NOWHERE)
    char_from_room(victim);
  char_to_room(victim, get_home(victim));
  look_at_room(victim, victim->in_room);
  act("$n suddenly appears in the room.", TRUE, victim, 0, 0, TO_ROOM);
  return;
}
-----------------------------

You have to put something that clears the loadroom of a char in clear_char...
(Could be you have to put some more in it, dunno any more...)
(And you replace the junk in nanny with go_home and you remove a 
look_at_room)
(And if you feel like it, you can make a 'home' command for imms and a 
home all for imps) (I did :)
(Of course, now, a char will also be put in his house when he quitted 
there :) Great, no?)
(I should stop using brackets now.)

The reason this works is because PLR_LOADROOM is only used to determine 
wether or not a char's loadroom should be overwritten.

Gekke Eekhoorn.

.-----------------------------------------------------------------------.
|    I t ' s   n o t   a   b u g ,   i t ' s   a   f e a t u r e ! ! !  |
| BUG Mud - Belgian UnderGround                  eduserv.rug.ac.be 3555 |
|  Imps : Charlotte, Gekke,            If you can't connect, email to : |
|         Hymy, Mentat and Wodan         tvergote@eduserv.rug.ac.be     |
|  Thanx to SunGoku...                  Subject : frontdoor             |
`-----------------------------------------------------------------------'



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