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

Function amii_cleanup

sys/amiga/amiwind.c:599–706  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

597 */
598
599void
600amii_cleanup(void)
601{
602 struct IntuiMessage *msg;
603
604 /* Close things up */
605 if (HackPort) {
606 amii_raw_print("");
607 amii_getret();
608 }
609
610 if (ConsoleIO.io_Device)
611 CloseDevice((struct IORequest *) &ConsoleIO);
612 ConsoleIO.io_Device = 0;
613
614 if (ConsoleIO.io_Message.mn_ReplyPort)
615 DeleteMsgPort(ConsoleIO.io_Message.mn_ReplyPort);
616 ConsoleIO.io_Message.mn_ReplyPort = 0;
617
618 /* Strip messages before deleting the port */
619 if (HackPort) {
620 Forbid();
621 while (msg = (struct IntuiMessage *) GetMsg(HackPort))
622 ReplyMsg((struct Message *) msg);
623 kill_nhwindows(1);
624 DeleteMsgPort(HackPort);
625 HackPort = NULL;
626 Permit();
627 }
628
629 /* Close the screen, under v37 or greater it is a pub screen and there may
630 * be visitors, so check close status and wait till everyone is gone.
631 */
632 if (HackScreen) {
633#ifdef INTUI_NEW_LOOK
634 if (IntuitionBase->LibNode.lib_Version >= 37) {
635 if (MenuStrip)
636 FreeMenus(MenuStrip);
637 if (VisualInfo)
638 FreeVisualInfo(VisualInfo);
639 while (CloseScreen(HackScreen) == FALSE) {
640 struct EasyStruct easy = {
641 sizeof(struct EasyStruct), 0, "Nethack Problem",
642 "Can't Close Screen, Close Visiting Windows", "Okay"
643 };
644 EasyRequest(NULL, &easy, NULL, NULL);
645 }
646 } else
647#endif
648 {
649 CloseScreen(HackScreen);
650 }
651 HackScreen = NULL;
652 }
653
654#ifdef HACKFONT
655 if (HackFont) {
656 CloseFont(HackFont);

Callers 2

AbortFunction · 0.85
CleanUpFunction · 0.85

Calls 3

amii_raw_printFunction · 0.85
amii_getretFunction · 0.85
kill_nhwindowsFunction · 0.85

Tested by

no test coverage detected