| 1580 | } |
| 1581 | |
| 1582 | char * |
| 1583 | build_plselection_prompt( |
| 1584 | char *buf, int buflen, |
| 1585 | int rolenum, int racenum, int gendnum, int alignnum) |
| 1586 | { |
| 1587 | const char *defprompt = "Shall I pick a character for you? [ynaq] "; |
| 1588 | int num_post_attribs = 0; |
| 1589 | char tmpbuf[BUFSZ], *p; |
| 1590 | |
| 1591 | if (buflen < QBUFSZ) |
| 1592 | return (char *) defprompt; |
| 1593 | |
| 1594 | Strcpy(tmpbuf, "Shall I pick "); |
| 1595 | if (racenum != ROLE_NONE || validrole(rolenum)) |
| 1596 | Strcat(tmpbuf, "your "); |
| 1597 | else |
| 1598 | Strcat(tmpbuf, "a "); |
| 1599 | /* <your> */ |
| 1600 | |
| 1601 | (void) root_plselection_prompt(eos(tmpbuf), buflen - Strlen(tmpbuf), |
| 1602 | rolenum, racenum, gendnum, alignnum); |
| 1603 | /* "Shall I pick a character's role, race, gender, and alignment for you?" |
| 1604 | plus " [ynaq] (y)" is a little too long for a conventional 80 columns; |
| 1605 | also, "pick a character's <anything>" sounds a bit stilted */ |
| 1606 | strsubst(tmpbuf, "pick a character", "pick character"); |
| 1607 | Sprintf(buf, "%s", s_suffix(tmpbuf)); |
| 1608 | /* don't bother splitting caveman/cavewoman or priest/priestess |
| 1609 | in order to apply possessive suffix to both halves, but do |
| 1610 | change "priest/priestess'" to "priest/priestess's" */ |
| 1611 | if ((p = strstri(buf, "priest/priestess'")) != 0 |
| 1612 | && p[sizeof "priest/priestess'" - sizeof ""] == '\0') |
| 1613 | strkitten(buf, 's'); |
| 1614 | |
| 1615 | /* buf should now be: |
| 1616 | * <your lawful female gnomish cavewoman's> |
| 1617 | * || <your lawful female gnome's> |
| 1618 | * || <your lawful female character's> |
| 1619 | * |
| 1620 | * Now append the post attributes to it |
| 1621 | */ |
| 1622 | num_post_attribs = gr.role_post_attribs; |
| 1623 | if (!num_post_attribs) { |
| 1624 | /* some constraints might have been mutually exclusive, in which case |
| 1625 | some prompting that would have been omitted is needed after all */ |
| 1626 | if (flags.initrole == ROLE_NONE && !gr.role_pa[BP_ROLE]) |
| 1627 | gr.role_pa[BP_ROLE] = ++gr.role_post_attribs; |
| 1628 | if (flags.initrace == ROLE_NONE && !gr.role_pa[BP_RACE]) |
| 1629 | gr.role_pa[BP_RACE] = ++gr.role_post_attribs; |
| 1630 | if (flags.initalign == ROLE_NONE && !gr.role_pa[BP_ALIGN]) |
| 1631 | gr.role_pa[BP_ALIGN] = ++gr.role_post_attribs; |
| 1632 | if (flags.initgend == ROLE_NONE && !gr.role_pa[BP_GEND]) |
| 1633 | gr.role_pa[BP_GEND] = ++gr.role_post_attribs; |
| 1634 | num_post_attribs = gr.role_post_attribs; |
| 1635 | } |
| 1636 | if (num_post_attribs) { |
| 1637 | if (gr.role_pa[BP_RACE]) { |
| 1638 | (void) promptsep(eos(buf), num_post_attribs); |
| 1639 | Strcat(buf, "race"); |
no test coverage detected