ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/common/readable.C
(Generate patch)

Comparing deliantra/server/common/readable.C (file contents):
Revision 1.62 by root, Sun May 1 16:58:15 2011 UTC vs.
Revision 1.66 by root, Mon Nov 12 03:14:32 2012 UTC

1/* 1/*
2 * This file is part of Deliantra, the Roguelike Realtime MMORPG. 2 * This file is part of Deliantra, the Roguelike Realtime MMORPG.
3 * 3 *
4 * Copyright (©) 2005,2006,2007,2008,2009,2010,2011 Marc Alexander Lehmann / Robin Redeker / the Deliantra team 4 * Copyright (©) 2005,2006,2007,2008,2009,2010,2011,2012 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
5 * Copyright (©) 2002 Mark Wedel & Crossfire Development Team 5 * Copyright (©) 2002 Mark Wedel & Crossfire Development Team
6 * Copyright (©) 1992 Frank Tore Johansen 6 * Copyright (©) 1992 Frank Tore Johansen
7 * 7 *
8 * Deliantra is free software: you can redistribute it and/or modify it under 8 * Deliantra is free software: you can redistribute it and/or modify it under
9 * the terms of the Affero GNU General Public License as published by the 9 * the terms of the Affero GNU General Public License as published by the
10 * Free Software Foundation, either version 3 of the License, or (at your 10 * Free Software Foundation, either version 3 of the License, or (at your
11 * option) any later version. 11 * option) any later version.
12 * 12 *
13 * This program is distributed in the hope that it will be useful, 13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details. 16 * GNU General Public License for more details.
17 * 17 *
18 * You should have received a copy of the Affero GNU General Public License 18 * You should have received a copy of the Affero GNU General Public License
19 * and the GNU General Public License along with this program. If not, see 19 * and the GNU General Public License along with this program. If not, see
20 * <http://www.gnu.org/licenses/>. 20 * <http://www.gnu.org/licenses/>.
21 * 21 *
22 * The authors can be reached via e-mail to <support@deliantra.net> 22 * The authors can be reached via e-mail to <support@deliantra.net>
23 */ 23 */
24 24
25/* This file contains code relevant to the BOOKS hack -- designed 25/* This file contains code relevant to the BOOKS hack -- designed
26 * to allow randomly occuring messages in non-magical texts. 26 * to allow randomly occuring messages in non-magical texts.
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
838static void 833static void
1335static char * 1330static char *
1336spellpath_msg (int level) 1331spellpath_msg (int level)
1337{ 1332{
1338 static dynbuf_text buf; buf.clear (); 1333 static dynbuf_text buf; buf.clear ();
1339 1334
1340 static char retbuf[BOOK_BUF];
1341 char tmpbuf[BOOK_BUF];
1342 int path = rndm (NRSPELLPATHS), prayers = rndm (2); 1335 int path = rndm (NRSPELLPATHS), prayers = rndm (2);
1343 uint32 pnum = (path == -1) ? PATH_NULL : spellpathdef[path]; 1336 uint32 pnum = (path == -1) ? PATH_NULL : spellpathdef[path];
1344 archetype *at; 1337 archetype *at;
1345 1338
1346 /* Preamble */ 1339 /* Preamble */
1678 buf << "[Unfortunately the rest of the information is hopelessly garbled!]"; 1671 buf << "[Unfortunately the rest of the information is hopelessly garbled!]";
1679 1672
1680 return buf; 1673 return buf;
1681} 1674}
1682 1675
1683/* tailor_readable_ob()- The main routine. This chooses a random 1676/* tailor_readable_ob()- The main routine. This chooses a random
1684 * message to put in given readable object (type==BOOK) which will 1677 * message to put in given readable object (type==BOOK) which will
1685 * 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-
1686 * termine the value of the information we will insert. Higher 1679 * termine the value of the information we will insert. Higher
1687 * values mean the book will (generally) have better/more info. 1680 * values mean the book will (generally) have better/more info.
1688 * See individual cases as to how this will be utilized. 1681 * See individual cases as to how this will be utilized.
1689 * "Book" name/content length are based on the weight of the 1682 * "Book" name/content length are based on the weight of the
1690 * 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
1691 * choose the kind of message to generate. 1684 * choose the kind of message to generate.
1692 * -b.t. thomas@astro.psu.edu 1685 * -b.t. thomas@astro.psu.edu
1693 * 1686 *
1694 * book is the object we are creating into. 1687 * book is the object we are creating into.
1695 * 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
1696 * message type - otherwise a random value is used. 1689 * message type - otherwise a random value is used.

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines