1 #include "save/info-writer.h"
2 #include "birth/quick-start.h"
3 #include "game-option/cheat-options.h"
4 #include "game-option/option-flags.h"
5 #include "game-option/option-types-table.h"
6 #include "game-option/special-options.h"
7 #include "player-ability/player-ability-types.h"
8 #include "save/item-writer.h"
9 #include "save/save-util.h"
10 #include "save/save.h"
11 #include "store/store-util.h"
12 #include "system/angband-system.h"
13 #include "system/angband.h"
14 #include "system/item-entity.h"
15 #include "util/enum-converter.h"
16 #include "world/world.h"
19 * @brief セーブデータに店舗情報を書き込む / Write a "store" record
20 * @param store_ptr 店舗情報の参照ポインタ
22 void wr_store(store_type *store_ptr)
24 wr_u32b(store_ptr->store_open);
25 wr_s16b(store_ptr->insult_cur);
26 wr_byte(store_ptr->owner);
27 wr_s16b(store_ptr->stock_num);
28 wr_s16b(store_ptr->good_buy);
29 wr_s16b(store_ptr->bad_buy);
30 wr_s32b(store_ptr->last_visit);
31 for (int j = 0; j < store_ptr->stock_num; j++) {
32 wr_item(&store_ptr->stock[j]);
37 * @brief セーブデータに乱数情報を書き込む / Write RNG state
40 void wr_randomizer(void)
44 const auto &state = AngbandSystem::get_instance().rng.get_state();
45 for (const auto s : state) {
48 for (int i = state.size(); i < RAND_DEG; i++) {
54 * @brief ゲームオプション情報を書き込む / Write the "options"
56 void wr_options(SaveType type)
58 for (int i = 0; i < 4; i++) {
62 wr_u32b(delay_factor);
64 wr_byte(hitpoint_warn);
67 /*** Cheating options ***/
109 if (cheat_diary_output) {
113 if (cheat_immortal) {
117 if (type == SaveType::DEBUG) {
125 wr_s16b(autosave_freq);
127 for (int i = 0; option_info[i].o_desc; i++) {
128 int os = option_info[i].o_set;
129 int ob = option_info[i].o_bit;
130 if (!option_info[i].o_var) {
134 if (*option_info[i].o_var) {
135 g_option_flags[os] |= (1UL << ob);
137 g_option_flags[os] &= ~(1UL << ob);
141 for (const auto &option_flag : g_option_flags) {
142 wr_u32b(option_flag);
145 for (const auto &option_mask : g_option_masks) {
146 wr_u32b(option_mask);
149 for (const auto &window_flag : g_window_flags) {
150 wr_FlagGroup_bytes(window_flag, wr_byte, 4);
153 for (const auto &window_mask : g_window_masks) {
154 wr_FlagGroup_bytes(window_mask, wr_byte, 4);
159 * @brief ダミー情報スキップを書き込む / Hack -- Write the "ghost" info
163 wr_string(_("不正なゴースト", "Broken Ghost"));
164 for (int i = 0; i < 60; i++) {
170 * @brief クイック・スタート情報を書き込む / Save quick start data
172 void save_quick_start(void)
174 wr_byte(previous_char.psex);
175 wr_byte((byte)previous_char.prace);
176 wr_byte((byte)previous_char.pclass);
177 wr_byte((byte)previous_char.ppersonality);
178 wr_byte((byte)previous_char.realm1);
179 wr_byte((byte)previous_char.realm2);
181 wr_s16b(previous_char.age);
182 wr_s16b(previous_char.ht);
183 wr_s16b(previous_char.wt);
184 wr_s16b(previous_char.sc);
185 wr_s32b(previous_char.au);
187 for (int i = 0; i < A_MAX; i++) {
188 wr_s16b(previous_char.stat_max[i]);
191 for (int i = 0; i < A_MAX; i++) {
192 wr_s16b(previous_char.stat_max_max[i]);
195 for (int i = 0; i < PY_MAX_LEVEL; i++) {
196 wr_s16b((int16_t)previous_char.player_hp[i]);
199 wr_s16b(previous_char.chaos_patron);
200 for (int i = 0; i < 8; i++) {
201 wr_s16b(enum2i(previous_char.vir_types[i]));
204 for (int i = 0; i < 4; i++) {
205 wr_string(previous_char.history[i]);
208 /* UNUSED : Was number of random quests */
210 if (w_ptr->noscore) {
211 previous_char.quick_ok = false;
214 wr_byte((byte)previous_char.quick_ok);