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

Function restore_msghistory

src/restore.c:1414–1441  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1412staticfn
1413#endif
1414void
1415restore_msghistory(NHFILE *nhfp)
1416{
1417 int msgsize = 0;
1418#ifndef SFCTOOL
1419 int msgcount = 0;
1420#endif
1421 char msg[BUFSZ];
1422
1423 while (1) {
1424 Sfi_int(nhfp, &msgsize, "msghistory-length");
1425 if (msgsize == -1)
1426 break;
1427 if (msgsize > BUFSZ - 1)
1428 panic("restore_msghistory: msg too big (%d)", msgsize);
1429 Sfi_char(nhfp, msg, "msghistory-msg", msgsize);
1430 msg[msgsize] = '\0';
1431#ifndef SFCTOOL
1432 putmsghistory(msg, TRUE);
1433 ++msgcount;
1434#endif /* !SFCTOOL */
1435 }
1436#ifndef SFCTOOL
1437 if (msgcount)
1438 putmsghistory((char *) 0, TRUE);
1439 debugpline1("Read %d messages from savefile.", msgcount);
1440#endif /* !SFCTOOL */
1441}
1442
1443#ifndef SFCTOOL
1444

Callers 1

restgamestateFunction · 0.85

Calls 1

panicFunction · 0.50

Tested by

no test coverage detected