… | |
… | |
814 | case 5: /*gods */ |
814 | case 5: /*gods */ |
815 | name = gods_book_name[rndm (array_length (gods_book_name))]; |
815 | name = gods_book_name[rndm (array_length (gods_book_name))]; |
816 | break; |
816 | break; |
817 | case 6: /*msg file */ |
817 | case 6: /*msg file */ |
818 | default: |
818 | default: |
819 | if (book->weight > 2000) |
819 | name = book->weight > 2000 /* based on weight */ |
820 | { /* based on weight */ |
|
|
821 | name = heavy_book_name[rndm (array_length (heavy_book_name))]; |
820 | ? heavy_book_name [rndm (array_length (heavy_book_name))] |
822 | } |
|
|
823 | else if (book->weight < 2001) |
|
|
824 | { |
|
|
825 | name = light_book_name[rndm (array_length (light_book_name))]; |
821 | : light_book_name [rndm (array_length (light_book_name))]; |
826 | } |
|
|
827 | break; |
822 | break; |
828 | } |
823 | } |
829 | |
824 | |
830 | book->name = name; |
825 | book->name = name; |
831 | } |
826 | } |
832 | |
827 | |
833 | /* add_book_author() |
828 | /* add_book_author() |
834 | * A lot like new_text_name above, but instead chooses an author |
829 | * A lot like new_text_name above, but instead chooses an author |
835 | * and sets op->title to that value |
830 | * and sets op->title to that value |
836 | */ |
831 | */ |
837 | |
832 | |
838 | static void |
833 | static void |
… | |
… | |
1676 | buf << "[Unfortunately the rest of the information is hopelessly garbled!]"; |
1671 | buf << "[Unfortunately the rest of the information is hopelessly garbled!]"; |
1677 | |
1672 | |
1678 | return buf; |
1673 | return buf; |
1679 | } |
1674 | } |
1680 | |
1675 | |
1681 | /* tailor_readable_ob()- The main routine. This chooses a random |
1676 | /* tailor_readable_ob()- The main routine. This chooses a random |
1682 | * message to put in given readable object (type==BOOK) which will |
1677 | * message to put in given readable object (type==BOOK) which will |
1683 | * be referred hereafter as a 'book'. We use the book level to de- |
1678 | * be referred hereafter as a 'book'. We use the book level to de- |
1684 | * termine the value of the information we will insert. Higher |
1679 | * termine the value of the information we will insert. Higher |
1685 | * values mean the book will (generally) have better/more info. |
1680 | * values mean the book will (generally) have better/more info. |
1686 | * See individual cases as to how this will be utilized. |
1681 | * See individual cases as to how this will be utilized. |
1687 | * "Book" name/content length are based on the weight of the |
1682 | * "Book" name/content length are based on the weight of the |
1688 | * document. If the value of msg_type is negative, we will randomly |
1683 | * document. If the value of msg_type is negative, we will randomly |
1689 | * choose the kind of message to generate. |
1684 | * choose the kind of message to generate. |
1690 | * -b.t. thomas@astro.psu.edu |
1685 | * -b.t. thomas@astro.psu.edu |
1691 | * |
1686 | * |
1692 | * book is the object we are creating into. |
1687 | * book is the object we are creating into. |
1693 | * If msg_type is a positive value, we use that to determine the |
1688 | * If msg_type is a positive value, we use that to determine the |
1694 | * message type - otherwise a random value is used. |
1689 | * message type - otherwise a random value is used. |