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

Function disco_output_sorted

src/o_init.c:740–760  ·  view source on GitHub ↗

sort and output sorted_lines to window and free the lines */

Source from the content-addressed store, hash-verified

738
739/* sort and output sorted_lines to window and free the lines */
740staticfn void
741disco_output_sorted(
742 winid tmpwin,
743 char **sorted_lines, int sorted_ct,
744 boolean lootsort)
745{
746 char *p;
747 int j;
748
749 qsort(sorted_lines, sorted_ct, sizeof (char *), discovered_cmp);
750 for (j = 0; j < sorted_ct; ++j) {
751 p = sorted_lines[j];
752 assert(p != NULL); /* pacify static analyzer */
753 if (lootsort) {
754 p[6] = p[0]; /* '*' or ' ' */
755 p += 6;
756 }
757 putstr(tmpwin, 0, p);
758 free(sorted_lines[j]), sorted_lines[j] = 0;
759 }
760}
761
762/* the #known command - show discovered object types */
763int

Callers 1

dodiscoveredFunction · 0.85

Calls 1

qsortFunction · 0.85

Tested by

no test coverage detected