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

Function delete_ls

src/light.c:141–165  ·  view source on GitHub ↗

remove a light source from the light_base list and free it */

Source from the content-addressed store, hash-verified

139
140/* remove a light source from the light_base list and free it */
141staticfn void
142delete_ls(light_source *ls)
143{
144 light_source *curr, *prev;
145
146 for (prev = 0, curr = gl.light_base; curr;
147 prev = curr, curr = curr->next) {
148 if (curr == ls) {
149 if (prev)
150 prev->next = curr->next;
151 else
152 gl.light_base = curr->next;
153 break;
154 }
155 }
156 if (curr) {
157 assert(curr == ls);
158 (void) memset((genericptr_t) ls, 0, sizeof(light_source));
159 free((genericptr_t) ls);
160 gv.vision_full_recalc = 1;
161 } else {
162 impossible("delete_ls not found, ls=%s", fmt_ptr((genericptr_t) ls));
163 }
164 return;
165}
166
167/* Mark locations that are temporarily lit via mobile light sources. */
168void

Callers 2

del_light_sourceFunction · 0.85
discard_flashesFunction · 0.85

Calls 2

fmt_ptrFunction · 0.85
impossibleFunction · 0.70

Tested by

no test coverage detected