… | |
… | |
1440 | * of a randomly selected alchemical formula. |
1440 | * of a randomly selected alchemical formula. |
1441 | */ |
1441 | */ |
1442 | static void |
1442 | static void |
1443 | make_formula_book (object *book, int level) |
1443 | make_formula_book (object *book, int level) |
1444 | { |
1444 | { |
1445 | char retbuf[BOOK_BUF], title[MAX_BUF]; |
1445 | char title[MAX_BUF]; |
1446 | recipelist *fl; |
1446 | recipelist *fl; |
1447 | recipe *formula = NULL; |
1447 | recipe *formula = NULL; |
1448 | int chance; |
1448 | int chance; |
|
|
1449 | |
|
|
1450 | static dynbuf_text buf; buf.clear (); |
1449 | |
1451 | |
1450 | /* the higher the book level, the more complex (ie number of |
1452 | /* the higher the book level, the more complex (ie number of |
1451 | * ingredients) the formula can be. |
1453 | * ingredients) the formula can be. |
1452 | */ |
1454 | */ |
1453 | fl = get_formulalist (rndm (level) / 3 + 1); |
1455 | fl = get_formulalist (rndm (level) / 3 + 1); |
… | |
… | |
1466 | /* get a random formula, weighted by its bookchance */ |
1468 | /* get a random formula, weighted by its bookchance */ |
1467 | chance = rndm (fl->total_chance); |
1469 | chance = rndm (fl->total_chance); |
1468 | for (formula = fl->items; formula; formula = formula->next) |
1470 | for (formula = fl->items; formula; formula = formula->next) |
1469 | { |
1471 | { |
1470 | chance -= formula->chance; |
1472 | chance -= formula->chance; |
|
|
1473 | |
1471 | if (chance <= 0) |
1474 | if (chance <= 0) |
1472 | break; |
1475 | break; |
1473 | } |
1476 | } |
1474 | |
1477 | |
1475 | if (!formula || formula->arch_names <= 0) |
1478 | if (!formula || formula->arch_names <= 0) |
1476 | { |
1479 | { |
1477 | book->msg = "<indecipherable text>\n"; |
1480 | book->msg = "<indecipherable text>\n"; |
1478 | new_text_name (book, 4); |
1481 | new_text_name (book, 4); |
1479 | add_author (book, 4); |
1482 | add_author (book, 4); |
1480 | |
1483 | return; |
1481 | } |
1484 | } |
|
|
1485 | |
|
|
1486 | /* looks like a formula was found. Base the amount |
|
|
1487 | * of information on the booklevel and the spellevel |
|
|
1488 | * of the formula. */ |
|
|
1489 | |
|
|
1490 | const char *op_name = formula->arch_name [rndm (formula->arch_names)]; |
|
|
1491 | archetype *at; |
|
|
1492 | |
|
|
1493 | /* preamble */ |
|
|
1494 | buf << "Herein is described a project using B<< " |
|
|
1495 | << (formula->skill ? &formula->skill : "an unknown skill") |
|
|
1496 | << " >>:\n\n"; |
|
|
1497 | |
|
|
1498 | if ((at = archetype::find (op_name))) |
|
|
1499 | op_name = at->object::name; |
1482 | else |
1500 | else |
|
|
1501 | LOG (llevError, "formula_msg() can't find arch %s for formula.\n", op_name); |
|
|
1502 | |
|
|
1503 | /* item name */ |
|
|
1504 | if (formula->title != shstr_NONE) |
|
|
1505 | { |
|
|
1506 | buf.printf ("The B<< %s of %s >>", op_name, &formula->title); |
|
|
1507 | /* This results in things like pile of philo. sulfur. |
|
|
1508 | * while philo. sulfur may look better, without this, |
|
|
1509 | * you get things like 'the wise' because its missing the |
|
|
1510 | * water of section. |
|
|
1511 | */ |
|
|
1512 | sprintf (title, "%s: %s of %s", |
|
|
1513 | formula_book_name [rndm (sizeof (formula_book_name) / sizeof (char *))], op_name, &formula->title); |
1483 | { |
1514 | } |
1484 | /* looks like a formula was found. Base the amount |
1515 | else |
1485 | * of information on the booklevel and the spellevel |
1516 | { |
1486 | * of the formula. */ |
1517 | buf << "The B<< " << op_name; |
1487 | |
1518 | |
1488 | const char *op_name = formula->arch_name [rndm (formula->arch_names)]; |
1519 | sprintf (title, "%s: %s", formula_book_name [rndm (sizeof (formula_book_name) / sizeof (char *))], op_name); |
|
|
1520 | if (at->title) |
|
|
1521 | { |
|
|
1522 | buf << " " << at->title; |
|
|
1523 | strcat (title, " "); |
|
|
1524 | strcat (title, at->title); |
|
|
1525 | } |
|
|
1526 | |
|
|
1527 | buf << " >>"; |
|
|
1528 | } |
|
|
1529 | |
|
|
1530 | /* Lets name the book something meaningful ! */ |
|
|
1531 | book->name = title; |
|
|
1532 | book->title = NULL; |
|
|
1533 | |
|
|
1534 | /* ingredients to make it */ |
|
|
1535 | if (formula->ingred) |
|
|
1536 | { |
|
|
1537 | linked_char *next; |
1489 | archetype *at; |
1538 | archetype *at; |
1490 | |
1539 | |
1491 | /* preamble */ |
|
|
1492 | sprintf (retbuf, "Herein is described a project using %s: \n", formula->skill ? &formula->skill : "an unknown skill"); |
|
|
1493 | |
|
|
1494 | if ((at = archetype::find (op_name)) != (archetype *) NULL) |
|
|
1495 | op_name = at->object::name; |
|
|
1496 | else |
|
|
1497 | LOG (llevError, "formula_msg() can't find arch %s for formula.\n", op_name); |
|
|
1498 | |
|
|
1499 | /* item name */ |
|
|
1500 | if (formula->title != shstr_NONE) |
|
|
1501 | { |
|
|
1502 | sprintf (retbuf, "%sThe %s of %s", retbuf, op_name, &formula->title); |
|
|
1503 | /* This results in things like pile of philo. sulfur. |
|
|
1504 | * while philo. sulfur may look better, without this, |
|
|
1505 | * you get things like 'the wise' because its missing the |
|
|
1506 | * water of section. |
|
|
1507 | */ |
|
|
1508 | sprintf (title, "%s: %s of %s", |
|
|
1509 | formula_book_name [rndm (sizeof (formula_book_name) / sizeof (char *))], op_name, &formula->title); |
|
|
1510 | } |
|
|
1511 | else |
|
|
1512 | { |
|
|
1513 | sprintf (retbuf, "%sThe %s", retbuf, op_name); |
|
|
1514 | sprintf (title, "%s: %s", formula_book_name [rndm (sizeof (formula_book_name) / sizeof (char *))], op_name); |
|
|
1515 | if (at->title) |
|
|
1516 | { |
|
|
1517 | strcat (retbuf, " "); |
|
|
1518 | strcat (retbuf, at->title); |
|
|
1519 | strcat (title, " "); |
|
|
1520 | strcat (title, at->title); |
|
|
1521 | } |
|
|
1522 | } |
|
|
1523 | |
|
|
1524 | /* Lets name the book something meaningful ! */ |
|
|
1525 | book->name = title; |
|
|
1526 | book->title = NULL; |
|
|
1527 | |
|
|
1528 | /* ingredients to make it */ |
|
|
1529 | if (formula->ingred != NULL) |
|
|
1530 | { |
|
|
1531 | linked_char *next; |
|
|
1532 | archetype *at; |
|
|
1533 | |
|
|
1534 | at = archetype::find (formula->cauldron); |
1540 | at = archetype::find (formula->cauldron); |
1535 | |
1541 | |
1536 | sprintf (retbuf + strlen (retbuf), |
1542 | buf.printf (" may be made at %s using the following ingredients:\n\n", |
1537 | " may be made at %s using the following ingredients:\n", at ? query_name (at) : "an unknown place"); |
1543 | at ? query_name (at) : "an appropriate place"); |
1538 | |
1544 | |
1539 | for (next = formula->ingred; next != NULL; next = next->next) |
1545 | for (next = formula->ingred; next; next = next->next) |
1540 | { |
1546 | buf << next->name << '\r'; |
1541 | strcat (retbuf, next->name); |
1547 | } |
1542 | strcat (retbuf, "\n"); |
|
|
1543 | } |
|
|
1544 | } |
|
|
1545 | else |
1548 | else |
1546 | LOG (llevError, "formula_msg() no ingredient list for object %s of %s\n", op_name, &formula->title); |
1549 | LOG (llevError, "formula_msg() no ingredient list for object %s of %s\n", op_name, &formula->title); |
1547 | if (retbuf[strlen (retbuf) - 1] != '\n') |
|
|
1548 | strcat (retbuf, "\n"); |
|
|
1549 | |
1550 | |
1550 | book->msg = retbuf; |
1551 | book->msg = buf; |
1551 | } |
|
|
1552 | } |
1552 | } |
1553 | |
1553 | |
1554 | #define DESCRIBE_PATH(retbuf, variable, name) \ |
1554 | #define DESCRIBE_PATH(retbuf, variable, name) \ |
1555 | if(variable) { \ |
1555 | if(variable) { \ |
1556 | int i,j=0; \ |
1556 | int i,j=0; \ |
… | |
… | |
1570 | * of a random god. Used by the book hack. b.t. |
1570 | * of a random god. Used by the book hack. b.t. |
1571 | */ |
1571 | */ |
1572 | static const char * |
1572 | static const char * |
1573 | god_info_msg (int level, int booksize) |
1573 | god_info_msg (int level, int booksize) |
1574 | { |
1574 | { |
1575 | static char retbuf[BOOK_BUF]; |
|
|
1576 | const char *name = NULL; |
1575 | const char *name = NULL; |
1577 | char buf[BOOK_BUF]; |
|
|
1578 | int i; |
|
|
1579 | size_t introlen; |
|
|
1580 | object *god = pntr_to_god_obj (get_rand_god ()); |
1576 | object *god = pntr_to_god_obj (get_rand_god ()); |
1581 | |
1577 | |
|
|
1578 | static dynbuf_text buf; buf.clear (); |
|
|
1579 | |
1582 | if (!god) |
1580 | if (!god) |
1583 | return (char *) NULL; /* oops, problems... */ |
1581 | return 0; /* oops, problems... */ |
|
|
1582 | |
1584 | name = god->name; |
1583 | name = god->name; |
1585 | |
1584 | |
1586 | /* preamble.. */ |
1585 | /* preamble.. */ |
1587 | sprintf (retbuf, "This document contains knowledge concerning\n"); |
1586 | buf << "This document contains knowledge concerning the diety B<< " |
1588 | sprintf (retbuf, "%sthe diety %s", retbuf, name); |
1587 | << name << " >>"; |
1589 | |
1588 | |
1590 | /* Always have as default information the god's descriptive terms. */ |
1589 | /* Always have as default information the god's descriptive terms. */ |
1591 | if (nstrtok (god->msg, ",") > 0) |
1590 | if (nstrtok (god->msg, ",") > 0) |
1592 | { |
1591 | buf << ", known as" << strtoktolin (god->msg, ","); |
1593 | strcat (retbuf, ", known as"); |
|
|
1594 | strcat (retbuf, strtoktolin (god->msg, ",")); |
|
|
1595 | } |
|
|
1596 | else |
1592 | else |
1597 | strcat (retbuf, "..."); |
1593 | buf << "..."; |
1598 | |
1594 | |
1599 | strcat (retbuf, "\n ---\n"); |
1595 | buf << "\n\n"; |
|
|
1596 | |
1600 | introlen = strlen (retbuf); /* so we will know if no new info is added later */ |
1597 | int introlen = buf.size (); /* so we will know if no new info is added later */ |
1601 | |
1598 | |
1602 | /* Information about the god is random, and based on the level of the |
1599 | /* Information about the god is random, and based on the level of the |
1603 | * 'book'. Probably there is a more intellegent way to implement |
1600 | * 'book'. Probably there is a more intellegent way to implement |
1604 | * this ... |
1601 | * this ... |
1605 | */ |
1602 | */ |
1606 | while (level > 0) |
1603 | while (level > 0 && buf.size () < BOOK_BUF) |
1607 | { |
1604 | { |
1608 | sprintf (buf, " "); |
|
|
1609 | if (level == 2 && rndm (2)) |
1605 | if (level == 2 && rndm (2)) |
1610 | { /* enemy god */ |
1606 | { /* enemy god */ |
1611 | const char *enemy = god->title; |
1607 | const char *enemy = god->title; |
1612 | |
1608 | |
1613 | if (enemy) |
1609 | if (enemy) |
1614 | sprintf (buf, "The gods %s and %s are enemies.\n ---\n", name, enemy); |
1610 | buf.printf ("The gods %s and %s are enemies.\r", name, enemy); |
1615 | } |
1611 | } |
1616 | |
1612 | |
1617 | if (level == 3 && rndm (2)) |
1613 | if (level == 3 && rndm (2)) |
1618 | { /* enemy race, what the god's holy word effects */ |
1614 | { /* enemy race, what the god's holy word effects */ |
1619 | const char *enemy = god->slaying; |
1615 | const char *enemy = god->slaying; |
|
|
1616 | int i; |
1620 | |
1617 | |
1621 | if (enemy && !(god->path_denied & PATH_TURNING)) |
1618 | if (enemy && !(god->path_denied & PATH_TURNING)) |
1622 | if ((i = nstrtok (enemy, ",")) > 0) |
1619 | if ((i = nstrtok (enemy, ",")) > 0) |
1623 | { |
1620 | { |
1624 | char tmpbuf[MAX_BUF]; |
1621 | char tmpbuf[MAX_BUF]; |
1625 | |
1622 | |
1626 | sprintf (buf, "The holy words of %s have the power to\n", name); |
1623 | buf << "The holy words of " << name |
1627 | strcat (buf, "slay creatures belonging to the "); |
1624 | << " have the power to slay creatures belonging to the "; |
|
|
1625 | |
1628 | if (i > 1) |
1626 | if (i > 1) |
1629 | sprintf (tmpbuf, "following \n races:%s", strtoktolin (enemy, ",")); |
1627 | buf << "following races:" << strtoktolin (enemy, ","); |
1630 | else |
1628 | else |
1631 | sprintf (tmpbuf, "race of%s", strtoktolin (enemy, ",")); |
1629 | buf << "race of" << strtoktolin (enemy, ","); |
1632 | sprintf (buf, "%s%s\n ---\n", buf, tmpbuf); |
1630 | |
|
|
1631 | buf << '\r'; |
1633 | } |
1632 | } |
1634 | } |
1633 | } |
1635 | |
1634 | |
1636 | if (level == 4 && rndm (2)) |
1635 | if (level == 4 && rndm (2)) |
1637 | { /* Priest of god gets these protect,vulnerable... */ |
1636 | { /* Priest of god gets these protect,vulnerable... */ |
1638 | char tmpbuf[MAX_BUF]; |
|
|
1639 | |
|
|
1640 | if (const char *cp = describe_resistance (god, 1)) |
1637 | if (const char *cp = describe_resistance (god, 1)) |
1641 | { /* This god does have protections */ |
1638 | { /* This god does have protections */ |
1642 | sprintf (tmpbuf, "%s has a potent aura which is extended\n", name); |
1639 | buf << name |
|
|
1640 | << " has a potent aura which is extended to" |
1643 | strcat (tmpbuf, "faithful priests. The effects of this aura include:\n"); |
1641 | " faithful priests. The effects of this aura include: " |
1644 | strcat (tmpbuf, cp); |
1642 | << cp |
1645 | strcat (buf, tmpbuf); |
1643 | << ".\r"; |
1646 | strcat (buf, "\n ---\n"); |
|
|
1647 | } |
1644 | } |
1648 | else |
|
|
1649 | sprintf (buf, " "); |
|
|
1650 | } |
1645 | } |
1651 | |
1646 | |
1652 | if (level == 5 && rndm (2)) |
1647 | if (level == 5 && rndm (2)) |
1653 | { /* aligned race, summoning */ |
1648 | { /* aligned race, summoning */ |
1654 | const char *race = god->race; /* aligned race */ |
1649 | const char *race = god->race; /* aligned race */ |
|
|
1650 | int i; |
1655 | |
1651 | |
1656 | if (race && !(god->path_denied & PATH_SUMMON)) |
1652 | if (race && !(god->path_denied & PATH_SUMMON)) |
1657 | if ((i = nstrtok (race, ",")) > 0) |
1653 | if ((i = nstrtok (race, ",")) > 0) |
1658 | { |
1654 | { |
1659 | char tmpbuf[MAX_BUF]; |
1655 | buf << "Creatures sacred to " << name << " include the "; |
1660 | |
|
|
1661 | sprintf (buf, "Creatures sacred to %s include the \n", name); |
|
|
1662 | if (i > 1) |
1656 | if (i > 1) |
1663 | sprintf (tmpbuf, "following \n races:%s", strtoktolin (race, ",")); |
1657 | buf << "following races:" << strtoktolin (race, ","); |
1664 | else |
1658 | else |
1665 | sprintf (tmpbuf, "race of%s", strtoktolin (race, ",")); |
1659 | buf << "race of" << strtoktolin (race, ","); |
1666 | sprintf (buf, "%s%s\n ---\n", buf, tmpbuf); |
1660 | |
|
|
1661 | buf << '\r'; |
1667 | } |
1662 | } |
1668 | } |
1663 | } |
1669 | |
1664 | |
1670 | if (level == 6 && rndm (2)) |
1665 | if (level == 6 && rndm (2)) |
1671 | { /* blessing,curse properties of the god */ |
1666 | { /* blessing,curse properties of the god */ |
1672 | char tmpbuf[MAX_BUF]; |
|
|
1673 | |
|
|
1674 | if (const char *cp = describe_resistance (god, 1)) |
1667 | if (const char *cp = describe_resistance (god, 1)) |
1675 | { /* This god does have protections */ |
1668 | { /* This god does have protections */ |
1676 | sprintf (tmpbuf, "\nThe priests of %s are known to be able to \n", name); |
1669 | buf << "The priests of " << name |
|
|
1670 | << " are known to be able to " |
1677 | strcat (tmpbuf, "bestow a blessing which makes the recipient\n"); |
1671 | "bestow a blessing which makes the recipient " |
1678 | strcat (tmpbuf, cp); |
1672 | << cp |
1679 | strcat (buf, tmpbuf); |
1673 | << '\r'; |
1680 | strcat (buf, "\n ---\n"); |
|
|
1681 | } |
1674 | } |
1682 | else |
|
|
1683 | sprintf (buf, " "); |
|
|
1684 | |
|
|
1685 | } |
1675 | } |
1686 | |
1676 | |
1687 | if (level == 8 && rndm (2)) |
1677 | if (level == 8 && rndm (2)) |
1688 | { /* immunity, holy possession */ |
1678 | { /* immunity, holy possession */ |
1689 | int has_effect = 0, tmpvar; |
1679 | buf << "The priests of " << name |
1690 | char tmpbuf[MAX_BUF]; |
1680 | << " are known to make cast a mighty" |
|
|
1681 | " prayer of possession"; |
|
|
1682 | |
|
|
1683 | int first = 1; |
1691 | |
1684 | |
1692 | sprintf (tmpbuf, "\n"); |
|
|
1693 | sprintf (tmpbuf, "The priests of %s are known to make cast a mighty \n", name); |
|
|
1694 | |
|
|
1695 | strcat (tmpbuf, "prayer of possession which gives the recipient\n"); |
|
|
1696 | |
|
|
1697 | for (tmpvar = 0; tmpvar < NROFATTACKS; tmpvar++) |
1685 | for (int i = 0; i < NROFATTACKS; i++) |
|
|
1686 | if (god->resist[i] == 100) |
1698 | { |
1687 | { |
1699 | if (god->resist[tmpvar] == 100) |
1688 | if (first) |
1700 | { |
1689 | { |
|
|
1690 | buf << " which gives the recipient"; |
1701 | has_effect = 1; |
1691 | first = 0; |
1702 | sprintf (tmpbuf + strlen (tmpbuf), "Immunity to %s", attacktype_desc[tmpvar]); |
|
|
1703 | } |
1692 | } |
|
|
1693 | else |
|
|
1694 | buf << ", "; |
|
|
1695 | |
|
|
1696 | buf << " immunity to " << attacktype_desc[i]; |
1704 | } |
1697 | } |
1705 | |
1698 | |
1706 | if (has_effect) |
1699 | buf << ".\r"; |
1707 | { |
|
|
1708 | strcat (buf, tmpbuf); |
|
|
1709 | strcat (buf, "\n ---\n"); |
|
|
1710 | } |
|
|
1711 | else |
|
|
1712 | sprintf (buf, " "); |
|
|
1713 | } |
1700 | } |
1714 | |
1701 | |
1715 | if (level == 12 && rndm (2)) |
1702 | if (level == 12 && rndm (2)) |
1716 | { /* spell paths */ |
1703 | { /* spell paths */ |
|
|
1704 | //TODO: |
1717 | int has_effect = 0, tmpvar; |
1705 | int has_effect = 0, tmpvar; |
1718 | char tmpbuf[MAX_BUF]; |
1706 | char tmpbuf[MAX_BUF]; |
1719 | |
1707 | |
1720 | sprintf (tmpbuf, "\n"); |
1708 | sprintf (tmpbuf, "\n"); |
1721 | sprintf (tmpbuf, "It is rarely known fact that the priests of %s\n", name); |
1709 | sprintf (tmpbuf, "It is rarely known fact that the priests of %s\n", name); |
… | |
… | |
1738 | has_effect = 1; |
1726 | has_effect = 1; |
1739 | DESCRIBE_PATH (tmpbuf, tmpvar, "Denied"); |
1727 | DESCRIBE_PATH (tmpbuf, tmpvar, "Denied"); |
1740 | } |
1728 | } |
1741 | |
1729 | |
1742 | if (has_effect) |
1730 | if (has_effect) |
1743 | { |
1731 | buf << tmpbuf << '\r'; |
1744 | strcat (buf, tmpbuf); |
|
|
1745 | strcat (buf, "\n ---\n"); |
|
|
1746 | } |
|
|
1747 | else |
1732 | else |
1748 | sprintf (buf, " "); |
1733 | buf << '\r'; |
1749 | } |
1734 | } |
1750 | |
1735 | |
1751 | /* check to be sure new buffer size dont exceed either |
|
|
1752 | * the maximum buffer size, or the 'natural' size of the |
|
|
1753 | * book... |
|
|
1754 | */ |
|
|
1755 | if (book_overflow (retbuf, buf, booksize)) |
|
|
1756 | break; |
|
|
1757 | else if (strlen (buf) > 1) |
|
|
1758 | strcat (retbuf, buf); |
|
|
1759 | |
|
|
1760 | level--; |
1736 | level--; |
1761 | } |
1737 | } |
1762 | |
1738 | |
1763 | if (strlen (retbuf) == introlen) |
1739 | if (buf.size () == introlen) |
1764 | { /* we got no information beyond the preamble! */ |
1740 | /* we got no information beyond the preamble! */ |
1765 | strcat (retbuf, " [Unfortunately the rest of the information is\n"); |
1741 | buf << "[Unfortunately the rest of the information is hopelessly garbled!]"; |
1766 | strcat (retbuf, " hopelessly garbled!]\n ---\n"); |
1742 | |
1767 | } |
|
|
1768 | #ifdef BOOK_MSG_DEBUG |
|
|
1769 | LOG (llevDebug, "\n god_info_msg() created string: %d\n", strlen (retbuf)); |
|
|
1770 | LOG (llevDebug, " MADE THIS:\n%s", retbuf); |
|
|
1771 | #endif |
|
|
1772 | return retbuf; |
1743 | return buf; |
1773 | } |
1744 | } |
1774 | |
1745 | |
1775 | /* tailor_readable_ob()- The main routine. This chooses a random |
1746 | /* tailor_readable_ob()- The main routine. This chooses a random |
1776 | * message to put in given readable object (type==BOOK) which will |
1747 | * message to put in given readable object (type==BOOK) which will |
1777 | * be referred hereafter as a 'book'. We use the book level to de- |
1748 | * be referred hereafter as a 'book'. We use the book level to de- |
… | |
… | |
1815 | * 3) make sure there are entries for your case in new_text_title() |
1786 | * 3) make sure there are entries for your case in new_text_title() |
1816 | * and add_authour(). |
1787 | * and add_authour(). |
1817 | * 4) you may want separate authour/book name arrays in read.h |
1788 | * 4) you may want separate authour/book name arrays in read.h |
1818 | */ |
1789 | */ |
1819 | msg_type = msg_type > 0 ? msg_type : rndm (8); |
1790 | msg_type = msg_type > 0 ? msg_type : rndm (8); |
1820 | switch (msg_type*0+2)//D |
1791 | switch (msg_type) |
1821 | { |
1792 | { |
1822 | case 1: /* monster attrib */ |
1793 | case 1: /* monster attrib */ |
1823 | strcpy (msgbuf, mon_info_msg (level, book_buf_size)); |
1794 | strcpy (msgbuf, mon_info_msg (level, book_buf_size)); |
1824 | break; |
1795 | break; |
1825 | case 2: /* artifact attrib */ |
1796 | case 2: /* artifact attrib */ |
… | |
… | |
1830 | break; |
1801 | break; |
1831 | case 4: /* describe an alchemy formula */ |
1802 | case 4: /* describe an alchemy formula */ |
1832 | make_formula_book (book, level); |
1803 | make_formula_book (book, level); |
1833 | /* make_formula_book already gives title */ |
1804 | /* make_formula_book already gives title */ |
1834 | return; |
1805 | return; |
1835 | break; |
|
|
1836 | case 5: /* bits of information about a god */ |
1806 | case 5: /* bits of information about a god */ |
1837 | strcpy (msgbuf, god_info_msg (level, book_buf_size)); |
1807 | strcpy (msgbuf, god_info_msg (level, book_buf_size)); |
1838 | break; |
1808 | break; |
1839 | case 0: /* use info list in lib/ */ |
1809 | case 0: /* use info list in lib/ */ |
1840 | default: |
1810 | default: |
1841 | cfperl_make_book (book, level); |
1811 | cfperl_make_book (book, level); |
|
|
1812 | /* already gives title */ |
1842 | return; |
1813 | return; |
1843 | } |
1814 | } |
1844 | |
|
|
1845 | strcat (msgbuf, "\n"); /* safety -- we get ugly map saves/crashes w/o this */ |
|
|
1846 | |
1815 | |
1847 | if (strlen (msgbuf) > 1) |
1816 | if (strlen (msgbuf) > 1) |
1848 | { |
1817 | { |
1849 | book->msg = msgbuf; |
1818 | book->msg = msgbuf; |
1850 | /* lets give the "book" a new name, which may be a compound word */ |
1819 | /* lets give the "book" a new name, which may be a compound word */ |
… | |
… | |
1867 | linked_char *lmsg, *nextmsg; |
1836 | linked_char *lmsg, *nextmsg; |
1868 | objectlink *monlink, *nextmon; |
1837 | objectlink *monlink, *nextmon; |
1869 | |
1838 | |
1870 | LOG (llevDebug, "freeing all book information\n"); |
1839 | LOG (llevDebug, "freeing all book information\n"); |
1871 | |
1840 | |
1872 | for (tlist = booklist; tlist != NULL; tlist = tnext) |
1841 | for (tlist = booklist; tlist; tlist = tnext) |
1873 | { |
1842 | { |
1874 | tnext = tlist->next; |
1843 | tnext = tlist->next; |
1875 | |
1844 | |
1876 | for (title1 = tlist->first_book; title1; title1 = titlenext) |
1845 | for (title1 = tlist->first_book; title1; title1 = titlenext) |
1877 | { |
1846 | { |