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);
}
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ICQ: 386326
Bryan L. Britt 501-327-8558
Beltane Web Services, Conway, AR http://www.beltane.com
~~~~~~~~~~Support Private Communications on the Internet~~~~~~~~~~
finger beltane@beltane.com -- for PGP Public Key and Privacy Info
+------------------------------------------------------------+
| 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