1 #include "load/world-loader.h"
2 #include "cmd-building/cmd-building.h"
3 #include "dungeon/dungeon.h"
4 #include "floor/wild.h"
5 #include "load/angband-version-comparer.h"
6 #include "load/load-util.h"
7 #include "load/load-zangband.h"
8 #include "market/bounty.h"
9 #include "system/building-type-definition.h"
10 #include "system/floor-type-definition.h"
11 #include "world/world.h"
13 static void rd_hengband_dungeons(void)
15 byte max = (byte)current_world_ptr->max_d_idx;
18 for (int i = 0; i < max; i++) {
21 if (max_dlv[i] > d_info[i].maxdepth)
22 max_dlv[i] = d_info[i].maxdepth;
26 void rd_dungeons(player_type *creature_ptr)
28 if (h_older_than(0, 3, 8))
29 rd_zangband_dungeon();
31 rd_hengband_dungeons();
33 if (creature_ptr->max_plv < creature_ptr->lev)
34 creature_ptr->max_plv = creature_ptr->lev;
38 * @brief 現実変容処理の有無及びその残りターン数を読み込む
39 * @param creature_ptr プレーヤーへの参照ポインタ
42 void rd_alter_reality(player_type *creature_ptr)
45 if (h_older_than(0, 3, 8))
46 creature_ptr->recall_dungeon = DUNGEON_ANGBAND;
49 creature_ptr->recall_dungeon = (byte)tmp16s;
52 if (h_older_than(1, 5, 0, 0))
53 creature_ptr->alter_reality = 0;
55 rd_s16b(&creature_ptr->alter_reality);
58 void set_gambling_monsters(void)
60 const int max_gambling_monsters = 4;
61 for (int i = 0; i < max_gambling_monsters; i++) {
62 rd_s16b(&battle_mon[i]);
63 if (h_older_than(0, 3, 4))
64 set_zangband_gambling_monsters(i);
66 rd_u32b(&mon_odds[i]);
71 * @details 自動拾い関係はこれしかないのでworldに突っ込むことにする。必要があれば再分割する
73 void rd_autopick(player_type *creature_ptr)
77 creature_ptr->autopick_autoregister = tmp8u != 0;
80 static void set_undead_turn_limit(player_type *creature_ptr)
82 switch (creature_ptr->start_race) {
87 current_world_ptr->game_turn_limit = TURNS_PER_TICK * TOWN_DAWN * MAX_DAYS + TURNS_PER_TICK * TOWN_DAWN * 3 / 4;
90 current_world_ptr->game_turn_limit = TURNS_PER_TICK * TOWN_DAWN * (MAX_DAYS - 1) + TURNS_PER_TICK * TOWN_DAWN * 3 / 4;
95 static void rd_world_info(player_type *creature_ptr)
97 set_undead_turn_limit(creature_ptr);
98 current_world_ptr->dungeon_turn_limit = TURNS_PER_TICK * TOWN_DAWN * (MAX_DAYS - 1) + TURNS_PER_TICK * TOWN_DAWN * 3 / 4;
99 rd_s32b(&creature_ptr->current_floor_ptr->generated_turn);
100 if (h_older_than(1, 7, 0, 4))
101 creature_ptr->feeling_turn = creature_ptr->current_floor_ptr->generated_turn;
103 rd_s32b(&creature_ptr->feeling_turn);
105 rd_s32b(¤t_world_ptr->game_turn);
106 if (h_older_than(0, 3, 12))
107 current_world_ptr->dungeon_turn = current_world_ptr->game_turn;
109 rd_s32b(¤t_world_ptr->dungeon_turn);
111 if (h_older_than(1, 0, 13))
112 set_zangband_game_turns(creature_ptr);
114 if (h_older_than(0, 3, 13))
115 current_world_ptr->arena_start_turn = current_world_ptr->game_turn;
117 rd_s32b(¤t_world_ptr->arena_start_turn);
119 if (h_older_than(0, 0, 3))
120 determine_daily_bounty(creature_ptr, TRUE);
122 rd_s16b(¤t_world_ptr->today_mon);
123 rd_s16b(&creature_ptr->today_mon);
127 void rd_visited_towns(player_type *creature_ptr)
129 if (h_older_than(0, 3, 9)) {
130 creature_ptr->visit = 1L;
134 if (h_older_than(0, 3, 10)) {
135 set_zangband_visited_towns(creature_ptr);
141 creature_ptr->visit = (BIT_FLAGS)tmp32s;
144 void rd_global_configurations(player_type *creature_ptr)
146 rd_u32b(¤t_world_ptr->seed_flavor);
147 rd_u32b(¤t_world_ptr->seed_town);
149 rd_u16b(&creature_ptr->panic_save);
150 rd_u16b(¤t_world_ptr->total_winner);
151 rd_u16b(¤t_world_ptr->noscore);
155 creature_ptr->is_dead = (bool)tmp8u;
157 rd_byte(&creature_ptr->feeling);
158 rd_world_info(creature_ptr);
161 void load_wilderness_info(player_type *creature_ptr)
163 rd_s32b(&creature_ptr->wilderness_x);
164 rd_s32b(&creature_ptr->wilderness_y);
165 if (h_older_than(0, 3, 13)) {
166 creature_ptr->wilderness_x = 5;
167 creature_ptr->wilderness_y = 48;
170 if (h_older_than(0, 3, 7))
171 creature_ptr->wild_mode = FALSE;
173 rd_byte((byte *)&creature_ptr->wild_mode);
175 if (h_older_than(0, 3, 7))
176 creature_ptr->ambush_flag = FALSE;
178 rd_byte((byte *)&creature_ptr->ambush_flag);
181 errr analyze_wilderness(void)
185 rd_s32b(&wild_x_size);
186 rd_s32b(&wild_y_size);
188 if ((wild_x_size > current_world_ptr->max_wild_x) || (wild_y_size > current_world_ptr->max_wild_y)) {
189 load_note(format(_("荒野が大きすぎる(%u/%u)!", "Wilderness is too big (%u/%u)!"), wild_x_size, wild_y_size));
193 for (int i = 0; i < wild_x_size; i++)
194 for (int j = 0; j < wild_y_size; j++)
195 rd_u32b(&wilderness[j][i].seed);