OSDN Git Service

^AcでINSTA_ARTの★を作成したとき、追加耐性等も正常に付くようにした。
[hengband/hengband.git] / src / init.h
1 /* File: init.h */
2
3 /*
4  * Copyright (c) 2000 Robert Ruehlmann
5  *
6  * This software may be copied and distributed for educational, research,
7  * and not for profit purposes provided that this copyright and statement
8  * are included in all such copies.
9  */
10
11 #ifndef INCLUDED_INIT_H
12 #define INCLUDED_INIT_H
13
14 #include "h-basic.h"
15
16
17 #if 0
18 /*
19  * Parse errors
20  */
21 #define PARSE_ERROR_GENERIC                  1
22 #define PARSE_ERROR_OBSOLETE_FILE            2
23 #define PARSE_ERROR_MISSING_RECORD_HEADER    3
24 #define PARSE_ERROR_NON_SEQUENTIAL_RECORDS   4
25 #define PARSE_ERROR_INVALID_FLAG             5
26 #define PARSE_ERROR_UNDEFINED_DIRECTIVE      6
27 #define PARSE_ERROR_OUT_OF_MEMORY            7
28 #define PARSE_ERROR_OUT_OF_BOUNDS            8
29 #define PARSE_ERROR_TOO_FEW_ARGUMENTS        9
30 #define PARSE_ERROR_TOO_MANY_ARGUMENTS      10
31 #define PARSE_ERROR_TOO_MANY_ALLOCATIONS    11
32 #define PARSE_ERROR_INVALID_SPELL_FREQ      12
33 #define PARSE_ERROR_INVALID_ITEM_NUMBER     13
34 #define PARSE_ERROR_TOO_MANY_ENTRIES        14
35
36 #define PARSE_ERROR_MAX                     15
37 #endif /* 0 */
38
39
40 typedef struct header header;
41
42 typedef errr (*parse_info_txt_func)(char *buf, header *head);
43
44 /*
45  * Template file header information (see "init.c").  16 bytes.
46  *
47  * Note that the sizes of many of the "arrays" are between 32768 and
48  * 65535, and so we must use "unsigned" values to hold the "sizes" of
49  * these arrays below.  Normally, I try to avoid using unsigned values,
50  * since they can cause all sorts of bizarre problems, but I have no
51  * choice here, at least, until the "race" array is split into "normal"
52  * and "unique" monsters, which may or may not actually help.
53  *
54  * Note that, on some machines, for example, the Macintosh, the standard
55  * "read()" and "write()" functions cannot handle more than 32767 bytes
56  * at one time, so we need replacement functions, see "util.c" for details.
57  *
58  * Note that, on some machines, for example, the Macintosh, the standard
59  * "malloc()" function cannot handle more than 32767 bytes at one time,
60  * but we may assume that the "ralloc()" function can handle up to 65535
61  * butes at one time.  We should not, however, assume that the "ralloc()"
62  * function can handle more than 65536 bytes at a time, since this might
63  * result in segmentation problems on certain older machines, and in fact,
64  * we should not assume that it can handle exactly 65536 bytes at a time,
65  * since the internal functions may use an unsigned short to specify size.
66  *
67  * In general, these problems occur only on machines (such as most personal
68  * computers) which use 2 byte "int" values, and which use "int" for the
69  * arguments to the relevent functions.
70  */
71 struct header
72 {
73         byte v_major;           /* Version -- major */
74         byte v_minor;           /* Version -- minor */
75         byte v_patch;           /* Version -- patch */
76         byte v_extra;           /* Version -- extra */
77
78
79         u16b info_num;          /* Number of "info" records */
80
81         u16b info_len;          /* Size of each "info" record */
82
83
84         u16b head_size;         /* Size of the "header" in bytes */
85
86         u32b info_size;         /* Size of the "info" array in bytes */
87
88         u32b name_size;         /* Size of the "name" array in bytes */
89
90         u32b text_size;         /* Size of the "text" array in bytes */
91
92         void *info_ptr;
93         char *name_ptr;
94         char *text_ptr;
95
96         parse_info_txt_func parse_info_txt;
97 };
98
99 extern errr init_info_txt(FILE *fp, char *buf, header *head,
100                           parse_info_txt_func parse_info_txt_line);
101
102 #ifdef ALLOW_TEMPLATES
103 extern errr parse_z_info(char *buf, header *head);
104 extern errr parse_v_info(char *buf, header *head);
105 extern errr parse_f_info(char *buf, header *head);
106 extern errr parse_k_info(char *buf, header *head);
107 extern errr parse_a_info(char *buf, header *head);
108 extern errr parse_e_info(char *buf, header *head);
109 extern errr parse_r_info(char *buf, header *head);
110 extern errr parse_d_info(char *buf, header *head);
111 extern errr parse_s_info(char *buf, header *head);
112 extern errr parse_m_info(char *buf, header *head);
113
114 /*
115  * Error tracking
116  */
117 extern int error_idx;
118 extern int error_line;
119
120 #endif /* ALLOW_TEMPLATES */
121
122
123 /*
124  * File headers
125  */
126 extern header z_head;
127 extern header v_head;
128 extern header f_head;
129 extern header k_head;
130 extern header a_head;
131 extern header e_head;
132 extern header r_head;
133 extern header p_head;
134 extern header h_head;
135 extern header b_head;
136 extern header g_head;
137
138 #endif /* INCLUDED_INIT_H */