| 943 | |
| 944 | /* so>0: standout line; so=0: ordinary line */ |
| 945 | staticfn void |
| 946 | outentry(int rank, struct toptenentry *t1, boolean so) |
| 947 | { |
| 948 | boolean second_line = TRUE; |
| 949 | char linebuf[BUFSZ]; |
| 950 | char *bp, hpbuf[24], linebuf3[BUFSZ]; |
| 951 | int hppos, lngr; |
| 952 | |
| 953 | linebuf[0] = '\0'; |
| 954 | if (rank) |
| 955 | Sprintf(eos(linebuf), "%3d", rank); |
| 956 | else |
| 957 | Strcat(linebuf, " "); |
| 958 | |
| 959 | Sprintf(eos(linebuf), " %10ld %.10s", t1->points ? t1->points : u.urexp, |
| 960 | t1->name); |
| 961 | Sprintf(eos(linebuf), "-%s", t1->plrole); |
| 962 | if (t1->plrace[0] != '?') |
| 963 | Sprintf(eos(linebuf), "-%s", t1->plrace); |
| 964 | /* Printing of gender and alignment is intentional. It has been |
| 965 | * part of the NetHack Geek Code, and illustrates a proper way to |
| 966 | * specify a character from the command line. |
| 967 | */ |
| 968 | Sprintf(eos(linebuf), "-%s", t1->plgend); |
| 969 | if (t1->plalign[0] != '?') |
| 970 | Sprintf(eos(linebuf), "-%s ", t1->plalign); |
| 971 | else |
| 972 | Strcat(linebuf, " "); |
| 973 | if (!strncmp("escaped", t1->death, 7)) { |
| 974 | Sprintf(eos(linebuf), "escaped the dungeon %s[max level %d]", |
| 975 | !strncmp(" (", t1->death + 7, 2) ? t1->death + 7 + 2 : "", |
| 976 | t1->maxlvl); |
| 977 | /* fixup for closing paren in "escaped... with...Amulet)[max..." */ |
| 978 | if ((bp = strchr(linebuf, ')')) != 0) |
| 979 | *bp = (t1->deathdnum == astral_level.dnum) ? '\0' : ' '; |
| 980 | second_line = FALSE; |
| 981 | } else if (!strncmp("ascended", t1->death, 8)) { |
| 982 | Sprintf(eos(linebuf), "ascended to demigod%s-hood", |
| 983 | (t1->plgend[0] == 'F') ? "dess" : ""); |
| 984 | second_line = FALSE; |
| 985 | } else { |
| 986 | if (!strncmp(t1->death, "quit", 4)) { |
| 987 | Strcat(linebuf, "quit"); |
| 988 | second_line = FALSE; |
| 989 | } else if (!strncmp(t1->death, "died of st", 10)) { |
| 990 | Strcat(linebuf, "starved to death"); |
| 991 | second_line = FALSE; |
| 992 | } else if (!strncmp(t1->death, "choked", 6)) { |
| 993 | Sprintf(eos(linebuf), "choked on h%s food", |
| 994 | (t1->plgend[0] == 'F') ? "er" : "is"); |
| 995 | } else if (!strncmp(t1->death, "poisoned", 8)) { |
| 996 | Strcat(linebuf, "was poisoned"); |
| 997 | } else if (!strncmp(t1->death, "crushed", 7)) { |
| 998 | Strcat(linebuf, "was crushed to death"); |
| 999 | } else if (!strncmp(t1->death, "petrified by ", 13)) { |
| 1000 | Strcat(linebuf, "turned to stone"); |
| 1001 | } else |
| 1002 | Strcat(linebuf, "died"); |
no test coverage detected