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

Function restdamage

src/restore.c:152–179  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

150}
151
152staticfn void
153restdamage(NHFILE *nhfp)
154{
155 unsigned int dmgcount = 0;
156 int counter;
157 struct damage *tmp_dam;
158#ifndef SFCTOOL
159 boolean ghostly = (nhfp->ftype == NHF_BONESFILE);
160#endif
161
162 Sfi_unsigned(nhfp, &dmgcount, "damage-damage_count");
163 counter = (int) dmgcount;
164
165 if (!counter)
166 return;
167 do {
168 tmp_dam = (struct damage *) alloc(sizeof *tmp_dam);
169
170 Sfi_damage(nhfp, tmp_dam, "damage");
171#ifndef SFCTOOL
172 if (ghostly)
173 tmp_dam->when += (svm.moves - svo.omoves);
174
175 tmp_dam->next = svl.level.damagelist;
176 svl.level.damagelist = tmp_dam;
177#endif /* !SFCTOOL */
178 } while (--counter > 0);
179}
180
181/* restore one object */
182staticfn void

Callers 1

getlevFunction · 0.85

Calls 1

allocFunction · 0.70

Tested by

no test coverage detected