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.53 by root, Fri Nov 6 13:45:28 2009 UTC vs.
Revision 1.67 by root, Wed Nov 16 23:41:59 2016 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 Marc Alexander Lehmann / Robin Redeker / the Deliantra team 4 * Copyright (©) 2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
5 * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team 5 * Copyright (©) 2002 Mark Wedel & Crossfire Development Team
6 * Copyright (©) 1992,2007 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.
401static const char *const book_descrpt[] = { 401static const char *const book_descrpt[] = {
402 "ancient", 402 "ancient",
403 "cryptic", 403 "cryptic",
404 "cryptical", 404 "cryptical",
405 "dusty", 405 "dusty",
406 "hiearchical", 406 "hierarchical",
407 "grizzled", 407 "grizzled",
408 "gold-guilt", 408 "gold-guilt",
409 "great", 409 "great",
410 "lost", 410 "lost",
411 "magnificent", 411 "magnificent",
504 * Start of misc. readable functions used by others functions in this file 504 * Start of misc. readable functions used by others functions in this file
505 * 505 *
506 *****************************************************************************/ 506 *****************************************************************************/
507 507
508static titlelist * 508static titlelist *
509get_empty_booklist (void) 509get_empty_booklist ()
510{ 510{
511 titlelist *bl = new titlelist; 511 titlelist *bl = new titlelist;
512 512
513 bl->number = 0; 513 bl->number = 0;
514 bl->first_book = NULL; 514 bl->first_book = NULL;
515 bl->next = NULL; 515 bl->next = NULL;
516 return bl; 516 return bl;
517} 517}
518 518
519static title * 519static title *
520get_empty_book (void) 520get_empty_book ()
521{ 521{
522 title *t = new title; 522 title *t = new title;
523 523
524 t->name = NULL; 524 t->name = NULL;
525 t->archname = NULL; 525 t->archname = NULL;
534/* get_titlelist() - returns pointer to the title list referanced by i */ 534/* get_titlelist() - returns pointer to the title list referanced by i */
535 535
536static titlelist * 536static titlelist *
537get_titlelist (int i) 537get_titlelist (int i)
538{ 538{
539 if (!booklist)
540 booklist = get_empty_booklist ();
541
539 titlelist *tl = booklist; 542 titlelist *tl = booklist;
540 int number = i; 543 int number = i;
541 544
542 if (number < 0) 545 if (number < 0)
543 return tl; 546 return tl;
546 { 549 {
547 if (!tl->next) 550 if (!tl->next)
548 tl->next = get_empty_booklist (); 551 tl->next = get_empty_booklist ();
549 552
550 tl = tl->next; 553 tl = tl->next;
551 number--; 554 --number;
552 } 555 }
553 556
554 return tl; 557 return tl;
555} 558}
556 559
566 char *tbuf, sbuf[12], buf[MAX_BUF]; 569 char *tbuf, sbuf[12], buf[MAX_BUF];
567 int number = 0; 570 int number = 0;
568 571
569 if (!buf1 || !buf2) 572 if (!buf1 || !buf2)
570 return 0; 573 return 0;
571 sprintf (buf, "%s", buf1); 574
572 sprintf (sbuf, "%s", buf2); 575 strcpy (buf, buf1);
576 strcpy (sbuf, buf2);
577
573 tbuf = strtok (buf, sbuf); 578 tbuf = strtok (buf, sbuf);
574 while (tbuf) 579 while (tbuf)
575 { 580 {
576 number++; 581 number++;
577 tbuf = strtok (NULL, sbuf); 582 tbuf = strtok (NULL, sbuf);
596 strcpy (rbuf, " "); 601 strcpy (rbuf, " ");
597 tbuf = strtok (buf, sbuf); 602 tbuf = strtok (buf, sbuf);
598 while (tbuf && i > 0) 603 while (tbuf && i > 0)
599 { 604 {
600 strcat (rbuf, tbuf); 605 strcat (rbuf, tbuf);
606
601 i--; 607 i--;
602 if (i == 1 && maxi > 1) 608 if (i == 1 && maxi > 1)
603 strcat (rbuf, " and "); 609 strcat (rbuf, " and ");
604 else if (i > 0 && maxi > 1) 610 else if (i > 0 && maxi > 1)
605 strcat (rbuf, ", "); 611 strcat (rbuf, ", ");
606 else 612 else
607 strcat (rbuf, "."); 613 strcat (rbuf, ".");
614
608 tbuf = strtok (NULL, sbuf); 615 tbuf = strtok (NULL, sbuf);
609 } 616 }
617
610 return (char *) rbuf; 618 return rbuf;
611} 619}
612 620
613/***************************************************************************** 621/*****************************************************************************
614 * 622 *
615 * Start of initialisation related functions. 623 * Start of initialisation related functions.
619/* init_book_archive() - if not called before, initialise the info list 627/* init_book_archive() - if not called before, initialise the info list
620 * This reads in the bookarch file into memory. bookarch is the file 628 * This reads in the bookarch file into memory. bookarch is the file
621 * created and updated across multiple runs of the program. 629 * created and updated across multiple runs of the program.
622 */ 630 */
623static void 631static void
624init_book_archive (void) 632init_book_archive ()
625{ 633{
626 FILE *fp;
627 int comp, nroftitle = 0; 634 int nroftitle = 0;
628 char buf[MAX_BUF], fname[MAX_BUF], *cp;
629 title *book = NULL;
630 titlelist *bl = get_empty_booklist (); 635 titlelist *bl = get_empty_booklist ();
631 static int did_init_barch;
632 636
633 if (did_init_barch) 637 object_thawer thawer (settings.localdir, "bookarch");
638
639 if (!thawer)
640 {
641 LOG (llevDebug, "could not read bookarch file\n");
634 return; 642 return;
635
636 did_init_barch = 1;
637
638 if (!booklist)
639 booklist = bl;
640
641 sprintf (fname, "%s/bookarch", settings.localdir);
642 LOG (llevDebug, " Reading bookarch from %s...\n", fname);
643
644 if ((fp = open_and_uncompress (fname, 0, &comp)) != NULL)
645 { 643 }
644
645 while (thawer.kw)
646 {
647 if (thawer.kw != KW_title)
648 if (!thawer.parse_error ("bookarch file"))
649 break;
650
651 title *book = get_empty_book (); /* init new book entry */
652 thawer.get (book->name);
653
646 int value, type = 0; 654 int type = -1;
647 size_t i;
648 655
649 while (fgets (buf, MAX_BUF, fp) != NULL) 656 for (;;)
650 { 657 {
651 if (*buf == '#') 658 thawer.next ();
652 continue; 659
653 if ((cp = strchr (buf, '\n')) != NULL) 660 switch (thawer.kw)
654 *cp = '\0';
655 cp = buf;
656 while (*cp == ' ') /* Skip blanks */
657 cp++;
658 if (!strncmp (cp, "title", 4))
659 { 661 {
660 book = get_empty_book (); /* init new book entry */ 662 case KW_type: thawer.get (type ); break;
661 book->name = strchr (cp, ' ') + 1; 663 case KW_authour: thawer.get (book->authour ); break;
662 type = -1; 664 case KW_arch: thawer.get (book->archname ); break;
663 nroftitle++; 665 case KW_level: thawer.get (book->level ); break;
664 continue; 666 case KW_size: thawer.get (book->size ); break;
665 } 667 case KW_index: thawer.get (book->msg_index); break;
666 if (!strncmp (cp, "authour", 4)) 668
667 { 669 case KW_end:
668 book->authour = strchr (cp, ' ') + 1;
669 }
670 if (!strncmp (cp, "arch", 4))
671 {
672 book->archname = strchr (cp, ' ') + 1;
673 }
674 else if (sscanf (cp, "level %d", &value))
675 {
676 book->level = (uint16) value;
677 }
678 else if (sscanf (cp, "type %d", &value))
679 {
680 type = (uint16) value;
681 }
682 else if (sscanf (cp, "size %d", &value))
683 {
684 book->size = (uint16) value;
685 }
686 else if (sscanf (cp, "index %d", &value))
687 {
688 book->msg_index = (uint16) value;
689 }
690 else if (!strncmp (cp, "end", 3))
691 { /* link it */ 670 /* link it */
692 bl = get_titlelist (type); 671 bl = get_titlelist (type);
693 book->next = bl->first_book; 672 book->next = bl->first_book;
694 bl->first_book = book; 673 bl->first_book = book;
695 bl->number++; 674 bl->number++;
675 ++nroftitle;
676 goto book_done;
677
678 default:
679 delete book;
680 goto book_done;
696 } 681 }
697 } 682 }
683
684book_done:
685 thawer.next ();
686 }
687
698 LOG (llevDebug, "book archives(used/avail): \n"); 688 LOG (llevDebug, "book archives(used/avail): \n");
689 int i;
699 for (bl = booklist, i = 0; bl != NULL && i < sizeof (max_titles) / sizeof (*max_titles); bl = bl->next, i++) 690 for (bl = booklist, i = 0; bl && i < sizeof (max_titles) / sizeof (*max_titles); bl = bl->next, i++)
700 {
701 LOG (llevDebug, " (%d/%d)\n", bl->number, max_titles[i]); 691 LOG (llevDebug, " (%d/%d)\n", bl->number, max_titles[i]);
702 }
703 close_and_delete (fp, comp);
704 }
705 692
706#ifdef BOOK_MSG_DEBUG
707 LOG (llevDebug, "init_book_archive() got %d titles.\n", nroftitle); 693 LOG (llevDebug, "init_book_archive() got %d titles.\n", nroftitle);
708#endif
709 LOG (llevDebug, " done.\n");
710} 694}
711 695
712/* init_mon_info() - creates the linked list of pointers to 696/* init_mon_info() - creates the linked list of pointers to
713 * monster archetype objects if not called previously 697 * monster archetype objects if not called previously
714 */ 698 */
744 * 728 *
745 * This is the function called by the main routine to initialise 729 * This is the function called by the main routine to initialise
746 * all the readable information. 730 * all the readable information.
747 */ 731 */
748void 732void
749init_readable (void) 733init_readable ()
750{ 734{
751 static int did_this; 735 static int did_this;
752 736
753 if (did_this) 737 if (did_this)
754 return; 738 return;
806 * is given is based on various criteria 790 * is given is based on various criteria
807 */ 791 */
808static void 792static void
809new_text_name (object *book, int msgtype) 793new_text_name (object *book, int msgtype)
810{ 794{
811 int nbr; 795 const char *name;
812 char name[MAX_BUF];
813 796
814 if (book->type != BOOK) 797 if (book->type != BOOK)
815 return; 798 return;
816 799
817 switch (msgtype) 800 switch (msgtype)
818 { 801 {
819 case 1: /*monster */ 802 case 1: /*monster */
820 nbr = sizeof (mon_book_name) / sizeof (char *); 803 name = mon_book_name[rndm (array_length (mon_book_name))];
821 assign (name, mon_book_name[rndm (nbr)]);
822 break; 804 break;
823 case 2: /*artifact */ 805 case 2: /*artifact */
824 nbr = sizeof (art_book_name) / sizeof (char *); 806 name = art_book_name[rndm (array_length (art_book_name))];
825 assign (name, art_book_name[rndm (nbr)]);
826 break; 807 break;
827 case 3: /*spellpath */ 808 case 3: /*spellpath */
828 nbr = sizeof (path_book_name) / sizeof (char *); 809 name = path_book_name[rndm (array_length (path_book_name))];
829 assign (name, path_book_name[rndm (nbr)]);
830 break; 810 break;
831 case 4: /*alchemy */ 811 case 4: /*alchemy */
832 nbr = sizeof (formula_book_name) / sizeof (char *); 812 name = formula_book_name[rndm (array_length (formula_book_name))];
833 assign (name, formula_book_name[rndm (nbr)]);
834 break; 813 break;
835 case 5: /*gods */ 814 case 5: /*gods */
836 nbr = sizeof (gods_book_name) / sizeof (char *); 815 name = gods_book_name[rndm (array_length (gods_book_name))];
837 assign (name, gods_book_name[rndm (nbr)]);
838 break; 816 break;
839 case 6: /*msg file */ 817 case 6: /*msg file */
840 default: 818 default:
841 if (book->weight > 2000) 819 name = book->weight > 2000 /* based on weight */
842 { /* based on weight */ 820 ? heavy_book_name [rndm (array_length (heavy_book_name))]
843 nbr = sizeof (heavy_book_name) / sizeof (char *); 821 : light_book_name [rndm (array_length (light_book_name))];
844 assign (name, heavy_book_name[rndm (nbr)]);
845 }
846 else if (book->weight < 2001)
847 {
848 nbr = sizeof (light_book_name) / sizeof (char *);
849 assign (name, light_book_name[rndm (nbr)]);
850 }
851 break; 822 break;
852 } 823 }
853 824
854 book->name = name; 825 book->name = name;
855} 826}
856 827
857/* add_book_author() 828/* add_book_author()
858 * 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
859 * and sets op->title to that value 830 * and sets op->title to that value
860 */ 831 */
861 832
862static void 833static void
863add_author (object *op, int msgtype) 834add_author (object *op, int msgtype)
864{ 835{
865 char title[MAX_BUF], name[MAX_BUF]; 836 const char *name;
866 int nbr = sizeof (book_author) / sizeof (char *);
867 837
868 if (msgtype < 0 || strlen (op->msg) < 5) 838 if (msgtype < 0 || strlen (op->msg) < 5)
869 return; 839 return;
870 840
871 switch (msgtype) 841 switch (msgtype)
872 { 842 {
873 case 1: /* monster */ 843 case 1: /* monster */
874 nbr = sizeof (mon_author) / sizeof (char *); 844 name = mon_author[rndm (array_length (mon_author))];
875 assign (name, mon_author[rndm (nbr)]);
876 break; 845 break;
877 case 2: /* artifacts */ 846 case 2: /* artifacts */
878 nbr = sizeof (art_author) / sizeof (char *); 847 name = art_author[rndm (array_length (art_author))];
879 assign (name, art_author[rndm (nbr)]);
880 break; 848 break;
881 case 3: /* spellpath */ 849 case 3: /* spellpath */
882 nbr = sizeof (path_author) / sizeof (char *); 850 name = path_author[rndm (array_length (path_author))];
883 assign (name, path_author[rndm (nbr)]);
884 break; 851 break;
885 case 4: /* alchemy */ 852 case 4: /* alchemy */
886 nbr = sizeof (formula_author) / sizeof (char *); 853 name = formula_author[rndm (array_length (formula_author))];
887 assign (name, formula_author[rndm (nbr)]);
888 break; 854 break;
889 case 5: /* gods */ 855 case 5: /* gods */
890 nbr = sizeof (gods_author) / sizeof (char *); 856 name = gods_author[rndm (array_length (gods_author))];
891 assign (name, gods_author[rndm (nbr)]);
892 break; 857 break;
893 case 6: /* msg file */ 858 case 6: /* msg file */
894 default: 859 default:
895 assign (name, book_author[rndm (nbr)]); 860 name = book_author[rndm (array_length (book_author))];
896 } 861 }
897 862
898 sprintf (title, "of %s", name); 863 op->title = format ("of %s", name);
899 op->title = title;
900} 864}
901 865
902/* unique_book() - check to see if the book title/msg is unique. We 866/* unique_book() - check to see if the book title/msg is unique. We
903 * go through the entire list of possibilities each time. If we find 867 * go through the entire list of possibilities each time. If we find
904 * a match, then unique_book returns true (because inst unique). 868 * a match, then unique_book returns true (because inst unique).
986 */ 950 */
987 951
988 if ((strlen (book->msg) > 5) && (t = find_title (book, msgtype))) 952 if ((strlen (book->msg) > 5) && (t = find_title (book, msgtype)))
989 { 953 {
990 /* alter book properties */ 954 /* alter book properties */
991 if (object *tmpbook = get_archetype (t->archname)) 955 if (object *tmpbook = archetype::get (t->archname))
992 { 956 {
993 tmpbook->msg = book->msg; 957 tmpbook->msg = book->msg;
994 tmpbook->copy_to (book); 958 tmpbook->copy_to (book);
995 tmpbook->destroy (); 959 tmpbook->destroy ();
996 } 960 }
1054#endif 1018#endif
1055 /* restore old book properties here */ 1019 /* restore old book properties here */
1056 book->title = old_title; 1020 book->title = old_title;
1057 1021
1058 if (rndm (4)) 1022 if (rndm (4))
1059 {
1060 /* Lets give the book a description to individualize it some */ 1023 /* Lets give the book a description to individualize it some */
1061 char new_name[MAX_BUF];
1062
1063 snprintf (new_name, MAX_BUF, "%s %s", book_descrpt[rndm (nbr)], old_name); 1024 book->name = format ("%s %s", book_descrpt[rndm (nbr)], old_name);
1064
1065 book->name = new_name;
1066 }
1067 else 1025 else
1068 {
1069 book->name = old_name; 1026 book->name = old_name;
1070 }
1071 } 1027 }
1072 else if (book->title && strlen (book->msg) > 5) 1028 else if (book->title && strlen (book->msg) > 5)
1073 { /* archive if long msg texts */ 1029 { /* archive if long msg texts */
1074 add_book_to_list (book, msgtype); 1030 add_book_to_list (book, msgtype);
1075 } 1031 }
1265 * for that type exists! 1221 * for that type exists!
1266 */ 1222 */
1267 i = 0; 1223 i = 0;
1268 do 1224 do
1269 { 1225 {
1270 index = rndm (sizeof (art_name_array) / sizeof (arttypename)); 1226 index = rndm (array_length (art_name_array));
1271 type = art_name_array[index].type; 1227 type = art_name_array[index].type;
1272 al = find_artifactlist (type); 1228 al = find_artifactlist (type);
1273 i++; 1229 i++;
1274 } 1230 }
1275 while ((al == NULL) && (i < 10)); 1231 while ((al == NULL) && (i < 10));
1348 1304
1349 /* properties of the artifact */ 1305 /* properties of the artifact */
1350 tmp = object::create (); 1306 tmp = object::create ();
1351 add_abilities (tmp, art->item); 1307 add_abilities (tmp, art->item);
1352 tmp->type = type; 1308 tmp->type = type;
1353 SET_FLAG (tmp, FLAG_IDENTIFIED); 1309 tmp->set_flag (FLAG_IDENTIFIED);
1354 if ((ch = describe_item (tmp, 0)) && strlen (ch) > 1) 1310 if ((ch = describe_item (tmp, 0)) && strlen (ch) > 1)
1355 buf << "\rProperties of this artifact include:\r" << ch << "\n"; 1311 buf << "\rProperties of this artifact include:\r" << ch << "\n";
1356 1312
1357 tmp->destroy (); 1313 tmp->destroy ();
1358 1314
1374static char * 1330static char *
1375spellpath_msg (int level) 1331spellpath_msg (int level)
1376{ 1332{
1377 static dynbuf_text buf; buf.clear (); 1333 static dynbuf_text buf; buf.clear ();
1378 1334
1379 static char retbuf[BOOK_BUF];
1380 char tmpbuf[BOOK_BUF];
1381 int path = rndm (NRSPELLPATHS), prayers = rndm (2); 1335 int path = rndm (NRSPELLPATHS), prayers = rndm (2);
1382 uint32 pnum = (path == -1) ? PATH_NULL : spellpathdef[path]; 1336 uint32 pnum = (path == -1) ? PATH_NULL : spellpathdef[path];
1383 archetype *at; 1337 archetype *at;
1384 1338
1385 /* Preamble */ 1339 /* Preamble */
1595 int i; 1549 int i;
1596 1550
1597 if (enemy && !(god->path_denied & PATH_TURNING)) 1551 if (enemy && !(god->path_denied & PATH_TURNING))
1598 if ((i = nstrtok (enemy, ",")) > 0) 1552 if ((i = nstrtok (enemy, ",")) > 0)
1599 { 1553 {
1600 char tmpbuf[MAX_BUF];
1601
1602 buf << "The holy words of " << name 1554 buf << "The holy words of " << name
1603 << " have the power to slay creatures belonging to the "; 1555 << " have the power to slay creatures belonging to the ";
1604 1556
1605 if (i > 1) 1557 if (i > 1)
1606 buf << "following races:" << strtoktolin (enemy, ","); 1558 buf << "following races:" << strtoktolin (enemy, ",");
1682 { /* spell paths */ 1634 { /* spell paths */
1683 //TODO: 1635 //TODO:
1684 int has_effect = 0, tmpvar; 1636 int has_effect = 0, tmpvar;
1685 char tmpbuf[MAX_BUF]; 1637 char tmpbuf[MAX_BUF];
1686 1638
1687 sprintf (tmpbuf, "\n");
1688 sprintf (tmpbuf, "It is rarely known fact that the priests of %s\n", name); 1639 sprintf (tmpbuf, "It is rarely known fact that the priests of %s\n", name);
1689 strcat (tmpbuf, "are mystically transformed. Effects of this include:\n"); 1640 strcat (tmpbuf, "are mystically transformed. Effects of this include:\n");
1690 1641
1691 if ((tmpvar = god->path_attuned)) 1642 if ((tmpvar = god->path_attuned))
1692 { 1643 {
1720 buf << "[Unfortunately the rest of the information is hopelessly garbled!]"; 1671 buf << "[Unfortunately the rest of the information is hopelessly garbled!]";
1721 1672
1722 return buf; 1673 return buf;
1723} 1674}
1724 1675
1725/* tailor_readable_ob()- The main routine. This chooses a random 1676/* tailor_readable_ob()- The main routine. This chooses a random
1726 * message to put in given readable object (type==BOOK) which will 1677 * message to put in given readable object (type==BOOK) which will
1727 * 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-
1728 * termine the value of the information we will insert. Higher 1679 * termine the value of the information we will insert. Higher
1729 * values mean the book will (generally) have better/more info. 1680 * values mean the book will (generally) have better/more info.
1730 * See individual cases as to how this will be utilized. 1681 * See individual cases as to how this will be utilized.
1731 * "Book" name/content length are based on the weight of the 1682 * "Book" name/content length are based on the weight of the
1732 * 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
1733 * choose the kind of message to generate. 1684 * choose the kind of message to generate.
1734 * -b.t. thomas@astro.psu.edu 1685 * -b.t. thomas@astro.psu.edu
1735 * 1686 *
1736 * book is the object we are creating into. 1687 * book is the object we are creating into.
1737 * 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
1738 * message type - otherwise a random value is used. 1689 * message type - otherwise a random value is used.
1801 * Writeback routine for updating the bookarchive. 1752 * Writeback routine for updating the bookarchive.
1802 * 1753 *
1803 ****************************************************************************/ 1754 ****************************************************************************/
1804/* write_book_archive() - write out the updated book archive */ 1755/* write_book_archive() - write out the updated book archive */
1805void 1756void
1806write_book_archive (void) 1757write_book_archive ()
1807{ 1758{
1808 FILE *fp; 1759 FILE *fp;
1809 int index = 0; 1760 int index = 0;
1810 char fname[MAX_BUF]; 1761 char fname[MAX_BUF];
1811 title *book = NULL; 1762 title *book = NULL;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines