MCPcopy Create free account
hub / github.com/NetHack/NetHack / toss_wsegs

Function toss_wsegs

src/worm.c:145–167  ·  view source on GitHub ↗

* 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. */

Source from the content-addressed store, hash-verified

143 * The display may or may not need to be updated as we free the segments.
144 */
145staticfn void
146toss_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()

Callers 4

shrink_wormFunction · 0.85
wormgoneFunction · 0.85
cutwormFunction · 0.85
place_worm_tail_randomlyFunction · 0.85

Calls 1

newsymFunction · 0.85

Tested by

no test coverage detected