OSDN Git Service

[Refactor] #40467 Separated set_zangband_bounty_uniques() from extra-loader.c to...
authorHourier <hourier@users.sourceforge.jp>
Sun, 5 Jul 2020 04:03:13 +0000 (13:03 +0900)
committerHourier <hourier@users.sourceforge.jp>
Sun, 5 Jul 2020 04:03:13 +0000 (13:03 +0900)
src/savedata/extra-loader.c
src/savedata/load-zangband.c
src/savedata/load-zangband.h

index b999a5d..817044b 100644 (file)
@@ -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(&current_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);
index 5990ae3..437ac6c 100644 (file)
@@ -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;
+    }
+}
index 353e171..309a54b 100644 (file)
@@ -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);