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

Method selectRole

win/Qt/qt_plsel.cpp:572–610  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

570}
571
572void NetHackQtPlayerSelector::selectRole(int crow, int ccol,
573 int prow, int pcol)
574{
575 int ra = race->currentRow();
576 int ro = role->currentRow();
577 if (ra == -1 || ro == -1)
578 return;
579 QTableWidgetItem *item = role->item(prow, 0);
580 if (item != NULL)
581 item->setSelected(false);
582
583#ifdef QT_CHOOSE_RACE_FIRST
584 selectRace(crow, ccol, prow, pcol);
585#else
586 QTableWidgetItem *i = role->currentItem();
587 QTableWidgetItem *valid = 0;
588 for (int j = 0; roles[j].name.m; ++j) {
589 if (!valid && (ra < 0 || validrace(j, ra))) {
590 valid = role->item(j, 0);
591 break;
592 }
593 }
594 if (!validrace(role->currentRow(), ra))
595 i = valid;
596 role->setCurrentItem(i, 0);
597 for (int j = 0; roles[j].name.m; ++j) {
598 item = role->item(j, 0);
599 item->setSelected(item == i);
600 /* used to call setFlags here, but setupOthers() -> selectGender()
601 (and selectAlignment()) -> populate_roles() takes care of that */
602 }
603 nhUse(crow);
604 nhUse(ccol);
605 nhUse(pcol);
606#endif
607
608 //flags.initrole = role->currentRow();
609 setupOthers();
610}
611
612void NetHackQtPlayerSelector::selectRace(int crow, int ccol,
613 int prow, int pcol)

Callers

nothing calls this directly

Calls 1

validraceFunction · 0.85

Tested by

no test coverage detected