/*
* The default table in terrain level generation.
*/
-static int terrain_table[MAX_WILDERNESS][MAX_FEAT_IN_TERRAIN];
+static s16b terrain_table[MAX_WILDERNESS][MAX_FEAT_IN_TERRAIN];
static void generate_wilderness_area(int terrain, u32b seed, bool border, bool corner)
{
int x1, y1;
- int table_size = sizeof(terrain_table[0]) / sizeof(int);
+ int table_size = sizeof(terrain_table[0]) / sizeof(s16b);
int roughness = 1; /* The roughness of the level. */
+ u32b state_backup[4];
/* Unused */
(void)border;
}
- /* 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)
{
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);
}
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);
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);
}
}
{
int lim;
- feat = va_arg(vp, s16b);
+ feat = (s16b)va_arg(vp, int);
num = va_arg(vp, int);
lim = cur + num;
}
}
- 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);
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);