summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/birth.cc12
-rw-r--r--src/cmd2.cc3
-rw-r--r--src/defines.h2
-rw-r--r--src/dungeon.cc10
-rw-r--r--src/files.cc6
-rw-r--r--src/init1.cc14
-rw-r--r--src/init2.cc12
-rw-r--r--src/loadsave.cc14
-rw-r--r--src/monster1.cc3
-rw-r--r--src/q_god.cc16
-rw-r--r--src/variable.cc8
-rw-r--r--src/variable.hpp5
-rw-r--r--src/wild.cc109
-rw-r--r--src/wizard2.cc31
-rw-r--r--src/xtra1.cc6
-rw-r--r--src/xtra2.cc7
16 files changed, 142 insertions, 116 deletions
diff --git a/src/birth.cc b/src/birth.cc
index 0a80cf89..53974938 100644
--- a/src/birth.cc
+++ b/src/birth.cc
@@ -3191,13 +3191,15 @@ void player_birth(void)
}
/* Init wilderness seeds */
- for (i = 0; i < max_wild_x; i++)
+ auto &wilderness = *wilderness_ptr;
+ for (std::size_t y = 0; y < wilderness.height(); y++)
{
- for (j = 0; j < max_wild_y; j++)
+ for (std::size_t x = 0; x < wilderness.width(); x++)
{
- wild_map[j][i].seed = seed_t::system();
- wild_map[j][i].entrance = 0;
- wild_map[j][i].known = FALSE;
+ auto &w = wilderness(x, y);
+ w.seed = seed_t::system();
+ w.entrance = 0;
+ w.known = FALSE;
}
}
}
diff --git a/src/cmd2.cc b/src/cmd2.cc
index b0c9e38e..947d2816 100644
--- a/src/cmd2.cc
+++ b/src/cmd2.cc
@@ -2549,8 +2549,9 @@ static void do_cmd_walk_jump(int pickup, bool_ disarm)
energy_use *= (p_ptr->wild_mode) ? ((MAX_HGT + MAX_WID) / 2) : 1;
/* Hack again -- Is there a special encounter ??? */
+ auto const &wilderness = *wilderness_ptr;
if (p_ptr->wild_mode &&
- magik(wf_info[wild_map[p_ptr->py][p_ptr->px].feat].level - (p_ptr->lev * 2)))
+ magik(wf_info[wilderness(p_ptr->px, p_ptr->py).feat].level - (p_ptr->lev * 2)))
{
/* Go into large wilderness view */
p_ptr->wilderness_x = p_ptr->px;
diff --git a/src/defines.h b/src/defines.h
index b17403ef..19f2f8c3 100644
--- a/src/defines.h
+++ b/src/defines.h
@@ -2463,7 +2463,7 @@
*/
#define level_or_feat(DTYPE, DLEVEL) \
((DTYPE) == DUNGEON_WILDERNESS ? \
- wild_map[p_ptr->wilderness_y][p_ptr->wilderness_x].feat : \
+ (*wilderness_ptr)(p_ptr->wilderness_x, p_ptr->wilderness_y).feat : \
(DLEVEL) )
diff --git a/src/dungeon.cc b/src/dungeon.cc
index 16b6bcc0..c6ec2889 100644
--- a/src/dungeon.cc
+++ b/src/dungeon.cc
@@ -3524,8 +3524,9 @@ static void process_command(void)
/* Special cases */
else
{
- if ((wf_info[wild_map[p_ptr->py][p_ptr->px].feat].entrance >= 1000) ||
- (wild_map[p_ptr->py][p_ptr->px].entrance > 1000))
+ auto const &wilderness = *wilderness_ptr;
+ auto const &tile = wilderness(p_ptr->px, p_ptr->py);
+ if ((wf_info[tile.feat].entrance >= 1000) || (tile.entrance > 1000))
{
p_ptr->wilderness_x = p_ptr->px;
p_ptr->wilderness_y = p_ptr->py;
@@ -4295,7 +4296,10 @@ static void process_player(void)
/* Hack -- mark current wilderness location as known */
if (!p_ptr->wild_mode && dun_level == 0)
- wild_map[p_ptr->wilderness_y][p_ptr->wilderness_x].known = TRUE;
+ {
+ auto &wilderness = *wilderness_ptr;
+ wilderness(p_ptr->wilderness_x, p_ptr->wilderness_y).known = TRUE;
+ }
/* Place the cursor on the player */
diff --git a/src/files.cc b/src/files.cc
index 4e70acde..d055b32c 100644
--- a/src/files.cc
+++ b/src/files.cc
@@ -2321,11 +2321,13 @@ void display_player(int mode)
*/
cptr describe_player_location()
{
+ auto const &wilderness = *wilderness_ptr;
+
int i;
static char desc[80];
int pwx = (p_ptr->wild_mode ? p_ptr->px : p_ptr->wilderness_x);
int pwy = (p_ptr->wild_mode ? p_ptr->py : p_ptr->wilderness_y);
- int feat = wild_map[pwy][pwx].feat;
+ int feat = wilderness(pwx, pwy).feat;
if (dungeon_type != DUNGEON_WILDERNESS && dun_level > 0)
{
@@ -2362,7 +2364,7 @@ cptr describe_player_location()
if (!wf_info[i].entrance) continue;
/* Skip if we haven't seen it */
- if (!wild_map[wy][wx].known) continue;
+ if (!wilderness(wx, wy).known) continue;
dist = distance(wy, wx, pwy, pwx);
if (dist < l_dist || l_dist < 0)
diff --git a/src/init1.cc b/src/init1.cc
index c0835da0..3fb33179 100644
--- a/src/init1.cc
+++ b/src/init1.cc
@@ -6363,6 +6363,8 @@ static dungeon_grid letter[255];
*/
static errr process_dungeon_file_aux(char *buf, int *yval, int *xval, int xvalstart, int ymax, int xmax, bool_ full)
{
+ auto &wilderness = *wilderness_ptr;
+
int i;
char *zz[33];
@@ -6842,7 +6844,7 @@ static errr process_dungeon_file_aux(char *buf, int *yval, int *xval, int xvalst
int y = *yval;
- for (int x = 0; x < max_wild_x; x++)
+ for (std::size_t x = 0; x < wilderness.width(); x++)
{
char i;
if (1 != sscanf(s + x, "%c", &i))
@@ -6852,7 +6854,7 @@ static errr process_dungeon_file_aux(char *buf, int *yval, int *xval, int xvalst
auto const wi = wildc2i[(int)i];
- wild_map[y][x].feat = wi;
+ wilderness(x, y).feat = wi;
/*
* If this is a town/dungeon entrance, note
@@ -6914,7 +6916,9 @@ static errr process_dungeon_file_aux(char *buf, int *yval, int *xval, int xvalst
{
if (tokenize(buf + 4, 3, zz, ':', '/') == 3)
{
- wild_map[atoi(zz[1])][atoi(zz[2])].entrance = 1000 + atoi(zz[0]);
+ int y = atoi(zz[1]);
+ int x = atoi(zz[2]);
+ wilderness(x, y).entrance = 1000 + atoi(zz[0]);
}
else
{
@@ -7104,13 +7108,13 @@ static errr process_dungeon_file_aux(char *buf, int *yval, int *xval, int xvalst
/* Maximum wilderness x size */
else if (zz[0][0] == 'X')
{
- max_wild_x = atoi(zz[1]);
+ wilderness.width(atoi(zz[1]));
}
/* Maximum wilderness y size */
else if (zz[0][0] == 'Y')
{
- max_wild_y = atoi(zz[1]);
+ wilderness.height(atoi(zz[1]));
}
/* Maximum d_idx */
diff --git a/src/init2.cc b/src/init2.cc
index 77866648..fa07bb02 100644
--- a/src/init2.cc
+++ b/src/init2.cc
@@ -723,15 +723,6 @@ void create_stores_stock(int t)
*/
static errr init_wilderness(void)
{
- /* Allocate the wilderness (two-dimension array) */
- wild_map = make_array<wilderness_map *>(max_wild_y);
-
- /* Init the other pointers */
- for (std::size_t i = 0; i < max_wild_y; i++)
- {
- wild_map[i] = new wilderness_map[max_wild_x];
- }
-
/* No encounter right now */
generate_encounter = FALSE;
@@ -1266,6 +1257,9 @@ void init_angband(void)
(void)fd_close(fd);
+ /* Allocate the wilderness */
+ wilderness_ptr = new grid<wilderness_map>();
+
/*** Initialise some arrays ***/
/* Initialise misc. values */
diff --git a/src/loadsave.cc b/src/loadsave.cc
index 9b963cfd..9eb0b185 100644
--- a/src/loadsave.cc
+++ b/src/loadsave.cc
@@ -2245,6 +2245,8 @@ static bool do_quests(ls_flag_t flag)
static bool do_wilderness(ls_flag_t flag)
{
+ auto &wilderness = *wilderness_ptr;
+
// Player position and "mode" wrt. wilderness
do_s32b(&p_ptr->wilderness_x, flag);
do_s32b(&p_ptr->wilderness_y, flag);
@@ -2252,14 +2254,14 @@ static bool do_wilderness(ls_flag_t flag)
do_bool(&p_ptr->old_wild_mode, flag);
// Size of the wilderness
- u16b wild_x_size = max_wild_x;
- u16b wild_y_size = max_wild_y;
+ u16b wild_x_size = wilderness.width();
+ u16b wild_y_size = wilderness.height();
do_u16b(&wild_x_size, flag);
do_u16b(&wild_y_size, flag);
if (flag == ls_flag_t::LOAD)
{
- if ((wild_x_size > max_wild_x) || (wild_y_size > max_wild_y))
+ if ((wild_x_size > wilderness.width()) || (wild_y_size > wilderness.height()))
{
note("Wilderness is too big!");
return false;
@@ -2267,11 +2269,11 @@ static bool do_wilderness(ls_flag_t flag)
}
// Save/load wilderness tile state
- for (std::size_t i = 0; i < wild_x_size; i++)
+ for (std::size_t x = 0; x < wild_x_size; x++)
{
- for (std::size_t j = 0; j < wild_y_size; j++)
+ for (std::size_t y = 0; y < wild_y_size; y++)
{
- auto w = &wild_map[j][i];
+ auto w = &wilderness(x, y);
do_seed(&w->seed, flag);
do_u16b(&w->entrance, flag);
do_bool(&w->known, flag);
diff --git a/src/monster1.cc b/src/monster1.cc
index 9c838af9..ae54448c 100644
--- a/src/monster1.cc
+++ b/src/monster1.cc
@@ -1535,7 +1535,8 @@ void set_mon_num_hook(void)
{
if (!dun_level)
{
- switch (wf_info[wild_map[p_ptr->wilderness_y][p_ptr->wilderness_x].feat].terrain_idx)
+ auto const &wilderness = *wilderness_ptr;
+ switch (wf_info[wilderness(p_ptr->wilderness_x, p_ptr->wilderness_y).feat].terrain_idx)
{
case TERRAIN_TOWN:
get_mon_num_hook = monster_town;
diff --git a/src/q_god.cc b/src/q_god.cc
index c5120da0..fc8a89f0 100644
--- a/src/q_god.cc
+++ b/src/q_god.cc
@@ -292,12 +292,14 @@ std::string quest_god_describe()
static void quest_god_place_rand_dung()
{
+ auto &wilderness = *wilderness_ptr;
+
int x = -1, y = -1, tries;
/* erase old dungeon */
if (cquest_quests_given > 0)
{
- wild_map[cquest_dung_y][cquest_dung_x].entrance = 0;
+ wilderness(cquest_dung_x, cquest_dung_y).entrance = 0;
/* erase old recall level */
max_dlv[DUNGEON_GOD] = 0;
@@ -307,19 +309,17 @@ static void quest_god_place_rand_dung()
tries = 1000;
while (tries > 0)
{
- wilderness_map *w_ptr = NULL;
- wilderness_type_info *wf_ptr = NULL;
tries = tries - 1;
/* get grid coordinates, within a range which prevents
* dungeon being generated at the very edge of the
* wilderness (would crash the game). */
- x = rand_range(1, max_wild_x-2);
- y = rand_range(1, max_wild_y-2);
+ x = rand_range(1, wilderness.width()-2);
+ y = rand_range(1, wilderness.height()-2);
/* Is there a town/dungeon/potentially impassable feature there, ? */
- w_ptr = &wild_map[y][x];
- wf_ptr = &wf_info[w_ptr->feat];
+ wilderness_map const *w_ptr = &wilderness(x, y);
+ wilderness_type_info const *wf_ptr = &wf_info[w_ptr->feat];
if ((w_ptr->entrance != 0) ||
(wf_ptr->entrance != 0) ||
@@ -350,7 +350,7 @@ static void quest_god_place_rand_dung()
}
/* create god dungeon in that place */
- wild_map[y][x].entrance = 1000 + DUNGEON_GOD;
+ wilderness(x, y).entrance = 1000 + DUNGEON_GOD;
/* set quest variables */
cquest_dung_x = x;
diff --git a/src/variable.cc b/src/variable.cc
index 51ec1333..e9557c6a 100644
--- a/src/variable.cc
+++ b/src/variable.cc
@@ -669,15 +669,9 @@ s32b get_level_max_stick = -1;
s32b get_level_use_stick = -1;
/*
- * Maximum size of the wilderness map
- */
-u16b max_wild_x;
-u16b max_wild_y;
-
-/*
* Wilderness map
*/
-wilderness_map **wild_map;
+grid<wilderness_map> *wilderness_ptr;
/*
diff --git a/src/variable.hpp b/src/variable.hpp
index 3385bebd..e305d6bd 100644
--- a/src/variable.hpp
+++ b/src/variable.hpp
@@ -13,6 +13,7 @@
#include "ego_item_type_fwd.hpp"
#include "fate.hpp"
#include "feature_type_fwd.hpp"
+#include "grid.hpp"
#include "hist_type_fwd.hpp"
#include "meta_class_type_fwd.hpp"
#include "monster_ego_fwd.hpp"
@@ -207,9 +208,7 @@ extern char *ANGBAND_DIR_DNGN;
extern bool_ (*get_mon_num_hook)(int r_idx);
extern bool_ (*get_mon_num2_hook)(int r_idx);
extern bool_ (*get_obj_num_hook)(int k_idx);
-extern u16b max_wild_x;
-extern u16b max_wild_y;
-extern wilderness_map **wild_map;
+extern grid<wilderness_map> *wilderness_ptr;
extern u16b max_ab_idx;
extern u16b max_s_idx;
extern u16b max_r_idx;
diff --git a/src/wild.cc b/src/wild.cc
index cbd899f7..55a03087 100644
--- a/src/wild.cc
+++ b/src/wild.cc
@@ -30,6 +30,7 @@
#include "wilderness_type_info.hpp"
#include "z-rand.hpp"
+#include <algorithm>
#include <memory>
@@ -154,13 +155,17 @@ static void plasma_recursive(int x1, int y1, int x2, int y2,
*/
static int generate_area(int y, int x, bool_ border, bool_ corner)
{
+ auto const &wilderness = *wilderness_ptr;
int road, entrance;
int x1, y1;
int hack_floor = 0;
/* Number of the town (if any) */
- p_ptr->town_num = wf_info[wild_map[y][x].feat].entrance;
- if (!p_ptr->town_num) p_ptr->town_num = wild_map[y][x].entrance;
+ p_ptr->town_num = wf_info[wilderness(x, y).feat].entrance;
+ if (!p_ptr->town_num)
+ {
+ p_ptr->town_num = wilderness(x, y).entrance;
+ }
{
int roughness = 1; /* The roughness of the level. */
@@ -172,22 +177,23 @@ static int generate_area(int y, int x, bool_ border, bool_ corner)
if (!p_ptr->oldpy) p_ptr->oldpy = MAX_HGT / 2;
/* Initialize the terrain array */
- ym = ((y - 1) < 0) ? 0 : (y - 1);
- xm = ((x - 1) < 0) ? 0 : (x - 1);
- yp = ((y + 1) >= max_wild_y) ? (max_wild_y - 1) : (y + 1);
- xp = ((x + 1) >= max_wild_x) ? (max_wild_x - 1) : (x + 1);
- terrain[0][0] = wild_map[ym][xm].feat;
- terrain[0][1] = wild_map[ym][x].feat;
- terrain[0][2] = wild_map[ym][xp].feat;
- terrain[1][0] = wild_map[y][xm].feat;
- terrain[1][1] = wild_map[y][x].feat;
- terrain[1][2] = wild_map[y][xp].feat;
- terrain[2][0] = wild_map[yp][xm].feat;
- terrain[2][1] = wild_map[yp][x].feat;
- terrain[2][2] = wild_map[yp][xp].feat;
+ ym = std::max<int>(y - 1, 0);
+ xm = std::max<int>(x - 1, 0);
+ yp = std::min<int>(y + 1, static_cast<int>(wilderness.height()) - 1);
+ xp = std::min<int>(x + 1, static_cast<int>(wilderness.width()) - 1);
+
+ terrain[0][0] = wilderness(xm, ym).feat;
+ terrain[0][1] = wilderness(x , ym).feat;
+ terrain[0][2] = wilderness(xp, ym).feat;
+ terrain[1][0] = wilderness(xm, y ).feat;
+ terrain[1][1] = wilderness(x , y ).feat;
+ terrain[1][2] = wilderness(xp, y ).feat;
+ terrain[2][0] = wilderness(xm, yp).feat;
+ terrain[2][1] = wilderness(x , yp).feat;
+ terrain[2][2] = wilderness(xp, yp).feat;
/* Hack -- Induce consistant town layout */
- set_quick_rng(wild_map[y][x].seed);
+ set_quick_rng(wilderness(x, y).seed);
/* Create level background */
for (y1 = 0; y1 < MAX_HGT; y1++)
@@ -250,7 +256,7 @@ static int generate_area(int y, int x, bool_ border, bool_ corner)
* Place roads in the wilderness
* ToDo: make the road a bit more interresting
*/
- road = wf_info[wild_map[y][x].feat].road;
+ road = wf_info[wilderness(x, y).feat].road;
if (road & ROAD_NORTH)
{
@@ -294,10 +300,10 @@ static int generate_area(int y, int x, bool_ border, bool_ corner)
}
/* Hack -- Induce consistant town layout */
- set_quick_rng(wild_map[y][x].seed);
+ set_quick_rng(wilderness(x, y).seed);
- entrance = wf_info[wild_map[y][x].feat].entrance;
- if (!entrance) entrance = wild_map[y][x].entrance;
+ entrance = wf_info[wilderness(x, y).feat].entrance;
+ if (!entrance) entrance = wilderness(x, y).entrance;
/* Create the dungeon if requested on the map */
if (entrance >= 1000)
@@ -332,11 +338,10 @@ static int generate_area(int y, int x, bool_ border, bool_ corner)
hack_floor = 1;
}
- /* Set the monster generation level to the wilderness level */
- monster_level = wf_info[wild_map[y][x].feat].level;
-
- /* Set the object generation level to the wilderness level */
- object_level = wf_info[wild_map[y][x].feat].level;
+ /* Set the monster/object generation level to the wilderness level */
+ auto const &wf = wf_info[wilderness(x, y).feat];
+ monster_level = wf.level;
+ object_level = wf.level;
return hack_floor;
}
@@ -570,14 +575,14 @@ void wilderness_gen()
*/
void wilderness_gen_small()
{
- int i, j, entrance;
+ auto const &wilderness = *wilderness_ptr;
int xstart = 0;
int ystart = 0;
/* To prevent stupid things */
- for (i = 0; i < MAX_WID; i++)
+ for (int i = 0; i < MAX_WID; i++)
{
- for (j = 0; j < MAX_HGT; j++)
+ for (int j = 0; j < MAX_HGT; j++)
{
cave_set_feat(j, i, FEAT_EKKAIA);
}
@@ -587,31 +592,35 @@ void wilderness_gen_small()
process_dungeon_file("w_info.txt", &ystart, &xstart, cur_hgt, cur_wid, TRUE, FALSE);
/* Fill the map */
- for (i = 0; i < max_wild_x; i++)
+ for (std::size_t x = 0; x < wilderness.width(); x++)
{
- for (j = 0; j < max_wild_y; j++)
+ for (std::size_t y = 0; y < wilderness.height(); y++)
{
- entrance = wf_info[wild_map[j][i].feat].entrance;
- if (!entrance) entrance = wild_map[j][i].entrance;
+ auto const &wm = wilderness(x, y);
+
+ int entrance = wf_info[wm.feat].entrance;
+ if (!entrance) entrance = wm.entrance;
- if (wild_map[j][i].entrance)
+ if (wm.entrance)
{
- cave_set_feat(j, i, FEAT_MORE);
+ cave_set_feat(y, x, FEAT_MORE);
}
else
{
- cave_set_feat(j, i, wf_info[wild_map[j][i].feat].feat);
+ cave_set_feat(y, x, wf_info[wm.feat].feat);
}
- if ((cave[j][i].feat == FEAT_MORE) && (entrance >= 1000))
+ auto &cv = cave[y][x];
+
+ if ((cv.feat == FEAT_MORE) && (entrance >= 1000))
{
- cave[j][i].special = entrance - 1000;
+ cv.special = entrance - 1000;
}
/* Show it if we know it */
- if (wild_map[j][i].known)
+ if (wm.known)
{
- cave[j][i].info |= (CAVE_GLOW | CAVE_MARK);
+ cv.info |= (CAVE_GLOW | CAVE_MARK);
}
}
}
@@ -621,7 +630,7 @@ void wilderness_gen_small()
p_ptr->py = p_ptr->wilderness_y;
/* Set rewarded quests to finished */
- for (i = 0; i < MAX_Q_IDX; i++)
+ for (int i = 0; i < MAX_Q_IDX; i++)
{
if (quest[i].status == QUEST_STATUS_REWARDED)
{
@@ -636,26 +645,30 @@ void wilderness_gen_small()
/* Show a small radius of wilderness around the player */
void reveal_wilderness_around_player(int y, int x, int h, int w)
{
- int i, j;
+ auto &wilderness = *wilderness_ptr;
/* Circle or square ? */
if (h == 0)
{
- for (i = x - w; i < x + w; i++)
+ for (int i = x - w; i < x + w; i++)
{
- for (j = y - w; j < y + w; j++)
+ for (int j = y - w; j < y + w; j++)
{
/* Bound checking */
if (!in_bounds(j, i)) continue;
/* Severe bound checking */
- if ((i < 0) || (i >= max_wild_x) || (j < 0) || (j >= max_wild_y)) continue;
+ if ((i < 0) || (static_cast<size_t>(i) >= wilderness.width()) ||
+ (j < 0) || (static_cast<size_t>(j) >= wilderness.height()))
+ {
+ continue;
+ }
/* We want a radius, not a "squarus" :) */
if (distance(y, x, j, i) >= w) continue;
/* New we know here */
- wild_map[j][i].known = TRUE;
+ wilderness(i, j).known = TRUE;
/* Only if we are in overview */
if (p_ptr->wild_mode)
@@ -670,15 +683,15 @@ void reveal_wilderness_around_player(int y, int x, int h, int w)
}
else
{
- for (i = x; i < x + w; i++)
+ for (int i = x; i < x + w; i++)
{
- for (j = y; j < y + h; j++)
+ for (int j = y; j < y + h; j++)
{
/* Bound checking */
if (!in_bounds(j, i)) continue;
/* New we know here */
- wild_map[j][i].known = TRUE;
+ wilderness(i, j).known = TRUE;
/* Only if we are in overview */
if (p_ptr->wild_mode)
diff --git a/src/wizard2.cc b/src/wizard2.cc
index 266fc353..786ca796 100644
--- a/src/wizard2.cc
+++ b/src/wizard2.cc
@@ -80,26 +80,33 @@ static void wiz_align_monster(int status)
*/
static void teleport_player_town(int town)
{
- int x = 0, y = 0;
-
autosave_checkpoint();
/* Change town */
dun_level = 0;
p_ptr->town_num = town;
- for (x = 0; x < max_wild_x; x++)
- for (y = 0; y < max_wild_y; y++)
- if (p_ptr->town_num == wf_info[wild_map[y][x].feat].entrance) goto finteletown;
-finteletown:
- p_ptr->wilderness_y = y;
- p_ptr->wilderness_x = x;
+ auto const &wilderness = *wilderness_ptr;
+ for (std::size_t y = 0; y < wilderness.height(); y++)
+ {
+ for (std::size_t x = 0; x < wilderness.width(); x++)
+ {
+ if (p_ptr->town_num == wf_info[wilderness(x, y).feat].entrance)
+ {
+ p_ptr->wilderness_y = y;
+ p_ptr->wilderness_x = x;
- leaving_quest = p_ptr->inside_quest;
- p_ptr->inside_quest = 0;
+ leaving_quest = p_ptr->inside_quest;
+ p_ptr->inside_quest = 0;
- /* Leaving */
- p_ptr->leaving = TRUE;
+ /* Leaving */
+ p_ptr->leaving = TRUE;
+
+ // Done
+ return;
+ }
+ }
+ }
}
diff --git a/src/xtra1.cc b/src/xtra1.cc
index 6005deee..6891c801 100644
--- a/src/xtra1.cc
+++ b/src/xtra1.cc
@@ -559,9 +559,11 @@ static void prt_depth(int row, int col)
}
else if (!dun_level)
{
- if (wf_info[wild_map[p_ptr->wilderness_y][p_ptr->wilderness_x].feat].name)
+ auto const &wilderness = *wilderness_ptr;
+ auto const &wf = wf_info[wilderness(p_ptr->wilderness_x, p_ptr->wilderness_y).feat];
+ if (wf.name)
{
- strcpy(depths, wf_info[wild_map[p_ptr->wilderness_y][p_ptr->wilderness_x].feat].name);
+ strcpy(depths, wf.name);
}
else
{
diff --git a/src/xtra2.cc b/src/xtra2.cc
index 501d9693..5e53d945 100644
--- a/src/xtra2.cc
+++ b/src/xtra2.cc
@@ -4237,10 +4237,11 @@ static int target_set_aux(int y, int x, int mode, cptr info)
if (p_ptr->wild_mode && (feat == FEAT_TOWN))
{
+ auto const &wilderness = *wilderness_ptr;
+ auto const &wf = wf_info[wilderness(x, y).feat];
+
s3 = "";
- name = format("%s(%s)",
- wf_info[wild_map[y][x].feat].name,
- wf_info[wild_map[y][x].feat].text);
+ name = format("%s(%s)", wf.name, wf.text);
}
if ((feat == FEAT_FOUNTAIN) && (c_ptr->info & CAVE_IDNT))