OSDN Git Service

[Add] @return を不要に書き込んだことによる警告をひとまず置換で修正.
[hengbandforosx/hengbandosx.git] / src / load / info-loader.cpp
1 #include "load/info-loader.h"
2 #include "game-option/runtime-arguments.h"
3 #include "load/angband-version-comparer.h"
4 #include "load/load-util.h"
5 #include "load/option-loader.h"
6 #include "system/angband.h"
7 #include "system/angband-version.h"
8 #include "view/display-messages.h"
9 #include "world/world.h"
10
11 /*!
12  * @brief セーブファイルからバージョン情報及びセーブ情報を取得する
13  * @details
14  * バージョン0.x.x時代のバージョン情報である場合、サポート対象外
15  * (FAKE_VERもH_VERも10台の数字のはず)
16  */
17 void rd_version_info(void)
18 {
19     byte fake_major;
20     rd_byte(&fake_major);
21
22     strip_bytes(3);
23     load_xor_byte = current_world_ptr->sf_extra;
24     v_check = 0L;
25     x_check = 0L;
26
27     /* Old savefile will be version 0.0.0.3 */
28     rd_byte(&current_world_ptr->h_ver_extra);
29     rd_byte(&current_world_ptr->h_ver_patch);
30     rd_byte(&current_world_ptr->h_ver_minor);
31     rd_byte(&current_world_ptr->h_ver_major);
32
33     rd_u32b(&current_world_ptr->sf_system);
34     rd_u32b(&current_world_ptr->sf_when);
35     rd_u16b(&current_world_ptr->sf_lives);
36     rd_u16b(&current_world_ptr->sf_saves);
37
38     rd_u32b(&loading_savefile_version);
39
40     /* h_ver_majorがfake_ver_majorと同じだったころへの対策 */
41     if (fake_major - current_world_ptr->h_ver_major < FAKE_VER_PLUS)
42         current_world_ptr->h_ver_major -= FAKE_VER_PLUS;
43
44     load_note(format(_("バージョン %d.%d.%d のセーブデータ(SAVE%lu形式)をロード中...", "Loading a Verison %d.%d.%d savefile (SAVE%lu format)..."),
45         current_world_ptr->h_ver_major, current_world_ptr->h_ver_minor, current_world_ptr->h_ver_patch,
46         loading_savefile_version));
47 }
48
49 /*!
50  * @brief 乱数状態を読み込む / Read RNG state (added in 2.8.0)
51  */
52 void rd_randomizer(void)
53 {
54     u16b tmp16u;
55     rd_u16b(&tmp16u);
56     rd_u16b(&Rand_place);
57     for (int i = 0; i < RAND_DEG; i++)
58         rd_u32b(&Rand_state[i]);
59 }
60
61 /*!
62  * @brief メッセージログを読み込む / Read the saved messages
63  */
64 void rd_messages(void)
65 {
66     if (h_older_than(2, 2, 0, 75)) {
67         u16b num;
68         rd_u16b(&num);
69         int message_max;
70         message_max = (int)num;
71
72         for (int i = 0; i < message_max; i++) {
73             char buf[128];
74             rd_string(buf, sizeof(buf));
75             message_add(buf);
76         }
77     }
78
79     u32b num;
80     rd_u32b(&num);
81     int message_max = (int)num;
82     for (int i = 0; i < message_max; i++) {
83         char buf[128];
84         rd_string(buf, sizeof(buf));
85         message_add(buf);
86     }
87 }
88
89 void rd_system_info(void)
90 {
91     rd_byte(&kanji_code);
92     rd_randomizer();
93     if (arg_fiddle)
94         load_note(_("乱数情報をロードしました", "Loaded Randomizer Info"));
95
96     rd_options();
97     if (arg_fiddle)
98         load_note(_("オプションをロードしました", "Loaded Option Flags"));
99
100     rd_messages();
101     if (arg_fiddle)
102         load_note(_("メッセージをロードしました", "Loaded Messages"));
103 }