OSDN Git Service

Thrown torch's dice is changed
[hengband/hengband.git] / src / wild.c
index d3fb7cf..98acd6f 100644 (file)
@@ -160,6 +160,7 @@ static void generate_wilderness_area(int terrain, u32b seed, bool border, bool c
        int x1, y1;
        int table_size = sizeof(terrain_table[0]) / sizeof(s16b);
        int roughness = 1; /* The roughness of the level. */
+       u32b state_backup[4];
 
        /* Unused */
        (void)border;
@@ -181,11 +182,11 @@ static void generate_wilderness_area(int terrain, u32b seed, bool border, bool c
        }
 
 
-       /* Hack -- Use the "simple" RNG */
-       Rand_quick = TRUE;
+       /* Hack -- Backup the RNG state */
+       Rand_state_backup(state_backup);
 
-       /* Hack -- Induce consistant town layout */
-       Rand_value = seed;
+       /* Hack -- Induce consistant flavors */
+       Rand_state_init(seed);
 
        if (!corner)
        {
@@ -242,8 +243,8 @@ static void generate_wilderness_area(int terrain, u32b seed, bool border, bool c
                cave[MAX_HGT - 2][MAX_WID - 2].feat = terrain_table[terrain][cave[MAX_HGT - 2][MAX_WID - 2].feat];
        }
 
-       /* Use the complex RNG */
-       Rand_quick = FALSE;
+       /* Hack -- Restore the RNG state */
+       Rand_state_restore(state_backup);
 }
 
 
@@ -357,12 +358,13 @@ static void generate_area(int y, int x, bool border, bool corner)
        if (wilderness[y][x].entrance && !wilderness[y][x].town && (p_ptr->total_winner || !(d_info[wilderness[y][x].entrance].flags1 & DF1_WINNER)))
        {
                int dy, dx;
+               u32b state_backup[4];
 
-               /* Hack -- Use the "simple" RNG */
-               Rand_quick = TRUE;
+               /* Hack -- Backup the RNG state */
+               Rand_state_backup(state_backup);
 
-               /* Hack -- Induce consistant town layout */
-               Rand_value = wilderness[y][x].seed;
+               /* Hack -- Induce consistant flavors */
+               Rand_state_init(wilderness[y][x].seed);
 
                dy = rand_range(6, cur_hgt - 6);
                dx = rand_range(6, cur_wid - 6);
@@ -370,8 +372,8 @@ static void generate_area(int y, int x, bool border, bool corner)
                cave[dy][dx].feat = feat_entrance;
                cave[dy][dx].special = wilderness[y][x].entrance;
 
-               /* Use the complex RNG */
-               Rand_quick = FALSE;
+               /* Hack -- Restore the RNG state */
+               Rand_state_restore(state_backup);
        }
 }
 
@@ -926,8 +928,11 @@ static void init_terrain_table(int terrain, s16b feat_global, cptr fmt, ...)
                }
        }
 
-       feat = terrain_table[terrain][cur];
-       for (; cur < MAX_FEAT_IN_TERRAIN; cur++) terrain_table[terrain][cur] = feat;
+       /* Paranoia */
+       if (cur < MAX_FEAT_IN_TERRAIN)
+       {
+               plog_fmt("Too few parameters");
+       }
 
        /* End the varargs stuff */
        va_end(vp);
@@ -1091,6 +1096,9 @@ bool change_wild_mode(void)
        p_ptr->oldpx = px;
        p_ptr->oldpy = py;
 
+       /* Cancel hex spelling */
+       if (hex_spelling_any()) stop_hex_spell_all();
+
        /* Cancel any special action */
        set_action(ACTION_NONE);