* toss_wsegs() * * Get rid of all worm segments on and following the given pointer curr. * The display may or may not need to be updated as we free the segments. */
| 143 | * The display may or may not need to be updated as we free the segments. |
| 144 | */ |
| 145 | staticfn void |
| 146 | toss_wsegs(struct wseg *curr, boolean display_update) |
| 147 | { |
| 148 | struct wseg *nxtseg; |
| 149 | |
| 150 | while (curr) { |
| 151 | nxtseg = curr->nseg; |
| 152 | |
| 153 | /* remove from level.monsters[][]; |
| 154 | need to check curr->wx for genocided while migrating_mon */ |
| 155 | if (curr->wx) { |
| 156 | remove_monster(curr->wx, curr->wy); |
| 157 | |
| 158 | /* update screen before deallocation */ |
| 159 | if (display_update) |
| 160 | newsym(curr->wx, curr->wy); |
| 161 | } |
| 162 | |
| 163 | /* free memory used by the segment */ |
| 164 | dealloc_seg(curr); |
| 165 | curr = nxtseg; |
| 166 | } |
| 167 | } |
| 168 | |
| 169 | /* |
| 170 | * shrink_worm() |
no test coverage detected