OSDN Git Service

Merge pull request #502 from sikabane-works/release/3.0.0Alpha11
[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 "view/display-messages.h"
8 #include "world/world.h"
9
10 void rd_version_info(void)
11 {
12     strip_bytes(4);
13     load_xor_byte = current_world_ptr->sf_extra;
14     v_check = 0L;
15     x_check = 0L;
16
17     /* Old savefile will be version 0.0.0.3 */
18     rd_byte(&current_world_ptr->h_ver_extra);
19     rd_byte(&current_world_ptr->h_ver_patch);
20     rd_byte(&current_world_ptr->h_ver_minor);
21     rd_byte(&current_world_ptr->h_ver_major);
22
23     rd_u32b(&current_world_ptr->sf_system);
24     rd_u32b(&current_world_ptr->sf_when);
25     rd_u16b(&current_world_ptr->sf_lives);
26     rd_u16b(&current_world_ptr->sf_saves);
27
28     rd_u32b(&loading_savefile_version);
29
30     load_note(format(_("バージョン %d.%d.%d.%d のセーブデータ(SAVE%lu形式)をロード中...", "Loading a Verison %d.%d.%d.%d savefile (SAVE%lu format)..."),
31         (current_world_ptr->h_ver_major > 9) ? current_world_ptr->h_ver_major - 10 : current_world_ptr->h_ver_major, current_world_ptr->h_ver_minor,
32         current_world_ptr->h_ver_patch, current_world_ptr->h_ver_extra, loading_savefile_version));
33 }
34
35 /*!
36  * @brief 乱数状態を読み込む / Read RNG state (added in 2.8.0)
37  * @return なし
38  */
39 void rd_randomizer(void)
40 {
41     u16b tmp16u;
42     rd_u16b(&tmp16u);
43     rd_u16b(&Rand_place);
44     for (int i = 0; i < RAND_DEG; i++)
45         rd_u32b(&Rand_state[i]);
46 }
47
48 /*!
49  * @brief メッセージログを読み込む / Read the saved messages
50  * @return なし
51  */
52 void rd_messages(void)
53 {
54     if (h_older_than(2, 2, 0, 75)) {
55         u16b num;
56         rd_u16b(&num);
57         int message_max;
58         message_max = (int)num;
59
60         for (int i = 0; i < message_max; i++) {
61             char buf[128];
62             rd_string(buf, sizeof(buf));
63             message_add(buf);
64         }
65     }
66
67     u32b num;
68     rd_u32b(&num);
69     int message_max = (int)num;
70     for (int i = 0; i < message_max; i++) {
71         char buf[128];
72         rd_string(buf, sizeof(buf));
73         message_add(buf);
74     }
75 }
76
77 void rd_system_info(void)
78 {
79     rd_byte(&kanji_code);
80     rd_randomizer();
81     if (arg_fiddle)
82         load_note(_("乱数情報をロードしました", "Loaded Randomizer Info"));
83
84     rd_options();
85     if (arg_fiddle)
86         load_note(_("オプションをロードしました", "Loaded Option Flags"));
87
88     rd_messages();
89     if (arg_fiddle)
90         load_note(_("メッセージをロードしました", "Loaded Messages"));
91 }