I copied this msg to bugs@circlemud.org.
Here is the fix for CircleMUD bpl 14 (few bugs I described before):
Functions modified:
save_char, db.c
do_purge, act.wizard.c
extract_char, handler.c
make_corpse, fight.c
1) Link dead chars weren't saved at all! For example: char dies while
linkdead, but reenters the game with full exp. :(
The money would also stay, but money duplication was prevented by
special check in make_corpse(). :I
2) The game crashed in many situations: for example, it crashed if linkdead
char was forced to rent.
3) No longer need the "gold duplication 'if' clause" in make_corpse().
4) "Corpses disappearing" bug (dying in NOWHERE):
Only chars in POS_STUNNED or better are transferred to NOWHERE now.
They must not be poisoned too!
=== In act.wizard.c, do_purge, replace this block: ===
if (!IS_NPC(vict)) {
sprintf(buf, "(GC) %s has purged %s.", GET_NAME(ch), GET_NAME(vict));
mudlog(buf, BRF, LVL_GOD, TRUE);
if (vict->desc) {
STATE(vict->desc) = CON_CLOSE;
vict->desc->character = NULL;
vict->desc = NULL;
}
}
extract_char(vict);
=== with: ===
if (!IS_NPC(vict)) {
sprintf(buf, "(GC) %s has purged %s.", GET_NAME(ch),
GET_NAME(vict));
mudlog(buf, BRF, LVL_GOD, TRUE);
}
/* Zmey: fixed do_purge+extract_char bug: */
if (!IS_NPC(vict) && vict->desc) {
STATE(vict->desc) = CON_CLOSE;
vict->desc->character = NULL;
vict->desc = NULL;
extract_char(vict);
free_char(vict);
} else
extract_char(vict);
===
=== In handler.c, extract_char(), replace: ===
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);
}
=== with: ===
if (!freed) {
if (ch->desc != NULL) {
STATE(ch->desc) = CON_MENU;
SEND_TO_Q(MENU, ch->desc);
} /* else {
Zmey: We _can't_ free_char here, because there are lot of combinations
of extact_char+save_char where game will crash if char is linkdead!
Its not neccessary to free him here anyways - char_data structure
will be freed in close_socket... Special case is do_purge which
destroys descriptor's pointer to character, so I had to rewrite it.
*/
/* free_char(ch); DELME! */
/* } */
}
===
=== In db.c, save_char(), replace: ===
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';
=== with: ===
if (IS_NPC(ch) || GET_PFILEPOS(ch) < 0)
return;
char_to_store(ch, &st);
if (ch->desc) {
strncpy(st.host, ch->desc->host, HOST_LENGTH);
st.host[HOST_LENGTH] = '\0';
} else { /* Zmey: FIXME: Read old host's address from pfile! */
strcpy(st.host, ">> Linkdead save <<");
}
===
=== In fight.c, make_corpse(), replace: ===
/* transfer gold */
if (GET_GOLD(ch) > 0) {
/* following 'if' clause added to fix gold duplication loophole */
if (IS_NPC(ch) || (!IS_NPC(ch) && ch->desc)) {
money = create_money(GET_GOLD(ch));
obj_to_obj(money, corpse);
}
GET_GOLD(ch) = 0;
}
=== with: ===
/* transfer gold */
if (GET_GOLD(ch) > 0) {
/* following 'if' clause added to fix gold duplication loophole */
/* No longer neccessary
if (IS_NPC(ch) || (!IS_NPC(ch) && ch->desc)) {
*/
money = create_money(GET_GOLD(ch));
obj_to_obj(money, corpse);
/* } */
GET_GOLD(ch) = 0;
}
===
=== In fight.c, damage(), replace: ===
/* Help out poor linkless people who are attacked */
if (!IS_NPC(victim) && !(victim->desc)) {
do_flee(victim, NULL, 0, 0);
if (!FIGHTING(victim)) {
act("$n is rescued by divine forces.", FALSE, victim, 0, 0, TO_ROOM);
=== with: ===
/* Help out poor linkless people who are attacked */
if (!IS_NPC(victim) && !(victim->desc)) {
do_flee(victim, NULL, 0, 0);
/* Zmey: fixed the "death in NOWHERE" bug */
if (!FIGHTING(victim) && GET_POS(victim) >= POS_STUNNED &&
!AFF_FLAGGED(victim, AFF_POISON)) {
act("$n is rescued by divine forces.", FALSE, victim, 0, 0, TO_ROOM);
===
Hope I didn't forgot anything...
Zmey // 3MoonsWorld (rmud.net.ru:4000)
+------------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
| http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
+------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/15/00 PST