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

Function note

outdated/sys/mac/mrecover.c:486–551  ·  view source on GitHub ↗

* display messages using Notification Manager or an alert. * no run-length checking is done. the messages are created to fit * in the allocated space (nmBufSize and aboutBufSize). */

Source from the content-addressed store, hash-verified

484 * in the allocated space (nmBufSize and aboutBufSize).
485 */
486static void
487note(short errorSignal, short alertID, unsigned char *msg)
488{
489 if (!errorSignal) {
490 Size grow;
491
492 if (MaxMem(&grow) < pBytes->memAbort)
493 noteErrorMessage(msg, "\pOut of Memory");
494 }
495
496 if (errorSignal || !in.Front) {
497 notifPtr pNMR;
498 short i = nmt.nmBuf[0] + 1; /* insertion point */
499
500 if (errorSignal) /* use notification template */
501 {
502 pNMR = &nmt;
503
504 /* we're going to abort so add in this prefix */
505 BlockMove("Abort: ", &nmt.nmBuf[i], 7);
506 i += 7;
507 nmt.nmBuf[0] += 7;
508 } else /* allocate a notification record */
509 {
510 if (!(pNMR = (notifPtr) NewPtr(sizeof(notifRec))))
511 noteErrorMessage(msg, "\pNil New Pointer");
512
513 /* initialize it */
514 *pNMR = nmt;
515 pNMR->nmr.nmStr = (StringPtr) & (pNMR->nmBuf);
516
517 /* update the notification queue */
518 if (!pNMQ)
519 pNMQ = pNMR;
520 else {
521 notifPtr pNMX;
522
523 /* find the end of the queue */
524 for (pNMX = pNMQ; pNMX->nmNext; pNMX = pNMX->nmNext)
525 ;
526
527 pNMX->nmNext = pNMR;
528 }
529 }
530
531 /* concatenate the message */
532 BlockMove(&msg[1], &((pNMR->nmBuf)[i]), msg[0]);
533 (pNMR->nmBuf)[0] += msg[0];
534
535 in.Notify++; /* increase note pending level */
536
537 NMInstall((NMRec *) pNMR);
538
539 if (errorSignal)
540 cooldown();
541
542 return;
543 }

Callers 15

warmupFunction · 0.85
alignTemplateFunction · 0.85
noteErrorMessageFunction · 0.85
adjustMemoryFunction · 0.85
optionMemStatsFunction · 0.85
RecoverMenuEventFunction · 0.85
eventLoopFunction · 0.85
beginRecoverFunction · 0.85
continueRecoverFunction · 0.85
saveRezStringsFunction · 0.85
set_levelfile_nameFunction · 0.85
open_levelfileFunction · 0.85

Calls 2

noteErrorMessageFunction · 0.85
cooldownFunction · 0.85

Tested by

no test coverage detected