From 936a51f50f1efc6e73c7e3927aecc42757437c7d Mon Sep 17 00:00:00 2001 From: Hourier Date: Sun, 5 Jul 2020 13:03:13 +0900 Subject: [PATCH] [Refactor] #40467 Separated set_zangband_bounty_uniques() from extra-loader.c to load-zangband.c/h --- src/savedata/extra-loader.c | 21 ++++++--------------- src/savedata/load-zangband.c | 15 ++++++++++++++- src/savedata/load-zangband.h | 1 + 3 files changed, 21 insertions(+), 16 deletions(-) diff --git a/src/savedata/extra-loader.c b/src/savedata/extra-loader.c index b999a5d95..817044b13 100644 --- a/src/savedata/extra-loader.c +++ b/src/savedata/extra-loader.c @@ -70,7 +70,7 @@ static void set_race(player_type *creature_ptr) rd_s16b(&creature_ptr->old_realm); } -static set_imitation(player_type *creature_ptr) +static void set_imitation(player_type *creature_ptr) { if (z_older_than(10, 0, 1)) { for (int i = 0; i < MAX_MANE; i++) { @@ -214,19 +214,11 @@ void rd_extra(player_type *creature_ptr) set_race(creature_ptr); set_imitation(creature_ptr); - if (z_older_than(10, 0, 3)) { - determine_bounty_uniques(creature_ptr); - - for (int i = 0; i < MAX_BOUNTY; i++) { - /* Is this bounty unique already dead? */ - if (!r_info[current_world_ptr->bounty_r_idx[i]].max_num) - current_world_ptr->bounty_r_idx[i] += 10000; - } - } else { - for (int i = 0; i < MAX_BOUNTY; i++) { + if (z_older_than(10, 0, 3)) + set_zangband_bounty_uniques(creature_ptr); + else + for (int i = 0; i < MAX_BOUNTY; i++) rd_s16b(¤t_world_ptr->bounty_r_idx[i]); - } - } if (z_older_than(10, 0, 3)) { update_gambling_monsters(creature_ptr); @@ -244,10 +236,9 @@ void rd_extra(player_type *creature_ptr) rd_s16b(&creature_ptr->town_num); rd_s16b(&creature_ptr->arena_number); - if (h_older_than(1, 5, 0, 1)) { + if (h_older_than(1, 5, 0, 1)) if (creature_ptr->arena_number >= 99) creature_ptr->arena_number = ARENA_DEFEATED_OLD_VER; - } s16b tmp16s; rd_s16b(&tmp16s); diff --git a/src/savedata/load-zangband.c b/src/savedata/load-zangband.c index 5990ae32c..437ac6ccc 100644 --- a/src/savedata/load-zangband.c +++ b/src/savedata/load-zangband.c @@ -1,7 +1,10 @@ #include "savedata/load-zangband.h" #include "game-option/option-flags.h" +#include "market/bounty.h" +#include "monster-race/monster-race.h" #include "player/player-skill.h" #include "realm/realm-types.h" +#include "world/world.h" void load_zangband_options(void) { @@ -89,4 +92,14 @@ void set_zangband_race(player_type *creature_ptr) creature_ptr->old_race1 = 0L; creature_ptr->old_race2 = 0L; creature_ptr->old_realm = 0; -} \ No newline at end of file +} + +void set_zangband_bounty_uniques(player_type *creature_ptr) +{ + determine_bounty_uniques(creature_ptr); + for (int i = 0; i < MAX_BOUNTY; i++) { + /* Is this bounty unique already dead? */ + if (!r_info[current_world_ptr->bounty_r_idx[i]].max_num) + current_world_ptr->bounty_r_idx[i] += 10000; + } +} diff --git a/src/savedata/load-zangband.h b/src/savedata/load-zangband.h index 353e17106..309a54b89 100644 --- a/src/savedata/load-zangband.h +++ b/src/savedata/load-zangband.h @@ -7,3 +7,4 @@ void set_zangband_realm(player_type *creature_ptr); void set_zangband_skill(player_type *creature_ptr); void set_zangband_spells(player_type *creature_ptr); void set_zangband_race(player_type *creature_ptr); +void set_zangband_bounty_uniques(player_type *creature_ptr); -- 2.11.0