Hengband  2.1.4
 全て データ構造 ファイル 関数 変数 型定義 マクロ定義 ページ
関数 | 変数
init2.c

ゲームデータ初期化2 / Initialization (part 2) -BEN- [詳細]

#include "angband.h"
#include "init.h"
#include <sys/types.h>
#include <sys/stat.h>
init2.cのインクルード依存関係図

関数

void init_file_paths (char *path)
 各データファイルを読み取るためのパスを取得する Find the default paths to all of our important sub-directories. [詳細]
 
static errr check_modification_date (int fd, cptr template_file)
 テキストファイルとrawファイルの更新時刻を比較する Find the default paths to all of our important sub-directories. [詳細]
 
static errr init_info_raw (int fd, header *head)
 rawファイルからのデータの読み取り処理 Initialize the "*_info" array, by parsing a binary "image" file [詳細]
 
static void init_header (header *head, int num, int len)
 ヘッダ構造体の更新 Initialize the header of an *_info.raw file. [詳細]
 
static errr init_info (cptr filename, header *head, void **info, char **name, char **text, char **tag)
 ヘッダ構造体の更新 Initialize the "*_info" array [詳細]
 
static errr init_f_info (void)
 地形情報読み込みのメインルーチン / Initialize the "f_info" array [詳細]
 
static errr init_k_info (void)
 ベースアイテム情報読み込みのメインルーチン / Initialize the "k_info" array [詳細]
 
static errr init_a_info (void)
 固定アーティファクト情報読み込みのメインルーチン / Initialize the "a_info" array [詳細]
 
static errr init_e_info (void)
 固定アーティファクト情報読み込みのメインルーチン / Initialize the "e_info" array [詳細]
 
static errr init_r_info (void)
 モンスター種族情報読み込みのメインルーチン / Initialize the "r_info" array [詳細]
 
static errr init_d_info (void)
 ダンジョン情報読み込みのメインルーチン / Initialize the "d_info" array [詳細]
 
errr init_v_info (void)
 Vault情報読み込みのメインルーチン / Initialize the "v_info" array. [詳細]
 
static errr init_s_info (void)
 職業技能情報読み込みのメインルーチン / Initialize the "s_info" array [詳細]
 
static errr init_m_info (void)
 職業魔法情報読み込みのメインルーチン / Initialize the "m_info" array [詳細]
 
static errr init_misc (void)
 基本情報読み込みのメインルーチン / Initialize misc. [詳細]
 
static errr init_towns (void)
 町情報読み込みのメインルーチン / Initialize town array [詳細]
 
errr init_buildings (void)
 店情報初期化のメインルーチン / Initialize buildings [詳細]
 
static errr init_quests (void)
 クエスト情報初期化のメインルーチン / Initialize quest array [詳細]
 
s16b f_tag_to_index_in_init (cptr str)
 地形タグからIDを得る / Initialize quest array [詳細]
 
static errr init_feat_variables (void)
 地形の汎用定義をタグを通じて取得する / Initialize feature variables [詳細]
 
static errr init_other (void)
 その他の初期情報更新 / Initialize some other arrays [詳細]
 
static errr init_object_alloc (void)
 オブジェクト配列を初期化する / Initialize some other arrays [詳細]
 
static errr init_alloc (void)
 モンスター配列と生成テーブルを初期化する / Initialize some other arrays [詳細]
 
static void note (cptr str)
 画面左下にシステムメッセージを表示する / Hack – take notes on line 23 [詳細]
 
static void init_angband_aux (cptr why)
 全ゲームデータ読み込みのサブルーチン / Hack – Explain a broken "lib" folder and quit (see below). [詳細]
 
void init_angband (void)
 全ゲームデータ読み込みのメインルーチン / Hack – main Angband initialization entry point [詳細]
 
cptr get_check_sum (void)
 サムチェック情報を出力 / Get check sum in string form [詳細]
 

変数

int error_idx
 データ読み込み/初期化時に汎用的にエラーコードを保存するグローバル変数 [詳細]
 
int error_line
 データ読み込み/初期化時に汎用的にエラー行数を保存するグローバル変数 [詳細]
 
cptr err_str [PARSE_ERROR_MAX]
 エラーメッセージの名称定義 / Standard error message text [詳細]
 
header v_head
 Vault情報のヘッダ構造体 [詳細]
 
header f_head
 地形情報のヘッダ構造体 [詳細]
 
header k_head
 ペースアイテム情報のヘッダ構造体 [詳細]
 
header a_head
 固定アーティファクト情報のヘッダ構造体 [詳細]
 
header e_head
 アイテムエゴ情報のヘッダ構造体 [詳細]
 
header r_head
 モンスター種族情報のヘッダ構造体 [詳細]
 
header d_head
 ダンジョン情報のヘッダ構造体 [詳細]
 
header s_head
 プレイヤー職業技能情報のヘッダ構造体 [詳細]
 
header m_head
 プレイヤー職業魔法情報のヘッダ構造体 [詳細]
 
static byte store_table [MAX_STORES][STORE_CHOICES][2]
 店舗で販売するオブジェクトを定義する / Hack – Objects sold in the stores – by tval/sval pair. [詳細]
 
static bool feat_tag_is_not_found = FALSE
 地形タグ情報から地形IDを得られなかった場合にTRUEを返すグローバル変数 [詳細]
 

説明

ゲームデータ初期化2 / Initialization (part 2) -BEN-

日付
2014/01/28
作者
Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
This software may be copied and distributed for educational, research,
and not for profit purposes provided that this copyright and statement
are included in all such copies.  Other copyrights may also apply.
2014 Deskull rearranged comment for Doxygen.
This file is used to initialize various variables and arrays for the
Angband game.  Note the use of "fd_read()" and "fd_write()" to bypass
the common limitation of "read()" and "write()" to only 32767 bytes
at a time.
Several of the arrays for Angband are built from "template" files in
the "lib/file" directory, from which quick-load binary "image" files
are constructed whenever they are not present in the "lib/data"
directory, or if those files become obsolete, if we are allowed.
Warning – the "ascii" file parsers use a minor hack to collect the
name and text information in a single pass.  Thus, the game will not
be able to load any template file with more than 20K of names or 60K
of text, even though technically, up to 64K should be legal.
The "init1.c" file is used only to parse the ascii template files,
to create the binary image files.  If you include the binary image
files instead of the ascii template files, then you can undefine
"ALLOW_TEMPLATES", saving about 20K by removing "init1.c".  Note
that the binary image files are extremely system dependant.

関数

static errr check_modification_date ( int  fd,
cptr  template_file 
)
static

テキストファイルとrawファイルの更新時刻を比較する Find the default paths to all of our important sub-directories.

引数
fdファイルディスクリプタ
template_fileファイル名
戻り値
テキストの方が新しいか、rawファイルがなく更新の必要がある場合-1、更新の必要がない場合0。

関数の呼び出しグラフ:

呼出しグラフ:

s16b f_tag_to_index_in_init ( cptr  str)

地形タグからIDを得る / Initialize quest array

戻り値
地形ID

関数の呼び出しグラフ:

呼出しグラフ:

cptr get_check_sum ( void  )

サムチェック情報を出力 / Get check sum in string form

戻り値
サムチェック情報の文字列

関数の呼び出しグラフ:

呼出しグラフ:

static errr init_a_info ( void  )
static

固定アーティファクト情報読み込みのメインルーチン / Initialize the "a_info" array

戻り値
エラーコード

関数の呼び出しグラフ:

呼出しグラフ:

static errr init_alloc ( void  )
static

モンスター配列と生成テーブルを初期化する / Initialize some other arrays

戻り値
エラーコード

関数の呼び出しグラフ:

呼出しグラフ:

void init_angband ( void  )

全ゲームデータ読み込みのメインルーチン / Hack – main Angband initialization entry point

戻り値
なし
覚え書き
XXX XXX XXX This function is "messy" because various things
may or may not be initialized, but the "plog()" and "quit()"
functions are "supposed" to work under any conditions.
Verify some files, display the "news.txt" file, create
the high score file, initialize all internal arrays, and
load the basic "user pref files".
Be very careful to keep track of the order in which things
are initialized, in particular, the only thing known to
be available when this function is called is the "z-term.c"
package, and that may not be fully initialized until the
end of this function, when the default "user pref files"
are loaded and "Term_xtra(TERM_XTRA_REACT,0)" is called.
Note that this function attempts to verify the "news" file,
and the game aborts (cleanly) on failure, since without the
"news" file, it is likely that the "lib" folder has not been
correctly located.  Otherwise, the news file is displayed for
the user.
Note that this function attempts to verify (or create) the
"high score" file, and the game aborts (cleanly) on failure,
since one of the most common "extraction" failures involves
failing to extract all sub-directories (even empty ones), such
as by failing to use the "-d" option of "pkunzip", or failing
to use the "save empty directories" option with "Compact Pro".
This error will often be caught by the "high score" creation
code below, since the "lib/apex" directory, being empty in the
standard distributions, is most likely to be "lost", making it
impossible to create the high score file.
Note that various things are initialized by this function,
including everything that was once done by "init_some_arrays".
This initialization involves the parsing of special files
in the "lib/data" and sometimes the "lib/edit" directories.
Note that the "template" files are initialized first, since they
often contain errors.  This means that macros and message recall
and things like that are not available until after they are done.
We load the default "user pref files" here in case any "color"
changes are needed before character creation.
Note that the "graf-xxx.prf" file must be loaded separately,
if needed, in the first (?) pass through "TERM_XTRA_REACT".

関数の呼び出しグラフ:

呼出しグラフ:

static void init_angband_aux ( cptr  why)
static

全ゲームデータ読み込みのサブルーチン / Hack – Explain a broken "lib" folder and quit (see below).

戻り値
なし
覚え書き
XXX XXX XXX This function is "messy" because various things
may or may not be initialized, but the "plog()" and "quit()"
functions are "supposed" to work under any conditions.

関数の呼び出しグラフ:

呼出しグラフ:

errr init_buildings ( void  )

店情報初期化のメインルーチン / Initialize buildings

戻り値
エラーコード

呼出しグラフ:

static errr init_d_info ( void  )
static

ダンジョン情報読み込みのメインルーチン / Initialize the "d_info" array

戻り値
エラーコード

関数の呼び出しグラフ:

呼出しグラフ:

static errr init_e_info ( void  )
static

固定アーティファクト情報読み込みのメインルーチン / Initialize the "e_info" array

戻り値
エラーコード

関数の呼び出しグラフ:

呼出しグラフ:

static errr init_f_info ( void  )
static

地形情報読み込みのメインルーチン / Initialize the "f_info" array

戻り値
エラーコード

関数の呼び出しグラフ:

呼出しグラフ:

static errr init_feat_variables ( void  )
static

地形の汎用定義をタグを通じて取得する / Initialize feature variables

戻り値
エラーコード

関数の呼び出しグラフ:

呼出しグラフ:

void init_file_paths ( char *  path)

各データファイルを読み取るためのパスを取得する Find the default paths to all of our important sub-directories.

引数
pathパス保管先の文字列
戻り値
なし
The purpose of each sub-directory is described in "variable.c".
All of the sub-directories should, by default, be located inside
the main "lib" directory, whose location is very system dependant.
This function takes a writable buffer, initially containing the
"path" to the "lib" directory, for example, "/pkg/lib/angband/",
or a system dependant string, for example, ":lib:".  The buffer
must be large enough to contain at least 32 more characters.
Various command line options may allow some of the important
directories to be changed to user-specified directories, most
importantly, the "info" and "user" and "save" directories,
but this is done after this function, see "main.c".
In general, the initial path should end in the appropriate "PATH_SEP"
string.  All of the "sub-directory" paths (created below or supplied
by the user) will NOT end in the "PATH_SEP" string, see the special
"path_build()" function in "util.c" for more information.
Mega-Hack – support fat raw files under NEXTSTEP, using special
"suffixed" directories for the "ANGBAND_DIR_DATA" directory, but
requiring the directories to be created by hand by the user.
Hack – first we free all the strings, since this is known
to succeed even if the strings have not been allocated yet,
as long as the variables start out as "NULL".  This allows
this function to be called multiple times, for example, to
try several base "path" values until a good one is found.

関数の呼び出しグラフ:

呼出しグラフ:

static void init_header ( header head,
int  num,
int  len 
)
static

ヘッダ構造体の更新 Initialize the header of an *_info.raw file.

引数
headrawファイルのヘッダ
numデータ数
lenデータの長さ
戻り値
エラーコード

呼出しグラフ:

static errr init_info ( cptr  filename,
header head,
void **  info,
char **  name,
char **  text,
char **  tag 
)
static

ヘッダ構造体の更新 Initialize the "*_info" array

引数
filenameファイル名(拡張子txt/raw)
head処理に用いるヘッダ構造体
infoデータ保管先の構造体ポインタ
name名称用可変文字列の保管先
textテキスト用可変文字列の保管先
tagタグ用可変文字列の保管先
戻り値
エラーコード
覚え書き
Note that we let each entry have a unique "name" and "text" string, even if the string happens to be empty (everyone has a unique '\0').

関数の呼び出しグラフ:

呼出しグラフ:

static errr init_info_raw ( int  fd,
header head 
)
static

rawファイルからのデータの読み取り処理 Initialize the "*_info" array, by parsing a binary "image" file

引数
fdファイルディスクリプタ
headrawファイルのヘッダ
戻り値
エラーコード

関数の呼び出しグラフ:

呼出しグラフ:

static errr init_k_info ( void  )
static

ベースアイテム情報読み込みのメインルーチン / Initialize the "k_info" array

戻り値
エラーコード

関数の呼び出しグラフ:

呼出しグラフ:

static errr init_m_info ( void  )
static

職業魔法情報読み込みのメインルーチン / Initialize the "m_info" array

戻り値
エラーコード

関数の呼び出しグラフ:

呼出しグラフ:

static errr init_misc ( void  )
static

基本情報読み込みのメインルーチン / Initialize misc.

values

戻り値
エラーコード

関数の呼び出しグラフ:

呼出しグラフ:

static errr init_object_alloc ( void  )
static

オブジェクト配列を初期化する / Initialize some other arrays

戻り値
エラーコード

関数の呼び出しグラフ:

呼出しグラフ:

static errr init_other ( void  )
static

その他の初期情報更新 / Initialize some other arrays

戻り値
エラーコード

関数の呼び出しグラフ:

呼出しグラフ:

static errr init_quests ( void  )
static

クエスト情報初期化のメインルーチン / Initialize quest array

戻り値
エラーコード

呼出しグラフ:

static errr init_r_info ( void  )
static

モンスター種族情報読み込みのメインルーチン / Initialize the "r_info" array

戻り値
エラーコード

関数の呼び出しグラフ:

呼出しグラフ:

static errr init_s_info ( void  )
static

職業技能情報読み込みのメインルーチン / Initialize the "s_info" array

戻り値
エラーコード

関数の呼び出しグラフ:

呼出しグラフ:

static errr init_towns ( void  )
static

町情報読み込みのメインルーチン / Initialize town array

戻り値
エラーコード

呼出しグラフ:

errr init_v_info ( void  )

Vault情報読み込みのメインルーチン / Initialize the "v_info" array.

戻り値
エラーコード
覚え書き
Note that we let each entry have a unique "name" and "text" string, even if the string happens to be empty (everyone has a unique '\0').

関数の呼び出しグラフ:

呼出しグラフ:

static void note ( cptr  str)
static

画面左下にシステムメッセージを表示する / Hack – take notes on line 23

戻り値
なし

関数の呼び出しグラフ:

呼出しグラフ:

変数

header a_head

固定アーティファクト情報のヘッダ構造体

header d_head

ダンジョン情報のヘッダ構造体

header e_head

アイテムエゴ情報のヘッダ構造体

cptr err_str[PARSE_ERROR_MAX]
初期値:
=
{
"parse error",
"obsolete file",
"missing record header",
"non-sequential records",
"invalid flag specification",
"undefined directive",
"out of memory",
"coordinates out of bounds",
"too few arguments",
"undefined terrain tag",
}
#define NULL
コンパイル環境に定義がない場合のNULL定義
Definition: h-define.h:19

エラーメッセージの名称定義 / Standard error message text

int error_idx

データ読み込み/初期化時に汎用的にエラーコードを保存するグローバル変数

int error_line

データ読み込み/初期化時に汎用的にエラー行数を保存するグローバル変数

header f_head

地形情報のヘッダ構造体

bool feat_tag_is_not_found = FALSE
static

地形タグ情報から地形IDを得られなかった場合にTRUEを返すグローバル変数

header k_head

ペースアイテム情報のヘッダ構造体

header m_head

プレイヤー職業魔法情報のヘッダ構造体

header r_head

モンスター種族情報のヘッダ構造体

header s_head

プレイヤー職業技能情報のヘッダ構造体

byte store_table[MAX_STORES][STORE_CHOICES][2]
static

店舗で販売するオブジェクトを定義する / Hack – Objects sold in the stores – by tval/sval pair.

header v_head

Vault情報のヘッダ構造体