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

Function wormno_sanity_check

src/worm.c:681–703  ·  view source on GitHub ↗

called from mon_sanity_check(mon.c) */

Source from the content-addressed store, hash-verified

679
680/* called from mon_sanity_check(mon.c) */
681void
682wormno_sanity_check(void)
683{
684#ifdef EXTRA_SANITY_CHECKS
685 struct wseg *seg;
686 int wh = 0, wt = 0;
687
688 /* checking tail management, not a particular monster; since wormno==0
689 means 'not a worm', wheads[0] and wtails[0] should always be empty;
690 note: if erroneously non-Null, tail segment count will include the
691 extra segment for the worm's head that isn't shown on the map */
692 for (seg = wheads[0]; seg; seg = seg->nseg)
693 ++wh;
694 for (seg = wtails[0]; seg; seg = seg->nseg)
695 ++wt;
696 if (wh || wt) {
697 impossible(
698 "phantom worm tail #0 [head=%s, %d segment%s; tail=%s, %d segment%s]",
699 fmt_ptr(wheads[0]), wh, plur(wh),
700 fmt_ptr(wtails[0]), wt, plur(wt));
701 }
702#endif /* EXTRA_SANITY_CHECKS */
703}
704
705/*
706 * remove_worm()

Callers 1

mon_sanity_checkFunction · 0.85

Calls 2

fmt_ptrFunction · 0.85
impossibleFunction · 0.70

Tested by

no test coverage detected