MCPcopy Index your code
hub / github.com/NetHack/NetHack / qt_more

Method qt_more

win/Qt/qt_bind.cpp:771–838  ·  view source on GitHub ↗

display "--More--" as a prompt and wait for a response from the user Used by qt_display_nhwindow(WIN_MESSAGE, TRUE) where second argument True requests blocking. We need it to support MSGTYPE=stop but the core also uses that in various other situations.

Source from the content-addressed store, hash-verified

769// True requests blocking. We need it to support MSGTYPE=stop but the
770// core also uses that in various other situations.
771char NetHackQtBind::qt_more()
772{
773 char ch = '\033';
774
775 // without this gameover hack, quitting via menu or window close
776 // button ends up provoking a complaint from qt_nhgetch() [see the
777 // ^C comment in that routine] when the core triggers --More-- via
778 // done2() -> really_done() -> display_nhwindow(WIN_MESSAGE, TRUE)
779 // (get rid of this if the exec() loop issue gets properly fixed)
780 if (::program_state.gameover)
781 return ch; // bypass --More-- and just continue with program exit
782
783 NetHackQtMessageWindow *mesgwin = main ? main->GetMessageWindow() : NULL;
784
785 // kill any typeahead; for '!popup_dialog' this forces qt_nhgetch()
786 keybuffer.Drain();
787
788 if (mesgwin && !::iflags.wc_popup_dialog && WIN_MESSAGE != WIN_ERR) {
789
790 mesgwin->AddToStr("--More--");
791 bool retry = false;
792 int complain = 0;
793 do {
794 ch = NetHackQtBind::qt_nhgetch();
795 if (::program_state.savefile_completed) {
796 retry = false;
797 break;
798 }
799 switch (ch) {
800 case '\0': // hypothetical
801 ch = '\033';
802 FALLTHROUGH;
803 /*FALLTHRU*/
804 case ' ':
805 case '\n':
806 case '\r':
807 case '\033':
808 retry = false;
809 break;
810 default:
811 if (++complain > 1)
812 NetHackQtBind::qt_nhbell();
813 // typing anything caused the most recent message line
814 // (which happens to our prompt) from having highlighting
815 // be removed; put that back
816 if (mesgwin)
817 mesgwin->RehighlightPrompt();
818 retry = true;
819 break;
820 }
821 } while (retry);
822 // unhighlight the line with the prompt; does not erase the window
823 NetHackQtBind::qt_clear_nhwindow(WIN_MESSAGE);
824
825 } else {
826 // use a popup dialog box; unlike yn_function(), we don't show
827 // the prompt+response in the message window
828 NetHackQtYnDialog dialog(main, "--More--", " \033\n\r", ' ');

Callers

nothing calls this directly

Calls 5

GetMessageWindowMethod · 0.80
DrainMethod · 0.80
AddToStrMethod · 0.80
RehighlightPromptMethod · 0.80
ExecMethod · 0.45

Tested by

no test coverage detected