summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/birth.cc3
-rw-r--r--src/cmd2.cc3
-rw-r--r--src/defines.h2
-rw-r--r--src/dungeon.cc5
-rw-r--r--src/files.cc3
-rw-r--r--src/game.hpp7
-rw-r--r--src/generate.cc1
-rw-r--r--src/init1.cc3
-rw-r--r--src/init2.cc4
-rw-r--r--src/loadsave.cc3
-rw-r--r--src/monster1.cc3
-rw-r--r--src/monster2.cc1
-rw-r--r--src/object2.cc1
-rw-r--r--src/q_god.cc3
-rw-r--r--src/variable.cc6
-rw-r--r--src/variable.hpp3
-rw-r--r--src/wild.cc7
-rw-r--r--src/wizard2.cc3
-rw-r--r--src/xtra1.cc3
-rw-r--r--src/xtra2.cc3
20 files changed, 39 insertions, 28 deletions
diff --git a/src/birth.cc b/src/birth.cc
index 53974938..06c2115e 100644
--- a/src/birth.cc
+++ b/src/birth.cc
@@ -16,6 +16,7 @@
#include "dungeon_info_type.hpp"
#include "files.h"
#include "files.hpp"
+#include "game.hpp"
#include "gods.hpp"
#include "help.hpp"
#include "hist_type.hpp"
@@ -3191,7 +3192,7 @@ void player_birth(void)
}
/* Init wilderness seeds */
- auto &wilderness = *wilderness_ptr;
+ auto &wilderness = game->wilderness;
for (std::size_t y = 0; y < wilderness.height(); y++)
{
for (std::size_t x = 0; x < wilderness.width(); x++)
diff --git a/src/cmd2.cc b/src/cmd2.cc
index 947d2816..eccf37f0 100644
--- a/src/cmd2.cc
+++ b/src/cmd2.cc
@@ -17,6 +17,7 @@
#include "feature_flag.hpp"
#include "feature_type.hpp"
#include "files.hpp"
+#include "game.hpp"
#include "gods.hpp"
#include "hook_chat_in.hpp"
#include "hook_enter_dungeon_in.hpp"
@@ -2549,7 +2550,7 @@ 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;
+ auto const &wilderness = game->wilderness;
if (p_ptr->wild_mode &&
magik(wf_info[wilderness(p_ptr->px, p_ptr->py).feat].level - (p_ptr->lev * 2)))
{
diff --git a/src/defines.h b/src/defines.h
index 19f2f8c3..082fb291 100644
--- a/src/defines.h
+++ b/src/defines.h
@@ -2463,7 +2463,7 @@
*/
#define level_or_feat(DTYPE, DLEVEL) \
((DTYPE) == DUNGEON_WILDERNESS ? \
- (*wilderness_ptr)(p_ptr->wilderness_x, p_ptr->wilderness_y).feat : \
+ (game->wilderness)(p_ptr->wilderness_x, p_ptr->wilderness_y).feat : \
(DLEVEL) )
diff --git a/src/dungeon.cc b/src/dungeon.cc
index c6ec2889..92f5862e 100644
--- a/src/dungeon.cc
+++ b/src/dungeon.cc
@@ -26,6 +26,7 @@
#include "feature_type.hpp"
#include "files.h"
#include "files.hpp"
+#include "game.hpp"
#include "generate.hpp"
#include "gen_evol.hpp"
#include "gods.hpp"
@@ -3524,7 +3525,7 @@ static void process_command(void)
/* Special cases */
else
{
- auto const &wilderness = *wilderness_ptr;
+ auto const &wilderness = game->wilderness;
auto const &tile = wilderness(p_ptr->px, p_ptr->py);
if ((wf_info[tile.feat].entrance >= 1000) || (tile.entrance > 1000))
{
@@ -4297,7 +4298,7 @@ static void process_player(void)
/* Hack -- mark current wilderness location as known */
if (!p_ptr->wild_mode && dun_level == 0)
{
- auto &wilderness = *wilderness_ptr;
+ auto &wilderness = game->wilderness;
wilderness(p_ptr->wilderness_x, p_ptr->wilderness_y).known = TRUE;
}
diff --git a/src/files.cc b/src/files.cc
index d055b32c..91795af3 100644
--- a/src/files.cc
+++ b/src/files.cc
@@ -15,6 +15,7 @@
#include "cmd3.hpp"
#include "dungeon_info_type.hpp"
#include "feature_type.hpp"
+#include "game.hpp"
#include "hiscore.hpp"
#include "hook_chardump_in.hpp"
#include "hooks.hpp"
@@ -2321,7 +2322,7 @@ void display_player(int mode)
*/
cptr describe_player_location()
{
- auto const &wilderness = *wilderness_ptr;
+ auto const &wilderness = game->wilderness;
int i;
static char desc[80];
diff --git a/src/game.hpp b/src/game.hpp
index e0ebb9ea..03db8a45 100644
--- a/src/game.hpp
+++ b/src/game.hpp
@@ -1,12 +1,19 @@
#pragma once
#include "game_fwd.hpp"
+#include "grid.hpp"
+#include "wilderness_map.hpp"
/**
* All structures for the game itself.
*/
struct Game {
+ /*
+ * Wilderness map
+ */
+ grid<wilderness_map> wilderness;
+
};
/**
diff --git a/src/generate.cc b/src/generate.cc
index 573a58f6..752b0f53 100644
--- a/src/generate.cc
+++ b/src/generate.cc
@@ -15,6 +15,7 @@
#include "dungeon_flag.hpp"
#include "feature_flag.hpp"
#include "feature_type.hpp"
+#include "game.hpp"
#include "hook_build_room1_in.hpp"
#include "hooks.hpp"
#include "init1.hpp"
diff --git a/src/init1.cc b/src/init1.cc
index 3fb33179..fa99031f 100644
--- a/src/init1.cc
+++ b/src/init1.cc
@@ -11,6 +11,7 @@
#include "feature_flag.hpp"
#include "feature_type.hpp"
#include "files.hpp"
+#include "game.hpp"
#include "gods.hpp"
#include "hist_type.hpp"
#include "init2.hpp"
@@ -6363,7 +6364,7 @@ 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;
+ auto &wilderness = game->wilderness;
int i;
diff --git a/src/init2.cc b/src/init2.cc
index 7cb3a5cd..57f3255c 100644
--- a/src/init2.cc
+++ b/src/init2.cc
@@ -11,6 +11,7 @@
#include "ego_item_type.hpp"
#include "files.hpp"
#include "feature_type.hpp"
+#include "game.hpp"
#include "generate.hpp"
#include "gen_evol.hpp"
#include "gen_maze.hpp"
@@ -1259,9 +1260,6 @@ void init_angband(void)
// Initialize game structure
game = new Game();
- /* 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 9eb0b185..22708203 100644
--- a/src/loadsave.cc
+++ b/src/loadsave.cc
@@ -6,6 +6,7 @@
#include "cave_type.hpp"
#include "dungeon_info_type.hpp"
#include "ego_item_type.hpp"
+#include "game.hpp"
#include "init1.hpp"
#include "init2.hpp"
#include "levels.hpp"
@@ -2245,7 +2246,7 @@ static bool do_quests(ls_flag_t flag)
static bool do_wilderness(ls_flag_t flag)
{
- auto &wilderness = *wilderness_ptr;
+ auto &wilderness = game->wilderness;
// Player position and "mode" wrt. wilderness
do_s32b(&p_ptr->wilderness_x, flag);
diff --git a/src/monster1.cc b/src/monster1.cc
index ae54448c..6d913367 100644
--- a/src/monster1.cc
+++ b/src/monster1.cc
@@ -9,6 +9,7 @@
#include "monster1.hpp"
#include "cave_type.hpp"
+#include "game.hpp"
#include "monster2.hpp"
#include "monster_ego.hpp"
#include "monster_race.hpp"
@@ -1535,7 +1536,7 @@ void set_mon_num_hook(void)
{
if (!dun_level)
{
- auto const &wilderness = *wilderness_ptr;
+ auto const &wilderness = game->wilderness;
switch (wf_info[wilderness(p_ptr->wilderness_x, p_ptr->wilderness_y).feat].terrain_idx)
{
case TERRAIN_TOWN:
diff --git a/src/monster2.cc b/src/monster2.cc
index 4eb6a618..3ca14275 100644
--- a/src/monster2.cc
+++ b/src/monster2.cc
@@ -14,6 +14,7 @@
#include "dungeon_flag.hpp"
#include "dungeon_info_type.hpp"
#include "files.hpp"
+#include "game.hpp"
#include "hook_new_monster_in.hpp"
#include "hook_new_monster_end_in.hpp"
#include "hooks.hpp"
diff --git a/src/object2.cc b/src/object2.cc
index f96426fb..98487e46 100644
--- a/src/object2.cc
+++ b/src/object2.cc
@@ -19,6 +19,7 @@
#include "ego_item_type.hpp"
#include "feature_flag.hpp"
#include "feature_type.hpp"
+#include "game.hpp"
#include "hooks.hpp"
#include "mimic.hpp"
#include "monster2.hpp"
diff --git a/src/q_god.cc b/src/q_god.cc
index fc8a89f0..f5e182cc 100644
--- a/src/q_god.cc
+++ b/src/q_god.cc
@@ -5,6 +5,7 @@
#include "dungeon_info_type.hpp"
#include "feature_flag.hpp"
#include "feature_type.hpp"
+#include "game.hpp"
#include "hook_chardump_in.hpp"
#include "hook_get_in.hpp"
#include "hook_enter_dungeon_in.hpp"
@@ -292,7 +293,7 @@ std::string quest_god_describe()
static void quest_god_place_rand_dung()
{
- auto &wilderness = *wilderness_ptr;
+ auto &wilderness = game->wilderness;
int x = -1, y = -1, tries;
diff --git a/src/variable.cc b/src/variable.cc
index e9557c6a..91cb2a08 100644
--- a/src/variable.cc
+++ b/src/variable.cc
@@ -669,12 +669,6 @@ s32b get_level_max_stick = -1;
s32b get_level_use_stick = -1;
/*
- * Wilderness map
- */
-grid<wilderness_map> *wilderness_ptr;
-
-
-/*
* Maximum number of skills in s_info.txt
*/
u16b max_s_idx;
diff --git a/src/variable.hpp b/src/variable.hpp
index e305d6bd..1a789747 100644
--- a/src/variable.hpp
+++ b/src/variable.hpp
@@ -13,7 +13,6 @@
#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"
@@ -48,7 +47,6 @@
#include "trap_type_fwd.hpp"
#include "tval_desc.hpp"
#include "vault_type_fwd.hpp"
-#include "wilderness_map_fwd.hpp"
#include "wilderness_type_info_fwd.hpp"
#include "seed.hpp"
@@ -208,7 +206,6 @@ 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 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 55a03087..78a29f56 100644
--- a/src/wild.cc
+++ b/src/wild.cc
@@ -12,6 +12,7 @@
#include "cave_type.hpp"
#include "feature_flag.hpp"
#include "feature_type.hpp"
+#include "game.hpp"
#include "hook_wild_gen_in.hpp"
#include "hooks.hpp"
#include "init1.hpp"
@@ -155,7 +156,7 @@ 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;
+ auto const &wilderness = game->wilderness;
int road, entrance;
int x1, y1;
int hack_floor = 0;
@@ -575,7 +576,7 @@ void wilderness_gen()
*/
void wilderness_gen_small()
{
- auto const &wilderness = *wilderness_ptr;
+ auto const &wilderness = game->wilderness;
int xstart = 0;
int ystart = 0;
@@ -645,7 +646,7 @@ 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)
{
- auto &wilderness = *wilderness_ptr;
+ auto &wilderness = game->wilderness;
/* Circle or square ? */
if (h == 0)
diff --git a/src/wizard2.cc b/src/wizard2.cc
index 786ca796..359d5c5a 100644
--- a/src/wizard2.cc
+++ b/src/wizard2.cc
@@ -15,6 +15,7 @@
#include "corrupt.hpp"
#include "dungeon_info_type.hpp"
#include "files.hpp"
+#include "game.hpp"
#include "hooks.hpp"
#include "monster2.hpp"
#include "monster_race.hpp"
@@ -86,7 +87,7 @@ static void teleport_player_town(int town)
dun_level = 0;
p_ptr->town_num = town;
- auto const &wilderness = *wilderness_ptr;
+ auto const &wilderness = game->wilderness;
for (std::size_t y = 0; y < wilderness.height(); y++)
{
for (std::size_t x = 0; x < wilderness.width(); x++)
diff --git a/src/xtra1.cc b/src/xtra1.cc
index 6891c801..c8fdb2e0 100644
--- a/src/xtra1.cc
+++ b/src/xtra1.cc
@@ -16,6 +16,7 @@
#include "dungeon_flag.hpp"
#include "dungeon_info_type.hpp"
#include "files.hpp"
+#include "game.hpp"
#include "gods.hpp"
#include "hook_calculate_hp_in.hpp"
#include "hook_calculate_hp_out.hpp"
@@ -559,7 +560,7 @@ static void prt_depth(int row, int col)
}
else if (!dun_level)
{
- auto const &wilderness = *wilderness_ptr;
+ auto const &wilderness = game->wilderness;
auto const &wf = wf_info[wilderness(p_ptr->wilderness_x, p_ptr->wilderness_y).feat];
if (wf.name)
{
diff --git a/src/xtra2.cc b/src/xtra2.cc
index 5e53d945..b5ad738a 100644
--- a/src/xtra2.cc
+++ b/src/xtra2.cc
@@ -17,6 +17,7 @@
#include "feature_flag.hpp"
#include "feature_type.hpp"
#include "files.hpp"
+#include "game.hpp"
#include "gods.hpp"
#include "hook_player_level_in.hpp"
#include "hook_monster_death_in.hpp"
@@ -4237,7 +4238,7 @@ 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 &wilderness = game->wilderness;
auto const &wf = wf_info[wilderness(x, y).feat];
s3 = "";