On Sun, 14 Apr 1996, corey hoitsma wrote:
> I'm trying to write an ACMD(do_home) function...
> it pretty much follows the format of recall...
> and it would allow ppl with houses to goto them
> with the house command...
> BUT!
> How would I check to see if that person had a house?
> 'Cause if the player doesn't have a house and types home
> it core dumps (of course, since he doesn't have a house to goto),
> so I need to first check if the player has a house.. how would
> I do that?
Maybe this will help: (I made this some time ago, and I changed some save
and load and newbie code, so I don't know if it is totally working on
stock circle, but you can try, right? Besides, the house stuff should
work ok)
#include "structs.h"
#include "utils.h" /* And I'm not sure if these are enough */
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 */
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;
}
Good luck,
Gekke Eekhoorn of BUG.
This archive was generated by hypermail 2b30 : 12/18/00 PST