Hengband  2.1.4
 全て データ構造 ファイル 関数 変数 型定義 マクロ定義 ページ
init.h
説明を見る。
1 /*!
2  * @file init.h
3  * @brief ゲームデータ初期化処理のヘッダファイル
4  * @date 2015/01/02
5  * @author
6  * Copyright (c) 2000 Robert Ruehlmann
7  * @details
8  * This software may be copied and distributed for educational, research,
9  * and not for profit purposes provided that this copyright and statement
10  * are included in all such copies.
11  */
12 
13 #ifndef INCLUDED_INIT_H
14 #define INCLUDED_INIT_H
15 
16 #include "h-basic.h"
17 
18 
19 #if 0
20 /*
21  * Parse errors
22  */
23 #define PARSE_ERROR_GENERIC 1
24 #define PARSE_ERROR_OBSOLETE_FILE 2
25 #define PARSE_ERROR_MISSING_RECORD_HEADER 3
26 #define PARSE_ERROR_NON_SEQUENTIAL_RECORDS 4
27 #define PARSE_ERROR_INVALID_FLAG 5
28 #define PARSE_ERROR_UNDEFINED_DIRECTIVE 6
29 #define PARSE_ERROR_OUT_OF_MEMORY 7
30 #define PARSE_ERROR_OUT_OF_BOUNDS 8
31 #define PARSE_ERROR_TOO_FEW_ARGUMENTS 9
32 #define PARSE_ERROR_TOO_MANY_ARGUMENTS 10
33 #define PARSE_ERROR_TOO_MANY_ALLOCATIONS 11
34 #define PARSE_ERROR_INVALID_SPELL_FREQ 12
35 #define PARSE_ERROR_INVALID_ITEM_NUMBER 13
36 #define PARSE_ERROR_TOO_MANY_ENTRIES 14
37 
38 #define PARSE_ERROR_MAX 15
39 #endif /* 0 */
40 
41 
42 typedef struct header header;
43 
44 typedef errr (*parse_info_txt_func)(char *buf, header *head);
45 
46 /*!
47  * @struct header
48  * @brief 各初期データ用ヘッダ構造体 / Template file header information (see "init.c"). 16 bytes.
49  * @details
50  * Note that the sizes of many of the "arrays" are between 32768 and
51  * 65535, and so we must use "unsigned" values to hold the "sizes" of
52  * these arrays below. Normally, I try to avoid using unsigned values,
53  * since they can cause all sorts of bizarre problems, but I have no
54  * choice here, at least, until the "race" array is split into "normal"
55  * and "unique" monsters, which may or may not actually help.
56  *
57  * Note that, on some machines, for example, the Macintosh, the standard
58  * "read()" and "write()" functions cannot handle more than 32767 bytes
59  * at one time, so we need replacement functions, see "util.c" for details.
60  *
61  * Note that, on some machines, for example, the Macintosh, the standard
62  * "malloc()" function cannot handle more than 32767 bytes at one time,
63  * but we may assume that the "ralloc()" function can handle up to 65535
64  * butes at one time. We should not, however, assume that the "ralloc()"
65  * function can handle more than 65536 bytes at a time, since this might
66  * result in segmentation problems on certain older machines, and in fact,
67  * we should not assume that it can handle exactly 65536 bytes at a time,
68  * since the internal functions may use an unsigned short to specify size.
69  *
70  * In general, these problems occur only on machines (such as most personal
71  * computers) which use 2 byte "int" values, and which use "int" for the
72  * arguments to the relevent functions.
73  */
74 struct header
75 {
76  byte v_major; /* Version -- major */
77  byte v_minor; /* Version -- minor */
78  byte v_patch; /* Version -- patch */
79  byte v_extra; /* Version -- extra */
80 
81 
82  u16b info_num; /* Number of "info" records */
83 
84  u16b info_len; /* Size of each "info" record */
85 
86 
87  u16b head_size; /* Size of the "header" in bytes */
88 
89  u32b info_size; /* Size of the "info" array in bytes */
90 
91  u32b name_size; /* Size of the "name" array in bytes */
92 
93  u32b text_size; /* Size of the "text" array in bytes */
94 
95  u32b tag_size; /* Size of the "tag" array in bytes */
96 
97  void *info_ptr;
98  char *name_ptr;
99  char *text_ptr;
100  char *tag_ptr;
101 
103 
104  void (*retouch)(header *head);
105 };
106 
107 extern errr init_info_txt(FILE *fp, char *buf, header *head,
108  parse_info_txt_func parse_info_txt_line);
109 
110 #ifdef ALLOW_TEMPLATES
111 extern errr parse_z_info(char *buf, header *head);
112 extern errr parse_v_info(char *buf, header *head);
113 extern errr parse_f_info(char *buf, header *head);
114 extern void retouch_f_info(header *head);
115 extern errr parse_k_info(char *buf, header *head);
116 extern errr parse_a_info(char *buf, header *head);
117 extern errr parse_e_info(char *buf, header *head);
118 extern errr parse_r_info(char *buf, header *head);
119 extern errr parse_d_info(char *buf, header *head);
120 extern errr parse_s_info(char *buf, header *head);
121 extern errr parse_m_info(char *buf, header *head);
122 
123 /*
124  * Error tracking
125  */
126 extern int error_idx;
127 extern int error_line;
128 
129 #endif /* ALLOW_TEMPLATES */
130 
131 
132 /*
133  * File headers
134  */
135 extern header z_head;
136 extern header v_head;
137 extern header f_head;
138 extern header k_head;
139 extern header a_head;
140 extern header e_head;
141 extern header r_head;
142 extern header p_head;
143 extern header h_head;
144 extern header b_head;
145 extern header g_head;
146 
147 #endif /* INCLUDED_INIT_H */
header e_head
アイテムエゴ情報のヘッダ構造体
Definition: init2.c:297
header f_head
地形情報のヘッダ構造体
Definition: init2.c:294
char * buf
Definition: chuukei.c:83
header r_head
モンスター種族情報のヘッダ構造体
Definition: init2.c:298
void * info_ptr
Definition: init.h:97
header b_head
errr init_info_txt(FILE *fp, char *buf, header *head, parse_info_txt_func parse_info_txt_line)
パース関数に基づいてデータファイルからデータを読み取る / Initialize an "*_info" array, by parsing an ascii "template" file ...
Definition: init1.c:1086
byte v_patch
Definition: init.h:78
u16b info_len
Definition: init.h:84
byte v_major
Definition: init.h:76
header k_head
ペースアイテム情報のヘッダ構造体
Definition: init2.c:295
byte v_minor
Definition: init.h:77
void(* retouch)(header *head)
Definition: init.h:104
errr parse_r_info(char *buf, header *head)
モンスター種族情報(r_info)のパース関数 / Initialize the "r_info" array, by parsing an ascii "template" file ...
Definition: init1.c:2767
errr parse_f_info(char *buf, header *head)
地形情報(f_info)のパース関数 / Initialize the "f_info" array, by parsing an ascii "template" file ...
Definition: init1.c:1544
errr parse_s_info(char *buf, header *head)
職業技能情報(s_info)のパース関数 / Initialize the "s_info" array, by parsing an ascii "template" file ...
Definition: init1.c:1242
u16b head_size
Definition: init.h:87
u32b name_size
Definition: init.h:91
errr parse_a_info(char *buf, header *head)
固定アーティファクト情報(a_info)のパース関数 / Initialize the "a_info" array, by parsing an ascii "template" file ...
Definition: init1.c:2286
void retouch_f_info(header *head)
地形情報の各種タグからIDへ変換して結果を収める / Retouch fake tags of f_info
Definition: init1.c:1885
u32b info_size
Definition: init.h:89
変愚時追加された基本事項のヘッダーファイル / The most basic "include" file.
header v_head
Vault情報のヘッダ構造体
Definition: init2.c:293
errr parse_k_info(char *buf, header *head)
ベースアイテム(k_info)のパース関数 / Initialize the "k_info" array, by parsing an ascii "template" file ...
Definition: init1.c:1976
int errr
エラーコードの定義 / Error codes for function return values
Definition: h-type.h:56
unsigned short u16b
Definition: h-type.h:93
header h_head
int error_idx
データ読み込み/初期化時に汎用的にエラーコードを保存するグローバル変数
Definition: init2.c:250
char * text_ptr
Definition: init.h:99
header a_head
固定アーティファクト情報のヘッダ構造体
Definition: init2.c:296
header z_head
header p_head
u32b tag_size
Definition: init.h:95
errr parse_e_info(char *buf, header *head)
アイテムエゴ情報(e_info)のパース関数 / Initialize the "e_info" array, by parsing an ascii "template" file ...
Definition: init1.c:2516
unsigned long u32b
Definition: h-type.h:102
各初期データ用ヘッダ構造体 / Template file header information (see "init.c").
Definition: init.h:74
errr parse_v_info(char *buf, header *head)
Vault情報(v_info)のパース関数 / Initialize the "v_info" array, by parsing an ascii "template" file...
Definition: init1.c:1156
header g_head
int error_line
データ読み込み/初期化時に汎用的にエラー行数を保存するグローバル変数
Definition: init2.c:251
char * name_ptr
Definition: init.h:98
u32b text_size
Definition: init.h:93
errr parse_m_info(char *buf, header *head)
職業魔法情報(m_info)のパース関数 / Initialize the "m_info" array, by parsing an ascii "template" file ...
Definition: init1.c:1327
u16b info_num
Definition: init.h:82
parse_info_txt_func parse_info_txt
Definition: init.h:102
errr(* parse_info_txt_func)(char *buf, header *head)
Definition: init.h:44
char * tag_ptr
Definition: init.h:100
errr parse_d_info(char *buf, header *head)
ダンジョン情報(d_info)のパース関数 / Initialize the "d_info" array, by parsing an ascii "template" file ...
Definition: init1.c:3154
byte v_extra
Definition: init.h:79
unsigned char byte
byte型をunsighned charとして定義 / Note that unsigned values can cause math problems / An unsigned byte of m...
Definition: h-type.h:76