| 835 | } |
| 836 | |
| 837 | DISABLE_WARNING_FORMAT_NONLITERAL |
| 838 | |
| 839 | /* explanation of base-36 output from wiz_map_levltyp() */ |
| 840 | void |
| 841 | wiz_levltyp_legend(void) |
| 842 | { |
| 843 | winid win; |
| 844 | int i, j, last, c; |
| 845 | const char *dsc, *fmt; |
| 846 | char buf[BUFSZ]; |
| 847 | |
| 848 | win = create_nhwindow(NHW_TEXT); |
| 849 | putstr(win, 0, "#terrain encodings:"); |
| 850 | putstr(win, 0, ""); |
| 851 | fmt = " %c - %-28s"; /* TODO: include tab-separated variant for win32 */ |
| 852 | *buf = '\0'; |
| 853 | /* output in pairs, left hand column holds [0],[1],...,[N/2-1] |
| 854 | and right hand column holds [N/2],[N/2+1],...,[N-1]; |
| 855 | N ('last') will always be even, and may or may not include |
| 856 | the empty string entry to pad out the final pair, depending |
| 857 | upon how many other entries are present in levltyp[] */ |
| 858 | last = SIZE(levltyp) & ~1; |
| 859 | for (i = 0; i < last / 2; ++i) |
| 860 | for (j = i; j < last; j += last / 2) { |
| 861 | dsc = levltyp[j]; |
| 862 | c = !*dsc ? ' ' |
| 863 | : !strncmp(dsc, "unreachable", 11) ? '*' |
| 864 | /* same int-to-char conversion as wiz_map_levltyp() */ |
| 865 | : (j < 10) ? '0' + j |
| 866 | : (j < 36) ? 'a' + j - 10 |
| 867 | : 'A' + j - 36; |
| 868 | Sprintf(eos(buf), fmt, c, dsc); |
| 869 | if (j > i) { |
| 870 | putstr(win, 0, buf); |
| 871 | *buf = '\0'; |
| 872 | } |
| 873 | } |
| 874 | display_nhwindow(win, TRUE); |
| 875 | destroy_nhwindow(win); |
| 876 | return; |
| 877 | } |
| 878 | |
| 879 | RESTORE_WARNING_FORMAT_NONLITERAL |
| 880 | |