figure out canonical novel title from player-specified one */
| 1624 | |
| 1625 | /* figure out canonical novel title from player-specified one */ |
| 1626 | const char * |
| 1627 | lookup_novel(const char *lookname, int *idx) |
| 1628 | { |
| 1629 | int k; |
| 1630 | |
| 1631 | /* |
| 1632 | * Accept variant spellings: |
| 1633 | * _The_Colour_of_Magic_ uses British spelling, and American |
| 1634 | * editions keep that, but we also recognize American spelling; |
| 1635 | * _Sourcery_ is a joke rather than British spelling of "sorcery". |
| 1636 | */ |
| 1637 | if (!strcmpi(The(lookname), "The Color of Magic")) |
| 1638 | lookname = sir_Terry_novels[NVL_COLOUR_OF_MAGIC]; |
| 1639 | else if (!strcmpi(lookname, "Sorcery")) |
| 1640 | lookname = sir_Terry_novels[NVL_SOURCERY]; |
| 1641 | else if (!strcmpi(lookname, "Masquerade")) |
| 1642 | lookname = sir_Terry_novels[NVL_MASKERADE]; |
| 1643 | else if (!strcmpi(The(lookname), "The Amazing Maurice")) |
| 1644 | lookname = sir_Terry_novels[NVL_AMAZING_MAURICE]; |
| 1645 | else if (!strcmpi(lookname, "Thud")) |
| 1646 | lookname = sir_Terry_novels[NVL_THUD]; |
| 1647 | |
| 1648 | for (k = 0; k < SIZE(sir_Terry_novels); ++k) { |
| 1649 | if (!strcmpi(lookname, sir_Terry_novels[k]) |
| 1650 | || !strcmpi(The(lookname), sir_Terry_novels[k])) { |
| 1651 | if (idx) |
| 1652 | *idx = k; |
| 1653 | return sir_Terry_novels[k]; |
| 1654 | } |
| 1655 | } |
| 1656 | /* name not found; if novelidx is already set, override the name */ |
| 1657 | if (idx && IndexOk(*idx, sir_Terry_novels)) |
| 1658 | return sir_Terry_novels[*idx]; |
| 1659 | |
| 1660 | return (const char *) 0; |
| 1661 | } |
| 1662 | |
| 1663 | /*do_name.c*/ |
no test coverage detected