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.28 by root, Sun Jun 24 04:09:28 2007 UTC vs.
Revision 1.34 by root, Tue May 6 16:55:25 2008 UTC

1/* 1/*
2 * This file is part of Crossfire TRT, the Multiplayer Online Role Playing Game. 2 * This file is part of Deliantra, the Roguelike Realtime MMORPG.
3 * 3 *
4 * Copyright (©) 2005,2006,2007 Marc Alexander Lehmann / Robin Redeker / the Crossfire TRT team 4 * Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
5 * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team 5 * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team
6 * Copyright (©) 1992,2007 Frank Tore Johansen 6 * Copyright (©) 1992,2007 Frank Tore Johansen
7 * 7 *
8 * Crossfire TRT is free software; you can redistribute it and/or modify it 8 * Deliantra is free software: you can redistribute it and/or modify
9 * under the terms of the GNU General Public License as published by the Free 9 * it under the terms of the GNU General Public License as published by
10 * Software Foundation; either version 2 of the License, or (at your option) 10 * the Free Software Foundation, either version 3 of the License, or
11 * any later version. 11 * (at your option) any later version.
12 * 12 *
13 * This program is distributed in the hope that it will be useful, but 13 * This program is distributed in the hope that it will be useful,
14 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * for more details. 16 * GNU General Public License for more details.
17 * 17 *
18 * You should have received a copy of the GNU General Public License along 18 * You should have received a copy of the GNU General Public License
19 * with Crossfire TRT; if not, write to the Free Software Foundation, Inc. 51 19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 * 20 *
22 * The authors can be reached via e-mail to <crossfire@schmorp.de> 21 * The authors can be reached via e-mail to <support@deliantra.net>
23 */ 22 */
24 23
25/* This file contains code relevant to the BOOKS hack -- designed 24/* This file contains code relevant to the BOOKS hack -- designed
26 * to allow randomly occuring messages in non-magical texts. 25 * to allow randomly occuring messages in non-magical texts.
27 */ 26 */
435 * Be careful to keep the order. If you add readable subtype, add them 434 * Be careful to keep the order. If you add readable subtype, add them
436 * at the bottom of the list. Never delete a subtype because index is used as 435 * at the bottom of the list. Never delete a subtype because index is used as
437 * subtype paramater in arch files! 436 * subtype paramater in arch files!
438 */ 437 */
439static readable_message_type readable_message_types[] = { 438static readable_message_type readable_message_types[] = {
440 /*subtype 0 */ {0, 0, ""}, 439 /*subtype 0 */ {0, 0, "info"},
441 /* book messages subtypes */ 440 /* book messages subtypes */
442 /*subtype 1 */ {MSG_TYPE_BOOK, MSG_TYPE_BOOK_CLASP_1, "readable-book-clasp-1"}, 441 /*subtype 1 */ {MSG_TYPE_BOOK, MSG_TYPE_BOOK_CLASP_1, "readable-book-clasp-1"},
443 {MSG_TYPE_BOOK, MSG_TYPE_BOOK_CLASP_2, "readable-book-clasp-2"}, 442 {MSG_TYPE_BOOK, MSG_TYPE_BOOK_CLASP_2, "readable-book-clasp-2"},
444 {MSG_TYPE_BOOK, MSG_TYPE_BOOK_ELEGANT_1, "readable-book-elegant-1"}, 443 {MSG_TYPE_BOOK, MSG_TYPE_BOOK_ELEGANT_1, "readable-book-elegant-1"},
445 {MSG_TYPE_BOOK, MSG_TYPE_BOOK_ELEGANT_2, "readable-book-elegant-2"}, 444 {MSG_TYPE_BOOK, MSG_TYPE_BOOK_ELEGANT_2, "readable-book-elegant-2"},
1592 1591
1593 book->msg = retbuf; 1592 book->msg = retbuf;
1594 } 1593 }
1595} 1594}
1596 1595
1596#define DESCRIBE_PATH(retbuf, variable, name) \
1597 if(variable) { \
1598 int i,j=0; \
1599 strcat(retbuf,"(" name ": "); \
1600 for(i=0; i<NRSPELLPATHS; i++) \
1601 if(variable & (1<<i)) { \
1602 if (j) \
1603 strcat(retbuf,", "); \
1604 else \
1605 j = 1; \
1606 strcat(retbuf, spellpathnames[i]); \
1607 } \
1608 strcat(retbuf,")"); \
1609 }
1610
1597/* god_info_msg() - generate a message detailing the properties 1611/* god_info_msg() - generate a message detailing the properties
1598 * of a random god. Used by the book hack. b.t. 1612 * of a random god. Used by the book hack. b.t.
1599 */ 1613 */
1600const char * 1614const char *
1601god_info_msg (int level, int booksize) 1615god_info_msg (int level, int booksize)
1629 1643
1630 /* Information about the god is random, and based on the level of the 1644 /* Information about the god is random, and based on the level of the
1631 * 'book'. Probably there is a more intellegent way to implement 1645 * 'book'. Probably there is a more intellegent way to implement
1632 * this ... 1646 * this ...
1633 */ 1647 */
1634
1635 while (level > 0) 1648 while (level > 0)
1636 { 1649 {
1637 sprintf (buf, " "); 1650 sprintf (buf, " ");
1638 if (level == 2 && RANDOM () % 2) 1651 if (level == 2 && RANDOM () % 2)
1639 { /* enemy god */ 1652 { /* enemy god */
1843 * 2) make sure there is an entry in max_titles[] array. 1856 * 2) make sure there is an entry in max_titles[] array.
1844 * 3) make sure there are entries for your case in new_text_title() 1857 * 3) make sure there are entries for your case in new_text_title()
1845 * and add_authour(). 1858 * and add_authour().
1846 * 4) you may want separate authour/book name arrays in read.h 1859 * 4) you may want separate authour/book name arrays in read.h
1847 */ 1860 */
1848
1849 msg_type = msg_type > 0 ? msg_type : (RANDOM () % 6); 1861 msg_type = msg_type > 0 ? msg_type : (RANDOM () % 8);
1850 switch (msg_type) 1862 switch (msg_type)
1851 { 1863 {
1852 case 1: /* monster attrib */ 1864 case 1: /* monster attrib */
1853 strcpy (msgbuf, mon_info_msg (level, book_buf_size)); 1865 strcpy (msgbuf, mon_info_msg (level, book_buf_size));
1854 break; 1866 break;
1983get_readable_message_type (object *readable) 1995get_readable_message_type (object *readable)
1984{ 1996{
1985 uint8 subtype = readable->subtype; 1997 uint8 subtype = readable->subtype;
1986 1998
1987 if (subtype > last_readable_subtype) 1999 if (subtype > last_readable_subtype)
1988 return &(readable_message_types[0]); 2000 return &readable_message_types[0];
2001
1989 return &(readable_message_types[subtype]); 2002 return &readable_message_types[subtype];
1990} 2003}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines