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

Method InputCount

win/Qt/qt_menu.cpp:620–644  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

618}
619
620void NetHackQtMenuWindow::InputCount(char key)
621{
622 if (key == '\b' || key == '\177' || how == PICK_NONE) {
623 if (counting) {
624 if (countstr.isEmpty())
625 ClearCount();
626 else
627 countstr = countstr.mid(0, countstr.size() - 1);
628 }
629 } else {
630 counting = true;
631 // starting a count (enforced by caller) with '#' is optional;
632 // if used, show visible '0'
633 if (key == '#')
634 key = '0';
635 // if we have non-zero digit and are currently showing visible '0',
636 // replace instead of append; doesn't attempt to handle multiple
637 // leading zeroes--they won't affect the outcome, just look odd
638 else if (key > '0' && countstr == "0")
639 countstr = "";
640 countstr += QChar(key);
641 }
642 if (counting)
643 prompt.setText("Count: " + countstr);
644}
645
646void NetHackQtMenuWindow::ClearCount(void)
647{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected