MCPcopy Index your code
hub / github.com/NetHack/NetHack / revive_nasty

Function revive_nasty

src/hack.c:104–137  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

102}
103
104boolean
105revive_nasty(coordxy x, coordxy y, const char *msg)
106{
107 struct obj *otmp = 0, *otmp2 = 0;
108 struct monst *mtmp;
109 coord cc;
110 boolean revived = FALSE;
111
112 for (otmp = svl.level.objects[x][y]; otmp; otmp = otmp2) {
113 otmp2 = otmp->nexthere;
114 if (otmp->otyp == CORPSE
115 && (is_rider(&mons[otmp->corpsenm])
116 || otmp->corpsenm == PM_WIZARD_OF_YENDOR)) {
117 /* move any living monster already at that location */
118 if ((mtmp = m_at(x, y)) && enexto(&cc, x, y, mtmp->data))
119 rloc_to(mtmp, cc.x, cc.y);
120 if (msg)
121 Norep("%s", msg);
122 revived = revive_corpse(otmp);
123 }
124 }
125
126 /* this location might not be safe, if not, move revived monster */
127 if (revived) {
128 mtmp = m_at(x, y);
129 if (mtmp && !goodpos(x, y, mtmp, 0)
130 && enexto(&cc, x, y, mtmp->data)) {
131 rloc_to(mtmp, cc.x, cc.y);
132 }
133 /* else impossible? */
134 }
135
136 return revived;
137}
138
139#define squeezeablylightinvent() (!gi.invent \
140 || inv_weight() <= (WT_SQUEEZABLE_INV * -1))

Callers 3

moverock_coreFunction · 0.85
close_drawbridgeFunction · 0.85
open_drawbridgeFunction · 0.85

Calls 5

enextoFunction · 0.85
rloc_toFunction · 0.85
NorepFunction · 0.85
revive_corpseFunction · 0.85
goodposFunction · 0.85

Tested by

no test coverage detected