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

Function save_gamelog

src/save.c:236–262  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

234}
235
236staticfn void
237save_gamelog(NHFILE *nhfp)
238{
239 struct gamelog_line *tmp = gg.gamelog, *tmp2;
240 int slen;
241
242 while (tmp) {
243 tmp2 = tmp->next;
244 if (nhfp->mode & (COUNTING | WRITING)) {
245 slen = Strlen(tmp->text);
246 Sfo_int(nhfp, &slen, "gamelog-length");
247 Sfo_char(nhfp, tmp->text, "gamelog-gamelog_text", slen);
248 Sfo_gamelog_line(nhfp, tmp, "gamelog-gamelog_line");
249 }
250 if (nhfp->mode & FREEING) {
251 free((genericptr_t) tmp->text);
252 free((genericptr_t) tmp);
253 }
254 tmp = tmp2;
255 }
256 if (nhfp->mode & (COUNTING | WRITING)) {
257 slen = -1;
258 Sfo_int(nhfp, &slen, "gamelog-length");
259 }
260 if (nhfp->mode & FREEING)
261 gg.gamelog = NULL;
262}
263
264staticfn void
265savegamestate(NHFILE *nhfp)

Callers 1

savegamestateFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected