Hengband
2.2.1
|
ファイル入出力管理 / Purpose: code dealing with files (and death) [詳解]
#include "angband.h"
#include "util.h"
#include "files.h"
#include "core.h"
#include "birth.h"
#include "bldg.h"
#include "cmd-magiceat.h"
#include "cmd-dump.h"
#include "world.h"
#include "player-inventory.h"
#include "player-race.h"
#include "player-status.h"
#include "player-move.h"
#include "player-class.h"
#include "player-skill.h"
#include "player-personality.h"
#include "player-sex.h"
#include "player-effects.h"
#include "sort.h"
#include "mutation.h"
#include "quest.h"
#include "store.h"
#include "artifact.h"
#include "avatar.h"
#include "shoot.h"
#include "patron.h"
#include "monster.h"
#include "monster-process.h"
#include "monster-status.h"
#include "object-flavor.h"
#include "object-hook.h"
#include "realm.h"
#include "realm-hex.h"
#include "cmd-pet.h"
#include "spells.h"
#include "term.h"
#include "view-mainwindow.h"
#include "floor-events.h"
#include "floor-town.h"
#include "dungeon-file.h"
#include "init.h"
#include "monster-spell.h"
#include "floor.h"
#include "dungeon.h"
#include "melee.h"
#include "objectkind.h"
#include "autopick.h"
#include "save.h"
#include "realm-song.h"
#include <signal.h>
データ構造 | |
struct | named_num |
struct | all_player_flags |
型定義 | |
typedef struct named_num | named_num |
関数 | |
void | safe_setuid_drop (void) |
ファイルのドロップパーミッションチェック / Hack – drop permissions [詳解] | |
void | safe_setuid_grab (void) |
ファイルのグラブパーミッションチェック / Hack – grab permissions [詳解] | |
s16b | tokenize (char *buf, s16b num, char **tokens, BIT_FLAGS mode) |
各種データテキストをトークン単位に分解する / Extract the first few "tokens" from a buffer [詳解] | |
errr | process_pref_file_command (char *buf) |
設定ファイルの各行から各種テキスト情報を取得する / Parse a sub-file of the "extra info" (format shown below) [詳解] | |
concptr | process_pref_file_expr (char **sp, char *fp) |
process_pref_fileのサブルーチンとして条件分岐処理の解釈と結果を返す / Helper function for "process_pref_file()" [詳解] | |
static errr | process_pref_file_aux (concptr name, int preftype) |
process_pref_fileのサブルーチン / Open the "user pref file" and parse it. [詳解] | |
errr | process_pref_file (concptr name) |
pref設定ファイルを読み込み設定を反映させる / Process the "user pref file" with the given name [詳解] | |
errr | check_time (void) |
Angbandプレイ禁止時刻をチェック / Handle CHECK_TIME [詳解] | |
errr | check_time_init (void) |
Angbandプレイ禁止時刻の初期化 / Initialize CHECK_TIME [詳解] | |
errr | check_load (void) |
Angbandプレイ禁止ホストのチェック / Handle CHECK_LOAD [詳解] | |
errr | check_load_init (void) |
Angbandプレイ禁止ホストの設定初期化 / Initialize CHECK_LOAD [詳解] | |
static void | display_player_one_line (int entry, concptr val, TERM_COLOR attr) |
プレイヤーのステータス1種を出力する [詳解] | |
static void | display_player_melee_bonus (int hand, int hand_entry) |
プレイヤーの打撃能力修正を表示する [詳解] | |
static void | display_player_middle (player_type *creature_ptr) |
プレイヤーステータス表示の中央部分を表示するサブルーチン Prints the following information on the screen. [詳解] | |
static concptr | likert (int x, int y) |
技能ランクの表示基準を定める Returns a "rating" of x depending on y [詳解] | |
static void | display_player_various (void) |
プレイヤーステータスの1ページ目各種詳細をまとめて表示するサブルーチン Prints ratings on certain abilities [詳解] | |
static void | player_flags (player_type *creature_ptr, BIT_FLAGS flgs[TR_FLAG_SIZE]) |
プレイヤーの職業、種族に応じた耐性フラグを返す Prints ratings on certain abilities [詳解] | |
static void | tim_player_flags (player_type *creature_ptr, BIT_FLAGS flgs[TR_FLAG_SIZE]) |
プレイヤーの一時的魔法効果による耐性を返す Prints ratings on certain abilities [詳解] | |
void | display_player_equippy (TERM_LEN y, TERM_LEN x, BIT_FLAGS16 mode) |
プレイヤーの装備一覧をシンボルで並べる Equippy chars [詳解] | |
static void | known_obj_immunity (BIT_FLAGS flgs[TR_FLAG_SIZE]) |
プレイヤーの装備による免疫フラグを返す [詳解] | |
static void | player_immunity (BIT_FLAGS flgs[TR_FLAG_SIZE]) |
プレイヤーの種族による免疫フラグを返す [詳解] | |
static void | tim_player_immunity (BIT_FLAGS flgs[TR_FLAG_SIZE]) |
プレイヤーの一時的魔法効果による免疫フラグを返す [詳解] | |
static void | player_vuln_flags (BIT_FLAGS flgs[TR_FLAG_SIZE]) |
プレイヤーの種族による弱点フラグを返す [詳解] | |
static void | display_flag_aux (TERM_LEN row, TERM_LEN col, concptr header, int flag1, all_player_flags *f, u16b mode) |
プレイヤーの特性フラグ一種を表示するサブルーチン / Helper function, see below [詳解] | |
static void | display_player_flag_info (void) |
プレイヤーの特性フラグ一覧表示1 / Special display, part 1 [詳解] | |
static void | display_player_other_flag_info (void) |
プレイヤーの特性フラグ一覧表示2 / Special display, part 2 [詳解] | |
static void | display_player_misc_info (void) |
プレイヤーの特性フラグ一覧表示2a / Special display, part 2a [詳解] | |
static void | display_player_stat_info (player_type *creature_ptr) |
プレイヤーの特性フラグ一覧表示2b / Special display, part 2b [詳解] | |
void | display_player (player_type *creature_ptr, int mode) |
プレイヤーのステータス表示メイン処理 Display the character on the screen (various modes) [詳解] | |
static void | dump_aux_display_player (FILE *fff) |
プレイヤーのステータス表示をファイルにダンプする [詳解] | |
static void | dump_aux_pet (FILE *fff) |
プレイヤーのペット情報をファイルにダンプする [詳解] | |
static void | dump_aux_class_special (FILE *fff) |
プレイヤーの職業能力情報をファイルにダンプする [詳解] | |
static void | dump_aux_quest (FILE *fff) |
クエスト情報をファイルにダンプする [詳解] | |
static void | dump_aux_last_message (FILE *fff) |
死の直前メッセージ並びに遺言をファイルにダンプする [詳解] | |
static void | dump_aux_recall (FILE *fff) |
帰還場所情報をファイルにダンプする [詳解] | |
static void | dump_aux_options (FILE *fff) |
オプション情報をファイルにダンプする [詳解] | |
static void | dump_aux_arena (FILE *fff) |
闘技場の情報をファイルにダンプする [詳解] | |
static void | dump_aux_monsters (FILE *fff) |
撃破モンスターの情報をファイルにダンプする [詳解] | |
static void | dump_aux_race_history (FILE *fff) |
元種族情報をファイルにダンプする [詳解] | |
static void | dump_aux_realm_history (FILE *fff) |
元魔法領域情報をファイルにダンプする [詳解] | |
static void | dump_aux_virtues (FILE *fff) |
徳の情報をファイルにダンプする [詳解] | |
static void | dump_aux_mutations (FILE *fff) |
突然変異の情報をファイルにダンプする [詳解] | |
static void | dump_aux_equipment_inventory (FILE *fff) |
所持品の情報をファイルにダンプする [詳解] | |
static void | dump_aux_home_museum (FILE *fff) |
我が家と博物館のオブジェクト情報をファイルにダンプする [詳解] | |
errr | make_character_dump (FILE *fff) |
ダンプ出力のメインルーチン Output the character dump to a file [詳解] | |
errr | file_character (concptr name) |
プレイヤーステータスをファイルダンプ出力する Hack – Dump a character description file [詳解] | |
static void | show_file_aux_line (concptr str, int cy, concptr shower) |
ファイル内容の一行をコンソールに出力する Display single line of on-line help file [詳解] | |
変数 | |
concptr | ANGBAND_DIR |
Path name: The main "lib" directory This variable is not actually used anywhere in the code [詳解] | |
concptr | ANGBAND_DIR_APEX |
High score files (binary) These files may be portable between platforms [詳解] | |
concptr | ANGBAND_DIR_BONE |
Bone files for player ghosts (ascii) These files are portable between platforms [詳解] | |
concptr | ANGBAND_DIR_DATA |
Binary image files for the "*_info" arrays (binary) These files are not portable between platforms [詳解] | |
concptr | ANGBAND_DIR_EDIT |
Textual template files for the "*_info" arrays (ascii) These files are portable between platforms [詳解] | |
concptr | ANGBAND_DIR_SCRIPT |
Script files These files are portable between platforms. [詳解] | |
concptr | ANGBAND_DIR_FILE |
Various extra files (ascii) These files may be portable between platforms [詳解] | |
concptr | ANGBAND_DIR_HELP |
Help files (normal) for the online help (ascii) These files are portable between platforms [詳解] | |
concptr | ANGBAND_DIR_INFO |
Help files (spoilers) for the online help (ascii) These files are portable between platforms [詳解] | |
concptr | ANGBAND_DIR_PREF |
Default user "preference" files (ascii) These files are rarely portable between platforms [詳解] | |
concptr | ANGBAND_DIR_SAVE |
Savefiles for current characters (binary) [詳解] | |
concptr | ANGBAND_DIR_USER |
User "preference" files (ascii) These files are rarely portable between platforms [詳解] | |
concptr | ANGBAND_DIR_XTRA |
Various extra files (binary) These files are rarely portable between platforms [詳解] | |
s16b | signal_count |
char | savefile [1024] |
char | savefile_base [40] |
static named_num | gf_desc [] |
struct { | |
int col | |
int row | |
int len | |
char header [20] | |
} | disp_player_line [] |
static TERM_COLOR | likert_color = TERM_WHITE |
ファイル入出力管理 / Purpose: code dealing with files (and death)
#define DP_CURSE 0x01 |
#define DP_IMM 0x02 |
#define DP_WP 0x08 |
#define ENTRY_AGE 38 |
#define ENTRY_ALIGN 42 |
#define ENTRY_AVG_DMG 30 |
#define ENTRY_BARE_HAND 0 |
#define ENTRY_BASE_AC 10 |
#define ENTRY_BLOWS 28 |
#define ENTRY_CLASS 35 |
#define ENTRY_CUR_EXP 12 |
#define ENTRY_DAY 16 |
#define ENTRY_EXP_ANDR 43 |
#define ENTRY_EXP_TO_ADV 14 |
#define ENTRY_EXP_TO_ADV_ANDR 44 |
#define ENTRY_GOLD 15 |
#define ENTRY_HEIGHT 39 |
#define ENTRY_HP 17 |
#define ENTRY_INFRA 31 |
#define ENTRY_LEFT_HAND1 3 |
#define ENTRY_LEFT_HAND2 4 |
#define ENTRY_LEVEL 11 |
#define ENTRY_MAX_EXP 13 |
#define ENTRY_NAME 32 |
#define ENTRY_PATRON 37 |
#define ENTRY_PLAY_TIME 19 |
#define ENTRY_POSTURE 6 |
#define ENTRY_RACE 34 |
#define ENTRY_REALM 36 |
#define ENTRY_RIGHT_HAND1 2 |
#define ENTRY_RIGHT_HAND2 5 |
#define ENTRY_SEX 33 |
#define ENTRY_SHOOT_HIT_DAM 7 |
#define ENTRY_SHOOT_POWER 8 |
#define ENTRY_SHOTS 29 |
#define ENTRY_SKILL_DEVICE 27 |
#define ENTRY_SKILL_DIG 45 |
#define ENTRY_SKILL_DISARM 26 |
#define ENTRY_SKILL_FIGHT 20 |
#define ENTRY_SKILL_PERCEP 24 |
#define ENTRY_SKILL_SAVING 22 |
#define ENTRY_SKILL_SEARCH 25 |
#define ENTRY_SKILL_SHOOT 21 |
#define ENTRY_SKILL_STEALTH 23 |
#define ENTRY_SOCIAL 41 |
#define ENTRY_SP 18 |
#define ENTRY_SPEED 9 |
#define ENTRY_TWO_HANDS 1 |
#define ENTRY_WEIGHT 40 |
#define GRAVE_LINE_WIDTH 31 |
#define PREF_TYPE_AUTOPICK 1 |
#define PREF_TYPE_HISTPREF 2 |
#define PREF_TYPE_NORMAL 0 |
errr check_load | ( | void | ) |
Angbandプレイ禁止ホストのチェック / Handle CHECK_LOAD
errr check_load_init | ( | void | ) |
Angbandプレイ禁止ホストの設定初期化 / Initialize CHECK_LOAD
errr check_time | ( | void | ) |
Angbandプレイ禁止時刻をチェック / Handle CHECK_TIME
errr check_time_init | ( | void | ) |
Angbandプレイ禁止時刻の初期化 / Initialize CHECK_TIME
|
static |
プレイヤーの特性フラグ一種を表示するサブルーチン / Helper function, see below
row | コンソール表示位置の左上行 |
col | コンソール表示位置の左上列 |
header | コンソール上で表示する特性名 |
flag1 | 参照する特性ID |
f | プレイヤーの特性情報構造体 |
mode | 表示オプション |
void display_player | ( | player_type * | creature_ptr, |
int | mode | ||
) |
プレイヤーのステータス表示メイン処理 Display the character on the screen (various modes)
mode | 表示モードID |
The top one and bottom two lines are left blank. Mode 0 = standard display with skills Mode 1 = standard display with history Mode 2 = summary of various things Mode 3 = summary of various things (part 2) Mode 4 = mutations
void display_player_equippy | ( | TERM_LEN | y, |
TERM_LEN | x, | ||
BIT_FLAGS16 | mode | ||
) |
プレイヤーの装備一覧をシンボルで並べる Equippy chars
y | 表示するコンソールの行 |
x | 表示するコンソールの列 |
mode | オプション |
|
static |
プレイヤーの特性フラグ一覧表示1 / Special display, part 1
|
static |
プレイヤーの打撃能力修正を表示する
hand | 武器の装備部位ID |
hand_entry | 項目ID |
|
static |
プレイヤーステータス表示の中央部分を表示するサブルーチン Prints the following information on the screen.
|
static |
プレイヤーの特性フラグ一覧表示2a / Special display, part 2a
|
static |
プレイヤーのステータス1種を出力する
entry | 項目ID |
val | 値を保管した文字列ポインタ |
attr | 項目表示の色 |
|
static |
プレイヤーの特性フラグ一覧表示2 / Special display, part 2
|
static |
プレイヤーの特性フラグ一覧表示2b / Special display, part 2b
How to print out the modifications and sustains. Positive mods with no sustain will be light green. Positive mods with a sustain will be dark green. Sustains (with no modification) will be a dark green 's'. Negative mods (from a curse) will be red. Huge mods (>9), like from MICoMorgoth, will be a '*' No mod, no sustain, will be a slate '.'
|
static |
プレイヤーステータスの1ページ目各種詳細をまとめて表示するサブルーチン Prints ratings on certain abilities
This code is "imitated" elsewhere to "dump" a character sheet.
|
static |
闘技場の情報をファイルにダンプする
fff | ファイルポインタ |
|
static |
プレイヤーの職業能力情報をファイルにダンプする
fff | ファイルポインタ |
|
static |
プレイヤーのステータス表示をファイルにダンプする
fff | ファイルポインタ |
|
static |
所持品の情報をファイルにダンプする
fff | ファイルポインタ |
|
static |
我が家と博物館のオブジェクト情報をファイルにダンプする
fff | ファイルポインタ |
|
static |
死の直前メッセージ並びに遺言をファイルにダンプする
fff | ファイルポインタ |
|
static |
撃破モンスターの情報をファイルにダンプする
fff | ファイルポインタ |
|
static |
突然変異の情報をファイルにダンプする
fff | ファイルポインタ |
|
static |
オプション情報をファイルにダンプする
fff | ファイルポインタ |
|
static |
プレイヤーのペット情報をファイルにダンプする
fff | ファイルポインタ |
|
static |
クエスト情報をファイルにダンプする
fff | ファイルポインタ |
|
static |
元種族情報をファイルにダンプする
fff | ファイルポインタ |
|
static |
元魔法領域情報をファイルにダンプする
fff | ファイルポインタ |
|
static |
帰還場所情報をファイルにダンプする
fff | ファイルポインタ |
|
static |
徳の情報をファイルにダンプする
fff | ファイルポインタ |
プレイヤーステータスをファイルダンプ出力する Hack – Dump a character description file
name | 出力ファイル名 |
Allow the "full" flag to dump additional info, and trigger its usage from various places in the code.
|
static |
|
static |
技能ランクの表示基準を定める Returns a "rating" of x depending on y
x | 技能値 |
y | 技能値に対するランク基準比 |
errr make_character_dump | ( | FILE * | fff | ) |
ダンプ出力のメインルーチン Output the character dump to a file
fff | ファイルポインタ |
|
static |
プレイヤーの職業、種族に応じた耐性フラグを返す Prints ratings on certain abilities
creature_ptr | 参照元クリーチャーポインタ |
flgs | フラグを保管する配列 |
Obtain the "flags" for the player as if he was an item
|
static |
|
static |
pref設定ファイルを読み込み設定を反映させる / Process the "user pref file" with the given name
name | 読み込むファイル名 |
See the functions above for a list of legal "commands". We also accept the special "?" and "%" directives, which allow conditional evaluation and filename inclusion.
process_pref_fileのサブルーチン / Open the "user pref file" and parse it.
name | 読み込むファイル名 |
preftype | prefファイルのタイプ |
Input: v: output buffer array f: final character Output: result
errr process_pref_file_command | ( | char * | buf | ) |
設定ファイルの各行から各種テキスト情報を取得する / Parse a sub-file of the "extra info" (format shown below)
buf | データテキストの参照ポインタ |
Each "action" line has an "action symbol" in the first column, followed by a colon, followed by some command specific info, usually in the form of "tokens" separated by colons or slashes. Blank lines, lines starting with white space, and lines starting with pound signs ("#") are ignored (as comments). Note the use of "tokenize()" to allow the use of both colons and slashes as delimeters, while still allowing final tokens which may contain any characters including "delimiters". Note the use of "strtol()" to allow all "integers" to be encoded in decimal, hexidecimal, or octal form. Note that "monster zero" is used for the "player" attr/char, "object zero" will be used for the "stack" attr/char, and "feature zero" is used for the "nothing" attr/char. Parse another file recursively, see below for details %:<filename> Specify the attr/char values for "monsters" by race index R:<num>:<a>:<c> Specify the attr/char values for "objects" by kind index K:<num>:<a>:<c> Specify the attr/char values for "features" by feature index F:<num>:<a>:<c> Specify the attr/char values for unaware "objects" by kind tval U:<tv>:<a>:<c> Specify the attr/char values for p_ptr->inventory_list "objects" by kind tval E:<tv>:<a>:<c> Define a macro action, given an encoded macro action A:<str> Create a normal macro, given an encoded macro trigger P:<str> Create a command macro, given an encoded macro trigger C:<str> Create a keyset mapping S:<key>:<key>:<dir> Turn an option off, given its name X:<str> Turn an option on, given its name Y:<str> Specify visual information, given an index, and some data V:<num>:<kv>:<rv>:<gv>:<bv> Specify the set of colors to use when drawing a zapped spell Z:<type>:<str> Specify a macro trigger template and macro trigger names. T:<template>:<modifier chr>:<modifier name1>:<modifier name2>:... T:<trigger>:<keycode>:<shift-keycode>
concptr process_pref_file_expr | ( | char ** | sp, |
char * | fp | ||
) |
process_pref_fileのサブルーチンとして条件分岐処理の解釈と結果を返す / Helper function for "process_pref_file()"
sp | テキスト文字列の参照ポインタ |
fp | 再帰中のポインタ参照 |
Input: v: output buffer array f: final character Output: result
void safe_setuid_drop | ( | void | ) |
ファイルのドロップパーミッションチェック / Hack – drop permissions
void safe_setuid_grab | ( | void | ) |
ファイルのグラブパーミッションチェック / Hack – grab permissions
ファイル内容の一行をコンソールに出力する Display single line of on-line help file
str | 出力する文字列 |
cy | コンソールの行 |
shower | 確認中 |
You can insert some special color tag to change text color. Such as... WHITETEXT [[[[y|SOME TEXT WHICH IS DISPLAYED IN YELLOW| WHITETEXT A colored segment is between "[[[[y|" and the last "|". You can use any single character in place of the "|".
|
static |
プレイヤーの一時的魔法効果による耐性を返す Prints ratings on certain abilities
flgs | フラグを保管する配列 |
|
static |
各種データテキストをトークン単位に分解する / Extract the first few "tokens" from a buffer
buf | データテキストの参照ポインタ |
num | トークンの数 |
tokens | トークンを保管する文字列参照ポインタ配列 |
mode | オプション |
This function uses "colon" and "slash" as the delimeter characters. We never extract more than "num" tokens. The "last" token may include "delimeter" characters, allowing the buffer to include a "string" token. We save pointers to the tokens in "tokens", and return the number found. Hack -- Attempt to handle the 'c' character formalism Hack -- An empty buffer, or a final delimeter, yields an "empty" token. Hack -- We will always extract at least one token
concptr ANGBAND_DIR |
Path name: The main "lib" directory This variable is not actually used anywhere in the code
concptr ANGBAND_DIR_APEX |
High score files (binary) These files may be portable between platforms
concptr ANGBAND_DIR_BONE |
Bone files for player ghosts (ascii) These files are portable between platforms
concptr ANGBAND_DIR_DATA |
Binary image files for the "*_info" arrays (binary) These files are not portable between platforms
concptr ANGBAND_DIR_EDIT |
Textual template files for the "*_info" arrays (ascii) These files are portable between platforms
concptr ANGBAND_DIR_FILE |
Various extra files (ascii) These files may be portable between platforms
concptr ANGBAND_DIR_HELP |
Help files (normal) for the online help (ascii) These files are portable between platforms
concptr ANGBAND_DIR_INFO |
Help files (spoilers) for the online help (ascii) These files are portable between platforms
concptr ANGBAND_DIR_PREF |
Default user "preference" files (ascii) These files are rarely portable between platforms
concptr ANGBAND_DIR_SAVE |
Savefiles for current characters (binary)
concptr ANGBAND_DIR_SCRIPT |
Script files These files are portable between platforms.
concptr ANGBAND_DIR_USER |
User "preference" files (ascii) These files are rarely portable between platforms
concptr ANGBAND_DIR_XTRA |
Various extra files (binary) These files are rarely portable between platforms
int col |
struct { ... } disp_player_line[] |
|
static |
char header[20] |
int len |
|
static |
int row |
char savefile[1024] |
char savefile_base[40] |
s16b signal_count |