* wormgone() * * Kill a worm tail. Also takes the head off the map. Caller needs to * keep track of what its coordinates were if planning to put it back. * * Should only be called when mon->wormno is non-zero. */
| 305 | * Should only be called when mon->wormno is non-zero. |
| 306 | */ |
| 307 | void |
| 308 | wormgone(struct monst *worm) |
| 309 | { |
| 310 | int wnum = worm->wormno; |
| 311 | |
| 312 | if (!wnum) /* note: continuing with wnum==0 runs to completion */ |
| 313 | impossible("wormgone: wormno is 0"); |
| 314 | |
| 315 | worm->wormno = 0; /* still a long worm but doesn't grow/shrink anymore */ |
| 316 | /* |
| 317 | * This will also remove the real monster (ie 'w') from the its |
| 318 | * position in level.monsters[][]. (That happens when removing |
| 319 | * the hidden tail segment which is co-located with the head.) |
| 320 | */ |
| 321 | toss_wsegs(wtails[wnum], TRUE); |
| 322 | |
| 323 | wheads[wnum] = wtails[wnum] = (struct wseg *) 0; |
| 324 | wgrowtime[wnum] = 0L; |
| 325 | |
| 326 | /* we don't expect to encounter this here but check for it anyway; |
| 327 | when a long worm gets created by a polymorph zap, it gets flagged |
| 328 | with MCORPSENM()==PM_LONG_WORM so that the same zap won't trigger |
| 329 | another polymorph if it hits the new tail */ |
| 330 | if (worm->data == &mons[PM_LONG_WORM] && has_mcorpsenm(worm)) |
| 331 | MCORPSENM(worm) = NON_PM; /* no longer polymorph-proof */ |
| 332 | } |
| 333 | |
| 334 | /* |
| 335 | * wormhitu() |
no test coverage detected