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

Method get

outdated/win/Qt3/qt3_win.cpp:5097–5135  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5095}
5096
5097int NetHackQtExtCmdRequestor::get()
5098{
5099 const int none = -10;
5100 char str[32];
5101 int cursor=0;
5102 resize(1,1); // pack
5103 centerOnMain(this);
5104 show();
5105 setResult(none);
5106 while (result()==none) {
5107 while (result()==none && !keysource.Empty()) {
5108 char k=keysource.GetAscii();
5109 if (k=='\r' || k=='\n' || k==' ' || k=='\033') {
5110 setResult(-1);
5111 } else {
5112 str[cursor++] = k;
5113 int r=-1;
5114 for (int i=0; extcmdlist[i].ef_txt; i++) {
5115 if (qstrnicmp(str, extcmdlist[i].ef_txt, cursor)==0) {
5116 if ( r == -1 )
5117 r = i;
5118 else
5119 r = -2;
5120 }
5121 }
5122 if ( r == -1 ) { // no match!
5123 QApplication::beep();
5124 cursor=0;
5125 } else if ( r != -2 ) { // only one match
5126 setResult(r);
5127 }
5128 }
5129 }
5130 if (result()==none)
5131 qApp->enter_loop();
5132 }
5133 hide();
5134 return result();
5135}
5136
5137
5138int NetHackQtBind::qt_get_ext_cmd()

Callers 1

qt_get_ext_cmdMethod · 0.45

Calls 3

centerOnMainFunction · 0.70
EmptyMethod · 0.45
GetAsciiMethod · 0.45

Tested by

no test coverage detected