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.h"
13 #include "system/item-entity.h"
14 #include "util/enum-converter.h"
15 #include "world/world.h"
18 * @brief セーブデータに店舗情報を書き込む / Write a "store" record
19 * @param store_ptr 店舗情報の参照ポインタ
21 void wr_store(store_type *store_ptr)
23 wr_u32b(store_ptr->store_open);
24 wr_s16b(store_ptr->insult_cur);
25 wr_byte(store_ptr->owner);
26 wr_s16b(store_ptr->stock_num);
27 wr_s16b(store_ptr->good_buy);
28 wr_s16b(store_ptr->bad_buy);
29 wr_s32b(store_ptr->last_visit);
30 for (int j = 0; j < store_ptr->stock_num; j++) {
31 wr_item(&store_ptr->stock[j]);
36 * @brief セーブデータに乱数情報を書き込む / Write RNG state
39 void wr_randomizer(void)
43 const auto &state = w_ptr->rng.get_state();
44 for (const auto s : state) {
47 for (int i = state.size(); i < RAND_DEG; i++) {
53 * @brief ゲームオプション情報を書き込む / Write the "options"
55 void wr_options(SaveType type)
57 for (int i = 0; i < 4; i++) {
61 wr_u32b(delay_factor);
63 wr_byte(hitpoint_warn);
66 /*** Cheating options ***/
108 if (cheat_diary_output) {
112 if (cheat_immortal) {
116 if (type == SaveType::DEBUG) {
124 wr_s16b(autosave_freq);
126 for (int i = 0; option_info[i].o_desc; i++) {
127 int os = option_info[i].o_set;
128 int ob = option_info[i].o_bit;
129 if (!option_info[i].o_var) {
133 if (*option_info[i].o_var) {
134 g_option_flags[os] |= (1UL << ob);
136 g_option_flags[os] &= ~(1UL << ob);
140 for (const auto &option_flag : g_option_flags) {
141 wr_u32b(option_flag);
144 for (const auto &option_mask : g_option_masks) {
145 wr_u32b(option_mask);
148 for (const auto &window_flag : g_window_flags) {
149 wr_FlagGroup_bytes(window_flag, wr_byte, 4);
152 for (const auto &window_mask : g_window_masks) {
153 wr_u32b(window_mask);
158 * @brief ダミー情報スキップを書き込む / Hack -- Write the "ghost" info
162 wr_string(_("不正なゴースト", "Broken Ghost"));
163 for (int i = 0; i < 60; i++) {
169 * @brief クイック・スタート情報を書き込む / Save quick start data
171 void save_quick_start(void)
173 wr_byte(previous_char.psex);
174 wr_byte((byte)previous_char.prace);
175 wr_byte((byte)previous_char.pclass);
176 wr_byte((byte)previous_char.ppersonality);
177 wr_byte((byte)previous_char.realm1);
178 wr_byte((byte)previous_char.realm2);
180 wr_s16b(previous_char.age);
181 wr_s16b(previous_char.ht);
182 wr_s16b(previous_char.wt);
183 wr_s16b(previous_char.sc);
184 wr_s32b(previous_char.au);
186 for (int i = 0; i < A_MAX; i++) {
187 wr_s16b(previous_char.stat_max[i]);
190 for (int i = 0; i < A_MAX; i++) {
191 wr_s16b(previous_char.stat_max_max[i]);
194 for (int i = 0; i < PY_MAX_LEVEL; i++) {
195 wr_s16b((int16_t)previous_char.player_hp[i]);
198 wr_s16b(previous_char.chaos_patron);
199 for (int i = 0; i < 8; i++) {
200 wr_s16b(enum2i(previous_char.vir_types[i]));
203 for (int i = 0; i < 4; i++) {
204 wr_string(previous_char.history[i]);
207 /* UNUSED : Was number of random quests */
209 if (w_ptr->noscore) {
210 previous_char.quick_ok = false;
213 wr_byte((byte)previous_char.quick_ok);