diff --git a/include/decl.h b/include/decl.h index d1d4ddd20..d1974da2a 100644 --- a/include/decl.h +++ b/include/decl.h @@ -170,16 +170,20 @@ E const char disclosure_options[]; E NEARDATA int smeq[]; E NEARDATA int doorindex; E NEARDATA char *save_cm; + +E NEARDATA struct kinfo { + struct kinfo *next; /* chain of delayed killers */ + int id; /* uprop keys to ID a delayed killer */ + int format; /* one of the killer formats */ #define KILLED_BY_AN 0 #define KILLED_BY 1 #define NO_KILLER_PREFIX 2 -E NEARDATA int killer_format; -E const char *killer; -E const char *delayed_killer; + char name[BUFSZ]; /* actual killer name */ +} killer; + #ifdef GOLDOBJ E long done_money; #endif -E char killer_buf[BUFSZ]; E const char *configfile; E NEARDATA char plname[PL_NSIZ]; E NEARDATA char dogname[]; diff --git a/include/extern.h b/include/extern.h index 4fb9397a3..eb0ffb668 100644 --- a/include/extern.h +++ b/include/extern.h @@ -555,6 +555,11 @@ E void FDECL(done, (int)); E void FDECL(container_contents, (struct obj *,BOOLEAN_P,BOOLEAN_P)); E void FDECL(terminate, (int)); E int NDECL(num_genocides); +E void FDECL(delayed_killer, (int, int, const char*)); +E struct kinfo *FDECL(find_delayed_killer, (int)); +E void FDECL(dealloc_killer, (struct kinfo*)); +E void FDECL(save_killers, (int,int)); +E void FDECL(restore_killers, (int)); /* ### engrave.c ### */ @@ -1546,6 +1551,7 @@ E void FDECL(make_confused, (long,BOOLEAN_P)); E void FDECL(make_stunned, (long,BOOLEAN_P)); E void FDECL(make_blinded, (long,BOOLEAN_P)); E void FDECL(make_sick, (long, const char *, BOOLEAN_P,int)); +E void FDECL(make_slimed, (long,const char*)); E void FDECL(make_vomiting, (long,BOOLEAN_P)); E void FDECL(make_hallucinated, (long,BOOLEAN_P,long)); E int NDECL(dodrink); diff --git a/include/you.h b/include/you.h index 9460bb164..d792b7176 100644 --- a/include/you.h +++ b/include/you.h @@ -265,7 +265,6 @@ struct you { struct prop uprops[LAST_PROP+1]; unsigned umconf; - char usick_cause[PL_PSIZ+20]; /* sizeof "unicorn horn named "+1 */ Bitfield(usick_type,2); #define SICK_VOMITABLE 0x01 #define SICK_NONVOMITABLE 0x02 diff --git a/src/allmain.c b/src/allmain.c index 61b22a02d..8d30d3879 100644 --- a/src/allmain.c +++ b/src/allmain.c @@ -360,8 +360,8 @@ moveloop() else if (!u.uinvulnerable) { u.utrap -= 1<<8; if(u.utrap < 1<<8) { - killer_format = KILLED_BY; - killer = "molten lava"; + killer.format = KILLED_BY; + Strcpy(killer.name, "molten lava"); You("sink below the surface and die."); done(DISSOLVED); } else if(didmove && !u.umoved) { diff --git a/src/artifact.c b/src/artifact.c index 29b1f406f..407295f89 100644 --- a/src/artifact.c +++ b/src/artifact.c @@ -1210,7 +1210,7 @@ arti_invoke(obj) else u.uhp += healamt; } if(Sick) make_sick(0L,(char *)0,FALSE,SICK_ALL); - if(Slimed) Slimed = 0L; + if(Slimed) make_slimed(0L, (char *)0); if (Blinded > creamed) make_blinded(creamed, FALSE); context.botl = 1; break; diff --git a/src/cmd.c b/src/cmd.c index 19cc6a0fb..1109c92f9 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -975,7 +975,7 @@ int final; /* 0 => still in progress; 1 => over, survived; 2 => dead */ /* If you die while dismounting, u.usteed is still set. Since several * places in the done() sequence depend on u.usteed, just detect this * special case. */ - if (u.usteed && (final < 2 || strcmp(killer, "riding accident"))) { + if (u.usteed && (final < 2 || strcmp(killer.name, "riding accident"))) { Sprintf(buf, "riding %s", y_monnam(u.usteed)); you_are(buf); } diff --git a/src/dbridge.c b/src/dbridge.c index ae80abb2c..53b987825 100644 --- a/src/dbridge.c +++ b/src/dbridge.c @@ -370,18 +370,18 @@ int dest, how; { if (is_u(etmp)) { if (how == DROWNING) { - killer = 0; /* drown() sets its own killer */ + killer.name[0] = 0; /* drown() sets its own killer */ (void) drown(); } else if (how == BURNING) { - killer = 0; /* lava_effects() sets its own killer */ + killer.name[0] = 0; /* lava_effects() sets own killer */ (void) lava_effects(); } else { coord xy; /* use more specific killer if specified */ - if (!killer) { - killer_format = KILLED_BY_AN; - killer = "falling drawbridge"; + if (!killer.name[0]) { + killer.format = KILLED_BY_AN; + Strcpy(killer.name, "falling drawbridge"); } done(how); /* So, you didn't die */ @@ -399,7 +399,7 @@ int dest, how; /* we might have crawled out of the moat to survive */ etmp->ex = u.ux, etmp->ey = u.uy; } else { - killer = 0; + killer.name[0] = 0; /* fake "digested to death" damage-type suppresses corpse */ #define mk_message(dest) ((dest & 1) ? "" : (char *)0) #define mk_corpse(dest) ((dest & 2) ? AD_DGST : AD_PHYS) @@ -671,8 +671,8 @@ struct entity *etmp; E_phrase(etmp, "disappear")); } if (!e_survives_at(etmp, etmp->ex, etmp->ey)) { - killer_format = KILLED_BY_AN; - killer = "closing drawbridge"; + killer.format = KILLED_BY_AN; + Strcpy(killer.name, "closing drawbridge"); e_died(etmp, 0, CRUSHING); /* no message */ return; } @@ -710,8 +710,8 @@ struct entity *etmp; E_phrase(etmp, "fall"), lava ? "lava" : "moat"); } - killer_format = NO_KILLER_PREFIX; - killer = "fell from a drawbridge"; + killer.format = NO_KILLER_PREFIX; + Strcpy(killer.name, "fell from a drawbridge"); e_died(etmp, e_inview ? 3 : 2, /* CRUSHING is arbitrary */ (is_pool(etmp->ex, etmp->ey)) ? DROWNING : (is_lava(etmp->ex, etmp->ey)) ? BURNING : @@ -880,8 +880,8 @@ int x,y; if (e_inview) pline("%s blown apart by flying debris.", E_phrase(etmp2, "are")); - killer_format = KILLED_BY_AN; - killer = "exploding drawbridge"; + killer.format = KILLED_BY_AN; + Strcpy(killer.name, "exploding drawbridge"); e_died(etmp2, e_inview? 3 : 2, CRUSHING); /*no corpse*/ } /* nothing which is vulnerable can survive this */ } @@ -909,8 +909,8 @@ int x,y; E_phrase(etmp1, "die")); #endif } - killer_format = KILLED_BY_AN; - killer = "collapsing drawbridge"; + killer.format = KILLED_BY_AN; + Strcpy(killer.name, "collapsing drawbridge"); e_died(etmp1, e_inview? 3 : 2, CRUSHING); /*no corpse*/ if(lev1->typ == MOAT) do_entity(etmp1); } diff --git a/src/decl.c b/src/decl.c index ac1f7c197..82918be8b 100644 --- a/src/decl.c +++ b/src/decl.c @@ -45,15 +45,12 @@ struct q_score quest_status = DUMMY; NEARDATA int smeq[MAXNROFROOMS+1] = DUMMY; NEARDATA int doorindex = 0; - NEARDATA char *save_cm = 0; -NEARDATA int killer_format = 0; -const char *killer = 0; -const char *delayed_killer = 0; + +NEARDATA struct kinfo killer = DUMMY; #ifdef GOLDOBJ NEARDATA long done_money = 0; #endif -char killer_buf[BUFSZ] = DUMMY; const char *nomovemsg = 0; const char nul[40] = DUMMY; /* contains zeros */ NEARDATA char plname[PL_NSIZ] = DUMMY; /* player name */ diff --git a/src/do.c b/src/do.c index 3a0f937e1..49ef8cada 100644 --- a/src/do.c +++ b/src/do.c @@ -1072,7 +1072,7 @@ boolean at_stairs, falling, portal; if (fd < 0) { pline("%s", whynot); pline("Probably someone removed it."); - killer = whynot; + Strcpy(killer.name, whynot); done(TRICKED); /* we'll reach here if running in wizard mode */ error("Cannot continue this game."); diff --git a/src/do_wear.c b/src/do_wear.c index 22d7e8499..ef54c3410 100644 --- a/src/do_wear.c +++ b/src/do_wear.c @@ -537,10 +537,7 @@ Amulet_on() case FAKE_AMULET_OF_YENDOR: break; case AMULET_OF_UNCHANGING: - if (Slimed) { - Slimed = 0; - context.botl = 1; - } + if (Slimed) make_slimed(0L, (char *)0); break; case AMULET_OF_CHANGE: { diff --git a/src/dokick.c b/src/dokick.c index 86dc7384f..bb248eebc 100644 --- a/src/dokick.c +++ b/src/dokick.c @@ -426,17 +426,14 @@ xchar x, y; if(kickobj->otyp == CORPSE && touch_petrifies(&mons[kickobj->corpsenm]) && !Stone_resistance && !uarmf) { - char kbuf[BUFSZ]; - You("kick the %s with your bare %s.", corpse_xname(kickobj, TRUE), makeplural(body_part(FOOT))); if (!(poly_when_stoned(youmonst.data) && polymon(PM_STONE_GOLEM))) { You("turn to stone..."); - killer_format = KILLED_BY; + killer.format = KILLED_BY; /* KMH -- otmp should be kickobj */ - Sprintf(kbuf, "kicking %s without boots", + Sprintf(killer.name, "kicking %s without boots", an(corpse_xname(kickobj, TRUE))); - killer = kbuf; done(STONING); } } diff --git a/src/dothrow.c b/src/dothrow.c index bd92dabd7..9c47f18a6 100644 --- a/src/dothrow.c +++ b/src/dothrow.c @@ -96,8 +96,8 @@ int shotlimit; touch_petrifies(&mons[obj->corpsenm]))) { You("throw the %s corpse with your bare %s.", mons[obj->corpsenm].mname, body_part(HAND)); - Sprintf(killer_buf, "%s corpse", an(mons[obj->corpsenm].mname)); - instapetrify(killer_buf); + Sprintf(killer.name, "%s corpse", an(mons[obj->corpsenm].mname)); + instapetrify(killer.name); } if (welded(obj)) { weldmsg(obj); @@ -801,8 +801,8 @@ boolean hitsroof; if (!Stone_resistance && !(poly_when_stoned(youmonst.data) && polymon(PM_STONE_GOLEM))) { petrify: - killer_format = KILLED_BY; - killer = "elementary physics"; /* "what goes up..." */ + killer.format = KILLED_BY; + Strcpy(killer.name, "elementary physics"); /* "what goes up..." */ You("turn to stone."); if (obj) dropy(obj); /* bypass most of hitfloor() */ done(STONING); diff --git a/src/eat.c b/src/eat.c index 8404f5b10..d0d23d2e0 100644 --- a/src/eat.c +++ b/src/eat.c @@ -208,7 +208,7 @@ choke(food) /* To a full belly all food is bad. (It.) */ nomovemsg = 0; vomit(); } else { - killer_format = KILLED_BY_AN; + killer.format = KILLED_BY_AN; /* * Note all "killer"s below read "Choked on %s" on the * high score list & tombstone. So plan accordingly. @@ -216,19 +216,19 @@ choke(food) /* To a full belly all food is bad. (It.) */ if(food) { You("choke over your %s.", foodword(food)); if (food->oclass == COIN_CLASS) { - killer = "a very rich meal"; + Strcpy(killer.name, "a very rich meal"); } else { - killer = food_xname(food, FALSE); + Strcpy(killer.name, food_xname(food, FALSE)); if (food->otyp == CORPSE && (mons[food->corpsenm].geno & G_UNIQ)) { if (!type_is_pname(&mons[food->corpsenm])) - killer = the(killer); - killer_format = KILLED_BY; + Strcpy(killer.name, the(killer.name)); + killer.format = KILLED_BY; } } } else { You("choke over it."); - killer = "quick snack"; + Strcpy(killer.name, "quick snack"); } You("die..."); done(CHOKING); @@ -425,9 +425,8 @@ register int pm; if (touch_petrifies(&mons[pm]) || pm == PM_MEDUSA) { if (!Stone_resistance && !(poly_when_stoned(youmonst.data) && polymon(PM_STONE_GOLEM))) { - Sprintf(killer_buf, "tasting %s meat", mons[pm].mname); - killer_format = KILLED_BY; - killer = killer_buf; + Sprintf(killer.name, "tasting %s meat", mons[pm].mname); + killer.format = KILLED_BY; You("turn to stone."); done(STONING); if (context.victual.piece) @@ -454,12 +453,11 @@ register int pm; case PM_DEATH: case PM_PESTILENCE: case PM_FAMINE: - { char buf[BUFSZ]; + { pline("Eating that is instantly fatal."); - Sprintf(buf, "unwisely ate the body of %s", + Sprintf(killer.name, "unwisely ate the body of %s", mons[pm].mname); - killer = buf; - killer_format = NO_KILLER_PREFIX; + killer.format = NO_KILLER_PREFIX; done(DIED); /* It so happens that since we know these monsters */ /* cannot appear in tins, context.victual.piece will always */ @@ -474,8 +472,8 @@ register int pm; if (!Slimed && !Unchanging && !flaming(youmonst.data) && youmonst.data != &mons[PM_GREEN_SLIME]) { You("don't feel very well."); - Slimed = 10L; - context.botl = 1; + make_slimed(10L, (char*) 0); + delayed_killer(SLIMED, KILLED_BY_AN, nul); } /* Fall through */ default: @@ -489,7 +487,7 @@ void fix_petrification() { Stoned = 0; - delayed_killer = 0; + dealloc_killer(find_delayed_killer(STONED)); if (Hallucination) pline("What a pity - you just ruined a future piece of %sart!", ACURR(A_CHA) > 15 ? "fine " : ""); @@ -1668,8 +1666,8 @@ register struct obj *otmp; if(!rn2(17)) u.uhpmax++; u.uhp = u.uhpmax; } else if (u.uhp <= 0) { - killer_format = KILLED_BY_AN; - killer = "rotten lump of royal jelly"; + killer.format = KILLED_BY_AN; + Strcpy(killer.name, "rotten lump of royal jelly"); done(POISONING); } } @@ -1679,10 +1677,12 @@ register struct obj *otmp; if (touch_petrifies(&mons[otmp->corpsenm])) { if (!Stone_resistance && !(poly_when_stoned(youmonst.data) && polymon(PM_STONE_GOLEM))) { - if (!Stoned) Stoned = 5; - killer_format = KILLED_BY_AN; - Sprintf(killer_buf, "%s egg", mons[otmp->corpsenm].mname); - delayed_killer = killer_buf; + if (!Stoned) { + Stoned = 5; + Sprintf(killer.name, + "%s egg", mons[otmp->corpsenm].mname); + delayed_killer(STONED, KILLED_BY_AN, killer.name); + } } } break; @@ -2294,8 +2294,8 @@ boolean incr; context.botl = 1; bot(); You("die from starvation."); - killer_format = KILLED_BY; - killer = "starvation"; + killer.format = KILLED_BY; + Strcpy(killer.name, "starvation"); done(STARVING); /* if we return, we lifesaved, and that calls newuhs */ return; @@ -2346,8 +2346,8 @@ boolean incr; bot(); if ((Upolyd ? u.mh : u.uhp) < 1) { You("die from hunger and exhaustion."); - killer_format = KILLED_BY; - killer = "exhaustion"; + killer.format = KILLED_BY; + Strcpy(killer.name, "exhaustion"); done(STARVING); return; } diff --git a/src/end.c b/src/end.c index d16b12c14..8a1ae6946 100644 --- a/src/end.c +++ b/src/end.c @@ -6,6 +6,7 @@ #include "hack.h" #include "eshk.h" +#include "lev.h" #ifndef NO_SIGNAL #include #endif @@ -188,18 +189,18 @@ register struct monst *mtmp; You("die..."); mark_synch(); /* flush buffered screen output */ buf[0] = '\0'; - killer_format = KILLED_BY_AN; + killer.format = KILLED_BY_AN; /* "killed by the high priest of Crom" is okay, "killed by the high priest" alone isn't */ if ((mtmp->data->geno & G_UNIQ) != 0 && !(mtmp->data == &mons[PM_HIGH_PRIEST] && !mtmp->ispriest)) { if (!type_is_pname(mtmp->data)) Strcat(buf, "the "); - killer_format = KILLED_BY; + killer.format = KILLED_BY; } /* _the_ ghost of Dudley */ if (mtmp->data == &mons[PM_GHOST] && mtmp->mnamelth) { Strcat(buf, "the "); - killer_format = KILLED_BY; + killer.format = KILLED_BY; } if (mtmp->minvis) Strcat(buf, "invisible "); @@ -212,12 +213,11 @@ register struct monst *mtmp; } else if(mtmp->isshk) { Sprintf(eos(buf), "%s %s, the shopkeeper", (mtmp->female ? "Ms." : "Mr."), shkname(mtmp)); - killer_format = KILLED_BY; + killer.format = KILLED_BY; } else if (mtmp->ispriest || mtmp->isminion) { /* m_monnam() suppresses "the" prefix plus "invisible", and it overrides the effect of Hallucination on priestname() */ - killer = m_monnam(mtmp); - Strcat(buf, killer); + Strcat(buf, m_monnam(mtmp)); } else { Strcat(buf, mtmp->data->mname); if (mtmp->mnamelth) @@ -225,7 +225,7 @@ register struct monst *mtmp; } if (multi) Strcat(buf, ", while helpless"); - killer = buf; + Strcpy(killer.name, buf); if (mtmp->data->mlet == S_WRAITH) u.ugrave_arise = PM_WRAITH; else if (mtmp->data->mlet == S_MUMMY && urace.mummynum != NON_PM) @@ -534,16 +534,16 @@ done(how) int how; { boolean taken; - char kilbuf[BUFSZ], pbuf[BUFSZ]; + char pbuf[BUFSZ]; winid endwin = WIN_ERR; boolean bones_ok, have_windows = iflags.window_inited; struct obj *corpse = (struct obj *)0; long umoney; if (how == TRICKED) { - if (killer) { - paniclog("trickery", killer); - killer = 0; + if (killer.name[0]) { + paniclog("trickery", killer.name); + killer.name[0] = 0; } #ifdef WIZARD if (wizard) { @@ -553,18 +553,15 @@ int how; #endif } - /* kilbuf: used to copy killer in case it comes from something like - * xname(), which would otherwise get overwritten when we call - * xname() when listing possessions - * pbuf: holds Sprintf'd output for raw_print and putstr + /* pbuf: holds Sprintf'd output for raw_print and putstr */ - if (how == ASCENDED || (!killer && how == GENOCIDED)) - killer_format = NO_KILLER_PREFIX; + if (how == ASCENDED || (!killer.name[0] && how == GENOCIDED)) + killer.format = NO_KILLER_PREFIX; /* Avoid killed by "a" burning or "a" starvation */ - if (!killer && (how == STARVING || how == BURNING)) - killer_format = KILLED_BY; - Strcpy(kilbuf, (!killer || how >= PANICKED ? deaths[how] : killer)); - killer = kilbuf; + if (!killer.name[0] && (how == STARVING || how == BURNING)) + killer.format = KILLED_BY; + if (!killer.name[0] || how >= PANICKED) + Strcpy(killer.name, deaths[how]); if (how < PANICKED) u.umortality++; if (Lifesaved && (how <= GENOCIDED)) { @@ -583,8 +580,8 @@ int how; if (how == GENOCIDED) pline("Unfortunately you are still genocided..."); else { - killer = 0; - killer_format = 0; + killer.name[0] = 0; + killer.format = 0; return; } } @@ -598,8 +595,8 @@ int how; (how == CHOKING) ? "choke" : "die"); if(u.uhpmax <= 0) u.uhpmax = u.ulevel * 8; /* arbitrary */ savelife(how); - killer = 0; - killer_format = 0; + killer.name[0] = 0; + killer.format = 0; return; } @@ -659,24 +656,24 @@ die: corpse = mk_named_object(CORPSE, &mons[mnum], u.ux, u.uy, plname); Sprintf(pbuf, "%s, %s%s", plname, - killer_format == NO_KILLER_PREFIX ? "" : + killer.format == NO_KILLER_PREFIX ? "" : killed_by_prefix[how], - killer_format == KILLED_BY_AN ? an(killer) : killer); + killer.format == KILLED_BY_AN ? an(killer.name) : + killer.name); make_grave(u.ux, u.uy, pbuf); } } if (how == QUIT) { - killer_format = NO_KILLER_PREFIX; - if (u.uhp < 1) { - how = DIED; - u.umortality++; /* skipped above when how==QUIT */ - /* note that killer is pointing at kilbuf */ - Strcpy(kilbuf, "quit while already on Charon's boat"); - } + killer.format = NO_KILLER_PREFIX; + if (u.uhp < 1) { + how = DIED; + u.umortality++; /* skipped above when how==QUIT */ + Strcpy(killer.name, "quit while already on Charon's boat"); + } } if (how == ESCAPED || how == PANICKED) - killer_format = NO_KILLER_PREFIX; + killer.format = NO_KILLER_PREFIX; if (how != PANICKED) { /* these affect score and/or bones, but avoid them during panic */ @@ -755,15 +752,12 @@ die: } else done_stopprint = 1; /* just avoid any more output */ -/* changing kilbuf really changes killer. we do it this way because - killer is declared a (const char *) -*/ - if (u.uhave.amulet) Strcat(kilbuf, " (with the Amulet)"); + if (u.uhave.amulet) Strcat(killer.name, " (with the Amulet)"); else if (how == ESCAPED) { if (Is_astralevel(&u.uz)) /* offered Amulet to wrong deity */ - Strcat(kilbuf, " (in celestial disgrace)"); + Strcat(killer.name, " (in celestial disgrace)"); else if (carrying(FAKE_AMULET_OF_YENDOR)) - Strcat(kilbuf, " (with a fake Amulet)"); + Strcat(killer.name, " (with a fake Amulet)"); /* don't bother counting to see whether it should be plural */ } @@ -1100,4 +1094,94 @@ boolean ask; } } +/* set a delayed killer, ensure non-delayed killer is cleared out */ +void +delayed_killer(id, format, killername) + int id; + int format; + const char *killername; +{ + struct kinfo *k = find_delayed_killer(id); + + if (k == (struct kinfo*) 0) { + /* no match, add a new delayed killer to the list */ + k = (struct kinfo*) alloc(sizeof(struct kinfo)); + k->id = id; + k->next = killer.next; + killer.next = k; + } + + k->format = format; + Strcpy(k->name, killername ? killername : ""); + killer.name[0] = 0; +} + +struct kinfo* +find_delayed_killer(id) + int id; +{ + struct kinfo* k; + + for (k = killer.next; k != (struct kinfo*) 0; k = k->next) { + if (k->id == id) break; + } + + return k; +} + +void +dealloc_killer(kptr) + struct kinfo *kptr; +{ + struct kinfo *prev = &killer, *k; + + if (kptr == (struct kinfo *)0) return; + for (k = killer.next; k != (struct kinfo*) 0; k = k->next) { + if (k == kptr) break; + prev = k; + } + + if (k == (struct kinfo*) 0) { + impossible("dealloc_killer not on list"); + } else { + prev->next = k->next; + free((genericptr_t) k); + } +} + +void +save_killers(fd, mode) + int fd; + int mode; +{ + struct kinfo *kptr; + + if (perform_bwrite(mode)) { + for (kptr = &killer; kptr != (struct kinfo*)0; kptr = kptr->next) { + bwrite(fd, (genericptr_t)kptr, sizeof(struct kinfo)); + } + } + if (release_data(mode)) { + while (killer.next) { + kptr = killer.next->next; + free((genericptr_t)killer.next); + killer.next = kptr; + } + } +} + +void +restore_killers(fd) + int fd; +{ + struct kinfo *kptr; + + for (kptr = &killer; kptr != (struct kinfo*)0; kptr = kptr->next) { + mread(fd, (genericptr_t)kptr, sizeof(struct kinfo)); + if (kptr->next) { + kptr->next = (struct kinfo*) alloc(sizeof(struct kinfo)); + } + } +} + /*end.c*/ diff --git a/src/exper.c b/src/exper.c index 3d2bc5469..6e56c4879 100644 --- a/src/exper.c +++ b/src/exper.c @@ -132,9 +132,9 @@ const char *drainer; /* cause of death, if drain should be fatal */ reset_rndmonst(NON_PM); /* new monster selection */ } else { if (drainer) { - killer_format = KILLED_BY; - killer = drainer; - done(DIED); + killer.format = KILLED_BY; + if (killer.name != drainer) Strcpy(killer.name, drainer); + done(DIED); } /* no drainer or lifesaved */ u.uexp = 0; diff --git a/src/explode.c b/src/explode.c index f3c6f1f6c..3f80576a3 100644 --- a/src/explode.c +++ b/src/explode.c @@ -31,7 +31,7 @@ int expltype; boolean starting = 1; boolean visible, any_shield; int uhurt = 0; /* 0=unhurt, 1=items damaged, 2=you and items damaged */ - const char *str; + const char *str = (const char *) 0; int idamres, idamnonres; struct monst *mtmp; uchar adtyp; @@ -53,8 +53,7 @@ int expltype; } if (olet == MON_EXPLODE) { - str = killer; - killer = 0; /* set again later as needed */ + str = killer.name; adtyp = AD_PHYS; } else switch (abs(type) % 10) { @@ -338,22 +337,23 @@ int expltype; } else { if (olet == MON_EXPLODE) { /* killer handled by caller */ - if (str != killer_buf && !generic) - Strcpy(killer_buf, str); - killer_format = KILLED_BY_AN; + if (generic) + killer.name[0] = 0; + else if (str != killer.name) + Strcpy(killer.name, str); + killer.format = KILLED_BY_AN; } else if (type >= 0 && olet != SCROLL_CLASS) { - killer_format = NO_KILLER_PREFIX; - Sprintf(killer_buf, "caught %sself in %s own %s", + killer.format = NO_KILLER_PREFIX; + Sprintf(killer.name, "caught %sself in %s own %s", uhim(), uhis(), str); } else if (!strncmpi(str,"tower of flame", 8) || !strncmpi(str,"fireball", 8)) { - killer_format = KILLED_BY_AN; - Strcpy(killer_buf, str); + killer.format = KILLED_BY_AN; + Strcpy(killer.name, str); } else { - killer_format = KILLED_BY; - Strcpy(killer_buf, str); + killer.format = KILLED_BY; + Strcpy(killer.name, str); } - killer = killer_buf; /* Known BUG: BURNING suppresses corpse in bones data, but done does not handle killer reason correctly */ done((adtyp == AD_FIRE) ? BURNING : DIED); diff --git a/src/hack.c b/src/hack.c index f3ca86f92..6f2a15440 100644 --- a/src/hack.c +++ b/src/hack.c @@ -2099,8 +2099,9 @@ boolean k_format; u.uhpmax = u.uhp; /* perhaps n was negative */ context.botl = 1; if(u.uhp < 1) { - killer_format = k_format; - killer = knam; /* the thing that killed you */ + killer.format = k_format; + if (killer.name != knam) /* the thing that killed you */ + Strcpy(killer.name, knam ? knam : ""); You("die..."); done(DIED); } else if (n > 0 && u.uhp*10 < u.uhpmax) { diff --git a/src/mcastu.c b/src/mcastu.c index b48db5ac6..2b2c91a50 100644 --- a/src/mcastu.c +++ b/src/mcastu.c @@ -332,8 +332,8 @@ int spellnum; if (Hallucination) { You("have an out of body experience."); } else { - killer_format = KILLED_BY_AN; - killer = "touch of death"; + killer.format = KILLED_BY_AN; + Strcpy(killer.name, "touch of death"); done(DIED); } } else { diff --git a/src/mhitu.c b/src/mhitu.c index 5b7f5e201..0fc975908 100644 --- a/src/mhitu.c +++ b/src/mhitu.c @@ -1058,8 +1058,8 @@ dopois: pline("Unfortunately your brain is still gone."); else Your("last thought fades away."); - killer = "brainlessness"; - killer_format = KILLED_BY; + Strcpy(killer.name, "brainlessness"); + killer.format = KILLED_BY; done(DIED); lifesaved++; } @@ -1150,18 +1150,16 @@ dopois: if (!Stoned && !Stone_resistance && !(poly_when_stoned(youmonst.data) && polymon(PM_STONE_GOLEM))) { - Stoned = 5; - delayed_killer = mtmp->data->mname; - if (mtmp->data->geno & G_UNIQ) { - if (!type_is_pname(mtmp->data)) { - static char buf[BUFSZ]; + int kformat = KILLED_BY_AN; + const char *kname = mtmp->data->mname; - /* "the" buffer may be reallocated */ - Strcpy(buf, the(delayed_killer)); - delayed_killer = buf; - } - killer_format = KILLED_BY; - } else killer_format = KILLED_BY_AN; + Stoned = 5; + if (mtmp->data->geno & G_UNIQ) { + if (!type_is_pname(mtmp->data)) + kname = the(kname); + kformat = KILLED_BY; + } + delayed_killer(STONED, kformat, kname); return(1); /* You("turn to stone..."); */ /* done_in_by(mtmp); */ @@ -1195,11 +1193,10 @@ dopois: !Is_waterlevel(&u.uz); pline("%s drowns you...", Monnam(mtmp)); - killer_format = KILLED_BY_AN; - Sprintf(buf, "%s by %s", + killer.format = KILLED_BY_AN; + Sprintf(killer.name, "%s by %s", moat ? "moat" : "pool of water", an(mtmp->data->mname)); - killer = buf; done(DROWNING); } else if(mattk->aatyp == AT_HUGS) You("are being crushed."); @@ -1450,8 +1447,8 @@ dopois: switch (rn2(20)) { case 19: case 18: case 17: if (!Antimagic) { - killer_format = KILLED_BY_AN; - killer = "touch of death"; + killer.format = KILLED_BY_AN; + Strcpy(killer.name, "touch of death"); done(DIED); dmg = 0; break; @@ -1491,10 +1488,8 @@ dopois: dmg = 0; } else if (!Slimed) { You("don't feel very well."); - Slimed = 10L; - context.botl = 1; - killer_format = KILLED_BY_AN; - delayed_killer = mtmp->data->mname; + make_slimed(10L, (char*) 0); + delayed_killer(SLIMED, KILLED_BY_AN, mtmp->data->mname); } else pline("Yuck!"); break; @@ -1912,8 +1907,8 @@ gazemu(mtmp, mattk) /* monster gazes at you */ if(poly_when_stoned(youmonst.data) && polymon(PM_STONE_GOLEM)) break; You("turn to stone..."); - killer_format = KILLED_BY; - killer = mtmp->data->mname; + killer.format = KILLED_BY; + Strcpy(killer.name, mtmp->data->mname); done(STONING); } break; diff --git a/src/mon.c b/src/mon.c index 08fb1edfb..be20c45c5 100644 --- a/src/mon.c +++ b/src/mon.c @@ -1483,10 +1483,10 @@ boolean was_swallowed; /* digestion */ if (magr == &youmonst) { There("is an explosion in your %s!", body_part(STOMACH)); - Sprintf(killer_buf, "%s explosion", + Sprintf(killer.name, "%s explosion", s_suffix(mdat->mname)); if (Half_physical_damage) tmp = (tmp+1) / 2; - losehp(tmp, killer_buf, KILLED_BY_AN); + losehp(tmp, killer.name, KILLED_BY_AN); } else { if (!Deaf) You_hear("an explosion."); magr->mhp -= tmp; @@ -1502,9 +1502,8 @@ boolean was_swallowed; /* digestion */ return FALSE; } - Sprintf(killer_buf, "%s explosion", s_suffix(mdat->mname)); - killer = killer_buf; - killer_format = KILLED_BY_AN; + Sprintf(killer.name, "%s explosion", s_suffix(mdat->mname)); + killer.format = KILLED_BY_AN; explode(mon->mx, mon->my, -1, tmp, MON_EXPLODE, EXPL_NOXIOUS); return (FALSE); } @@ -2018,8 +2017,8 @@ int typ, fatal; losehp(i, pname, kprefix); } if(u.uhp < 1) { - killer_format = kprefix; - killer = pname; + killer.format = kprefix; + Strcpy(killer.name, pname); /* "Poisoned by a poisoned ___" is redundant */ done(strstri(pname, "poison") ? DIED : POISONING); } @@ -2315,21 +2314,21 @@ struct monst *mon; break; } #ifdef WIZARD - /* For debugging only: allow control of polymorphed monster; not saved */ + /* For debugging: allow control of polymorphed monster; not saved */ if (wizard && iflags.mon_polycontrol) { - char pprompt[BUFSZ], buf[BUFSZ]; - int tries = 0; - do { - Sprintf(pprompt, - "Change %s into what kind of monster? [type the name]", - mon_nam(mon)); - getlin(pprompt,buf); - mndx = name_to_mon(buf); - if (mndx < LOW_PM) - You("cannot polymorph %s into that.", mon_nam(mon)); - else break; - } while(++tries < 5); - if (tries==5) pline(thats_enough_tries); + char pprompt[BUFSZ], buf[BUFSZ]; + int tries = 0; + do { + Sprintf(pprompt, + "Change %s into what kind of monster? [type the name]", + mon_nam(mon)); + getlin(pprompt,buf); + mndx = name_to_mon(buf); + if (mndx < LOW_PM) + You("cannot polymorph %s into that.", mon_nam(mon)); + else break; + } while(++tries < 5); + if (tries==5) pline(thats_enough_tries); } #endif /*WIZARD*/ if (mndx == NON_PM) mndx = rn1(SPECIAL_PM - LOW_PM, LOW_PM); diff --git a/src/mthrowu.c b/src/mthrowu.c index 3d1ca7633..b627a0f5a 100644 --- a/src/mthrowu.c +++ b/src/mthrowu.c @@ -400,11 +400,11 @@ m_throw(mon, x, y, dx, dy, range, obj) } } if (hitu && singleobj->otyp == EGG) { - if (!Stone_resistance + if (!Stoned && !Stone_resistance && !(poly_when_stoned(youmonst.data) && polymon(PM_STONE_GOLEM))) { Stoned = 5; - killer = (char *) 0; + delayed_killer(STONED, KILLED_BY, nul); } } stop_occupation(); diff --git a/src/polyself.c b/src/polyself.c index 6f70e7aae..d5c55c0d5 100644 --- a/src/polyself.c +++ b/src/polyself.c @@ -67,11 +67,16 @@ const char *fmt, *arg; (urace.femalenum != NON_PM && (mvitals[urace.femalenum].mvflags & G_GENOD))) { /* intervening activity might have clobbered genocide info */ - killer = delayed_killer; - if (!killer || !strstri(killer, "genocid")) { - killer_format = KILLED_BY; - killer = "self-genocide"; + struct kinfo *kptr = find_delayed_killer(POLYMORPH); + + if (kptr != (struct kinfo*) 0 && kptr->name[0]) { + killer.format = kptr->format; + Strcpy(killer.name, kptr->name); + } else { + killer.format = KILLED_BY; + Strcpy(killer.name, "self-genocide"); } + dealloc_killer(kptr); done(GENOCIDED); } @@ -188,7 +193,7 @@ newman() u.uhunger = rn1(500,500); if (Sick) make_sick(0L, (char *) 0, FALSE, SICK_ALL); Stoned = 0; - delayed_killer = 0; + dealloc_killer(find_delayed_killer(STONED)); if (u.uhp <= 0 || u.uhpmax <= 0) { if (Polymorph_control) { if (u.uhp <= 0) u.uhp = 1; @@ -196,8 +201,8 @@ newman() } else { dead: /* we come directly here if their experience level went to 0 or less */ Your("new form doesn't seem healthy enough to survive."); - killer_format = KILLED_BY_AN; - killer="unsuccessful polymorph"; + killer.format = KILLED_BY_AN; + Strcpy(killer.name, "unsuccessful polymorph"); done(DIED); newuhs(FALSE); return; /* lifesaved */ @@ -209,7 +214,7 @@ dead: /* we come directly here if their experience level went to 0 or less */ (urace.individual.m) ? urace.individual.m : urace.noun); if (Slimed) { Your("body transforms, but there is still slime on you."); - Slimed = 10L; + make_slimed(10L, (const char*) 0); } context.botl = 1; see_monsters(); @@ -385,7 +390,7 @@ int mntmp; You("turn to stone!"); mntmp = PM_STONE_GOLEM; Stoned = 0; - delayed_killer = 0; + dealloc_killer(find_delayed_killer(STONED)); } u.mtimedone = rn1(500, 500); @@ -399,7 +404,7 @@ int mntmp; if (Stone_resistance && Stoned) { /* parnes@eniac.seas.upenn.edu */ Stoned = 0; - delayed_killer = 0; + dealloc_killer(find_delayed_killer(STONED)); You("no longer seem to be petrifying."); } if (Sick_resistance && Sick) { @@ -408,13 +413,10 @@ int mntmp; } if (Slimed) { if (flaming(youmonst.data)) { - pline_The("slime burns away!"); - Slimed = 0L; - context.botl = 1; + make_slimed(0L, "The slime burns away!"); } else if (mntmp == PM_GREEN_SLIME) { /* do it silently */ - Slimed = 0L; - context.botl = 1; + make_slimed(0L, (char*) 0); } } if (nohands(youmonst.data)) Glib = 0; @@ -715,8 +717,8 @@ rehumanize() { /* You can't revert back while unchanging */ if (Unchanging && (u.mh < 1)) { - killer_format = NO_KILLER_PREFIX; - killer = "killed while stuck in creature form"; + killer.format = NO_KILLER_PREFIX; + Strcpy(killer.name, "killed while stuck in creature form"); done(DIED); } @@ -725,11 +727,8 @@ rehumanize() polyman("return to %s form!", urace.adj); if (u.uhp < 1) { - char kbuf[256]; - - Sprintf(kbuf, "reverting to unhealthy %s form", urace.adj); - killer_format = KILLED_BY; - killer = kbuf; + Sprintf(killer.name, "reverting to unhealthy %s form", urace.adj); + killer.format = KILLED_BY; done(DIED); } if (!uarmg) selftouch("No longer petrify-resistant, you"); @@ -1045,8 +1044,9 @@ dogaze() l_monnam(mtmp)); /* as if gazing at a sleeping anything is fruitful... */ You("turn to stone..."); - killer_format = KILLED_BY; - killer = "deliberately meeting Medusa's gaze"; + killer.format = KILLED_BY; + Strcpy(killer.name, + "deliberately meeting Medusa's gaze"); done(STONING); } } diff --git a/src/potion.c b/src/potion.c index a5d7d4eca..da8f00d0c 100644 --- a/src/potion.c +++ b/src/potion.c @@ -133,14 +133,24 @@ int type; if (Sick) { exercise(A_CON, FALSE); - if (cause) { - (void) strncpy(u.usick_cause, cause, sizeof(u.usick_cause)); - u.usick_cause[sizeof(u.usick_cause)-1] = 0; - } - else - u.usick_cause[0] = 0; + delayed_killer(SICK, KILLED_BY_AN, cause); } else - u.usick_cause[0] = 0; + dealloc_killer(find_delayed_killer(SICK)); +} + +void +make_slimed(xtime, msg) +long xtime; +const char *msg; +{ + long old = Slimed; + + if ((!xtime && old) || (xtime && !old)) { + if (msg) pline("%s", msg); + context.botl = 1; + } + set_itimeout(&Slimed, xtime); + if (!Slimed) dealloc_killer(find_delayed_killer(SLIMED)); } void diff --git a/src/pray.c b/src/pray.c index a733a0302..2faec7c24 100644 --- a/src/pray.c +++ b/src/pray.c @@ -279,13 +279,10 @@ register int trouble; You_feel("more limber."); Stoned = 0; context.botl = 1; - delayed_killer = 0; + dealloc_killer(find_delayed_killer(STONED)); break; case TROUBLE_SLIMED: - pline_The("slime disappears."); - Slimed = 0; - context.botl = 1; - delayed_killer = 0; + make_slimed(0L, "The slime disappears."); break; case TROUBLE_STRANGLED: if (uamul && uamul->otyp == AMULET_OF_STRANGULATION) { @@ -544,12 +541,9 @@ STATIC_OVL void fry_by_god(resp_god) aligntyp resp_god; { - char killerbuf[64]; - You("fry to a crisp."); - killer_format = KILLED_BY; - Sprintf(killerbuf, "the wrath of %s", align_gname(resp_god)); - killer = killerbuf; + killer.format = KILLED_BY; + Sprintf(killer.name, "the wrath of %s", align_gname(resp_god)); done(DIED); } diff --git a/src/read.c b/src/read.c index 03fb3142a..fe4d73f1e 100644 --- a/src/read.c +++ b/src/read.c @@ -1593,8 +1593,8 @@ do_class_genocide() } } if (gameover || u.uhp == -1) { - killer_format = KILLED_BY_AN; - killer = "scroll of genocide"; + killer.format = KILLED_BY_AN; + Strcpy(killer.name, "scroll of genocide"); if (gameover) done(GENOCIDED); } return; @@ -1709,25 +1709,24 @@ int how; u.uhp = -1; if (how & PLAYER) { - killer_format = KILLED_BY; - killer = "genocidal confusion"; + killer.format = KILLED_BY; + Strcpy(killer.name, "genocidal confusion"); } else if (how & ONTHRONE) { /* player selected while on a throne */ - killer_format = KILLED_BY_AN; - killer = "imperious order"; + killer.format = KILLED_BY_AN; + Strcpy(killer.name, "imperious order"); } else { /* selected player deliberately, not confused */ - killer_format = KILLED_BY_AN; - killer = "scroll of genocide"; + killer.format = KILLED_BY_AN; + Strcpy(killer.name, "scroll of genocide"); } /* Polymorphed characters will die as soon as they're rehumanized. */ /* KMH -- Unchanging prevents rehumanization */ if (Upolyd && ptr != youmonst.data) { - delayed_killer = killer; - killer = 0; - You_feel("dead inside."); + delayed_killer(POLYMORPH, killer.format, killer.name); + You_feel("dead inside."); } else - done(GENOCIDED); + done(GENOCIDED); } else if (ptr == youmonst.data) { rehumanize(); } diff --git a/src/restore.c b/src/restore.c index 53bf5239f..369212646 100644 --- a/src/restore.c +++ b/src/restore.c @@ -403,6 +403,7 @@ unsigned int *stuckid, *steedid; /* STEED */ } /* this stuff comes after potential aborted restore attempts */ + restore_killers(fd); restore_timers(fd, RANGE_GLOBAL, FALSE, 0L); restore_light_sources(fd); invent = restobjchn(fd, FALSE, FALSE); @@ -694,7 +695,7 @@ char *reason; pline("Strange, this map is not as I remember it."); pline("Somebody is trying some trickery here..."); pline("This game is void."); - killer = reason; + Strcpy(killer.name, reason ? reason : ""); done(TRICKED); } diff --git a/src/rip.c b/src/rip.c index 9a8263005..595929702 100644 --- a/src/rip.c +++ b/src/rip.c @@ -117,18 +117,18 @@ int how; center(GOLD_LINE, buf); /* Put together death description */ - switch (killer_format) { + switch (killer.format) { default: impossible("bad killer format?"); case KILLED_BY_AN: Strcpy(buf, killed_by_prefix[how]); - Strcat(buf, an(killer)); + Strcat(buf, an(killer.name)); break; case KILLED_BY: Strcpy(buf, killed_by_prefix[how]); - Strcat(buf, killer); + Strcat(buf, killer.name); break; case NO_KILLER_PREFIX: - Strcpy(buf, killer); + Strcpy(buf, killer.name); break; } diff --git a/src/save.c b/src/save.c index 5cd60e43d..98db2a25e 100644 --- a/src/save.c +++ b/src/save.c @@ -252,7 +252,7 @@ dosave0() HUP pline("%s", whynot); (void) close(fd); (void) delete_savefile(); - HUP killer = whynot; + HUP Strcpy(killer.name, whynot); HUP done(TRICKED); return(0); } @@ -297,6 +297,7 @@ register int fd, mode; } #endif bwrite(fd, (genericptr_t) &u, sizeof(struct you)); + save_killers(fd, mode); /* must come before migrating_objs and migrating_mons are freed */ save_timers(fd, mode, RANGE_GLOBAL); @@ -371,7 +372,7 @@ savestateinlock() if (fd < 0) { pline("%s", whynot); pline("Probably someone removed it."); - killer = whynot; + Strcpy(killer.name, whynot); done(TRICKED); return; } @@ -382,7 +383,7 @@ savestateinlock() "Level #0 pid (%d) doesn't match ours (%d)!", hpid, hackpid); pline("%s", whynot); - killer = whynot; + Strcpy(killer.name, whynot); done(TRICKED); } (void) close(fd); @@ -390,7 +391,7 @@ savestateinlock() fd = create_levelfile(0, whynot); if (fd < 0) { pline("%s", whynot); - killer = whynot; + Strcpy(killer.name, whynot); done(TRICKED); return; } @@ -1007,6 +1008,7 @@ freedynamicdata() # define freetrapchn(X) (savetrapchn(0, X, FREE_SAVE), X = 0) # define freefruitchn() savefruitchn(0, FREE_SAVE) # define freenames() savenames(0, FREE_SAVE) +# define free_killers() save_killers(0, FREE_SAVE) # define free_oracles() save_oracles(0, FREE_SAVE) # define free_waterlevel() save_waterlevel(0, FREE_SAVE) # define free_worm() save_worm(0, FREE_SAVE) @@ -1032,6 +1034,7 @@ freedynamicdata() freedamage(); /* game-state data */ + free_killers(); free_timers(RANGE_GLOBAL); free_light_sources(RANGE_GLOBAL); freeobjchn(invent); diff --git a/src/spell.c b/src/spell.c index 42bd5fa1b..4470105aa 100644 --- a/src/spell.c +++ b/src/spell.c @@ -925,11 +925,7 @@ boolean atme; break; case SPE_CURE_SICKNESS: if (Sick) You("are no longer ill."); - if (Slimed) { - pline_The("slime disappears!"); - Slimed = 0; - /* context.botl = 1; -- healup() handles this */ - } + if (Slimed) make_slimed(0L, "The slime disappears!"); healup(0, 0, TRUE, FALSE); break; case SPE_CREATE_FAMILIAR: diff --git a/src/teleport.c b/src/teleport.c index 861250b9b..2cd31322a 100644 --- a/src/teleport.c +++ b/src/teleport.c @@ -631,8 +631,8 @@ level_tele() is_silent(youmonst.data) ? "writhe" : "scream"); display_nhwindow(WIN_MESSAGE, FALSE); You("cease to exist."); - killer_format = NO_KILLER_PREFIX; - killer = "committed suicide"; + killer.format = NO_KILLER_PREFIX; + Strcpy(killer.name, "committed suicide"); done(DIED); return; } @@ -685,7 +685,7 @@ level_tele() } #endif - killer = 0; /* still alive, so far... */ + killer.name[0] = 0; /* still alive, so far... */ if (newlev < 0) { if (*u.ushops0) { @@ -699,8 +699,8 @@ level_tele() if (newlev <= -10) { You("arrive in heaven."); verbalize("Thou art early, but we'll admit thee."); - killer_format = NO_KILLER_PREFIX; - killer = "went to heaven prematurely"; + killer.format = NO_KILLER_PREFIX; + Strcpy(killer.name, "went to heaven prematurely"); } else if (newlev == -9) { You_feel("deliriously happy. "); pline("(In fact, you're on Cloud 9!) "); @@ -708,7 +708,7 @@ level_tele() } else You("are now high above the clouds..."); - if (killer) { + if (killer.name[0]) { ; /* arrival in heaven is pending */ } else if (Levitation) { escape_by_flying = "float gently down to earth"; @@ -717,15 +717,14 @@ level_tele() } else { pline("Unfortunately, you don't know how to fly."); You("plummet a few thousand feet to your death."); - Sprintf(buf, + Sprintf(killer.name, "teleported out of the dungeon and fell to %s death", uhis()); - killer = buf; - killer_format = NO_KILLER_PREFIX; + killer.format = NO_KILLER_PREFIX; } } - if (killer) { /* the chosen destination was not survivable */ + if (killer.name[0]) { /* the chosen destination was not survivable */ d_level lsav; /* set specific death location; this also suppresses bones */ diff --git a/src/timeout.c b/src/timeout.c index 1fca06a96..75f6ef861 100644 --- a/src/timeout.c +++ b/src/timeout.c @@ -144,11 +144,8 @@ void burn_away_slime() { if (Slimed) { - pline_The("slime that covers you is burned away!"); - Slimed = 0L; - context.botl = 1; + make_slimed(0L, "The slime that covers you is burned away!"); } - return; } @@ -156,6 +153,7 @@ void nh_timeout() { register struct prop *upp; + struct kinfo *kptr; int sleeptime; int m_idx; int baseluck = (flags.moonphase == FULL_MOON) ? 1 : 0; @@ -211,29 +209,28 @@ nh_timeout() for(upp = u.uprops; upp < u.uprops+SIZE(u.uprops); upp++) if((upp->intrinsic & TIMEOUT) && !(--upp->intrinsic & TIMEOUT)) { + kptr = find_delayed_killer(upp - u.uprops); switch(upp - u.uprops){ case STONED: - if (delayed_killer && !killer) { - killer = delayed_killer; - delayed_killer = 0; - } - if (!killer) { - /* leaving killer_format would make it - "petrified by petrification" */ - killer_format = NO_KILLER_PREFIX; - killer = "killed by petrification"; + if (kptr && kptr->name[0]) { + killer.format = kptr->format; + Strcpy(killer.name, kptr->name); + } else { + killer.format = NO_KILLER_PREFIX; + Strcpy(killer.name, "killed by petrification"); } + dealloc_killer(kptr); done(STONING); break; case SLIMED: - if (delayed_killer && !killer) { - killer = delayed_killer; - delayed_killer = 0; - } - if (!killer) { - killer_format = NO_KILLER_PREFIX; - killer = "turned into green slime"; + if (kptr && kptr->name[0]) { + killer.format = kptr->format; + Strcpy(killer.name, kptr->name); + } else { + killer.format = NO_KILLER_PREFIX; + Strcpy(killer.name, "turned into green slime"); } + dealloc_killer(kptr); done(TURNED_SLIME); break; case VOMITING: @@ -241,15 +238,21 @@ nh_timeout() break; case SICK: You("die from your illness."); - killer_format = KILLED_BY_AN; - killer = u.usick_cause; - if ((m_idx = name_to_mon(killer)) >= LOW_PM) { + if (kptr && kptr->name[0]) { + killer.format = kptr->format; + Strcpy(killer.name, kptr->name); + } else { + killer.format = KILLED_BY_AN; + killer.name[0] = 0; /* take the default */ + } + dealloc_killer(kptr); + + if ((m_idx = name_to_mon(killer.name)) >= LOW_PM) { if (type_is_pname(&mons[m_idx])) { - killer_format = KILLED_BY; + killer.format = KILLED_BY; } else if (mons[m_idx].geno & G_UNIQ) { - killer = the(killer); - Strcpy(u.usick_cause, killer); - killer_format = KILLED_BY; + Strcpy(killer.name, the(killer.name)); + killer.format = KILLED_BY; } } u.usick_type = 0; @@ -318,8 +321,9 @@ nh_timeout() (void) float_down(I_SPECIAL|TIMEOUT, 0L); break; case STRANGLED: - killer_format = KILLED_BY; - killer = (u.uburied) ? "suffocation" : "strangulation"; + killer.format = KILLED_BY; + Strcpy(killer.name, + (u.uburied) ? "suffocation" : "strangulation"); done(DIED); break; case FUMBLING: diff --git a/src/topten.c b/src/topten.c index 19a04884a..9c95c9081 100644 --- a/src/topten.c +++ b/src/topten.c @@ -315,20 +315,20 @@ int how; (void) strncpy(t0->name, plname, NAMSZ); t0->name[NAMSZ] = '\0'; t0->death[0] = '\0'; - switch (killer_format) { + switch (killer.format) { default: impossible("bad killer format?"); case KILLED_BY_AN: Strcat(t0->death, killed_by_prefix[how]); - (void) strncat(t0->death, an(killer), + (void) strncat(t0->death, an(killer.name), DTHSZ-strlen(t0->death)); break; case KILLED_BY: Strcat(t0->death, killed_by_prefix[how]); - (void) strncat(t0->death, killer, + (void) strncat(t0->death, killer.name, DTHSZ-strlen(t0->death)); break; case NO_KILLER_PREFIX: - (void) strncat(t0->death, killer, DTHSZ); + (void) strncat(t0->death, killer.name, DTHSZ); break; } t0->birthdate = yyyymmdd(u.ubirthday); diff --git a/src/trap.c b/src/trap.c index 45c918795..c5ac3ece0 100644 --- a/src/trap.c +++ b/src/trap.c @@ -2137,8 +2137,8 @@ const char *str; if (poly_when_stoned(youmonst.data) && polymon(PM_STONE_GOLEM)) return; You("turn to stone..."); - killer_format = KILLED_BY; - killer = str; + killer.format = KILLED_BY; + if (str != killer.name) Strcpy(killer.name, str ? str : ""); done(STONING); } @@ -2902,9 +2902,10 @@ drown() } u.uinwater = 1; You("drown."); - killer_format = KILLED_BY_AN; - killer = (levl[u.ux][u.uy].typ == POOL || Is_medusa_level(&u.uz)) ? - "pool of water" : "moat"; + killer.format = KILLED_BY_AN; + Strcpy(killer.name, + (levl[u.ux][u.uy].typ == POOL || Is_medusa_level(&u.uz)) ? + "pool of water" : "moat"); done(DROWNING); /* oops, we're still alive. better get out of the water. */ while (!safe_teleds(TRUE)) { @@ -3924,8 +3925,8 @@ lava_effects() /* s/he died... */ u.uhp = -1; - killer_format = KILLED_BY; - killer = lava_killer; + killer.format = KILLED_BY; + Strcpy(killer.name, lava_killer); You("burn to a crisp..."); done(BURNING); while (!safe_teleds(TRUE)) { diff --git a/src/uhitm.c b/src/uhitm.c index c982a08ce..8c27ef922 100644 --- a/src/uhitm.c +++ b/src/uhitm.c @@ -1519,7 +1519,7 @@ register struct attack *mattk; if (!Unchanging && mdef->data == &mons[PM_GREEN_SLIME]) { if (!Slimed) { You("suck in some slime and don't feel very well."); - Slimed = 10L; + make_slimed(10L, (char*) 0); } } break; @@ -1536,8 +1536,7 @@ register struct attack *mattk; u.uconduct.food++; if (touch_petrifies(mdef->data) && !Stone_resistance && !Stoned) { Stoned = 5; - killer_format = KILLED_BY_AN; - delayed_killer = mdef->data->mname; + delayed_killer(STONED, KILLED_BY_AN, mdef->data->mname); } if (!vegan(mdef->data)) u.uconduct.unvegan++; @@ -1765,10 +1764,9 @@ register struct attack *mattk; if (is_rider(mdef->data)) { pline("Unfortunately, digesting any of it is fatal."); end_engulf(); - Sprintf(msgbuf, "unwisely tried to eat %s", + Sprintf(killer.name, "unwisely tried to eat %s", mdef->data->mname); - killer = msgbuf; - killer_format = NO_KILLER_PREFIX; + killer.format = NO_KILLER_PREFIX; done(DIED); return 0; /* lifesaved */ } @@ -1818,8 +1816,7 @@ register struct attack *mattk; Sprintf(msgbuf, "%s isn't sitting well with you.", The(mdef->data->mname)); if (!Unchanging) { - Slimed = 5L; - context.botl = 1; + make_slimed(5L, (char*) 0); } } else exercise(A_CON, TRUE); diff --git a/src/zap.c b/src/zap.c index 587af1d12..7b1879110 100644 --- a/src/zap.c +++ b/src/zap.c @@ -1852,7 +1852,6 @@ struct obj *obj; boolean ordinary; { int damage = 0; - char buf[BUFSZ]; switch(obj->otyp) { case WAN_STRIKING: @@ -2030,9 +2029,8 @@ boolean ordinary; : "You seem no deader than before."); break; } - Sprintf(buf, "shot %sself with a death ray", uhim()); - killer = buf; - killer_format = NO_KILLER_PREFIX; + Sprintf(killer.name,"shot %sself with a death ray",uhim()); + killer.format = NO_KILLER_PREFIX; You("irradiate yourself with pure energy!"); You("die."); makeknown(obj->otyp); @@ -3110,8 +3108,8 @@ xchar sx, sy; You("aren't affected."); break; } - killer_format = KILLED_BY_AN; - killer = fltxt; + killer.format = KILLED_BY_AN; + Strcpy(killer.name, fltxt ? fltxt : ""); /* when killed by disintegration breath, don't leave corpse */ u.ugrave_arise = (type == -ZT_BREATH(ZT_DEATH)) ? -3 : NON_PM; done(DIED); diff --git a/sys/amiga/Makefile.agc b/sys/amiga/Makefile.agc index 2537d8808..2818d7fce 100644 --- a/sys/amiga/Makefile.agc +++ b/sys/amiga/Makefile.agc @@ -1063,7 +1063,7 @@ $(O)dungeon.o: $(NHS)dungeon.c $(HDEP) $(I)dgn_file.h $(I)dlb.h $(O)eat.o: $(NHS)eat.c $(HDEP) -$(O)end.o: $(NHS)end.c $(HDEP) $(I)eshk.h $(I)dlb.h +$(O)end.o: $(NHS)end.c $(HDEP) $(I)eshk.h $(I)lev.h $(I)dlb.h $(O)engrave.o: $(NHS)engrave.c $(HDEP) $(I)lev.h diff --git a/sys/amiga/Makefile.ami b/sys/amiga/Makefile.ami index b9e830a6a..21d31761e 100644 --- a/sys/amiga/Makefile.ami +++ b/sys/amiga/Makefile.ami @@ -1396,7 +1396,7 @@ $(O)dungeon.o: $(NHS)dungeon.c $(HDEP) $(I)dgn_file.h $(I)dlb.h $(O)eat.o: $(NHS)eat.c $(HDEP) -$(O)end.o: $(NHS)end.c $(HDEP) $(I)eshk.h $(I)dlb.h +$(O)end.o: $(NHS)end.c $(HDEP) $(I)eshk.h $(I)lev.h $(I)dlb.h $(O)engrave.o: $(NHS)engrave.c $(HDEP) $(I)lev.h diff --git a/sys/amiga/amirip.c b/sys/amiga/amirip.c index c41110a4f..66fe86660 100644 --- a/sys/amiga/amirip.c +++ b/sys/amiga/amirip.c @@ -152,19 +152,19 @@ int how; BltBitMap(*tbmp, 0, 0, rp->BitMap, xoff, yoff, tomb_bmhd.w, tomb_bmhd.h, 0xc0, 0xff, NULL); /* Put together death description */ - switch (killer_format) { + switch (killer.format) { default: impossible("bad killer format?"); case KILLED_BY_AN: Strcpy(buf, killed_by_prefix[how]); - Strcat(buf, an(killer)); + Strcat(buf, an(killer.name)); break; case KILLED_BY: Strcpy(buf, killed_by_prefix[how]); - Strcat(buf, killer); + Strcat(buf, killer.name); break; case NO_KILLER_PREFIX: - Strcpy(buf, killer); + Strcpy(buf, killer.name); break; } @@ -205,19 +205,19 @@ int how; tomb_text(buf); /* Put together death description */ - switch (killer_format) { + switch (killer.format) { default: impossible("bad killer format?"); case KILLED_BY_AN: Strcpy(buf, killed_by_prefix[how]); - Strcat(buf, an(killer)); + Strcat(buf, an(killer.name)); break; case KILLED_BY: Strcpy(buf, killed_by_prefix[how]); - Strcat(buf, killer); + Strcat(buf, killer.name); break; case NO_KILLER_PREFIX: - Strcpy(buf, killer); + Strcpy(buf, killer.name); break; } diff --git a/sys/mac/macwin.c b/sys/mac/macwin.c index a54f454e7..8b2f62bc4 100644 --- a/sys/mac/macwin.c +++ b/sys/mac/macwin.c @@ -1200,7 +1200,7 @@ mac_destroy_nhwindow (winid win) { } if (win == WIN_INVEN || win == WIN_MESSAGE) { if (iflags.window_inited) { - if (flags.tombstone && killer) { + if (flags.tombstone && killer.name[0]) { /* Prepare for the coming of the tombstone window. */ win_fonts [NHW_TEXT] = kFontIDMonaco; } diff --git a/sys/msdos/Makefile.BC b/sys/msdos/Makefile.BC index e78ce3c47..53e8b9472 100644 --- a/sys/msdos/Makefile.BC +++ b/sys/msdos/Makefile.BC @@ -1814,7 +1814,7 @@ $(O)drawing.o: $(SRC)\drawing.c $(HACK_H) $(TERMCAP_H) @echo $(BCOPTS1) >> $(VROOMMCFG) @echo $(BCOPTS2) >> $(VROOMMCFG) $(CC) $(CFLAGSN) $(COBJNAM)$@ $(SRC)\drawing.c -$(O)end.o: $(SRC)\end.c $(HACK_H) $(ESHK_H) $(DLB_H) +$(O)end.o: $(SRC)\end.c $(HACK_H) $(ESHK_H) $(LEV_H) $(DLB_H) @type schema$(SCHEMA).bc | find "$(@B)_o" > $(VROOMMCFG) @echo $(BCOPTS1) >> $(VROOMMCFG) @echo $(BCOPTS2) >> $(VROOMMCFG) diff --git a/sys/msdos/Makefile.GCC b/sys/msdos/Makefile.GCC index 5e6752243..5af3e15d7 100644 --- a/sys/msdos/Makefile.GCC +++ b/sys/msdos/Makefile.GCC @@ -1166,7 +1166,7 @@ $(O)dothrow.o: dothrow.c $(HACK_H) $(O)drawing.o: drawing.c $(HACK_H) $(INCL)/tcap.h $(O)dungeon.o: dungeon.c $(HACK_H) $(INCL)/dgn_file.h $(INCL)/dlb.h $(O)eat.o: eat.c $(HACK_H) -$(O)end.o: end.c $(HACK_H) $(INCL)/eshk.h $(INCL)/dlb.h +$(O)end.o: end.c $(HACK_H) $(INCL)/eshk.h $(INCL)/lev.h $(INCL)/dlb.h $(O)engrave.o: engrave.c $(HACK_H) $(INCL)/lev.h $(O)exper.o: exper.c $(HACK_H) $(O)explode.o: explode.c $(HACK_H) diff --git a/sys/msdos/Makefile.MSC b/sys/msdos/Makefile.MSC index 7984dedaa..29f4a9999 100644 --- a/sys/msdos/Makefile.MSC +++ b/sys/msdos/Makefile.MSC @@ -1020,7 +1020,7 @@ dothrow.o: dothrow.c $(HACK_H) drawing.o: drawing.c $(HACK_H) $(INCL)\tcap.h dungeon.o: dungeon.c $(HACK_H) $(INCL)\dgn_file.h $(INCL)\dlb.h eat.o: eat.c $(HACK_H) -end.o: end.c $(HACK_H) $(INCL)\eshk.h $(INCL)\dlb.h +end.o: end.c $(HACK_H) $(INCL)\eshk.h $(INCL)\lev.h $(INCL)\dlb.h engrave.o: engrave.c $(HACK_H) $(INCL)\lev.h exper.o: exper.c $(HACK_H) explode.o: explode.c $(HACK_H) diff --git a/sys/os2/Makefile.os2 b/sys/os2/Makefile.os2 index 18ae59e01..6f2743b8d 100644 --- a/sys/os2/Makefile.os2 +++ b/sys/os2/Makefile.os2 @@ -1550,7 +1550,7 @@ $(OBJ)\dungeon.o : $(SRC)\$(CB) $(HACK_H) $(INCL)\dgn_file.h $(SRCCC) $(OBJ)\eat.o : $(SRC)\$(CB) $(HACK_H) $(SRCCC) -$(OBJ)\end.o : $(SRC)\$(CB) $(HACK_H) $(INCL)\eshk.h +$(OBJ)\end.o : $(SRC)\$(CB) $(HACK_H) $(INCL)\eshk.h $(INCL)\lev.h $(SRCCC) $(OBJ)\engrave.o : $(SRC)\$(CB) $(HACK_H) $(INCL)\lev.h $(SRCCC) diff --git a/sys/unix/Makefile.src b/sys/unix/Makefile.src index e7687978b..172455fa1 100644 --- a/sys/unix/Makefile.src +++ b/sys/unix/Makefile.src @@ -719,7 +719,7 @@ dothrow.o: dothrow.c $(HACK_H) drawing.o: drawing.c $(HACK_H) ../include/tcap.h dungeon.o: dungeon.c $(HACK_H) ../include/dgn_file.h ../include/dlb.h eat.o: eat.c $(HACK_H) -end.o: end.c $(HACK_H) ../include/eshk.h ../include/dlb.h +end.o: end.c $(HACK_H) ../include/eshk.h ../include/lev.h ../include/dlb.h engrave.o: engrave.c $(HACK_H) ../include/lev.h exper.o: exper.c $(HACK_H) explode.o: explode.c $(HACK_H) diff --git a/sys/vms/Makefile.src b/sys/vms/Makefile.src index b5360a374..3a105e31a 100644 --- a/sys/vms/Makefile.src +++ b/sys/vms/Makefile.src @@ -372,7 +372,7 @@ dothrow.obj : dothrow.c $(HACK_H) drawing.obj : drawing.c $(HACK_H) $(INC)tcap.h dungeon.obj : dungeon.c $(HACK_H) $(INC)dgn_file.h $(INC)dlb.h eat.obj : eat.c $(HACK_H) -end.obj : end.c $(HACK_H) $(INC)eshk.h $(INC)dlb.h +end.obj : end.c $(HACK_H) $(INC)eshk.h $(INC)lev.h $(INC)dlb.h engrave.obj : engrave.c $(HACK_H) $(INC)lev.h exper.obj : exper.c $(HACK_H) explode.obj : explode.c $(HACK_H) diff --git a/sys/wince/bootstrp.mak b/sys/wince/bootstrp.mak index f04eac259..4988c219c 100644 --- a/sys/wince/bootstrp.mak +++ b/sys/wince/bootstrp.mak @@ -789,7 +789,7 @@ $(O)dothrow.o: $(SRC)\dothrow.c $(HACK_H) $(O)drawing.o: $(SRC)\drawing.c $(HACK_H) $(INCL)\tcap.h $(O)dungeon.o: $(SRC)\dungeon.c $(HACK_H) $(INCL)\dgn_file.h $(INCL)\dlb.h $(O)eat.o: $(SRC)\eat.c $(HACK_H) -$(O)end.o: $(SRC)\end.c $(HACK_H) $(INCL)\eshk.h $(INCL)\dlb.h +$(O)end.o: $(SRC)\end.c $(HACK_H) $(INCL)\eshk.h $(INCL)\lev.h $(INCL)\dlb.h $(O)engrave.o: $(SRC)\engrave.c $(HACK_H) $(INCL)\lev.h $(O)exper.o: $(SRC)\exper.c $(HACK_H) $(O)explode.o: $(SRC)\explode.c $(HACK_H) diff --git a/sys/winnt/Makefile.bcc b/sys/winnt/Makefile.bcc index 4a2e80389..417006636 100644 --- a/sys/winnt/Makefile.bcc +++ b/sys/winnt/Makefile.bcc @@ -1284,7 +1284,7 @@ $(O)dothrow.o: dothrow.c $(HACK_H) $(O)drawing.o: drawing.c $(HACK_H) $(INCL)\tcap.h $(O)dungeon.o: dungeon.c $(HACK_H) $(INCL)\dgn_file.h $(INCL)\dlb.h $(O)eat.o: eat.c $(HACK_H) -$(O)end.o: end.c $(HACK_H) $(INCL)\eshk.h $(INCL)\dlb.h +$(O)end.o: end.c $(HACK_H) $(INCL)\eshk.h $(INCL)\lev.h $(INCL)\dlb.h $(O)engrave.o: engrave.c $(HACK_H) $(INCL)\lev.h $(O)exper.o: exper.c $(HACK_H) $(O)explode.o: explode.c $(HACK_H) diff --git a/sys/winnt/Makefile.gcc b/sys/winnt/Makefile.gcc index 428289f0a..d7885b6be 100644 --- a/sys/winnt/Makefile.gcc +++ b/sys/winnt/Makefile.gcc @@ -1258,7 +1258,7 @@ $(O)dothrow.o: dothrow.c $(HACK_H) $(O)drawing.o: drawing.c $(HACK_H) $(INCL)/tcap.h $(O)dungeon.o: dungeon.c $(HACK_H) $(INCL)/dgn_file.h $(INCL)/dlb.h $(O)eat.o: eat.c $(HACK_H) -$(O)end.o: end.c $(HACK_H) $(INCL)/eshk.h $(INCL)/dlb.h +$(O)end.o: end.c $(HACK_H) $(INCL)/eshk.h $(INCL)/lev.h $(INCL)/dlb.h $(O)engrave.o: engrave.c $(HACK_H) $(INCL)/lev.h $(O)exper.o: exper.c $(HACK_H) $(O)explode.o: explode.c $(HACK_H) diff --git a/sys/winnt/Makefile.msc b/sys/winnt/Makefile.msc index df98d18cc..237c69ce7 100644 --- a/sys/winnt/Makefile.msc +++ b/sys/winnt/Makefile.msc @@ -1325,7 +1325,7 @@ $(O)dothrow.o: dothrow.c $(HACK_H) $(O)drawing.o: drawing.c $(HACK_H) $(INCL)\tcap.h $(O)dungeon.o: dungeon.c $(HACK_H) $(INCL)\dgn_file.h $(INCL)\dlb.h $(O)eat.o: eat.c $(HACK_H) -$(O)end.o: end.c $(HACK_H) $(INCL)\eshk.h $(INCL)\dlb.h +$(O)end.o: end.c $(HACK_H) $(INCL)\eshk.h $(INCL)\lev.h $(INCL)\dlb.h $(O)engrave.o: engrave.c $(HACK_H) $(INCL)\lev.h $(O)exper.o: exper.c $(HACK_H) $(O)explode.o: explode.c $(HACK_H) diff --git a/win/Qt/qt_win.cpp b/win/Qt/qt_win.cpp index 7fcafb9e4..89af564f5 100644 --- a/win/Qt/qt_win.cpp +++ b/win/Qt/qt_win.cpp @@ -3311,18 +3311,18 @@ static char** rip_line=0; #endif /* Put together death description */ - switch (killer_format) { + switch (killer.format) { default: impossible("bad killer format?"); case KILLED_BY_AN: Strcpy(buf, killed_by_prefix[how]); - Strcat(buf, an(killer)); + Strcat(buf, an(killer.name)); break; case KILLED_BY: Strcpy(buf, killed_by_prefix[how]); - Strcat(buf, killer); + Strcat(buf, killer.name); break; case NO_KILLER_PREFIX: - Strcpy(buf, killer); + Strcpy(buf, killer.name); break; } diff --git a/win/X11/wintext.c b/win/X11/wintext.c index 84cafe6fa..cfadefcc1 100644 --- a/win/X11/wintext.c +++ b/win/X11/wintext.c @@ -290,7 +290,7 @@ create_text_window(wp) XtParseTranslationTable(text_translations)); num_args++; wp->w = XtCreateManagedWidget( - killer && WIN_MAP == WIN_ERR ? + killer.name[0] && WIN_MAP == WIN_ERR ? "tombstone" : "text_text", /* name */ asciiTextWidgetClass, form, /* parent widget */ @@ -474,18 +474,18 @@ calculate_rip_text(int how) done_money); #endif /* Put together death description */ - switch (killer_format) { + switch (killer.format) { default: impossible("bad killer format?"); case KILLED_BY_AN: Strcpy(buf, killed_by_prefix[how]); - Strcat(buf, an(killer)); + Strcat(buf, an(killer.name)); break; case KILLED_BY: Strcpy(buf, killed_by_prefix[how]); - Strcat(buf, killer); + Strcat(buf, killer.name); break; case NO_KILLER_PREFIX: - Strcpy(buf, killer); + Strcpy(buf, killer.name); break; } diff --git a/win/gem/wingem.c b/win/gem/wingem.c index ceb59d71a..2a5ab6529 100644 --- a/win/gem/wingem.c +++ b/win/gem/wingem.c @@ -1083,18 +1083,18 @@ int how; done_money); #endif /* Put together death description */ - switch (killer_format) { + switch (killer.format) { default: impossible("bad killer format?"); case KILLED_BY_AN: Strcpy(buf, killed_by_prefix[how]); - Strcat(buf, an(killer)); + Strcat(buf, an(killer.name)); break; case KILLED_BY: Strcpy(buf, killed_by_prefix[how]); - Strcat(buf, killer); + Strcat(buf, killer.name); break; case NO_KILLER_PREFIX: - Strcpy(buf, killer); + Strcpy(buf, killer.name); break; } /* Put death type on stone */ diff --git a/win/gnome/gnbind.c b/win/gnome/gnbind.c index 185090ddd..c3a8f98a0 100644 --- a/win/gnome/gnbind.c +++ b/win/gnome/gnbind.c @@ -1170,18 +1170,18 @@ void gnome_outrip(winid wid, int how) Strcat(ripString, buf); /* Put together death description */ - switch (killer_format) { + switch (killer.format) { default: impossible("bad killer format?"); case KILLED_BY_AN: Strcpy(buf, killed_by_prefix[how]); - Strcat(buf, an(killer)); + Strcat(buf, an(killer.name)); break; case KILLED_BY: Strcpy(buf, killed_by_prefix[how]); - Strcat(buf, killer); + Strcat(buf, killer.name); break; case NO_KILLER_PREFIX: - Strcpy(buf, killer); + Strcpy(buf, killer.name); break; } /* Put death type on stone */ diff --git a/win/win32/mswproc.c b/win/win32/mswproc.c index bc020a23a..c0a8be40c 100644 --- a/win/win32/mswproc.c +++ b/win/win32/mswproc.c @@ -1783,18 +1783,18 @@ void mswin_outrip(winid wid, int how) putstr(wid, 0, buf); /* Put together death description */ - switch (killer_format) { + switch (killer.format) { default: impossible("bad killer format?"); case KILLED_BY_AN: Strcpy(buf, killed_by_prefix[how]); - Strcat(buf, an(killer)); + Strcat(buf, an(killer.name)); break; case KILLED_BY: Strcpy(buf, killed_by_prefix[how]); - Strcat(buf, killer); + Strcat(buf, killer.name); break; case NO_KILLER_PREFIX: - Strcpy(buf, killer); + Strcpy(buf, killer.name); break; }