OSDN Git Service

[Fix] #40913 Windows以外で新規のセーブデータを作成できない不具合を解消した / Resolved the issue that new game...
[hengbandforosx/hengbandosx.git] / src / load / info-loader.c
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     load_note(format(_("バージョン %d.%d.%d.%d のセーブ・ファイルをロード中...", "Loading a %d.%d.%d.%d savefile..."),
24         (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,
25         current_world_ptr->h_ver_patch, current_world_ptr->h_ver_extra));
26
27     rd_u32b(&current_world_ptr->sf_system);
28     rd_u32b(&current_world_ptr->sf_when);
29     rd_u16b(&current_world_ptr->sf_lives);
30     rd_u16b(&current_world_ptr->sf_saves);
31 }
32
33 /*!
34  * @brief 乱数状態を読み込む / Read RNG state (added in 2.8.0)
35  * @return なし
36  */
37 void rd_randomizer(void)
38 {
39     u16b tmp16u;
40     rd_u16b(&tmp16u);
41     rd_u16b(&Rand_place);
42     for (int i = 0; i < RAND_DEG; i++)
43         rd_u32b(&Rand_state[i]);
44 }
45
46 /*!
47  * @brief メッセージログを読み込む / Read the saved messages
48  * @return なし
49  */
50 void rd_messages(void)
51 {
52     if (h_older_than(2, 2, 0, 75)) {
53         u16b num;
54         rd_u16b(&num);
55         int message_max;
56         message_max = (int)num;
57
58         for (int i = 0; i < message_max; i++) {
59             char buf[128];
60             rd_string(buf, sizeof(buf));
61             message_add(buf);
62         }
63     }
64
65     u32b num;
66     rd_u32b(&num);
67     int message_max = (int)num;
68     for (int i = 0; i < message_max; i++) {
69         char buf[128];
70         rd_string(buf, sizeof(buf));
71         message_add(buf);
72     }
73 }
74
75 void rd_system_info(void)
76 {
77     rd_byte(&kanji_code);
78     rd_randomizer();
79     if (arg_fiddle)
80         load_note(_("乱数情報をロードしました", "Loaded Randomizer Info"));
81
82     rd_options();
83     if (arg_fiddle)
84         load_note(_("オプションをロードしました", "Loaded Option Flags"));
85
86     rd_messages();
87     if (arg_fiddle)
88         load_note(_("メッセージをロードしました", "Loaded Messages"));
89 }