OSDN Git Service

[Refactor] #38995 seed_town, seed_flavor を world_type 構造体に取り込み.
authordeskull <deskull@users.sourceforge.jp>
Tue, 30 Apr 2019 10:50:09 +0000 (19:50 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Tue, 30 Apr 2019 10:50:09 +0000 (19:50 +0900)
src/core.c
src/dungeon-file.c
src/externs.h
src/load.c
src/object-flavor.c
src/save.c
src/variable.c
src/world.h

index 72a5b85..0fde23d 100644 (file)
@@ -5418,10 +5418,10 @@ void play_game(bool new_game)
                write_level = TRUE;
 
                /* Hack -- seed for flavors */
-               seed_flavor = randint0(0x10000000);
+               current_world_ptr->seed_flavor = randint0(0x10000000);
 
                /* Hack -- seed for town layout */
-               seed_town = randint0(0x10000000);
+               current_world_ptr->seed_town = randint0(0x10000000);
 
                /* Roll up a new character */
                player_birth();
index 650ccc4..080696f 100644 (file)
@@ -4634,7 +4634,7 @@ static concptr process_dungeon_file_expr(char **sp, char *fp)
                        else if (prefix(b + 1, "RANDOM"))
                        {
                                /* "RANDOM" uses a special parameter to determine the number of the quest */
-                               sprintf(tmp, "%d", (int)(seed_town%atoi(b + 7)));
+                               sprintf(tmp, "%d", (int)(current_world_ptr->seed_town%atoi(b + 7)));
                                v = tmp;
                        }
 
index 94b0842..f15947e 100644 (file)
@@ -129,8 +129,6 @@ extern bool character_saved;
 extern bool character_icky;
 extern bool character_xtra;
 extern bool creating_savefile;
-extern u32b seed_flavor;
-extern u32b seed_town;
 extern COMMAND_CODE command_cmd;
 extern COMMAND_ARG command_arg;
 extern s16b command_rep;
index 1aa74e6..510415e 100644 (file)
@@ -2246,8 +2246,8 @@ static void rd_extra(void)
 
 
        /* Hack -- the two "special seeds" */
-       rd_u32b(&seed_flavor);
-       rd_u32b(&seed_town);
+       rd_u32b(&current_world_ptr->seed_flavor);
+       rd_u32b(&current_world_ptr->seed_town);
 
 
        /* Special stuff */
index 9a9ccbc..d0bdac2 100644 (file)
@@ -21,6 +21,7 @@
 #include "trap.h"
 #include "snipe.h"
 #include "files.h"
+#include "world.h"
 
 /*!
  * @brief 最初から簡易な名称が明らかになるベースアイテムの判定。 /  Certain items, if aware, are known instantly 
@@ -297,7 +298,7 @@ void flavor_init(void)
        Rand_state_backup(state_backup);
 
        /* Hack -- Induce consistant flavors */
-       Rand_state_set(seed_flavor);
+       Rand_state_set(current_world_ptr->seed_flavor);
 
 
        /* Initialize flavor index of each object by itself */
index b519a49..c9ccb06 100644 (file)
@@ -811,8 +811,8 @@ static void wr_extra(void)
 
 
        /* Write the "object seeds" */
-       wr_u32b(seed_flavor);
-       wr_u32b(seed_town);
+       wr_u32b(current_world_ptr->seed_flavor);
+       wr_u32b(current_world_ptr->seed_town);
 
 
        /* Special stuff */
index 8904f70..6761f15 100644 (file)
@@ -91,9 +91,6 @@ bool character_xtra;          /* The game is in an icky startup mode */
 
 bool creating_savefile;                /* New savefile is currently created */
 
-u32b seed_flavor;              /* Hack -- consistent object colors */
-u32b seed_town;                        /* Hack -- consistent town layout */
-
 s16b command_cmd;              /* Current "Angband Command" */
 
 COMMAND_ARG command_arg;       /*!< 各種コマンドの汎用的な引数として扱う / Gives argument of current command */
index 44981c0..2d9222a 100644 (file)
@@ -12,6 +12,10 @@ typedef struct {
        MONRACE_IDX bounty_r_idx[MAX_KUBI];
 
        u32b play_time; /*!< 実プレイ時間 */
+
+       u32b seed_flavor;               /* Hack -- consistent object colors */
+       u32b seed_town;                 /* Hack -- consistent town layout */
+
 } world_type;
 
 extern bool is_daytime(void);