* initworm() * * Use if (mon->wormno = get_wormno()) before calling this function! * * Initialize the worm entry. This will set up the worm grow time, and * create and initialize the dummy segment for wheads[] and wtails[]. * * If the worm has no tail (ie get_wormno() fails) then this function * need not be called. */
| 117 | * need not be called. |
| 118 | */ |
| 119 | void |
| 120 | initworm(struct monst *worm, int wseg_count) |
| 121 | { |
| 122 | struct wseg *seg, *new_tail = create_worm_tail(wseg_count); |
| 123 | int wnum = worm->wormno; |
| 124 | |
| 125 | if (new_tail) { |
| 126 | wtails[wnum] = new_tail; |
| 127 | for (seg = new_tail; seg->nseg; seg = seg->nseg) |
| 128 | continue; |
| 129 | wheads[wnum] = seg; |
| 130 | } else { |
| 131 | wtails[wnum] = wheads[wnum] = seg = newseg(); |
| 132 | seg->nseg = (struct wseg *) 0; |
| 133 | } |
| 134 | seg->wx = worm->mx; |
| 135 | seg->wy = worm->my; |
| 136 | wgrowtime[wnum] = 0L; |
| 137 | } |
| 138 | |
| 139 | /* |
| 140 | * toss_wsegs() |
no test coverage detected