1 | |
1 | |
2 | /* |
2 | /* |
3 | * static char *rcsid_readable_c = |
3 | * static char *rcsid_readable_c = |
4 | * "$Id: readable.C,v 1.5 2006/09/10 16:00:23 root Exp $"; |
4 | * "$Id: readable.C,v 1.6 2006/09/13 23:32:04 root Exp $"; |
5 | */ |
5 | */ |
6 | |
6 | |
7 | /* |
7 | /* |
8 | CrossFire, A Multiplayer game for X-windows |
8 | CrossFire, A Multiplayer game for X-windows |
9 | |
9 | |
… | |
… | |
80 | /* Moved these structures from struct.h to this file in 0.94.3 - they |
80 | /* Moved these structures from struct.h to this file in 0.94.3 - they |
81 | * are not needed anyplace else, so why have them globally declared? |
81 | * are not needed anyplace else, so why have them globally declared? |
82 | */ |
82 | */ |
83 | |
83 | |
84 | /* 'title' and 'titlelist' are used by the readable code */ |
84 | /* 'title' and 'titlelist' are used by the readable code */ |
85 | typedef struct titlestruct:zero_initialised |
85 | struct title : zero_initialised |
86 | { |
86 | { |
87 | shstr name; /* the name of the book */ |
87 | shstr name; /* the name of the book */ |
88 | shstr authour; /* the name of the book authour */ |
88 | shstr authour; /* the name of the book authour */ |
89 | shstr archname; /* the archetype name of the book */ |
89 | shstr archname; /* the archetype name of the book */ |
90 | int level; /* level of difficulty of this message */ |
90 | int level; /* level of difficulty of this message */ |
91 | int size; /* size of the book message */ |
91 | int size; /* size of the book message */ |
92 | int msg_index; /* an index value derived from book message */ |
92 | int msg_index; /* an index value derived from book message */ |
93 | struct titlestruct *next; |
93 | title *next; |
94 | } title; |
94 | }; |
95 | |
95 | |
96 | typedef struct titleliststruct:zero_initialised |
96 | struct titlelist : zero_initialised |
97 | { |
97 | { |
98 | int number; /* number of items in the list */ |
98 | int number; /* number of items in the list */ |
99 | struct titlestruct *first_book; /* pointer to first book in this list */ |
99 | title *first_book; /* pointer to first book in this list */ |
100 | struct titleliststruct *next; /* pointer to next book list */ |
100 | titlelist *next; /* pointer to next book list */ |
101 | } titlelist; |
101 | }; |
102 | |
102 | |
103 | /* special structure, used only by art_name_array[] */ |
103 | /* special structure, used only by art_name_array[] */ |
104 | |
104 | struct arttypename |
105 | typedef struct namebytype |
|
|
106 | { |
105 | { |
107 | const char *name; /* generic name to call artifacts of this type */ |
106 | const char *name; /* generic name to call artifacts of this type */ |
108 | int type; /* matching type */ |
107 | int type; /* matching type */ |
109 | } |
108 | }; |
110 | arttypename; |
|
|
111 | |
|
|
112 | |
109 | |
113 | /* booklist is the buffer of books read in from the bookarch file */ |
110 | /* booklist is the buffer of books read in from the bookarch file */ |
114 | static titlelist *booklist = NULL; |
111 | static titlelist *booklist = NULL; |
115 | |
112 | |
116 | static objectlink *first_mon_info = NULL; |
113 | static objectlink *first_mon_info = NULL; |
… | |
… | |
565 | |
562 | |
566 | while (tl && number) |
563 | while (tl && number) |
567 | { |
564 | { |
568 | if (!tl->next) |
565 | if (!tl->next) |
569 | tl->next = get_empty_booklist (); |
566 | tl->next = get_empty_booklist (); |
|
|
567 | |
570 | tl = tl->next; |
568 | tl = tl->next; |
571 | number--; |
569 | number--; |
572 | } |
570 | } |
573 | |
571 | |
574 | return tl; |
572 | return tl; |
… | |
… | |
733 | titlelist *bl = get_empty_booklist (); |
731 | titlelist *bl = get_empty_booklist (); |
734 | static int did_init_barch; |
732 | static int did_init_barch; |
735 | |
733 | |
736 | if (did_init_barch) |
734 | if (did_init_barch) |
737 | return; |
735 | return; |
|
|
736 | |
738 | did_init_barch = 1; |
737 | did_init_barch = 1; |
739 | |
738 | |
740 | if (!booklist) |
739 | if (!booklist) |
741 | booklist = bl; |
740 | booklist = bl; |
742 | |
741 | |
… | |
… | |
891 | if (msgtype < 0) |
890 | if (msgtype < 0) |
892 | return (title *) NULL; |
891 | return (title *) NULL; |
893 | |
892 | |
894 | if (tl) |
893 | if (tl) |
895 | t = tl->first_book; |
894 | t = tl->first_book; |
|
|
895 | |
896 | while (t) |
896 | while (t) |
897 | if (t->size == length && t->msg_index == index) |
897 | if (t->size == length && t->msg_index == index) |
898 | break; |
898 | break; |
899 | else |
899 | else |
900 | t = t->next; |
900 | t = t->next; |