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

Function restore_gamelog

src/restore.c:1389–1409  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1387staticfn
1388#endif
1389void
1390restore_gamelog(NHFILE *nhfp)
1391{
1392 int slen = 0;
1393 char msg[BUFSZ*2];
1394 struct gamelog_line tmp = { 0 };
1395
1396 while (1) {
1397 Sfi_int(nhfp, &slen, "gamelog-length");
1398 if (slen == -1)
1399 break;
1400 if (slen > ((BUFSZ*2) - 1))
1401 panic("restore_gamelog: msg too big (%d)", slen);
1402 Sfi_char(nhfp, msg, "gamelog-gamelog_text", slen);
1403 msg[slen] = '\0';
1404 Sfi_gamelog_line(nhfp, &tmp, "gamelog-gamelog_line");
1405#ifndef SFCTOOL
1406 gamelog_add(tmp.flags, tmp.turn, msg);
1407#endif /* !SFCTOOL */
1408 }
1409}
1410
1411#ifndef SFCTOOL
1412staticfn

Callers 1

restgamestateFunction · 0.85

Calls 2

gamelog_addFunction · 0.85
panicFunction · 0.50

Tested by

no test coverage detected