called from mon_sanity_check(mon.c) */
| 679 | |
| 680 | /* called from mon_sanity_check(mon.c) */ |
| 681 | void |
| 682 | wormno_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() |
no test coverage detected