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.50 by root, Sat Oct 24 00:43:30 2009 UTC vs.
Revision 1.53 by root, Fri Nov 6 13:45:28 2009 UTC

108/* these are needed for creation of a linked list of 108/* these are needed for creation of a linked list of
109 * pointers to all (hostile) monster objects */ 109 * pointers to all (hostile) monster objects */
110 110
111static int nrofmon = 0, need_to_write_bookarchive = 0; 111static int nrofmon = 0, need_to_write_bookarchive = 0;
112 112
113
114/* this is needed to keep track of status of initialisation
115 * of the message file */
116static int nrofmsg = 0;
117
118/* first_msg is the started of the linked list of messages as read from
119 * the messages file
120 */
121static linked_char *first_msg = NULL;
122
123/* 113/*
124 * Spellpath information 114 * Spellpath information
125 */ 115 */
126
127static uint32 spellpathdef[NRSPELLPATHS] = { 116static uint32 spellpathdef[NRSPELLPATHS] = {
128 PATH_PROT, 117 PATH_PROT,
129 PATH_FIRE, 118 PATH_FIRE,
130 PATH_FROST, 119 PATH_FROST,
131 PATH_ELEC, 120 PATH_ELEC,
497 /*subtype 50 */ {MSG_TYPE_MONUMENT, MSG_TYPE_MONUMENT_GRAVESTONE_3, "readable-monument-gravestone-3"}, 486 /*subtype 50 */ {MSG_TYPE_MONUMENT, MSG_TYPE_MONUMENT_GRAVESTONE_3, "readable-monument-gravestone-3"},
498 {MSG_TYPE_MONUMENT, MSG_TYPE_MONUMENT_WALL_1, "readable-monument-wall-1"}, 487 {MSG_TYPE_MONUMENT, MSG_TYPE_MONUMENT_WALL_1, "readable-monument-wall-1"},
499 {MSG_TYPE_MONUMENT, MSG_TYPE_MONUMENT_WALL_2, "readable-monument-wall-2"}, 488 {MSG_TYPE_MONUMENT, MSG_TYPE_MONUMENT_WALL_2, "readable-monument-wall-2"},
500 {MSG_TYPE_MONUMENT, MSG_TYPE_MONUMENT_WALL_3, "readable-monument-wall-3"} 489 {MSG_TYPE_MONUMENT, MSG_TYPE_MONUMENT_WALL_3, "readable-monument-wall-3"}
501}; 490};
502int last_readable_subtype = sizeof (readable_message_types) / sizeof (readable_message_type); 491static int last_readable_subtype = sizeof (readable_message_types) / sizeof (readable_message_type);
503 492
504static int max_titles[6] = { 493static int max_titles[6] = {
505 ((sizeof (light_book_name) / sizeof (char *)) + (sizeof (heavy_book_name) / sizeof (char *))) * (sizeof (book_author) / sizeof (char *)), 494 ((sizeof (light_book_name) / sizeof (char *)) + (sizeof (heavy_book_name) / sizeof (char *))) * (sizeof (book_author) / sizeof (char *)),
506 (sizeof (mon_book_name) / sizeof (char *)) * (sizeof (mon_author) / sizeof (char *)), 495 (sizeof (mon_book_name) / sizeof (char *)) * (sizeof (mon_author) / sizeof (char *)),
507 (sizeof (art_book_name) / sizeof (char *)) * (sizeof (art_author) / sizeof (char *)), 496 (sizeof (art_book_name) / sizeof (char *)) * (sizeof (art_author) / sizeof (char *)),
617 else 606 else
618 strcat (rbuf, "."); 607 strcat (rbuf, ".");
619 tbuf = strtok (NULL, sbuf); 608 tbuf = strtok (NULL, sbuf);
620 } 609 }
621 return (char *) rbuf; 610 return (char *) rbuf;
622}
623
624static int
625book_overflow (const char *buf1, const char *buf2, int booksize)
626{
627 if (buf_overflow (buf1, buf2, BOOK_BUF - 2) /* 2 less so always room for trailing \n */
628 || buf_overflow (buf1, buf2, booksize))
629 return 1;
630
631 return 0;
632} 611}
633 612
634/***************************************************************************** 613/*****************************************************************************
635 * 614 *
636 * Start of initialisation related functions. 615 * Start of initialisation related functions.
1817 } 1796 }
1818} 1797}
1819 1798
1820/***************************************************************************** 1799/*****************************************************************************
1821 * 1800 *
1822 * Cleanup routine for readble stuff.
1823 *
1824 *****************************************************************************/
1825void
1826free_all_readable (void)
1827{
1828 titlelist *tlist, *tnext;
1829 title *title1, *titlenext;
1830 linked_char *lmsg, *nextmsg;
1831 objectlink *monlink, *nextmon;
1832
1833 LOG (llevDebug, "freeing all book information\n");
1834
1835 for (tlist = booklist; tlist; tlist = tnext)
1836 {
1837 tnext = tlist->next;
1838
1839 for (title1 = tlist->first_book; title1; title1 = titlenext)
1840 {
1841 titlenext = title1->next;
1842 delete title1;
1843 }
1844
1845 delete tlist;
1846 }
1847
1848 for (lmsg = first_msg; lmsg; lmsg = nextmsg)
1849 {
1850 nextmsg = lmsg->next;
1851 delete lmsg;
1852 }
1853
1854 for (monlink = first_mon_info; monlink; monlink = nextmon)
1855 {
1856 nextmon = monlink->next;
1857 delete monlink;
1858 }
1859}
1860
1861/*****************************************************************************
1862 *
1863 * Writeback routine for updating the bookarchive. 1801 * Writeback routine for updating the bookarchive.
1864 * 1802 *
1865 ****************************************************************************/ 1803 ****************************************************************************/
1866/* write_book_archive() - write out the updated book archive */ 1804/* write_book_archive() - write out the updated book archive */
1867void 1805void

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines