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

セーブファイル読み込み処理 / Purpose: support for loading savefiles -BEN- [詳細]

#include "angband.h"
load.cのインクルード依存関係図

マクロ定義

#define MAX_TRIES   100
 
#define OLD_MAX_MANE   22
 
#define RF3_IM_ACID   0x00010000 /* Resist acid a lot */
 
#define RF3_IM_ELEC   0x00020000 /* Resist elec a lot */
 
#define RF3_IM_FIRE   0x00040000 /* Resist fire a lot */
 
#define RF3_IM_COLD   0x00080000 /* Resist cold a lot */
 
#define RF3_IM_POIS   0x00100000 /* Resist poison a lot */
 
#define RF3_RES_TELE   0x00200000 /* Resist teleportation */
 
#define RF3_RES_NETH   0x00400000 /* Resist nether a lot */
 
#define RF3_RES_WATE   0x00800000 /* Resist water */
 
#define RF3_RES_PLAS   0x01000000 /* Resist plasma */
 
#define RF3_RES_NEXU   0x02000000 /* Resist nexus */
 
#define RF3_RES_DISE   0x04000000 /* Resist disenchantment */
 
#define RF3_RES_ALL   0x08000000 /* Resist all */
 
#define MOVE_RF3_TO_RFR(R_PTR, RF3, RFR)
 
#define RF4_BR_TO_RFR(R_PTR, RF4_BR, RFR)
 
#define RF4_BR_LITE   0x00004000 /* Breathe Lite */
 
#define RF4_BR_DARK   0x00008000 /* Breathe Dark */
 
#define RF4_BR_CONF   0x00010000 /* Breathe Confusion */
 
#define RF4_BR_SOUN   0x00020000 /* Breathe Sound */
 
#define RF4_BR_CHAO   0x00040000 /* Breathe Chaos */
 
#define RF4_BR_TIME   0x00200000 /* Breathe Time */
 
#define RF4_BR_INER   0x00400000 /* Breathe Inertia */
 
#define RF4_BR_GRAV   0x00800000 /* Breathe Gravity */
 
#define RF4_BR_SHAR   0x01000000 /* Breathe Shards */
 
#define RF4_BR_WALL   0x04000000 /* Breathe Force */
 
#define CAVE_TRAP   0x8000
 
#define OLD_FEAT_INVIS   0x02
 
#define OLD_FEAT_GLYPH   0x03
 
#define OLD_FEAT_QUEST_ENTER   0x08
 
#define OLD_FEAT_QUEST_EXIT   0x09
 
#define OLD_FEAT_MINOR_GLYPH   0x40
 
#define OLD_FEAT_BLDG_1   0x81
 
#define OLD_FEAT_MIRROR   0xc3
 
#define OLD_QUEST_WATER_CAVE   18
 
#define QUEST_OLD_CASTLE   27
 
#define QUEST_ROYAL_CRYPT   28
 

関数

static bool h_older_than (byte major, byte minor, byte patch, byte extra)
 変愚蛮怒のバージョン比較処理 / This function determines if the version of the savefile currently being read is older than version "major.minor.patch.extra". [詳細]
 
static bool z_older_than (byte x, byte y, byte z)
 Zangbandのバージョン比較処理 / The above function, adapted for Zangband. [詳細]
 
static void note (cptr msg)
 ゲームスクリーンにメッセージを表示する / Hack – Show information on the screen, one line at a time. [詳細]
 
static byte sf_get (void)
 ロードファイルポインタから1バイトを読み込む [詳細]
 
static void rd_byte (byte *ip)
 ロードファイルポインタから1バイトを読み込んでポインタに渡す [詳細]
 
static void rd_u16b (u16b *ip)
 ロードファイルポインタから符号なし16bit値を読み込んでポインタに渡す [詳細]
 
static void rd_s16b (s16b *ip)
 ロードファイルポインタから符号つき16bit値を読み込んでポインタに渡す [詳細]
 
static void rd_u32b (u32b *ip)
 ロードファイルポインタから符号なし32bit値を読み込んでポインタに渡す [詳細]
 
static void rd_s32b (s32b *ip)
 ロードファイルポインタから符号つき32bit値を読み込んでポインタに渡す [詳細]
 
static void rd_string (char *str, int max)
 ロードファイルポインタから文字列を読み込んでポインタに渡す / Hack – read a string [詳細]
 
static void strip_bytes (int n)
 ロードファイルポインタを指定バイト分飛ばして進める / Hack – strip some bytes [詳細]
 
static void rd_item_old (object_type *o_ptr)
 アイテムオブジェクト1件を読み込む(変愚ver1.5.0以前) / Read an object (Old method) [詳細]
 
static void rd_item (object_type *o_ptr)
 アイテムオブジェクトを読み込む(現版) / Read an object (New method) [詳細]
 
static void rd_monster_old (monster_type *m_ptr)
 モンスターを読み込む(変愚ver1.5.0以前) / Read a monster (Old method) [詳細]
 
static void rd_monster (monster_type *m_ptr)
 モンスターを読み込む(現版) / Read a monster (New method) [詳細]
 
static void rd_lore (int r_idx)
 モンスターの思い出を読み込む / Read the monster lore [詳細]
 
static void home_carry (store_type *st_ptr, object_type *o_ptr)
 店置きのアイテムオブジェクトを読み込む / Add the item "o_ptr" to the inventory of the "Home" [詳細]
 
static errr rd_store (int town_number, int store_number)
 店舗情報を読み込む / Read a store [詳細]
 
static void rd_randomizer (void)
 乱数状態を読み込む / Read RNG state (added in 2.8.0) [詳細]
 
static void rd_options (void)
 ゲームオプションを読み込む / Read options (ignore most pre-2.8.0 options) [詳細]
 
static void rd_ghost (void)
 ダミー情報スキップ / Hack – strip the "ghost" info [詳細]
 
static void load_quick_start (void)
 クイックスタート情報を読み込む / Load quick start data [詳細]
 
static void rd_extra (void)
 その他の情報を読み込む / Read the "extra" information [詳細]
 
static errr rd_inventory (void)
 プレイヤーの所持品情報を読み込む / Read the player inventory [詳細]
 
static void rd_messages (void)
 メッセージログを読み込む / Read the saved messages [詳細]
 
static errr rd_dungeon_old (void)
 メッセージログを読み込む / Read the dungeon (old method) [詳細]
 
static errr rd_saved_floor (saved_floor_type *sf_ptr)
 保存されたフロアを読み込む / Read the saved floor [詳細]
 
static errr rd_dungeon (void)
 保存されたフロアを読み込む(現版) / Read the dungeon (new method) [詳細]
 
static errr rd_savefile_new_aux (void)
 ロード処理全体のサブ関数 / Actually read the savefile [詳細]
 
errr rd_savefile_new (void)
 ロード処理全体のメイン関数 / Actually read the savefile [詳細]
 
static bool load_floor_aux (saved_floor_type *sf_ptr)
 保存フロア読み込みのサブ関数 / Actually load and verify a floor save data [詳細]
 
bool load_floor (saved_floor_type *sf_ptr, u32b mode)
 一時保存フロア情報を読み込む / Attempt to load the temporally saved-floor data [詳細]
 

変数

static FILE * fff
 
static byte xor_byte
 
static u32b v_check = 0L
 
static u32b x_check = 0L
 
static byte kanji_code = 0
 

説明

セーブファイル読み込み処理 / Purpose: support for loading savefiles -BEN-

日付
2014/07/07
作者
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.

This file loads savefiles from Angband 2.7.X and 2.8.X

Ancient savefiles (pre-2.7.0) are loaded by another file.

Note that Angband 2.7.0 through 2.7.3 are now officially obsolete, and savefiles from those versions may not be successfully converted.

We attempt to prevent corrupt savefiles from inducing memory errors.

Note that this file should not use the random number generator, the object flavors, the visual attr/char mappings, or anything else which is initialized after or during the "load character" function.

This file assumes that the monster/object records are initialized to zero, and the race/kind tables have been loaded correctly. The order of object stacks is currently not saved in the savefiles, but the "next" pointers are saved, so all necessary knowledge is present.

We should implement simple "savefile extenders" using some form of "sized" chunks of bytes, with a {size,type,data} format, so everyone can know the size, interested people can know the type, and the actual data is available to the parsing routines that acknowledge the type.

Consider changing the "globe of invulnerability" code so that it takes some form of "maximum damage to protect from" in addition to the existing "number of turns to protect for", and where each hit by a monster will reduce the shield by that amount.

XXX XXX XXX

マクロ定義

#define CAVE_TRAP   0x8000
#define MAX_TRIES   100
#define MOVE_RF3_TO_RFR (   R_PTR,
  RF3,
  RFR 
)
値:
{\
if ((R_PTR)->r_flags3 & (RF3)) \
{ \
(R_PTR)->r_flags3 &= ~(RF3); \
(R_PTR)->r_flagsr |= (RFR); \
} \
}
#define OLD_FEAT_BLDG_1   0x81
#define OLD_FEAT_GLYPH   0x03
#define OLD_FEAT_INVIS   0x02
#define OLD_FEAT_MINOR_GLYPH   0x40
#define OLD_FEAT_MIRROR   0xc3
#define OLD_FEAT_QUEST_ENTER   0x08
#define OLD_FEAT_QUEST_EXIT   0x09
#define OLD_MAX_MANE   22
#define OLD_QUEST_WATER_CAVE   18
#define QUEST_OLD_CASTLE   27
#define QUEST_ROYAL_CRYPT   28
#define RF3_IM_ACID   0x00010000 /* Resist acid a lot */
#define RF3_IM_COLD   0x00080000 /* Resist cold a lot */
#define RF3_IM_ELEC   0x00020000 /* Resist elec a lot */
#define RF3_IM_FIRE   0x00040000 /* Resist fire a lot */
#define RF3_IM_POIS   0x00100000 /* Resist poison a lot */
#define RF3_RES_ALL   0x08000000 /* Resist all */
#define RF3_RES_DISE   0x04000000 /* Resist disenchantment */
#define RF3_RES_NETH   0x00400000 /* Resist nether a lot */
#define RF3_RES_NEXU   0x02000000 /* Resist nexus */
#define RF3_RES_PLAS   0x01000000 /* Resist plasma */
#define RF3_RES_TELE   0x00200000 /* Resist teleportation */
#define RF3_RES_WATE   0x00800000 /* Resist water */
#define RF4_BR_CHAO   0x00040000 /* Breathe Chaos */
#define RF4_BR_CONF   0x00010000 /* Breathe Confusion */
#define RF4_BR_DARK   0x00008000 /* Breathe Dark */
#define RF4_BR_GRAV   0x00800000 /* Breathe Gravity */
#define RF4_BR_INER   0x00400000 /* Breathe Inertia */
#define RF4_BR_LITE   0x00004000 /* Breathe Lite */
#define RF4_BR_SHAR   0x01000000 /* Breathe Shards */
#define RF4_BR_SOUN   0x00020000 /* Breathe Sound */
#define RF4_BR_TIME   0x00200000 /* Breathe Time */
#define RF4_BR_TO_RFR (   R_PTR,
  RF4_BR,
  RFR 
)
値:
{\
if ((R_PTR)->r_flags4 & (RF4_BR)) \
{ \
(R_PTR)->r_flagsr |= (RFR); \
} \
}
#define RF4_BR_WALL   0x04000000 /* Breathe Force */

関数

static bool h_older_than ( byte  major,
byte  minor,
byte  patch,
byte  extra 
)
static

変愚蛮怒のバージョン比較処理 / This function determines if the version of the savefile currently being read is older than version "major.minor.patch.extra".

引数
majorメジャーバージョン値
minorマイナーバージョン値
patchパッチバージョン値
extraエクストラパージョン値
戻り値
現在のバージョンより値が古いならtrue

呼出しグラフ:

static void home_carry ( store_type st_ptr,
object_type o_ptr 
)
static

店置きのアイテムオブジェクトを読み込む / Add the item "o_ptr" to the inventory of the "Home"

引数
st_ptr店舗の参照ポインタ
o_ptrアイテムオブジェクト参照ポインタ
戻り値
なし

In all cases, return the slot (or -1) where the object was placed

Note that this is a hacked up version of "inven_carry()".

Also note that it may not correctly "adapt" to "knowledge" bacoming known, the player may have to pick stuff up and drop it again.

関数の呼び出しグラフ:

呼出しグラフ:

bool load_floor ( saved_floor_type sf_ptr,
u32b  mode 
)

一時保存フロア情報を読み込む / Attempt to load the temporally saved-floor data

引数
sf_ptr保存フロア読み込み先
modeオプション
戻り値
成功したらtrue

関数の呼び出しグラフ:

呼出しグラフ:

static bool load_floor_aux ( saved_floor_type sf_ptr)
static

保存フロア読み込みのサブ関数 / Actually load and verify a floor save data

引数
sf_ptr保存フロア読み込み先
戻り値
成功したらtrue

関数の呼び出しグラフ:

呼出しグラフ:

static void load_quick_start ( void  )
static

クイックスタート情報を読み込む / Load quick start data

戻り値
なし

関数の呼び出しグラフ:

呼出しグラフ:

static void note ( cptr  msg)
static

ゲームスクリーンにメッセージを表示する / Hack – Show information on the screen, one line at a time.

引数
msg表示文字列
戻り値
なし

Avoid the top two lines, to avoid interference with "msg_print()".

関数の呼び出しグラフ:

呼出しグラフ:

static void rd_byte ( byte ip)
static

ロードファイルポインタから1バイトを読み込んでポインタに渡す

引数
ip読み込みポインタ
戻り値
なし

関数の呼び出しグラフ:

呼出しグラフ:

static errr rd_dungeon ( void  )
static

保存されたフロアを読み込む(現版) / Read the dungeon (new method)

戻り値
なし

The monsters/objects must be loaded in the same order that they were stored, since the actual indexes matter.

関数の呼び出しグラフ:

呼出しグラフ:

static errr rd_dungeon_old ( void  )
static

メッセージログを読み込む / Read the dungeon (old method)

戻り値
なし

The monsters/objects must be loaded in the same order that they were stored, since the actual indexes matter.

関数の呼び出しグラフ:

呼出しグラフ:

static void rd_extra ( void  )
static

その他の情報を読み込む / Read the "extra" information

戻り値
なし

関数の呼び出しグラフ:

呼出しグラフ:

static void rd_ghost ( void  )
static

ダミー情報スキップ / Hack – strip the "ghost" info

戻り値
なし

XXX XXX XXX This is such a nasty hack it hurts.

関数の呼び出しグラフ:

呼出しグラフ:

static errr rd_inventory ( void  )
static

プレイヤーの所持品情報を読み込む / Read the player inventory

戻り値
なし

Note that the inventory changed in Angband 2.7.4. Two extra pack slots were added and the equipment was rearranged. Note that these two features combine when parsing old save-files, in which items from the old "aux" slot are "carried", perhaps into one of the two new "inventory" slots.

Note that the inventory is "re-sorted" later by "dungeon()".

関数の呼び出しグラフ:

呼出しグラフ:

static void rd_item ( object_type o_ptr)
static

アイテムオブジェクトを読み込む(現版) / Read an object (New method)

引数
o_ptrアイテムオブジェクト保存先ポインタ
戻り値
なし

関数の呼び出しグラフ:

呼出しグラフ:

static void rd_item_old ( object_type o_ptr)
static

アイテムオブジェクト1件を読み込む(変愚ver1.5.0以前) / Read an object (Old method)

引数
o_ptrアイテムオブジェクト読み取り先ポインタ
戻り値
なし

This function attempts to "repair" old savefiles, and to extract the most up to date values for various object fields.

Note that Angband 2.7.9 introduced a new method for object "flags" in which the "flags" on an object are actually extracted when they are needed from the object kind, artifact index, ego-item index, and two special "xtra" fields which are used to encode any "extra" power of certain ego-items. This had the side effect that items imported from pre-2.7.9 savefiles will lose any "extra" powers they may have had, and also, all "uncursed" items will become "cursed" again, including Calris, even if it is being worn at the time. As a complete hack, items which are inscribed with "uncursed" will be "uncursed" when imported from pre-2.7.9 savefiles.

関数の呼び出しグラフ:

呼出しグラフ:

static void rd_lore ( int  r_idx)
static

モンスターの思い出を読み込む / Read the monster lore

引数
r_idx読み込み先モンスターID
戻り値
なし

関数の呼び出しグラフ:

呼出しグラフ:

static void rd_messages ( void  )
static

メッセージログを読み込む / Read the saved messages

戻り値
なし

関数の呼び出しグラフ:

呼出しグラフ:

static void rd_monster ( monster_type m_ptr)
static

モンスターを読み込む(現版) / Read a monster (New method)

引数
m_ptrモンスター保存先ポインタ
戻り値
なし

関数の呼び出しグラフ:

呼出しグラフ:

static void rd_monster_old ( monster_type m_ptr)
static

モンスターを読み込む(変愚ver1.5.0以前) / Read a monster (Old method)

引数
m_ptrモンスター保存先ポインタ
戻り値
なし

関数の呼び出しグラフ:

呼出しグラフ:

static void rd_options ( void  )
static

ゲームオプションを読み込む / Read options (ignore most pre-2.8.0 options)

戻り値
なし

Note that the normal options are now stored as a set of 256 bit flags, plus a set of 256 bit masks to indicate which bit flags were defined at the time the savefile was created. This will allow new options to be added, and old options to be removed, at any time, without hurting old savefiles.

The window options are stored in the same way, but note that each window gets 32 options, and their order is fixed by certain defines.

関数の呼び出しグラフ:

呼出しグラフ:

static void rd_randomizer ( void  )
static

乱数状態を読み込む / Read RNG state (added in 2.8.0)

戻り値
なし

関数の呼び出しグラフ:

呼出しグラフ:

static void rd_s16b ( s16b ip)
static

ロードファイルポインタから符号つき16bit値を読み込んでポインタに渡す

引数
ip読み込みポインタ
戻り値
なし

関数の呼び出しグラフ:

呼出しグラフ:

static void rd_s32b ( s32b ip)
static

ロードファイルポインタから符号つき32bit値を読み込んでポインタに渡す

引数
ip読み込みポインタ
戻り値
なし

関数の呼び出しグラフ:

呼出しグラフ:

static errr rd_saved_floor ( saved_floor_type sf_ptr)
static

保存されたフロアを読み込む / Read the saved floor

戻り値
なし

The monsters/objects must be loaded in the same order that they were stored, since the actual indexes matter.

関数の呼び出しグラフ:

呼出しグラフ:

errr rd_savefile_new ( void  )

ロード処理全体のメイン関数 / Actually read the savefile

戻り値
エラーコード

関数の呼び出しグラフ:

呼出しグラフ:

static errr rd_savefile_new_aux ( void  )
static

ロード処理全体のサブ関数 / Actually read the savefile

戻り値
エラーコード

関数の呼び出しグラフ:

呼出しグラフ:

static errr rd_store ( int  town_number,
int  store_number 
)
static

店舗情報を読み込む / Read a store

引数
town_number街ID
store_number店舗ID
戻り値
エラーID

関数の呼び出しグラフ:

呼出しグラフ:

static void rd_string ( char *  str,
int  max 
)
static

ロードファイルポインタから文字列を読み込んでポインタに渡す / Hack – read a string

引数
str読み込みポインタ
max最大読み取りバイト数
戻り値
なし

関数の呼び出しグラフ:

呼出しグラフ:

static void rd_u16b ( u16b ip)
static

ロードファイルポインタから符号なし16bit値を読み込んでポインタに渡す

引数
ip読み込みポインタ
戻り値
なし

関数の呼び出しグラフ:

呼出しグラフ:

static void rd_u32b ( u32b ip)
static

ロードファイルポインタから符号なし32bit値を読み込んでポインタに渡す

引数
ip読み込みポインタ
戻り値
なし

関数の呼び出しグラフ:

呼出しグラフ:

static byte sf_get ( void  )
static

ロードファイルポインタから1バイトを読み込む

戻り値
読み込んだバイト値

The following functions are used to load the basic building blocks of savefiles. They also maintain the "checksum" info for 2.7.0+

呼出しグラフ:

static void strip_bytes ( int  n)
static

ロードファイルポインタを指定バイト分飛ばして進める / Hack – strip some bytes

引数
nスキップバイト数
戻り値
なし

関数の呼び出しグラフ:

呼出しグラフ:

static bool z_older_than ( byte  x,
byte  y,
byte  z 
)
static

Zangbandのバージョン比較処理 / The above function, adapted for Zangband.

引数
xメジャーバージョン値
yマイナーバージョン値
zパッチバージョン値
戻り値
現在のバージョンより値が古いならtrue

呼出しグラフ:

変数

FILE* fff
static
byte kanji_code = 0
static
u32b v_check = 0L
static
u32b x_check = 0L
static
byte xor_byte
static