conflicting delayed killers

Introduce a new set of functions to manage delayed killers in the trunk, used
in addressing the various reports of delayed killer confusion.  Since existing
delayed killers are related to player properties, the delayed killers are
keyed by uprop indexes.  I did this to avoid adding yet another set of
similar identifiers.
- the new delayed_killer() is used for stoning, sliming, sickness, and
delayed self-genocide while polymorphed.  Some other timed events don't
use it (and didn't use the old delayed_killer variable) because they
use a fixed message when the timeout occurs.
- A new data structure, struct kinfo, is used to track both delayed and
immediate killers.  This encapsulates all the info involved with
identifying a killer.  The structure contains a buffer, which subsumes the
old killer_buf and several other buffers that didn't/couldn't use killer_buf.
- the killer list is saved and restored as part of the game state.
- the special case of usick_cause was removed and a delayed killer list
entry is now used in its place
- common code dealing with (un)sliming is moved to a new make_slimed function
- attempted to update all make dependencies for new end.c -> lev.h
dependency, sorry if I messed any up
This commit is contained in:
cohrs
2003-09-29 19:24:20 +00:00
parent a89fa75f4c
commit 559be58c21
54 changed files with 430 additions and 349 deletions
+8 -4
View File
@@ -170,16 +170,20 @@ E const char disclosure_options[];
E NEARDATA int smeq[]; E NEARDATA int smeq[];
E NEARDATA int doorindex; E NEARDATA int doorindex;
E NEARDATA char *save_cm; 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_AN 0
#define KILLED_BY 1 #define KILLED_BY 1
#define NO_KILLER_PREFIX 2 #define NO_KILLER_PREFIX 2
E NEARDATA int killer_format; char name[BUFSZ]; /* actual killer name */
E const char *killer; } killer;
E const char *delayed_killer;
#ifdef GOLDOBJ #ifdef GOLDOBJ
E long done_money; E long done_money;
#endif #endif
E char killer_buf[BUFSZ];
E const char *configfile; E const char *configfile;
E NEARDATA char plname[PL_NSIZ]; E NEARDATA char plname[PL_NSIZ];
E NEARDATA char dogname[]; E NEARDATA char dogname[];
+6
View File
@@ -555,6 +555,11 @@ E void FDECL(done, (int));
E void FDECL(container_contents, (struct obj *,BOOLEAN_P,BOOLEAN_P)); E void FDECL(container_contents, (struct obj *,BOOLEAN_P,BOOLEAN_P));
E void FDECL(terminate, (int)); E void FDECL(terminate, (int));
E int NDECL(num_genocides); 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 ### */ /* ### 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_stunned, (long,BOOLEAN_P));
E void FDECL(make_blinded, (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_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_vomiting, (long,BOOLEAN_P));
E void FDECL(make_hallucinated, (long,BOOLEAN_P,long)); E void FDECL(make_hallucinated, (long,BOOLEAN_P,long));
E int NDECL(dodrink); E int NDECL(dodrink);
-1
View File
@@ -265,7 +265,6 @@ struct you {
struct prop uprops[LAST_PROP+1]; struct prop uprops[LAST_PROP+1];
unsigned umconf; unsigned umconf;
char usick_cause[PL_PSIZ+20]; /* sizeof "unicorn horn named "+1 */
Bitfield(usick_type,2); Bitfield(usick_type,2);
#define SICK_VOMITABLE 0x01 #define SICK_VOMITABLE 0x01
#define SICK_NONVOMITABLE 0x02 #define SICK_NONVOMITABLE 0x02
+2 -2
View File
@@ -360,8 +360,8 @@ moveloop()
else if (!u.uinvulnerable) { else if (!u.uinvulnerable) {
u.utrap -= 1<<8; u.utrap -= 1<<8;
if(u.utrap < 1<<8) { if(u.utrap < 1<<8) {
killer_format = KILLED_BY; killer.format = KILLED_BY;
killer = "molten lava"; Strcpy(killer.name, "molten lava");
You("sink below the surface and die."); You("sink below the surface and die.");
done(DISSOLVED); done(DISSOLVED);
} else if(didmove && !u.umoved) { } else if(didmove && !u.umoved) {
+1 -1
View File
@@ -1210,7 +1210,7 @@ arti_invoke(obj)
else u.uhp += healamt; else u.uhp += healamt;
} }
if(Sick) make_sick(0L,(char *)0,FALSE,SICK_ALL); 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); if (Blinded > creamed) make_blinded(creamed, FALSE);
context.botl = 1; context.botl = 1;
break; break;
+1 -1
View File
@@ -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 /* If you die while dismounting, u.usteed is still set. Since several
* places in the done() sequence depend on u.usteed, just detect this * places in the done() sequence depend on u.usteed, just detect this
* special case. */ * 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)); Sprintf(buf, "riding %s", y_monnam(u.usteed));
you_are(buf); you_are(buf);
} }
+14 -14
View File
@@ -370,18 +370,18 @@ int dest, how;
{ {
if (is_u(etmp)) { if (is_u(etmp)) {
if (how == DROWNING) { if (how == DROWNING) {
killer = 0; /* drown() sets its own killer */ killer.name[0] = 0; /* drown() sets its own killer */
(void) drown(); (void) drown();
} else if (how == BURNING) { } else if (how == BURNING) {
killer = 0; /* lava_effects() sets its own killer */ killer.name[0] = 0; /* lava_effects() sets own killer */
(void) lava_effects(); (void) lava_effects();
} else { } else {
coord xy; coord xy;
/* use more specific killer if specified */ /* use more specific killer if specified */
if (!killer) { if (!killer.name[0]) {
killer_format = KILLED_BY_AN; killer.format = KILLED_BY_AN;
killer = "falling drawbridge"; Strcpy(killer.name, "falling drawbridge");
} }
done(how); done(how);
/* So, you didn't die */ /* So, you didn't die */
@@ -399,7 +399,7 @@ int dest, how;
/* we might have crawled out of the moat to survive */ /* we might have crawled out of the moat to survive */
etmp->ex = u.ux, etmp->ey = u.uy; etmp->ex = u.ux, etmp->ey = u.uy;
} else { } else {
killer = 0; killer.name[0] = 0;
/* fake "digested to death" damage-type suppresses corpse */ /* fake "digested to death" damage-type suppresses corpse */
#define mk_message(dest) ((dest & 1) ? "" : (char *)0) #define mk_message(dest) ((dest & 1) ? "" : (char *)0)
#define mk_corpse(dest) ((dest & 2) ? AD_DGST : AD_PHYS) #define mk_corpse(dest) ((dest & 2) ? AD_DGST : AD_PHYS)
@@ -671,8 +671,8 @@ struct entity *etmp;
E_phrase(etmp, "disappear")); E_phrase(etmp, "disappear"));
} }
if (!e_survives_at(etmp, etmp->ex, etmp->ey)) { if (!e_survives_at(etmp, etmp->ex, etmp->ey)) {
killer_format = KILLED_BY_AN; killer.format = KILLED_BY_AN;
killer = "closing drawbridge"; Strcpy(killer.name, "closing drawbridge");
e_died(etmp, 0, CRUSHING); /* no message */ e_died(etmp, 0, CRUSHING); /* no message */
return; return;
} }
@@ -710,8 +710,8 @@ struct entity *etmp;
E_phrase(etmp, "fall"), E_phrase(etmp, "fall"),
lava ? "lava" : "moat"); lava ? "lava" : "moat");
} }
killer_format = NO_KILLER_PREFIX; killer.format = NO_KILLER_PREFIX;
killer = "fell from a drawbridge"; Strcpy(killer.name, "fell from a drawbridge");
e_died(etmp, e_inview ? 3 : 2, /* CRUSHING is arbitrary */ e_died(etmp, e_inview ? 3 : 2, /* CRUSHING is arbitrary */
(is_pool(etmp->ex, etmp->ey)) ? DROWNING : (is_pool(etmp->ex, etmp->ey)) ? DROWNING :
(is_lava(etmp->ex, etmp->ey)) ? BURNING : (is_lava(etmp->ex, etmp->ey)) ? BURNING :
@@ -880,8 +880,8 @@ int x,y;
if (e_inview) if (e_inview)
pline("%s blown apart by flying debris.", pline("%s blown apart by flying debris.",
E_phrase(etmp2, "are")); E_phrase(etmp2, "are"));
killer_format = KILLED_BY_AN; killer.format = KILLED_BY_AN;
killer = "exploding drawbridge"; Strcpy(killer.name, "exploding drawbridge");
e_died(etmp2, e_inview? 3 : 2, CRUSHING); /*no corpse*/ e_died(etmp2, e_inview? 3 : 2, CRUSHING); /*no corpse*/
} /* nothing which is vulnerable can survive this */ } /* nothing which is vulnerable can survive this */
} }
@@ -909,8 +909,8 @@ int x,y;
E_phrase(etmp1, "die")); E_phrase(etmp1, "die"));
#endif #endif
} }
killer_format = KILLED_BY_AN; killer.format = KILLED_BY_AN;
killer = "collapsing drawbridge"; Strcpy(killer.name, "collapsing drawbridge");
e_died(etmp1, e_inview? 3 : 2, CRUSHING); /*no corpse*/ e_died(etmp1, e_inview? 3 : 2, CRUSHING); /*no corpse*/
if(lev1->typ == MOAT) do_entity(etmp1); if(lev1->typ == MOAT) do_entity(etmp1);
} }
+2 -5
View File
@@ -45,15 +45,12 @@ struct q_score quest_status = DUMMY;
NEARDATA int smeq[MAXNROFROOMS+1] = DUMMY; NEARDATA int smeq[MAXNROFROOMS+1] = DUMMY;
NEARDATA int doorindex = 0; NEARDATA int doorindex = 0;
NEARDATA char *save_cm = 0; NEARDATA char *save_cm = 0;
NEARDATA int killer_format = 0;
const char *killer = 0; NEARDATA struct kinfo killer = DUMMY;
const char *delayed_killer = 0;
#ifdef GOLDOBJ #ifdef GOLDOBJ
NEARDATA long done_money = 0; NEARDATA long done_money = 0;
#endif #endif
char killer_buf[BUFSZ] = DUMMY;
const char *nomovemsg = 0; const char *nomovemsg = 0;
const char nul[40] = DUMMY; /* contains zeros */ const char nul[40] = DUMMY; /* contains zeros */
NEARDATA char plname[PL_NSIZ] = DUMMY; /* player name */ NEARDATA char plname[PL_NSIZ] = DUMMY; /* player name */
+1 -1
View File
@@ -1072,7 +1072,7 @@ boolean at_stairs, falling, portal;
if (fd < 0) { if (fd < 0) {
pline("%s", whynot); pline("%s", whynot);
pline("Probably someone removed it."); pline("Probably someone removed it.");
killer = whynot; Strcpy(killer.name, whynot);
done(TRICKED); done(TRICKED);
/* we'll reach here if running in wizard mode */ /* we'll reach here if running in wizard mode */
error("Cannot continue this game."); error("Cannot continue this game.");
+1 -4
View File
@@ -537,10 +537,7 @@ Amulet_on()
case FAKE_AMULET_OF_YENDOR: case FAKE_AMULET_OF_YENDOR:
break; break;
case AMULET_OF_UNCHANGING: case AMULET_OF_UNCHANGING:
if (Slimed) { if (Slimed) make_slimed(0L, (char *)0);
Slimed = 0;
context.botl = 1;
}
break; break;
case AMULET_OF_CHANGE: case AMULET_OF_CHANGE:
{ {
+2 -5
View File
@@ -426,17 +426,14 @@ xchar x, y;
if(kickobj->otyp == CORPSE && touch_petrifies(&mons[kickobj->corpsenm]) if(kickobj->otyp == CORPSE && touch_petrifies(&mons[kickobj->corpsenm])
&& !Stone_resistance && !uarmf) { && !Stone_resistance && !uarmf) {
char kbuf[BUFSZ];
You("kick the %s with your bare %s.", You("kick the %s with your bare %s.",
corpse_xname(kickobj, TRUE), makeplural(body_part(FOOT))); corpse_xname(kickobj, TRUE), makeplural(body_part(FOOT)));
if (!(poly_when_stoned(youmonst.data) && polymon(PM_STONE_GOLEM))) { if (!(poly_when_stoned(youmonst.data) && polymon(PM_STONE_GOLEM))) {
You("turn to stone..."); You("turn to stone...");
killer_format = KILLED_BY; killer.format = KILLED_BY;
/* KMH -- otmp should be kickobj */ /* KMH -- otmp should be kickobj */
Sprintf(kbuf, "kicking %s without boots", Sprintf(killer.name, "kicking %s without boots",
an(corpse_xname(kickobj, TRUE))); an(corpse_xname(kickobj, TRUE)));
killer = kbuf;
done(STONING); done(STONING);
} }
} }
+4 -4
View File
@@ -96,8 +96,8 @@ int shotlimit;
touch_petrifies(&mons[obj->corpsenm]))) { touch_petrifies(&mons[obj->corpsenm]))) {
You("throw the %s corpse with your bare %s.", You("throw the %s corpse with your bare %s.",
mons[obj->corpsenm].mname, body_part(HAND)); mons[obj->corpsenm].mname, body_part(HAND));
Sprintf(killer_buf, "%s corpse", an(mons[obj->corpsenm].mname)); Sprintf(killer.name, "%s corpse", an(mons[obj->corpsenm].mname));
instapetrify(killer_buf); instapetrify(killer.name);
} }
if (welded(obj)) { if (welded(obj)) {
weldmsg(obj); weldmsg(obj);
@@ -801,8 +801,8 @@ boolean hitsroof;
if (!Stone_resistance && if (!Stone_resistance &&
!(poly_when_stoned(youmonst.data) && polymon(PM_STONE_GOLEM))) { !(poly_when_stoned(youmonst.data) && polymon(PM_STONE_GOLEM))) {
petrify: petrify:
killer_format = KILLED_BY; killer.format = KILLED_BY;
killer = "elementary physics"; /* "what goes up..." */ Strcpy(killer.name, "elementary physics"); /* "what goes up..." */
You("turn to stone."); You("turn to stone.");
if (obj) dropy(obj); /* bypass most of hitfloor() */ if (obj) dropy(obj); /* bypass most of hitfloor() */
done(STONING); done(STONING);
+26 -26
View File
@@ -208,7 +208,7 @@ choke(food) /* To a full belly all food is bad. (It.) */
nomovemsg = 0; nomovemsg = 0;
vomit(); vomit();
} else { } else {
killer_format = KILLED_BY_AN; killer.format = KILLED_BY_AN;
/* /*
* Note all "killer"s below read "Choked on %s" on the * Note all "killer"s below read "Choked on %s" on the
* high score list & tombstone. So plan accordingly. * high score list & tombstone. So plan accordingly.
@@ -216,19 +216,19 @@ choke(food) /* To a full belly all food is bad. (It.) */
if(food) { if(food) {
You("choke over your %s.", foodword(food)); You("choke over your %s.", foodword(food));
if (food->oclass == COIN_CLASS) { if (food->oclass == COIN_CLASS) {
killer = "a very rich meal"; Strcpy(killer.name, "a very rich meal");
} else { } else {
killer = food_xname(food, FALSE); Strcpy(killer.name, food_xname(food, FALSE));
if (food->otyp == CORPSE && if (food->otyp == CORPSE &&
(mons[food->corpsenm].geno & G_UNIQ)) { (mons[food->corpsenm].geno & G_UNIQ)) {
if (!type_is_pname(&mons[food->corpsenm])) if (!type_is_pname(&mons[food->corpsenm]))
killer = the(killer); Strcpy(killer.name, the(killer.name));
killer_format = KILLED_BY; killer.format = KILLED_BY;
} }
} }
} else { } else {
You("choke over it."); You("choke over it.");
killer = "quick snack"; Strcpy(killer.name, "quick snack");
} }
You("die..."); You("die...");
done(CHOKING); done(CHOKING);
@@ -425,9 +425,8 @@ register int pm;
if (touch_petrifies(&mons[pm]) || pm == PM_MEDUSA) { if (touch_petrifies(&mons[pm]) || pm == PM_MEDUSA) {
if (!Stone_resistance && if (!Stone_resistance &&
!(poly_when_stoned(youmonst.data) && polymon(PM_STONE_GOLEM))) { !(poly_when_stoned(youmonst.data) && polymon(PM_STONE_GOLEM))) {
Sprintf(killer_buf, "tasting %s meat", mons[pm].mname); Sprintf(killer.name, "tasting %s meat", mons[pm].mname);
killer_format = KILLED_BY; killer.format = KILLED_BY;
killer = killer_buf;
You("turn to stone."); You("turn to stone.");
done(STONING); done(STONING);
if (context.victual.piece) if (context.victual.piece)
@@ -454,12 +453,11 @@ register int pm;
case PM_DEATH: case PM_DEATH:
case PM_PESTILENCE: case PM_PESTILENCE:
case PM_FAMINE: case PM_FAMINE:
{ char buf[BUFSZ]; {
pline("Eating that is instantly fatal."); 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); mons[pm].mname);
killer = buf; killer.format = NO_KILLER_PREFIX;
killer_format = NO_KILLER_PREFIX;
done(DIED); done(DIED);
/* It so happens that since we know these monsters */ /* It so happens that since we know these monsters */
/* cannot appear in tins, context.victual.piece will always */ /* cannot appear in tins, context.victual.piece will always */
@@ -474,8 +472,8 @@ register int pm;
if (!Slimed && !Unchanging && !flaming(youmonst.data) && if (!Slimed && !Unchanging && !flaming(youmonst.data) &&
youmonst.data != &mons[PM_GREEN_SLIME]) { youmonst.data != &mons[PM_GREEN_SLIME]) {
You("don't feel very well."); You("don't feel very well.");
Slimed = 10L; make_slimed(10L, (char*) 0);
context.botl = 1; delayed_killer(SLIMED, KILLED_BY_AN, nul);
} }
/* Fall through */ /* Fall through */
default: default:
@@ -489,7 +487,7 @@ void
fix_petrification() fix_petrification()
{ {
Stoned = 0; Stoned = 0;
delayed_killer = 0; dealloc_killer(find_delayed_killer(STONED));
if (Hallucination) if (Hallucination)
pline("What a pity - you just ruined a future piece of %sart!", pline("What a pity - you just ruined a future piece of %sart!",
ACURR(A_CHA) > 15 ? "fine " : ""); ACURR(A_CHA) > 15 ? "fine " : "");
@@ -1668,8 +1666,8 @@ register struct obj *otmp;
if(!rn2(17)) u.uhpmax++; if(!rn2(17)) u.uhpmax++;
u.uhp = u.uhpmax; u.uhp = u.uhpmax;
} else if (u.uhp <= 0) { } else if (u.uhp <= 0) {
killer_format = KILLED_BY_AN; killer.format = KILLED_BY_AN;
killer = "rotten lump of royal jelly"; Strcpy(killer.name, "rotten lump of royal jelly");
done(POISONING); done(POISONING);
} }
} }
@@ -1679,10 +1677,12 @@ register struct obj *otmp;
if (touch_petrifies(&mons[otmp->corpsenm])) { if (touch_petrifies(&mons[otmp->corpsenm])) {
if (!Stone_resistance && if (!Stone_resistance &&
!(poly_when_stoned(youmonst.data) && polymon(PM_STONE_GOLEM))) { !(poly_when_stoned(youmonst.data) && polymon(PM_STONE_GOLEM))) {
if (!Stoned) Stoned = 5; if (!Stoned) {
killer_format = KILLED_BY_AN; Stoned = 5;
Sprintf(killer_buf, "%s egg", mons[otmp->corpsenm].mname); Sprintf(killer.name,
delayed_killer = killer_buf; "%s egg", mons[otmp->corpsenm].mname);
delayed_killer(STONED, KILLED_BY_AN, killer.name);
}
} }
} }
break; break;
@@ -2294,8 +2294,8 @@ boolean incr;
context.botl = 1; context.botl = 1;
bot(); bot();
You("die from starvation."); You("die from starvation.");
killer_format = KILLED_BY; killer.format = KILLED_BY;
killer = "starvation"; Strcpy(killer.name, "starvation");
done(STARVING); done(STARVING);
/* if we return, we lifesaved, and that calls newuhs */ /* if we return, we lifesaved, and that calls newuhs */
return; return;
@@ -2346,8 +2346,8 @@ boolean incr;
bot(); bot();
if ((Upolyd ? u.mh : u.uhp) < 1) { if ((Upolyd ? u.mh : u.uhp) < 1) {
You("die from hunger and exhaustion."); You("die from hunger and exhaustion.");
killer_format = KILLED_BY; killer.format = KILLED_BY;
killer = "exhaustion"; Strcpy(killer.name, "exhaustion");
done(STARVING); done(STARVING);
return; return;
} }
+125 -41
View File
@@ -6,6 +6,7 @@
#include "hack.h" #include "hack.h"
#include "eshk.h" #include "eshk.h"
#include "lev.h"
#ifndef NO_SIGNAL #ifndef NO_SIGNAL
#include <signal.h> #include <signal.h>
#endif #endif
@@ -188,18 +189,18 @@ register struct monst *mtmp;
You("die..."); You("die...");
mark_synch(); /* flush buffered screen output */ mark_synch(); /* flush buffered screen output */
buf[0] = '\0'; 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 /* "killed by the high priest of Crom" is okay, "killed by the high
priest" alone isn't */ priest" alone isn't */
if ((mtmp->data->geno & G_UNIQ) != 0 && !(mtmp->data == &mons[PM_HIGH_PRIEST] && !mtmp->ispriest)) { if ((mtmp->data->geno & G_UNIQ) != 0 && !(mtmp->data == &mons[PM_HIGH_PRIEST] && !mtmp->ispriest)) {
if (!type_is_pname(mtmp->data)) if (!type_is_pname(mtmp->data))
Strcat(buf, "the "); Strcat(buf, "the ");
killer_format = KILLED_BY; killer.format = KILLED_BY;
} }
/* _the_ <invisible> <distorted> ghost of Dudley */ /* _the_ <invisible> <distorted> ghost of Dudley */
if (mtmp->data == &mons[PM_GHOST] && mtmp->mnamelth) { if (mtmp->data == &mons[PM_GHOST] && mtmp->mnamelth) {
Strcat(buf, "the "); Strcat(buf, "the ");
killer_format = KILLED_BY; killer.format = KILLED_BY;
} }
if (mtmp->minvis) if (mtmp->minvis)
Strcat(buf, "invisible "); Strcat(buf, "invisible ");
@@ -212,12 +213,11 @@ register struct monst *mtmp;
} else if(mtmp->isshk) { } else if(mtmp->isshk) {
Sprintf(eos(buf), "%s %s, the shopkeeper", Sprintf(eos(buf), "%s %s, the shopkeeper",
(mtmp->female ? "Ms." : "Mr."), shkname(mtmp)); (mtmp->female ? "Ms." : "Mr."), shkname(mtmp));
killer_format = KILLED_BY; killer.format = KILLED_BY;
} else if (mtmp->ispriest || mtmp->isminion) { } else if (mtmp->ispriest || mtmp->isminion) {
/* m_monnam() suppresses "the" prefix plus "invisible", and /* m_monnam() suppresses "the" prefix plus "invisible", and
it overrides the effect of Hallucination on priestname() */ it overrides the effect of Hallucination on priestname() */
killer = m_monnam(mtmp); Strcat(buf, m_monnam(mtmp));
Strcat(buf, killer);
} else { } else {
Strcat(buf, mtmp->data->mname); Strcat(buf, mtmp->data->mname);
if (mtmp->mnamelth) if (mtmp->mnamelth)
@@ -225,7 +225,7 @@ register struct monst *mtmp;
} }
if (multi) Strcat(buf, ", while helpless"); if (multi) Strcat(buf, ", while helpless");
killer = buf; Strcpy(killer.name, buf);
if (mtmp->data->mlet == S_WRAITH) if (mtmp->data->mlet == S_WRAITH)
u.ugrave_arise = PM_WRAITH; u.ugrave_arise = PM_WRAITH;
else if (mtmp->data->mlet == S_MUMMY && urace.mummynum != NON_PM) else if (mtmp->data->mlet == S_MUMMY && urace.mummynum != NON_PM)
@@ -534,16 +534,16 @@ done(how)
int how; int how;
{ {
boolean taken; boolean taken;
char kilbuf[BUFSZ], pbuf[BUFSZ]; char pbuf[BUFSZ];
winid endwin = WIN_ERR; winid endwin = WIN_ERR;
boolean bones_ok, have_windows = iflags.window_inited; boolean bones_ok, have_windows = iflags.window_inited;
struct obj *corpse = (struct obj *)0; struct obj *corpse = (struct obj *)0;
long umoney; long umoney;
if (how == TRICKED) { if (how == TRICKED) {
if (killer) { if (killer.name[0]) {
paniclog("trickery", killer); paniclog("trickery", killer.name);
killer = 0; killer.name[0] = 0;
} }
#ifdef WIZARD #ifdef WIZARD
if (wizard) { if (wizard) {
@@ -553,18 +553,15 @@ int how;
#endif #endif
} }
/* kilbuf: used to copy killer in case it comes from something like /* pbuf: holds Sprintf'd output for raw_print and putstr
* xname(), which would otherwise get overwritten when we call
* xname() when listing possessions
* pbuf: holds Sprintf'd output for raw_print and putstr
*/ */
if (how == ASCENDED || (!killer && how == GENOCIDED)) if (how == ASCENDED || (!killer.name[0] && how == GENOCIDED))
killer_format = NO_KILLER_PREFIX; killer.format = NO_KILLER_PREFIX;
/* Avoid killed by "a" burning or "a" starvation */ /* Avoid killed by "a" burning or "a" starvation */
if (!killer && (how == STARVING || how == BURNING)) if (!killer.name[0] && (how == STARVING || how == BURNING))
killer_format = KILLED_BY; killer.format = KILLED_BY;
Strcpy(kilbuf, (!killer || how >= PANICKED ? deaths[how] : killer)); if (!killer.name[0] || how >= PANICKED)
killer = kilbuf; Strcpy(killer.name, deaths[how]);
if (how < PANICKED) u.umortality++; if (how < PANICKED) u.umortality++;
if (Lifesaved && (how <= GENOCIDED)) { if (Lifesaved && (how <= GENOCIDED)) {
@@ -583,8 +580,8 @@ int how;
if (how == GENOCIDED) if (how == GENOCIDED)
pline("Unfortunately you are still genocided..."); pline("Unfortunately you are still genocided...");
else { else {
killer = 0; killer.name[0] = 0;
killer_format = 0; killer.format = 0;
return; return;
} }
} }
@@ -598,8 +595,8 @@ int how;
(how == CHOKING) ? "choke" : "die"); (how == CHOKING) ? "choke" : "die");
if(u.uhpmax <= 0) u.uhpmax = u.ulevel * 8; /* arbitrary */ if(u.uhpmax <= 0) u.uhpmax = u.ulevel * 8; /* arbitrary */
savelife(how); savelife(how);
killer = 0; killer.name[0] = 0;
killer_format = 0; killer.format = 0;
return; return;
} }
@@ -659,24 +656,24 @@ die:
corpse = mk_named_object(CORPSE, &mons[mnum], corpse = mk_named_object(CORPSE, &mons[mnum],
u.ux, u.uy, plname); u.ux, u.uy, plname);
Sprintf(pbuf, "%s, %s%s", plname, Sprintf(pbuf, "%s, %s%s", plname,
killer_format == NO_KILLER_PREFIX ? "" : killer.format == NO_KILLER_PREFIX ? "" :
killed_by_prefix[how], 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); make_grave(u.ux, u.uy, pbuf);
} }
} }
if (how == QUIT) { if (how == QUIT) {
killer_format = NO_KILLER_PREFIX; killer.format = NO_KILLER_PREFIX;
if (u.uhp < 1) { if (u.uhp < 1) {
how = DIED; how = DIED;
u.umortality++; /* skipped above when how==QUIT */ u.umortality++; /* skipped above when how==QUIT */
/* note that killer is pointing at kilbuf */ Strcpy(killer.name, "quit while already on Charon's boat");
Strcpy(kilbuf, "quit while already on Charon's boat"); }
}
} }
if (how == ESCAPED || how == PANICKED) if (how == ESCAPED || how == PANICKED)
killer_format = NO_KILLER_PREFIX; killer.format = NO_KILLER_PREFIX;
if (how != PANICKED) { if (how != PANICKED) {
/* these affect score and/or bones, but avoid them during panic */ /* these affect score and/or bones, but avoid them during panic */
@@ -755,15 +752,12 @@ die:
} else } else
done_stopprint = 1; /* just avoid any more output */ done_stopprint = 1; /* just avoid any more output */
/* changing kilbuf really changes killer. we do it this way because if (u.uhave.amulet) Strcat(killer.name, " (with the Amulet)");
killer is declared a (const char *)
*/
if (u.uhave.amulet) Strcat(kilbuf, " (with the Amulet)");
else if (how == ESCAPED) { else if (how == ESCAPED) {
if (Is_astralevel(&u.uz)) /* offered Amulet to wrong deity */ 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)) 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 */ /* 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*/ /*end.c*/
+3 -3
View File
@@ -132,9 +132,9 @@ const char *drainer; /* cause of death, if drain should be fatal */
reset_rndmonst(NON_PM); /* new monster selection */ reset_rndmonst(NON_PM); /* new monster selection */
} else { } else {
if (drainer) { if (drainer) {
killer_format = KILLED_BY; killer.format = KILLED_BY;
killer = drainer; if (killer.name != drainer) Strcpy(killer.name, drainer);
done(DIED); done(DIED);
} }
/* no drainer or lifesaved */ /* no drainer or lifesaved */
u.uexp = 0; u.uexp = 0;
+13 -13
View File
@@ -31,7 +31,7 @@ int expltype;
boolean starting = 1; boolean starting = 1;
boolean visible, any_shield; boolean visible, any_shield;
int uhurt = 0; /* 0=unhurt, 1=items damaged, 2=you and items damaged */ 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; int idamres, idamnonres;
struct monst *mtmp; struct monst *mtmp;
uchar adtyp; uchar adtyp;
@@ -53,8 +53,7 @@ int expltype;
} }
if (olet == MON_EXPLODE) { if (olet == MON_EXPLODE) {
str = killer; str = killer.name;
killer = 0; /* set again later as needed */
adtyp = AD_PHYS; adtyp = AD_PHYS;
} else } else
switch (abs(type) % 10) { switch (abs(type) % 10) {
@@ -338,22 +337,23 @@ int expltype;
} else { } else {
if (olet == MON_EXPLODE) { if (olet == MON_EXPLODE) {
/* killer handled by caller */ /* killer handled by caller */
if (str != killer_buf && !generic) if (generic)
Strcpy(killer_buf, str); killer.name[0] = 0;
killer_format = KILLED_BY_AN; else if (str != killer.name)
Strcpy(killer.name, str);
killer.format = KILLED_BY_AN;
} else if (type >= 0 && olet != SCROLL_CLASS) { } else if (type >= 0 && olet != SCROLL_CLASS) {
killer_format = NO_KILLER_PREFIX; killer.format = NO_KILLER_PREFIX;
Sprintf(killer_buf, "caught %sself in %s own %s", Sprintf(killer.name, "caught %sself in %s own %s",
uhim(), uhis(), str); uhim(), uhis(), str);
} else if (!strncmpi(str,"tower of flame", 8) || } else if (!strncmpi(str,"tower of flame", 8) ||
!strncmpi(str,"fireball", 8)) { !strncmpi(str,"fireball", 8)) {
killer_format = KILLED_BY_AN; killer.format = KILLED_BY_AN;
Strcpy(killer_buf, str); Strcpy(killer.name, str);
} else { } else {
killer_format = KILLED_BY; killer.format = KILLED_BY;
Strcpy(killer_buf, str); Strcpy(killer.name, str);
} }
killer = killer_buf;
/* Known BUG: BURNING suppresses corpse in bones data, /* Known BUG: BURNING suppresses corpse in bones data,
but done does not handle killer reason correctly */ but done does not handle killer reason correctly */
done((adtyp == AD_FIRE) ? BURNING : DIED); done((adtyp == AD_FIRE) ? BURNING : DIED);
+3 -2
View File
@@ -2099,8 +2099,9 @@ boolean k_format;
u.uhpmax = u.uhp; /* perhaps n was negative */ u.uhpmax = u.uhp; /* perhaps n was negative */
context.botl = 1; context.botl = 1;
if(u.uhp < 1) { if(u.uhp < 1) {
killer_format = k_format; killer.format = k_format;
killer = knam; /* the thing that killed you */ if (killer.name != knam) /* the thing that killed you */
Strcpy(killer.name, knam ? knam : "");
You("die..."); You("die...");
done(DIED); done(DIED);
} else if (n > 0 && u.uhp*10 < u.uhpmax) { } else if (n > 0 && u.uhp*10 < u.uhpmax) {
+2 -2
View File
@@ -332,8 +332,8 @@ int spellnum;
if (Hallucination) { if (Hallucination) {
You("have an out of body experience."); You("have an out of body experience.");
} else { } else {
killer_format = KILLED_BY_AN; killer.format = KILLED_BY_AN;
killer = "touch of death"; Strcpy(killer.name, "touch of death");
done(DIED); done(DIED);
} }
} else { } else {
+19 -24
View File
@@ -1058,8 +1058,8 @@ dopois:
pline("Unfortunately your brain is still gone."); pline("Unfortunately your brain is still gone.");
else else
Your("last thought fades away."); Your("last thought fades away.");
killer = "brainlessness"; Strcpy(killer.name, "brainlessness");
killer_format = KILLED_BY; killer.format = KILLED_BY;
done(DIED); done(DIED);
lifesaved++; lifesaved++;
} }
@@ -1150,18 +1150,16 @@ dopois:
if (!Stoned && !Stone_resistance if (!Stoned && !Stone_resistance
&& !(poly_when_stoned(youmonst.data) && && !(poly_when_stoned(youmonst.data) &&
polymon(PM_STONE_GOLEM))) { polymon(PM_STONE_GOLEM))) {
Stoned = 5; int kformat = KILLED_BY_AN;
delayed_killer = mtmp->data->mname; const char *kname = mtmp->data->mname;
if (mtmp->data->geno & G_UNIQ) {
if (!type_is_pname(mtmp->data)) {
static char buf[BUFSZ];
/* "the" buffer may be reallocated */ Stoned = 5;
Strcpy(buf, the(delayed_killer)); if (mtmp->data->geno & G_UNIQ) {
delayed_killer = buf; if (!type_is_pname(mtmp->data))
} kname = the(kname);
killer_format = KILLED_BY; kformat = KILLED_BY;
} else killer_format = KILLED_BY_AN; }
delayed_killer(STONED, kformat, kname);
return(1); return(1);
/* You("turn to stone..."); */ /* You("turn to stone..."); */
/* done_in_by(mtmp); */ /* done_in_by(mtmp); */
@@ -1195,11 +1193,10 @@ dopois:
!Is_waterlevel(&u.uz); !Is_waterlevel(&u.uz);
pline("%s drowns you...", Monnam(mtmp)); pline("%s drowns you...", Monnam(mtmp));
killer_format = KILLED_BY_AN; killer.format = KILLED_BY_AN;
Sprintf(buf, "%s by %s", Sprintf(killer.name, "%s by %s",
moat ? "moat" : "pool of water", moat ? "moat" : "pool of water",
an(mtmp->data->mname)); an(mtmp->data->mname));
killer = buf;
done(DROWNING); done(DROWNING);
} else if(mattk->aatyp == AT_HUGS) } else if(mattk->aatyp == AT_HUGS)
You("are being crushed."); You("are being crushed.");
@@ -1450,8 +1447,8 @@ dopois:
switch (rn2(20)) { switch (rn2(20)) {
case 19: case 18: case 17: case 19: case 18: case 17:
if (!Antimagic) { if (!Antimagic) {
killer_format = KILLED_BY_AN; killer.format = KILLED_BY_AN;
killer = "touch of death"; Strcpy(killer.name, "touch of death");
done(DIED); done(DIED);
dmg = 0; dmg = 0;
break; break;
@@ -1491,10 +1488,8 @@ dopois:
dmg = 0; dmg = 0;
} else if (!Slimed) { } else if (!Slimed) {
You("don't feel very well."); You("don't feel very well.");
Slimed = 10L; make_slimed(10L, (char*) 0);
context.botl = 1; delayed_killer(SLIMED, KILLED_BY_AN, mtmp->data->mname);
killer_format = KILLED_BY_AN;
delayed_killer = mtmp->data->mname;
} else } else
pline("Yuck!"); pline("Yuck!");
break; break;
@@ -1912,8 +1907,8 @@ gazemu(mtmp, mattk) /* monster gazes at you */
if(poly_when_stoned(youmonst.data) && polymon(PM_STONE_GOLEM)) if(poly_when_stoned(youmonst.data) && polymon(PM_STONE_GOLEM))
break; break;
You("turn to stone..."); You("turn to stone...");
killer_format = KILLED_BY; killer.format = KILLED_BY;
killer = mtmp->data->mname; Strcpy(killer.name, mtmp->data->mname);
done(STONING); done(STONING);
} }
break; break;
+20 -21
View File
@@ -1483,10 +1483,10 @@ boolean was_swallowed; /* digestion */
if (magr == &youmonst) { if (magr == &youmonst) {
There("is an explosion in your %s!", There("is an explosion in your %s!",
body_part(STOMACH)); body_part(STOMACH));
Sprintf(killer_buf, "%s explosion", Sprintf(killer.name, "%s explosion",
s_suffix(mdat->mname)); s_suffix(mdat->mname));
if (Half_physical_damage) tmp = (tmp+1) / 2; if (Half_physical_damage) tmp = (tmp+1) / 2;
losehp(tmp, killer_buf, KILLED_BY_AN); losehp(tmp, killer.name, KILLED_BY_AN);
} else { } else {
if (!Deaf) You_hear("an explosion."); if (!Deaf) You_hear("an explosion.");
magr->mhp -= tmp; magr->mhp -= tmp;
@@ -1502,9 +1502,8 @@ boolean was_swallowed; /* digestion */
return FALSE; return FALSE;
} }
Sprintf(killer_buf, "%s explosion", s_suffix(mdat->mname)); Sprintf(killer.name, "%s explosion", s_suffix(mdat->mname));
killer = killer_buf; killer.format = KILLED_BY_AN;
killer_format = KILLED_BY_AN;
explode(mon->mx, mon->my, -1, tmp, MON_EXPLODE, EXPL_NOXIOUS); explode(mon->mx, mon->my, -1, tmp, MON_EXPLODE, EXPL_NOXIOUS);
return (FALSE); return (FALSE);
} }
@@ -2018,8 +2017,8 @@ int typ, fatal;
losehp(i, pname, kprefix); losehp(i, pname, kprefix);
} }
if(u.uhp < 1) { if(u.uhp < 1) {
killer_format = kprefix; killer.format = kprefix;
killer = pname; Strcpy(killer.name, pname);
/* "Poisoned by a poisoned ___" is redundant */ /* "Poisoned by a poisoned ___" is redundant */
done(strstri(pname, "poison") ? DIED : POISONING); done(strstri(pname, "poison") ? DIED : POISONING);
} }
@@ -2315,21 +2314,21 @@ struct monst *mon;
break; break;
} }
#ifdef WIZARD #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) { if (wizard && iflags.mon_polycontrol) {
char pprompt[BUFSZ], buf[BUFSZ]; char pprompt[BUFSZ], buf[BUFSZ];
int tries = 0; int tries = 0;
do { do {
Sprintf(pprompt, Sprintf(pprompt,
"Change %s into what kind of monster? [type the name]", "Change %s into what kind of monster? [type the name]",
mon_nam(mon)); mon_nam(mon));
getlin(pprompt,buf); getlin(pprompt,buf);
mndx = name_to_mon(buf); mndx = name_to_mon(buf);
if (mndx < LOW_PM) if (mndx < LOW_PM)
You("cannot polymorph %s into that.", mon_nam(mon)); You("cannot polymorph %s into that.", mon_nam(mon));
else break; else break;
} while(++tries < 5); } while(++tries < 5);
if (tries==5) pline(thats_enough_tries); if (tries==5) pline(thats_enough_tries);
} }
#endif /*WIZARD*/ #endif /*WIZARD*/
if (mndx == NON_PM) mndx = rn1(SPECIAL_PM - LOW_PM, LOW_PM); if (mndx == NON_PM) mndx = rn1(SPECIAL_PM - LOW_PM, LOW_PM);
+2 -2
View File
@@ -400,11 +400,11 @@ m_throw(mon, x, y, dx, dy, range, obj)
} }
} }
if (hitu && singleobj->otyp == EGG) { if (hitu && singleobj->otyp == EGG) {
if (!Stone_resistance if (!Stoned && !Stone_resistance
&& !(poly_when_stoned(youmonst.data) && && !(poly_when_stoned(youmonst.data) &&
polymon(PM_STONE_GOLEM))) { polymon(PM_STONE_GOLEM))) {
Stoned = 5; Stoned = 5;
killer = (char *) 0; delayed_killer(STONED, KILLED_BY, nul);
} }
} }
stop_occupation(); stop_occupation();
+24 -24
View File
@@ -67,11 +67,16 @@ const char *fmt, *arg;
(urace.femalenum != NON_PM && (urace.femalenum != NON_PM &&
(mvitals[urace.femalenum].mvflags & G_GENOD))) { (mvitals[urace.femalenum].mvflags & G_GENOD))) {
/* intervening activity might have clobbered genocide info */ /* intervening activity might have clobbered genocide info */
killer = delayed_killer; struct kinfo *kptr = find_delayed_killer(POLYMORPH);
if (!killer || !strstri(killer, "genocid")) {
killer_format = KILLED_BY; if (kptr != (struct kinfo*) 0 && kptr->name[0]) {
killer = "self-genocide"; killer.format = kptr->format;
Strcpy(killer.name, kptr->name);
} else {
killer.format = KILLED_BY;
Strcpy(killer.name, "self-genocide");
} }
dealloc_killer(kptr);
done(GENOCIDED); done(GENOCIDED);
} }
@@ -188,7 +193,7 @@ newman()
u.uhunger = rn1(500,500); u.uhunger = rn1(500,500);
if (Sick) make_sick(0L, (char *) 0, FALSE, SICK_ALL); if (Sick) make_sick(0L, (char *) 0, FALSE, SICK_ALL);
Stoned = 0; Stoned = 0;
delayed_killer = 0; dealloc_killer(find_delayed_killer(STONED));
if (u.uhp <= 0 || u.uhpmax <= 0) { if (u.uhp <= 0 || u.uhpmax <= 0) {
if (Polymorph_control) { if (Polymorph_control) {
if (u.uhp <= 0) u.uhp = 1; if (u.uhp <= 0) u.uhp = 1;
@@ -196,8 +201,8 @@ newman()
} else { } else {
dead: /* we come directly here if their experience level went to 0 or less */ dead: /* we come directly here if their experience level went to 0 or less */
Your("new form doesn't seem healthy enough to survive."); Your("new form doesn't seem healthy enough to survive.");
killer_format = KILLED_BY_AN; killer.format = KILLED_BY_AN;
killer="unsuccessful polymorph"; Strcpy(killer.name, "unsuccessful polymorph");
done(DIED); done(DIED);
newuhs(FALSE); newuhs(FALSE);
return; /* lifesaved */ 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); (urace.individual.m) ? urace.individual.m : urace.noun);
if (Slimed) { if (Slimed) {
Your("body transforms, but there is still slime on you."); Your("body transforms, but there is still slime on you.");
Slimed = 10L; make_slimed(10L, (const char*) 0);
} }
context.botl = 1; context.botl = 1;
see_monsters(); see_monsters();
@@ -385,7 +390,7 @@ int mntmp;
You("turn to stone!"); You("turn to stone!");
mntmp = PM_STONE_GOLEM; mntmp = PM_STONE_GOLEM;
Stoned = 0; Stoned = 0;
delayed_killer = 0; dealloc_killer(find_delayed_killer(STONED));
} }
u.mtimedone = rn1(500, 500); u.mtimedone = rn1(500, 500);
@@ -399,7 +404,7 @@ int mntmp;
if (Stone_resistance && Stoned) { /* parnes@eniac.seas.upenn.edu */ if (Stone_resistance && Stoned) { /* parnes@eniac.seas.upenn.edu */
Stoned = 0; Stoned = 0;
delayed_killer = 0; dealloc_killer(find_delayed_killer(STONED));
You("no longer seem to be petrifying."); You("no longer seem to be petrifying.");
} }
if (Sick_resistance && Sick) { if (Sick_resistance && Sick) {
@@ -408,13 +413,10 @@ int mntmp;
} }
if (Slimed) { if (Slimed) {
if (flaming(youmonst.data)) { if (flaming(youmonst.data)) {
pline_The("slime burns away!"); make_slimed(0L, "The slime burns away!");
Slimed = 0L;
context.botl = 1;
} else if (mntmp == PM_GREEN_SLIME) { } else if (mntmp == PM_GREEN_SLIME) {
/* do it silently */ /* do it silently */
Slimed = 0L; make_slimed(0L, (char*) 0);
context.botl = 1;
} }
} }
if (nohands(youmonst.data)) Glib = 0; if (nohands(youmonst.data)) Glib = 0;
@@ -715,8 +717,8 @@ rehumanize()
{ {
/* You can't revert back while unchanging */ /* You can't revert back while unchanging */
if (Unchanging && (u.mh < 1)) { if (Unchanging && (u.mh < 1)) {
killer_format = NO_KILLER_PREFIX; killer.format = NO_KILLER_PREFIX;
killer = "killed while stuck in creature form"; Strcpy(killer.name, "killed while stuck in creature form");
done(DIED); done(DIED);
} }
@@ -725,11 +727,8 @@ rehumanize()
polyman("return to %s form!", urace.adj); polyman("return to %s form!", urace.adj);
if (u.uhp < 1) { if (u.uhp < 1) {
char kbuf[256]; Sprintf(killer.name, "reverting to unhealthy %s form", urace.adj);
killer.format = KILLED_BY;
Sprintf(kbuf, "reverting to unhealthy %s form", urace.adj);
killer_format = KILLED_BY;
killer = kbuf;
done(DIED); done(DIED);
} }
if (!uarmg) selftouch("No longer petrify-resistant, you"); if (!uarmg) selftouch("No longer petrify-resistant, you");
@@ -1045,8 +1044,9 @@ dogaze()
l_monnam(mtmp)); l_monnam(mtmp));
/* as if gazing at a sleeping anything is fruitful... */ /* as if gazing at a sleeping anything is fruitful... */
You("turn to stone..."); You("turn to stone...");
killer_format = KILLED_BY; killer.format = KILLED_BY;
killer = "deliberately meeting Medusa's gaze"; Strcpy(killer.name,
"deliberately meeting Medusa's gaze");
done(STONING); done(STONING);
} }
} }
+17 -7
View File
@@ -133,14 +133,24 @@ int type;
if (Sick) { if (Sick) {
exercise(A_CON, FALSE); exercise(A_CON, FALSE);
if (cause) { delayed_killer(SICK, KILLED_BY_AN, 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;
} else } 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 void
+4 -10
View File
@@ -279,13 +279,10 @@ register int trouble;
You_feel("more limber."); You_feel("more limber.");
Stoned = 0; Stoned = 0;
context.botl = 1; context.botl = 1;
delayed_killer = 0; dealloc_killer(find_delayed_killer(STONED));
break; break;
case TROUBLE_SLIMED: case TROUBLE_SLIMED:
pline_The("slime disappears."); make_slimed(0L, "The slime disappears.");
Slimed = 0;
context.botl = 1;
delayed_killer = 0;
break; break;
case TROUBLE_STRANGLED: case TROUBLE_STRANGLED:
if (uamul && uamul->otyp == AMULET_OF_STRANGULATION) { if (uamul && uamul->otyp == AMULET_OF_STRANGULATION) {
@@ -544,12 +541,9 @@ STATIC_OVL void
fry_by_god(resp_god) fry_by_god(resp_god)
aligntyp resp_god; aligntyp resp_god;
{ {
char killerbuf[64];
You("fry to a crisp."); You("fry to a crisp.");
killer_format = KILLED_BY; killer.format = KILLED_BY;
Sprintf(killerbuf, "the wrath of %s", align_gname(resp_god)); Sprintf(killer.name, "the wrath of %s", align_gname(resp_god));
killer = killerbuf;
done(DIED); done(DIED);
} }
+11 -12
View File
@@ -1593,8 +1593,8 @@ do_class_genocide()
} }
} }
if (gameover || u.uhp == -1) { if (gameover || u.uhp == -1) {
killer_format = KILLED_BY_AN; killer.format = KILLED_BY_AN;
killer = "scroll of genocide"; Strcpy(killer.name, "scroll of genocide");
if (gameover) done(GENOCIDED); if (gameover) done(GENOCIDED);
} }
return; return;
@@ -1709,25 +1709,24 @@ int how;
u.uhp = -1; u.uhp = -1;
if (how & PLAYER) { if (how & PLAYER) {
killer_format = KILLED_BY; killer.format = KILLED_BY;
killer = "genocidal confusion"; Strcpy(killer.name, "genocidal confusion");
} else if (how & ONTHRONE) { } else if (how & ONTHRONE) {
/* player selected while on a throne */ /* player selected while on a throne */
killer_format = KILLED_BY_AN; killer.format = KILLED_BY_AN;
killer = "imperious order"; Strcpy(killer.name, "imperious order");
} else { /* selected player deliberately, not confused */ } else { /* selected player deliberately, not confused */
killer_format = KILLED_BY_AN; killer.format = KILLED_BY_AN;
killer = "scroll of genocide"; Strcpy(killer.name, "scroll of genocide");
} }
/* Polymorphed characters will die as soon as they're rehumanized. */ /* Polymorphed characters will die as soon as they're rehumanized. */
/* KMH -- Unchanging prevents rehumanization */ /* KMH -- Unchanging prevents rehumanization */
if (Upolyd && ptr != youmonst.data) { if (Upolyd && ptr != youmonst.data) {
delayed_killer = killer; delayed_killer(POLYMORPH, killer.format, killer.name);
killer = 0; You_feel("dead inside.");
You_feel("dead inside.");
} else } else
done(GENOCIDED); done(GENOCIDED);
} else if (ptr == youmonst.data) { } else if (ptr == youmonst.data) {
rehumanize(); rehumanize();
} }
+2 -1
View File
@@ -403,6 +403,7 @@ unsigned int *stuckid, *steedid; /* STEED */
} }
/* this stuff comes after potential aborted restore attempts */ /* this stuff comes after potential aborted restore attempts */
restore_killers(fd);
restore_timers(fd, RANGE_GLOBAL, FALSE, 0L); restore_timers(fd, RANGE_GLOBAL, FALSE, 0L);
restore_light_sources(fd); restore_light_sources(fd);
invent = restobjchn(fd, FALSE, FALSE); invent = restobjchn(fd, FALSE, FALSE);
@@ -694,7 +695,7 @@ char *reason;
pline("Strange, this map is not as I remember it."); pline("Strange, this map is not as I remember it.");
pline("Somebody is trying some trickery here..."); pline("Somebody is trying some trickery here...");
pline("This game is void."); pline("This game is void.");
killer = reason; Strcpy(killer.name, reason ? reason : "");
done(TRICKED); done(TRICKED);
} }
+4 -4
View File
@@ -117,18 +117,18 @@ int how;
center(GOLD_LINE, buf); center(GOLD_LINE, buf);
/* Put together death description */ /* Put together death description */
switch (killer_format) { switch (killer.format) {
default: impossible("bad killer format?"); default: impossible("bad killer format?");
case KILLED_BY_AN: case KILLED_BY_AN:
Strcpy(buf, killed_by_prefix[how]); Strcpy(buf, killed_by_prefix[how]);
Strcat(buf, an(killer)); Strcat(buf, an(killer.name));
break; break;
case KILLED_BY: case KILLED_BY:
Strcpy(buf, killed_by_prefix[how]); Strcpy(buf, killed_by_prefix[how]);
Strcat(buf, killer); Strcat(buf, killer.name);
break; break;
case NO_KILLER_PREFIX: case NO_KILLER_PREFIX:
Strcpy(buf, killer); Strcpy(buf, killer.name);
break; break;
} }
+7 -4
View File
@@ -252,7 +252,7 @@ dosave0()
HUP pline("%s", whynot); HUP pline("%s", whynot);
(void) close(fd); (void) close(fd);
(void) delete_savefile(); (void) delete_savefile();
HUP killer = whynot; HUP Strcpy(killer.name, whynot);
HUP done(TRICKED); HUP done(TRICKED);
return(0); return(0);
} }
@@ -297,6 +297,7 @@ register int fd, mode;
} }
#endif #endif
bwrite(fd, (genericptr_t) &u, sizeof(struct you)); bwrite(fd, (genericptr_t) &u, sizeof(struct you));
save_killers(fd, mode);
/* must come before migrating_objs and migrating_mons are freed */ /* must come before migrating_objs and migrating_mons are freed */
save_timers(fd, mode, RANGE_GLOBAL); save_timers(fd, mode, RANGE_GLOBAL);
@@ -371,7 +372,7 @@ savestateinlock()
if (fd < 0) { if (fd < 0) {
pline("%s", whynot); pline("%s", whynot);
pline("Probably someone removed it."); pline("Probably someone removed it.");
killer = whynot; Strcpy(killer.name, whynot);
done(TRICKED); done(TRICKED);
return; return;
} }
@@ -382,7 +383,7 @@ savestateinlock()
"Level #0 pid (%d) doesn't match ours (%d)!", "Level #0 pid (%d) doesn't match ours (%d)!",
hpid, hackpid); hpid, hackpid);
pline("%s", whynot); pline("%s", whynot);
killer = whynot; Strcpy(killer.name, whynot);
done(TRICKED); done(TRICKED);
} }
(void) close(fd); (void) close(fd);
@@ -390,7 +391,7 @@ savestateinlock()
fd = create_levelfile(0, whynot); fd = create_levelfile(0, whynot);
if (fd < 0) { if (fd < 0) {
pline("%s", whynot); pline("%s", whynot);
killer = whynot; Strcpy(killer.name, whynot);
done(TRICKED); done(TRICKED);
return; return;
} }
@@ -1007,6 +1008,7 @@ freedynamicdata()
# define freetrapchn(X) (savetrapchn(0, X, FREE_SAVE), X = 0) # define freetrapchn(X) (savetrapchn(0, X, FREE_SAVE), X = 0)
# define freefruitchn() savefruitchn(0, FREE_SAVE) # define freefruitchn() savefruitchn(0, FREE_SAVE)
# define freenames() savenames(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_oracles() save_oracles(0, FREE_SAVE)
# define free_waterlevel() save_waterlevel(0, FREE_SAVE) # define free_waterlevel() save_waterlevel(0, FREE_SAVE)
# define free_worm() save_worm(0, FREE_SAVE) # define free_worm() save_worm(0, FREE_SAVE)
@@ -1032,6 +1034,7 @@ freedynamicdata()
freedamage(); freedamage();
/* game-state data */ /* game-state data */
free_killers();
free_timers(RANGE_GLOBAL); free_timers(RANGE_GLOBAL);
free_light_sources(RANGE_GLOBAL); free_light_sources(RANGE_GLOBAL);
freeobjchn(invent); freeobjchn(invent);
+1 -5
View File
@@ -925,11 +925,7 @@ boolean atme;
break; break;
case SPE_CURE_SICKNESS: case SPE_CURE_SICKNESS:
if (Sick) You("are no longer ill."); if (Sick) You("are no longer ill.");
if (Slimed) { if (Slimed) make_slimed(0L, "The slime disappears!");
pline_The("slime disappears!");
Slimed = 0;
/* context.botl = 1; -- healup() handles this */
}
healup(0, 0, TRUE, FALSE); healup(0, 0, TRUE, FALSE);
break; break;
case SPE_CREATE_FAMILIAR: case SPE_CREATE_FAMILIAR:
+9 -10
View File
@@ -631,8 +631,8 @@ level_tele()
is_silent(youmonst.data) ? "writhe" : "scream"); is_silent(youmonst.data) ? "writhe" : "scream");
display_nhwindow(WIN_MESSAGE, FALSE); display_nhwindow(WIN_MESSAGE, FALSE);
You("cease to exist."); You("cease to exist.");
killer_format = NO_KILLER_PREFIX; killer.format = NO_KILLER_PREFIX;
killer = "committed suicide"; Strcpy(killer.name, "committed suicide");
done(DIED); done(DIED);
return; return;
} }
@@ -685,7 +685,7 @@ level_tele()
} }
#endif #endif
killer = 0; /* still alive, so far... */ killer.name[0] = 0; /* still alive, so far... */
if (newlev < 0) { if (newlev < 0) {
if (*u.ushops0) { if (*u.ushops0) {
@@ -699,8 +699,8 @@ level_tele()
if (newlev <= -10) { if (newlev <= -10) {
You("arrive in heaven."); You("arrive in heaven.");
verbalize("Thou art early, but we'll admit thee."); verbalize("Thou art early, but we'll admit thee.");
killer_format = NO_KILLER_PREFIX; killer.format = NO_KILLER_PREFIX;
killer = "went to heaven prematurely"; Strcpy(killer.name, "went to heaven prematurely");
} else if (newlev == -9) { } else if (newlev == -9) {
You_feel("deliriously happy. "); You_feel("deliriously happy. ");
pline("(In fact, you're on Cloud 9!) "); pline("(In fact, you're on Cloud 9!) ");
@@ -708,7 +708,7 @@ level_tele()
} else } else
You("are now high above the clouds..."); You("are now high above the clouds...");
if (killer) { if (killer.name[0]) {
; /* arrival in heaven is pending */ ; /* arrival in heaven is pending */
} else if (Levitation) { } else if (Levitation) {
escape_by_flying = "float gently down to earth"; escape_by_flying = "float gently down to earth";
@@ -717,15 +717,14 @@ level_tele()
} else { } else {
pline("Unfortunately, you don't know how to fly."); pline("Unfortunately, you don't know how to fly.");
You("plummet a few thousand feet to your death."); You("plummet a few thousand feet to your death.");
Sprintf(buf, Sprintf(killer.name,
"teleported out of the dungeon and fell to %s death", "teleported out of the dungeon and fell to %s death",
uhis()); 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; d_level lsav;
/* set specific death location; this also suppresses bones */ /* set specific death location; this also suppresses bones */
+33 -29
View File
@@ -144,11 +144,8 @@ void
burn_away_slime() burn_away_slime()
{ {
if (Slimed) { if (Slimed) {
pline_The("slime that covers you is burned away!"); make_slimed(0L, "The slime that covers you is burned away!");
Slimed = 0L;
context.botl = 1;
} }
return;
} }
@@ -156,6 +153,7 @@ void
nh_timeout() nh_timeout()
{ {
register struct prop *upp; register struct prop *upp;
struct kinfo *kptr;
int sleeptime; int sleeptime;
int m_idx; int m_idx;
int baseluck = (flags.moonphase == FULL_MOON) ? 1 : 0; 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++) for(upp = u.uprops; upp < u.uprops+SIZE(u.uprops); upp++)
if((upp->intrinsic & TIMEOUT) && !(--upp->intrinsic & TIMEOUT)) { if((upp->intrinsic & TIMEOUT) && !(--upp->intrinsic & TIMEOUT)) {
kptr = find_delayed_killer(upp - u.uprops);
switch(upp - u.uprops){ switch(upp - u.uprops){
case STONED: case STONED:
if (delayed_killer && !killer) { if (kptr && kptr->name[0]) {
killer = delayed_killer; killer.format = kptr->format;
delayed_killer = 0; Strcpy(killer.name, kptr->name);
} } else {
if (!killer) { killer.format = NO_KILLER_PREFIX;
/* leaving killer_format would make it Strcpy(killer.name, "killed by petrification");
"petrified by petrification" */
killer_format = NO_KILLER_PREFIX;
killer = "killed by petrification";
} }
dealloc_killer(kptr);
done(STONING); done(STONING);
break; break;
case SLIMED: case SLIMED:
if (delayed_killer && !killer) { if (kptr && kptr->name[0]) {
killer = delayed_killer; killer.format = kptr->format;
delayed_killer = 0; Strcpy(killer.name, kptr->name);
} } else {
if (!killer) { killer.format = NO_KILLER_PREFIX;
killer_format = NO_KILLER_PREFIX; Strcpy(killer.name, "turned into green slime");
killer = "turned into green slime";
} }
dealloc_killer(kptr);
done(TURNED_SLIME); done(TURNED_SLIME);
break; break;
case VOMITING: case VOMITING:
@@ -241,15 +238,21 @@ nh_timeout()
break; break;
case SICK: case SICK:
You("die from your illness."); You("die from your illness.");
killer_format = KILLED_BY_AN; if (kptr && kptr->name[0]) {
killer = u.usick_cause; killer.format = kptr->format;
if ((m_idx = name_to_mon(killer)) >= LOW_PM) { 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])) { if (type_is_pname(&mons[m_idx])) {
killer_format = KILLED_BY; killer.format = KILLED_BY;
} else if (mons[m_idx].geno & G_UNIQ) { } else if (mons[m_idx].geno & G_UNIQ) {
killer = the(killer); Strcpy(killer.name, the(killer.name));
Strcpy(u.usick_cause, killer); killer.format = KILLED_BY;
killer_format = KILLED_BY;
} }
} }
u.usick_type = 0; u.usick_type = 0;
@@ -318,8 +321,9 @@ nh_timeout()
(void) float_down(I_SPECIAL|TIMEOUT, 0L); (void) float_down(I_SPECIAL|TIMEOUT, 0L);
break; break;
case STRANGLED: case STRANGLED:
killer_format = KILLED_BY; killer.format = KILLED_BY;
killer = (u.uburied) ? "suffocation" : "strangulation"; Strcpy(killer.name,
(u.uburied) ? "suffocation" : "strangulation");
done(DIED); done(DIED);
break; break;
case FUMBLING: case FUMBLING:
+4 -4
View File
@@ -315,20 +315,20 @@ int how;
(void) strncpy(t0->name, plname, NAMSZ); (void) strncpy(t0->name, plname, NAMSZ);
t0->name[NAMSZ] = '\0'; t0->name[NAMSZ] = '\0';
t0->death[0] = '\0'; t0->death[0] = '\0';
switch (killer_format) { switch (killer.format) {
default: impossible("bad killer format?"); default: impossible("bad killer format?");
case KILLED_BY_AN: case KILLED_BY_AN:
Strcat(t0->death, killed_by_prefix[how]); Strcat(t0->death, killed_by_prefix[how]);
(void) strncat(t0->death, an(killer), (void) strncat(t0->death, an(killer.name),
DTHSZ-strlen(t0->death)); DTHSZ-strlen(t0->death));
break; break;
case KILLED_BY: case KILLED_BY:
Strcat(t0->death, killed_by_prefix[how]); Strcat(t0->death, killed_by_prefix[how]);
(void) strncat(t0->death, killer, (void) strncat(t0->death, killer.name,
DTHSZ-strlen(t0->death)); DTHSZ-strlen(t0->death));
break; break;
case NO_KILLER_PREFIX: case NO_KILLER_PREFIX:
(void) strncat(t0->death, killer, DTHSZ); (void) strncat(t0->death, killer.name, DTHSZ);
break; break;
} }
t0->birthdate = yyyymmdd(u.ubirthday); t0->birthdate = yyyymmdd(u.ubirthday);
+8 -7
View File
@@ -2137,8 +2137,8 @@ const char *str;
if (poly_when_stoned(youmonst.data) && polymon(PM_STONE_GOLEM)) if (poly_when_stoned(youmonst.data) && polymon(PM_STONE_GOLEM))
return; return;
You("turn to stone..."); You("turn to stone...");
killer_format = KILLED_BY; killer.format = KILLED_BY;
killer = str; if (str != killer.name) Strcpy(killer.name, str ? str : "");
done(STONING); done(STONING);
} }
@@ -2902,9 +2902,10 @@ drown()
} }
u.uinwater = 1; u.uinwater = 1;
You("drown."); You("drown.");
killer_format = KILLED_BY_AN; killer.format = KILLED_BY_AN;
killer = (levl[u.ux][u.uy].typ == POOL || Is_medusa_level(&u.uz)) ? Strcpy(killer.name,
"pool of water" : "moat"; (levl[u.ux][u.uy].typ == POOL || Is_medusa_level(&u.uz)) ?
"pool of water" : "moat");
done(DROWNING); done(DROWNING);
/* oops, we're still alive. better get out of the water. */ /* oops, we're still alive. better get out of the water. */
while (!safe_teleds(TRUE)) { while (!safe_teleds(TRUE)) {
@@ -3924,8 +3925,8 @@ lava_effects()
/* s/he died... */ /* s/he died... */
u.uhp = -1; u.uhp = -1;
killer_format = KILLED_BY; killer.format = KILLED_BY;
killer = lava_killer; Strcpy(killer.name, lava_killer);
You("burn to a crisp..."); You("burn to a crisp...");
done(BURNING); done(BURNING);
while (!safe_teleds(TRUE)) { while (!safe_teleds(TRUE)) {
+5 -8
View File
@@ -1519,7 +1519,7 @@ register struct attack *mattk;
if (!Unchanging && mdef->data == &mons[PM_GREEN_SLIME]) { if (!Unchanging && mdef->data == &mons[PM_GREEN_SLIME]) {
if (!Slimed) { if (!Slimed) {
You("suck in some slime and don't feel very well."); You("suck in some slime and don't feel very well.");
Slimed = 10L; make_slimed(10L, (char*) 0);
} }
} }
break; break;
@@ -1536,8 +1536,7 @@ register struct attack *mattk;
u.uconduct.food++; u.uconduct.food++;
if (touch_petrifies(mdef->data) && !Stone_resistance && !Stoned) { if (touch_petrifies(mdef->data) && !Stone_resistance && !Stoned) {
Stoned = 5; Stoned = 5;
killer_format = KILLED_BY_AN; delayed_killer(STONED, KILLED_BY_AN, mdef->data->mname);
delayed_killer = mdef->data->mname;
} }
if (!vegan(mdef->data)) if (!vegan(mdef->data))
u.uconduct.unvegan++; u.uconduct.unvegan++;
@@ -1765,10 +1764,9 @@ register struct attack *mattk;
if (is_rider(mdef->data)) { if (is_rider(mdef->data)) {
pline("Unfortunately, digesting any of it is fatal."); pline("Unfortunately, digesting any of it is fatal.");
end_engulf(); end_engulf();
Sprintf(msgbuf, "unwisely tried to eat %s", Sprintf(killer.name, "unwisely tried to eat %s",
mdef->data->mname); mdef->data->mname);
killer = msgbuf; killer.format = NO_KILLER_PREFIX;
killer_format = NO_KILLER_PREFIX;
done(DIED); done(DIED);
return 0; /* lifesaved */ return 0; /* lifesaved */
} }
@@ -1818,8 +1816,7 @@ register struct attack *mattk;
Sprintf(msgbuf, "%s isn't sitting well with you.", Sprintf(msgbuf, "%s isn't sitting well with you.",
The(mdef->data->mname)); The(mdef->data->mname));
if (!Unchanging) { if (!Unchanging) {
Slimed = 5L; make_slimed(5L, (char*) 0);
context.botl = 1;
} }
} else } else
exercise(A_CON, TRUE); exercise(A_CON, TRUE);
+4 -6
View File
@@ -1852,7 +1852,6 @@ struct obj *obj;
boolean ordinary; boolean ordinary;
{ {
int damage = 0; int damage = 0;
char buf[BUFSZ];
switch(obj->otyp) { switch(obj->otyp) {
case WAN_STRIKING: case WAN_STRIKING:
@@ -2030,9 +2029,8 @@ boolean ordinary;
: "You seem no deader than before."); : "You seem no deader than before.");
break; break;
} }
Sprintf(buf, "shot %sself with a death ray", uhim()); Sprintf(killer.name,"shot %sself with a death ray",uhim());
killer = buf; killer.format = NO_KILLER_PREFIX;
killer_format = NO_KILLER_PREFIX;
You("irradiate yourself with pure energy!"); You("irradiate yourself with pure energy!");
You("die."); You("die.");
makeknown(obj->otyp); makeknown(obj->otyp);
@@ -3110,8 +3108,8 @@ xchar sx, sy;
You("aren't affected."); You("aren't affected.");
break; break;
} }
killer_format = KILLED_BY_AN; killer.format = KILLED_BY_AN;
killer = fltxt; Strcpy(killer.name, fltxt ? fltxt : "");
/* when killed by disintegration breath, don't leave corpse */ /* when killed by disintegration breath, don't leave corpse */
u.ugrave_arise = (type == -ZT_BREATH(ZT_DEATH)) ? -3 : NON_PM; u.ugrave_arise = (type == -ZT_BREATH(ZT_DEATH)) ? -3 : NON_PM;
done(DIED); done(DIED);
+1 -1
View File
@@ -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)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 $(O)engrave.o: $(NHS)engrave.c $(HDEP) $(I)lev.h
+1 -1
View File
@@ -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)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 $(O)engrave.o: $(NHS)engrave.c $(HDEP) $(I)lev.h
+8 -8
View File
@@ -152,19 +152,19 @@ int how;
BltBitMap(*tbmp, 0, 0, rp->BitMap, xoff, yoff, tomb_bmhd.w, tomb_bmhd.h, 0xc0, 0xff, NULL); BltBitMap(*tbmp, 0, 0, rp->BitMap, xoff, yoff, tomb_bmhd.w, tomb_bmhd.h, 0xc0, 0xff, NULL);
/* Put together death description */ /* Put together death description */
switch (killer_format) { switch (killer.format) {
default: default:
impossible("bad killer format?"); impossible("bad killer format?");
case KILLED_BY_AN: case KILLED_BY_AN:
Strcpy(buf, killed_by_prefix[how]); Strcpy(buf, killed_by_prefix[how]);
Strcat(buf, an(killer)); Strcat(buf, an(killer.name));
break; break;
case KILLED_BY: case KILLED_BY:
Strcpy(buf, killed_by_prefix[how]); Strcpy(buf, killed_by_prefix[how]);
Strcat(buf, killer); Strcat(buf, killer.name);
break; break;
case NO_KILLER_PREFIX: case NO_KILLER_PREFIX:
Strcpy(buf, killer); Strcpy(buf, killer.name);
break; break;
} }
@@ -205,19 +205,19 @@ int how;
tomb_text(buf); tomb_text(buf);
/* Put together death description */ /* Put together death description */
switch (killer_format) { switch (killer.format) {
default: default:
impossible("bad killer format?"); impossible("bad killer format?");
case KILLED_BY_AN: case KILLED_BY_AN:
Strcpy(buf, killed_by_prefix[how]); Strcpy(buf, killed_by_prefix[how]);
Strcat(buf, an(killer)); Strcat(buf, an(killer.name));
break; break;
case KILLED_BY: case KILLED_BY:
Strcpy(buf, killed_by_prefix[how]); Strcpy(buf, killed_by_prefix[how]);
Strcat(buf, killer); Strcat(buf, killer.name);
break; break;
case NO_KILLER_PREFIX: case NO_KILLER_PREFIX:
Strcpy(buf, killer); Strcpy(buf, killer.name);
break; break;
} }
+1 -1
View File
@@ -1200,7 +1200,7 @@ mac_destroy_nhwindow (winid win) {
} }
if (win == WIN_INVEN || win == WIN_MESSAGE) { if (win == WIN_INVEN || win == WIN_MESSAGE) {
if (iflags.window_inited) { if (iflags.window_inited) {
if (flags.tombstone && killer) { if (flags.tombstone && killer.name[0]) {
/* Prepare for the coming of the tombstone window. */ /* Prepare for the coming of the tombstone window. */
win_fonts [NHW_TEXT] = kFontIDMonaco; win_fonts [NHW_TEXT] = kFontIDMonaco;
} }
+1 -1
View File
@@ -1814,7 +1814,7 @@ $(O)drawing.o: $(SRC)\drawing.c $(HACK_H) $(TERMCAP_H)
@echo $(BCOPTS1) >> $(VROOMMCFG) @echo $(BCOPTS1) >> $(VROOMMCFG)
@echo $(BCOPTS2) >> $(VROOMMCFG) @echo $(BCOPTS2) >> $(VROOMMCFG)
$(CC) $(CFLAGSN) $(COBJNAM)$@ $(SRC)\drawing.c $(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) @type schema$(SCHEMA).bc | find "$(@B)_o" > $(VROOMMCFG)
@echo $(BCOPTS1) >> $(VROOMMCFG) @echo $(BCOPTS1) >> $(VROOMMCFG)
@echo $(BCOPTS2) >> $(VROOMMCFG) @echo $(BCOPTS2) >> $(VROOMMCFG)
+1 -1
View File
@@ -1166,7 +1166,7 @@ $(O)dothrow.o: dothrow.c $(HACK_H)
$(O)drawing.o: drawing.c $(HACK_H) $(INCL)/tcap.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)dungeon.o: dungeon.c $(HACK_H) $(INCL)/dgn_file.h $(INCL)/dlb.h
$(O)eat.o: eat.c $(HACK_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)engrave.o: engrave.c $(HACK_H) $(INCL)/lev.h
$(O)exper.o: exper.c $(HACK_H) $(O)exper.o: exper.c $(HACK_H)
$(O)explode.o: explode.c $(HACK_H) $(O)explode.o: explode.c $(HACK_H)
+1 -1
View File
@@ -1020,7 +1020,7 @@ dothrow.o: dothrow.c $(HACK_H)
drawing.o: drawing.c $(HACK_H) $(INCL)\tcap.h drawing.o: drawing.c $(HACK_H) $(INCL)\tcap.h
dungeon.o: dungeon.c $(HACK_H) $(INCL)\dgn_file.h $(INCL)\dlb.h dungeon.o: dungeon.c $(HACK_H) $(INCL)\dgn_file.h $(INCL)\dlb.h
eat.o: eat.c $(HACK_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 engrave.o: engrave.c $(HACK_H) $(INCL)\lev.h
exper.o: exper.c $(HACK_H) exper.o: exper.c $(HACK_H)
explode.o: explode.c $(HACK_H) explode.o: explode.c $(HACK_H)
+1 -1
View File
@@ -1550,7 +1550,7 @@ $(OBJ)\dungeon.o : $(SRC)\$(CB) $(HACK_H) $(INCL)\dgn_file.h
$(SRCCC) $(SRCCC)
$(OBJ)\eat.o : $(SRC)\$(CB) $(HACK_H) $(OBJ)\eat.o : $(SRC)\$(CB) $(HACK_H)
$(SRCCC) $(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) $(SRCCC)
$(OBJ)\engrave.o : $(SRC)\$(CB) $(HACK_H) $(INCL)\lev.h $(OBJ)\engrave.o : $(SRC)\$(CB) $(HACK_H) $(INCL)\lev.h
$(SRCCC) $(SRCCC)
+1 -1
View File
@@ -719,7 +719,7 @@ dothrow.o: dothrow.c $(HACK_H)
drawing.o: drawing.c $(HACK_H) ../include/tcap.h drawing.o: drawing.c $(HACK_H) ../include/tcap.h
dungeon.o: dungeon.c $(HACK_H) ../include/dgn_file.h ../include/dlb.h dungeon.o: dungeon.c $(HACK_H) ../include/dgn_file.h ../include/dlb.h
eat.o: eat.c $(HACK_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 engrave.o: engrave.c $(HACK_H) ../include/lev.h
exper.o: exper.c $(HACK_H) exper.o: exper.c $(HACK_H)
explode.o: explode.c $(HACK_H) explode.o: explode.c $(HACK_H)
+1 -1
View File
@@ -372,7 +372,7 @@ dothrow.obj : dothrow.c $(HACK_H)
drawing.obj : drawing.c $(HACK_H) $(INC)tcap.h drawing.obj : drawing.c $(HACK_H) $(INC)tcap.h
dungeon.obj : dungeon.c $(HACK_H) $(INC)dgn_file.h $(INC)dlb.h dungeon.obj : dungeon.c $(HACK_H) $(INC)dgn_file.h $(INC)dlb.h
eat.obj : eat.c $(HACK_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 engrave.obj : engrave.c $(HACK_H) $(INC)lev.h
exper.obj : exper.c $(HACK_H) exper.obj : exper.c $(HACK_H)
explode.obj : explode.c $(HACK_H) explode.obj : explode.c $(HACK_H)
+1 -1
View File
@@ -789,7 +789,7 @@ $(O)dothrow.o: $(SRC)\dothrow.c $(HACK_H)
$(O)drawing.o: $(SRC)\drawing.c $(HACK_H) $(INCL)\tcap.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)dungeon.o: $(SRC)\dungeon.c $(HACK_H) $(INCL)\dgn_file.h $(INCL)\dlb.h
$(O)eat.o: $(SRC)\eat.c $(HACK_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)engrave.o: $(SRC)\engrave.c $(HACK_H) $(INCL)\lev.h
$(O)exper.o: $(SRC)\exper.c $(HACK_H) $(O)exper.o: $(SRC)\exper.c $(HACK_H)
$(O)explode.o: $(SRC)\explode.c $(HACK_H) $(O)explode.o: $(SRC)\explode.c $(HACK_H)
+1 -1
View File
@@ -1284,7 +1284,7 @@ $(O)dothrow.o: dothrow.c $(HACK_H)
$(O)drawing.o: drawing.c $(HACK_H) $(INCL)\tcap.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)dungeon.o: dungeon.c $(HACK_H) $(INCL)\dgn_file.h $(INCL)\dlb.h
$(O)eat.o: eat.c $(HACK_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)engrave.o: engrave.c $(HACK_H) $(INCL)\lev.h
$(O)exper.o: exper.c $(HACK_H) $(O)exper.o: exper.c $(HACK_H)
$(O)explode.o: explode.c $(HACK_H) $(O)explode.o: explode.c $(HACK_H)
+1 -1
View File
@@ -1258,7 +1258,7 @@ $(O)dothrow.o: dothrow.c $(HACK_H)
$(O)drawing.o: drawing.c $(HACK_H) $(INCL)/tcap.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)dungeon.o: dungeon.c $(HACK_H) $(INCL)/dgn_file.h $(INCL)/dlb.h
$(O)eat.o: eat.c $(HACK_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)engrave.o: engrave.c $(HACK_H) $(INCL)/lev.h
$(O)exper.o: exper.c $(HACK_H) $(O)exper.o: exper.c $(HACK_H)
$(O)explode.o: explode.c $(HACK_H) $(O)explode.o: explode.c $(HACK_H)
+1 -1
View File
@@ -1325,7 +1325,7 @@ $(O)dothrow.o: dothrow.c $(HACK_H)
$(O)drawing.o: drawing.c $(HACK_H) $(INCL)\tcap.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)dungeon.o: dungeon.c $(HACK_H) $(INCL)\dgn_file.h $(INCL)\dlb.h
$(O)eat.o: eat.c $(HACK_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)engrave.o: engrave.c $(HACK_H) $(INCL)\lev.h
$(O)exper.o: exper.c $(HACK_H) $(O)exper.o: exper.c $(HACK_H)
$(O)explode.o: explode.c $(HACK_H) $(O)explode.o: explode.c $(HACK_H)
+4 -4
View File
@@ -3311,18 +3311,18 @@ static char** rip_line=0;
#endif #endif
/* Put together death description */ /* Put together death description */
switch (killer_format) { switch (killer.format) {
default: impossible("bad killer format?"); default: impossible("bad killer format?");
case KILLED_BY_AN: case KILLED_BY_AN:
Strcpy(buf, killed_by_prefix[how]); Strcpy(buf, killed_by_prefix[how]);
Strcat(buf, an(killer)); Strcat(buf, an(killer.name));
break; break;
case KILLED_BY: case KILLED_BY:
Strcpy(buf, killed_by_prefix[how]); Strcpy(buf, killed_by_prefix[how]);
Strcat(buf, killer); Strcat(buf, killer.name);
break; break;
case NO_KILLER_PREFIX: case NO_KILLER_PREFIX:
Strcpy(buf, killer); Strcpy(buf, killer.name);
break; break;
} }
+5 -5
View File
@@ -290,7 +290,7 @@ create_text_window(wp)
XtParseTranslationTable(text_translations)); num_args++; XtParseTranslationTable(text_translations)); num_args++;
wp->w = XtCreateManagedWidget( wp->w = XtCreateManagedWidget(
killer && WIN_MAP == WIN_ERR ? killer.name[0] && WIN_MAP == WIN_ERR ?
"tombstone" : "text_text", /* name */ "tombstone" : "text_text", /* name */
asciiTextWidgetClass, asciiTextWidgetClass,
form, /* parent widget */ form, /* parent widget */
@@ -474,18 +474,18 @@ calculate_rip_text(int how)
done_money); done_money);
#endif #endif
/* Put together death description */ /* Put together death description */
switch (killer_format) { switch (killer.format) {
default: impossible("bad killer format?"); default: impossible("bad killer format?");
case KILLED_BY_AN: case KILLED_BY_AN:
Strcpy(buf, killed_by_prefix[how]); Strcpy(buf, killed_by_prefix[how]);
Strcat(buf, an(killer)); Strcat(buf, an(killer.name));
break; break;
case KILLED_BY: case KILLED_BY:
Strcpy(buf, killed_by_prefix[how]); Strcpy(buf, killed_by_prefix[how]);
Strcat(buf, killer); Strcat(buf, killer.name);
break; break;
case NO_KILLER_PREFIX: case NO_KILLER_PREFIX:
Strcpy(buf, killer); Strcpy(buf, killer.name);
break; break;
} }
+4 -4
View File
@@ -1083,18 +1083,18 @@ int how;
done_money); done_money);
#endif #endif
/* Put together death description */ /* Put together death description */
switch (killer_format) { switch (killer.format) {
default: impossible("bad killer format?"); default: impossible("bad killer format?");
case KILLED_BY_AN: case KILLED_BY_AN:
Strcpy(buf, killed_by_prefix[how]); Strcpy(buf, killed_by_prefix[how]);
Strcat(buf, an(killer)); Strcat(buf, an(killer.name));
break; break;
case KILLED_BY: case KILLED_BY:
Strcpy(buf, killed_by_prefix[how]); Strcpy(buf, killed_by_prefix[how]);
Strcat(buf, killer); Strcat(buf, killer.name);
break; break;
case NO_KILLER_PREFIX: case NO_KILLER_PREFIX:
Strcpy(buf, killer); Strcpy(buf, killer.name);
break; break;
} }
/* Put death type on stone */ /* Put death type on stone */
+4 -4
View File
@@ -1170,18 +1170,18 @@ void gnome_outrip(winid wid, int how)
Strcat(ripString, buf); Strcat(ripString, buf);
/* Put together death description */ /* Put together death description */
switch (killer_format) { switch (killer.format) {
default: impossible("bad killer format?"); default: impossible("bad killer format?");
case KILLED_BY_AN: case KILLED_BY_AN:
Strcpy(buf, killed_by_prefix[how]); Strcpy(buf, killed_by_prefix[how]);
Strcat(buf, an(killer)); Strcat(buf, an(killer.name));
break; break;
case KILLED_BY: case KILLED_BY:
Strcpy(buf, killed_by_prefix[how]); Strcpy(buf, killed_by_prefix[how]);
Strcat(buf, killer); Strcat(buf, killer.name);
break; break;
case NO_KILLER_PREFIX: case NO_KILLER_PREFIX:
Strcpy(buf, killer); Strcpy(buf, killer.name);
break; break;
} }
/* Put death type on stone */ /* Put death type on stone */
+4 -4
View File
@@ -1783,18 +1783,18 @@ void mswin_outrip(winid wid, int how)
putstr(wid, 0, buf); putstr(wid, 0, buf);
/* Put together death description */ /* Put together death description */
switch (killer_format) { switch (killer.format) {
default: impossible("bad killer format?"); default: impossible("bad killer format?");
case KILLED_BY_AN: case KILLED_BY_AN:
Strcpy(buf, killed_by_prefix[how]); Strcpy(buf, killed_by_prefix[how]);
Strcat(buf, an(killer)); Strcat(buf, an(killer.name));
break; break;
case KILLED_BY: case KILLED_BY:
Strcpy(buf, killed_by_prefix[how]); Strcpy(buf, killed_by_prefix[how]);
Strcat(buf, killer); Strcat(buf, killer.name);
break; break;
case NO_KILLER_PREFIX: case NO_KILLER_PREFIX:
Strcpy(buf, killer); Strcpy(buf, killer.name);
break; break;
} }