"cause" of death (rather than "method")

buffer size isue on levelup text
fix pluralisation of single-word objects (eg "leaf")
This commit is contained in:
rob 2022-08-30 19:21:52 +10:00
parent 88f66bb4a7
commit 6199c829bb
3 changed files with 9 additions and 3 deletions

2
io.c
View File

@ -15413,7 +15413,7 @@ void tombstone(lifeform_t *lf) {
wattroff(mainwin, A_BOLD); wattroff(mainwin, A_BOLD);
wattron(mainwin, A_BOLD); wattron(mainwin, A_BOLD);
mvwprintw(mainwin, y, 0, HISCOREFORMAT, "Pos", "Score", "Name", "Job"); mvwprintw(mainwin, y, 0, HISCOREFORMAT, "Pos", "Score", "Name", "Job");
wprintw(mainwin, "Method of death"); y++; wprintw(mainwin, "Cause of death"); y++;
wmove(mainwin, y, 0); wmove(mainwin, y, 0);
wattroff(mainwin, A_BOLD); wattroff(mainwin, A_BOLD);

2
lf.c
View File

@ -5783,7 +5783,7 @@ void enhanceskills(lifeform_t *lf) {
for (i = 0; i < nposs; i++) { for (i = 0; i < nposs; i++) {
char this[2]; char this[2];
snprintf(this, 1, "%c", getattrletter(poss[i])); snprintf(this, 2, "%c", getattrletter(poss[i]));
if (isalpha(this[0])) { if (isalpha(this[0])) {
if (i == 0) { if (i == 0) {
snprintf(ques, BUFLEN, "Increase your %s", getattrname(poss[i])); snprintf(ques, BUFLEN, "Increase your %s", getattrname(poss[i]));

8
text.c
View File

@ -2373,7 +2373,9 @@ char *makeplural(char **text) {
len = strlen(*text); len = strlen(*text);
assert(len > 0); assert(len > 0);
newtext = strdup(*text); // make copy //newtext = strdup(*text); // make copy
// make copy with trailing space
asprintf(&newtext, "%s ", *text);
for (pl = firstplural ; pl ; pl = pl->next) { for (pl = firstplural ; pl ; pl = pl->next) {
strrep(&newtext, pl->singular, pl->plural, &rv); strrep(&newtext, pl->singular, pl->plural, &rv);
@ -2382,6 +2384,10 @@ char *makeplural(char **text) {
break; break;
} }
} }
// now remove trailing space
if ( newtext[strlen(newtext)-1] == ' ') {
newtext[strlen(newtext)-1] = '\0';
}
if (!done) { if (!done) {
// default // default