1 #include "load/option-loader.h"
2 #include "cmd-io/cmd-gameoption.h"
3 #include "game-option/cheat-options.h"
4 #include "game-option/option-flags.h"
5 #include "game-option/special-options.h"
6 #include "load/angband-version-comparer.h"
7 #include "load/load-util.h"
8 #include "load/load-zangband.h"
9 #include "system/angband.h"
10 #include "util/bit-flags-calculator.h"
11 #include "world/world.h"
14 * @brief ゲームオプションを読み込む / Read options (ignore most pre-2.8.0 options)
16 * Note that the normal options are now stored as a set of 256 bit flags,
17 * plus a set of 256 bit masks to indicate which bit flags were defined
18 * at the time the savefile was created. This will allow new options
19 * to be added, and old options to be removed, at any time, without
20 * hurting old savefiles.
22 * The window options are stored in the same way, but note that each
23 * window gets 32 options, and their order is fixed by certain defines.
29 if (loading_savefile_version_is_older_than(9)) {
31 delay_factor = b * b * b;
33 delay_factor = rd_s32b();
36 hitpoint_warn = rd_byte();
38 if (h_older_than(1, 7, 0, 0)) {
41 mana_warn = rd_byte();
49 cheat_peek = any_bits(c, 0x0100);
50 cheat_hear = any_bits(c, 0x0200);
51 cheat_room = any_bits(c, 0x0400);
52 cheat_xtra = any_bits(c, 0x0800);
53 cheat_know = any_bits(c, 0x1000);
54 cheat_live = any_bits(c, 0x2000);
55 cheat_save = any_bits(c, 0x4000);
56 cheat_diary_output = any_bits(c, 0x8000);
57 cheat_turn = any_bits(c, 0x0080);
58 cheat_sight = any_bits(c, 0x0040);
59 cheat_immortal = any_bits(c, 0x0020);
61 autosave_l = rd_byte() != 0;
62 autosave_t = rd_byte() != 0;
63 autosave_freq = rd_s16b();
66 for (int n = 0; n < 8; n++)
70 for (int n = 0; n < 8; n++)
73 for (auto n = 0; n < 8; n++) {
74 for (auto i = 0; i < 32; i++) {
75 if (none_bits(mask[n], 1U << i) || none_bits(option_mask[n], 1U << i)) {
79 if (flag[n] & (1UL << i)) {
80 option_flag[n] |= (1UL << i);
82 option_flag[n] &= ~(1UL << i);
87 if (h_older_than(0, 4, 5))
88 load_zangband_options();
90 extract_option_vars();
91 for (int n = 0; n < 8; n++)
94 for (int n = 0; n < 8; n++)
97 for (int n = 0; n < 8; n++) {
98 for (int i = 0; i < 32; i++) {
99 if (!(mask[n] & (1UL << i)))
101 if (!(window_mask[n] & (1UL << i)))
104 if (flag[n] & (1UL << i)) {
105 window_flag[n] |= (1UL << i);
107 window_flag[n] &= ~(1UL << i);