From: deskull Date: Tue, 30 Apr 2019 10:50:09 +0000 (+0900) Subject: [Refactor] #38995 seed_town, seed_flavor を world_type 構造体に取り込み. X-Git-Url: http://git.osdn.net/view?p=hengband%2Fhengband.git;a=commitdiff_plain;h=1876d4fc2ce3ce4fbeb53629acd1766b02e15355 [Refactor] #38995 seed_town, seed_flavor を world_type 構造体に取り込み. --- diff --git a/src/core.c b/src/core.c index 72a5b85b6..0fde23d09 100644 --- a/src/core.c +++ b/src/core.c @@ -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(); diff --git a/src/dungeon-file.c b/src/dungeon-file.c index 650ccc4bc..080696fb7 100644 --- a/src/dungeon-file.c +++ b/src/dungeon-file.c @@ -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; } diff --git a/src/externs.h b/src/externs.h index 94b0842b2..f15947e7b 100644 --- a/src/externs.h +++ b/src/externs.h @@ -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; diff --git a/src/load.c b/src/load.c index 1aa74e6ee..510415e47 100644 --- a/src/load.c +++ b/src/load.c @@ -2246,8 +2246,8 @@ static void rd_extra(void) /* Hack -- the two "special seeds" */ - rd_u32b(&seed_flavor); - rd_u32b(&seed_town); + rd_u32b(¤t_world_ptr->seed_flavor); + rd_u32b(¤t_world_ptr->seed_town); /* Special stuff */ diff --git a/src/object-flavor.c b/src/object-flavor.c index 9a9ccbca5..d0bdac28b 100644 --- a/src/object-flavor.c +++ b/src/object-flavor.c @@ -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 */ diff --git a/src/save.c b/src/save.c index b519a495c..c9ccb0629 100644 --- a/src/save.c +++ b/src/save.c @@ -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 */ diff --git a/src/variable.c b/src/variable.c index 8904f70c8..6761f15cb 100644 --- a/src/variable.c +++ b/src/variable.c @@ -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 */ diff --git a/src/world.h b/src/world.h index 44981c045..2d9222a51 100644 --- a/src/world.h +++ b/src/world.h @@ -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);