diff options
-rw-r--r-- | lib/edit/misc.txt | 3 | ||||
-rw-r--r-- | lib/mods/theme/edit/misc.txt | 3 | ||||
-rw-r--r-- | src/birth.cc | 3 | ||||
-rw-r--r-- | src/bldg.cc | 4 | ||||
-rw-r--r-- | src/cave.cc | 5 | ||||
-rw-r--r-- | src/files.cc | 14 | ||||
-rw-r--r-- | src/game_edit_data.hpp | 6 | ||||
-rw-r--r-- | src/init1.cc | 23 | ||||
-rw-r--r-- | src/init2.cc | 11 | ||||
-rw-r--r-- | src/loadsave.cc | 6 | ||||
-rw-r--r-- | src/object1.cc | 10 | ||||
-rw-r--r-- | src/store.cc | 37 | ||||
-rw-r--r-- | src/store_info_type_fwd.hpp | 3 | ||||
-rw-r--r-- | src/variable.cc | 10 | ||||
-rw-r--r-- | src/variable.hpp | 3 | ||||
-rw-r--r-- | src/wild.cc | 101 | ||||
-rw-r--r-- | src/xtra2.cc | 1 |
17 files changed, 150 insertions, 93 deletions
diff --git a/lib/edit/misc.txt b/lib/edit/misc.txt index 8bddc2e3..8bf64864 100644 --- a/lib/edit/misc.txt +++ b/lib/edit/misc.txt @@ -39,9 +39,6 @@ M:U:176 # Maximum number of terrain types in wf_info.txt M:W:30 -# Maximum number of store types in st_info.txt -M:S:61 - # Maximum size for "o_list[]" M:O:1024 diff --git a/lib/mods/theme/edit/misc.txt b/lib/mods/theme/edit/misc.txt index 7b4b3b08..b4f43f5e 100644 --- a/lib/mods/theme/edit/misc.txt +++ b/lib/mods/theme/edit/misc.txt @@ -39,9 +39,6 @@ M:U:176 # Maximum number of terrain types in wf_info.txt M:W:64 -# Maximum number of store types in st_info.txt -M:S:89 - # Maximum size for "o_list[]" M:O:1024 diff --git a/src/birth.cc b/src/birth.cc index 2106527c..0ea545b5 100644 --- a/src/birth.cc +++ b/src/birth.cc @@ -3055,6 +3055,7 @@ static void init_town(int t_idx) */ void player_birth(void) { + auto const &st_info = game->edit_data.st_info; auto &d_info = game->edit_data.d_info; /* Starting index for generated towns */ @@ -3177,7 +3178,7 @@ void player_birth(void) create_stores_stock(i); /* Init the stores */ - for (std::size_t j = 0; j < max_st_idx; j++) + for (std::size_t j = 0; j < st_info.size(); j++) { /* Initialize */ store_init(i, j); diff --git a/src/bldg.cc b/src/bldg.cc index 0425a909..8f681744 100644 --- a/src/bldg.cc +++ b/src/bldg.cc @@ -115,7 +115,9 @@ static void clear_bldg(int min_row, int max_row) void show_building(store_type const *s_ptr) { auto const &ba_info = game->edit_data.ba_info; - store_info_type *st_ptr = &st_info[s_ptr->st_idx]; + auto const &st_info = game->edit_data.st_info; + + auto st_ptr = &st_info[s_ptr->st_idx]; for (std::size_t i = 0; i < st_ptr->actions.size(); i++) { diff --git a/src/cave.cc b/src/cave.cc index e460ddc8..92f57c95 100644 --- a/src/cave.cc +++ b/src/cave.cc @@ -4,6 +4,7 @@ #include "dungeon_flag.hpp" #include "feature_flag.hpp" #include "feature_type.hpp" +#include "game.hpp" #include "hook_enter_dungeon_in.hpp" #include "monster2.hpp" #include "monster_race.hpp" @@ -845,6 +846,8 @@ static byte darker_attrs[16] = static void map_info(int y, int x, byte *ap, char *cp) { + auto const &st_info = game->edit_data.st_info; + byte a; byte c; @@ -1278,6 +1281,8 @@ static void map_info(int y, int x, byte *ap, char *cp) */ void map_info_default(int y, int x, byte *ap, char *cp) { + auto const &st_info = game->edit_data.st_info; + byte a; byte c; diff --git a/src/files.cc b/src/files.cc index a2c11846..eef16227 100644 --- a/src/files.cc +++ b/src/files.cc @@ -217,6 +217,7 @@ s16b tokenize(char *buf, s16b num, char **tokens, char delim1, char delim2) errr process_pref_file_aux(char *buf) { auto &race_mod_info = game->edit_data.race_mod_info; + auto &st_info = game->edit_data.st_info; int i, j, n1, n2; @@ -376,12 +377,13 @@ errr process_pref_file_aux(char *buf) { if (tokenize(buf + 2, 3, zz, ':', '/') == 3) { - store_info_type *st_ptr; - i = (huge)strtol(zz[0], NULL, 0); + std::size_t i = std::stoul(zz[0], 0, 0); n1 = strtol(zz[1], NULL, 0); n2 = strtol(zz[2], NULL, 0); - if (i >= max_st_idx) return (1); - st_ptr = &st_info[i]; + + if (i >= st_info.size()) return (1); + + auto st_ptr = &st_info[i]; if (n1) st_ptr->x_attr = n1; if (n2) st_ptr->x_char = n2; return (0); @@ -2513,8 +2515,10 @@ void file_character_print_item(FILE *fff, char label, object_type *obj, bool_ fu * * Prints out one "store" (for Home and Mathom-house) */ -void file_character_print_store(FILE *fff, wilderness_type_info *place, int store, bool_ full) +static void file_character_print_store(FILE *fff, wilderness_type_info *place, std::size_t store, bool_ full) { + auto const &st_info = game->edit_data.st_info; + town_type *town = &town_info[place->entrance]; store_type *st_ptr = &town->store[store]; diff --git a/src/game_edit_data.hpp b/src/game_edit_data.hpp index 863cabe4..7b69ecac 100644 --- a/src/game_edit_data.hpp +++ b/src/game_edit_data.hpp @@ -10,6 +10,7 @@ #include "randart_part_type.hpp" #include "set_type.hpp" #include "store_action_type.hpp" +#include "store_info_type.hpp" #include "vault_type.hpp" #include <vector> @@ -52,6 +53,11 @@ struct GameEditData { std::vector<store_action_type> ba_info; /** + * Buildings + */ + std::vector<store_info_type> st_info; + + /** * Building owners. */ std::vector<owner_type> ow_info; diff --git a/src/init1.cc b/src/init1.cc index b68309b7..fb44c99b 100644 --- a/src/init1.cc +++ b/src/init1.cc @@ -5617,9 +5617,9 @@ static errr grab_one_store_flag(store_flag_set *flags, cptr what) */ errr init_st_info_txt(FILE *fp) { - int i = 0; + auto &st_info = game->edit_data.st_info; + char buf[1024]; - char *s; /* Current entry */ store_info_type *st_ptr = NULL; @@ -5647,7 +5647,7 @@ errr init_st_info_txt(FILE *fp) if (buf[0] == 'N') { /* Find the colon before the name */ - s = strchr(buf + 2, ':'); + char *s = strchr(buf + 2, ':'); /* Verify that colon */ if (!s) return (1); @@ -5659,22 +5659,19 @@ errr init_st_info_txt(FILE *fp) if (!*s) return (1); /* Get the index */ - i = atoi(buf + 2); + int i = atoi(buf + 2); /* Verify information */ if (i < error_idx) return (4); - /* Verify information */ - if (i >= max_st_idx) return (2); - /* Save the index */ error_idx = i; /* Point at the "info" */ - st_ptr = &st_info[i]; + st_ptr = &expand_to_fit_index(st_info, i); + assert(!st_ptr->name); /* Copy name */ - assert(!st_ptr->name); st_ptr->name = my_strdup(s); /* Next... */ @@ -5688,7 +5685,7 @@ errr init_st_info_txt(FILE *fp) if (buf[0] == 'I') { /* Find the colon before the name */ - s = strchr(buf + 2, ':'); + char *s = strchr(buf + 2, ':'); /* Verify that colon */ if (!s) return (1); @@ -6958,12 +6955,6 @@ static errr process_dungeon_file_aux(char *buf, int *yval, int *xval, int xvalst max_wf_idx = atoi(zz[1]); } - /* Maximum st_idx */ - else if (zz[0][0] == 'S') - { - max_st_idx = atoi(zz[1]); - } - /* Maximum wilderness x size */ else if (zz[0][0] == 'X') { diff --git a/src/init2.cc b/src/init2.cc index 6ae3d9ba..242fd4bb 100644 --- a/src/init2.cc +++ b/src/init2.cc @@ -454,7 +454,7 @@ namespace { static void allocate() { - st_info = new store_info_type[max_st_idx]; + // Nothing to do } static errr parse(FILE *fp) @@ -666,6 +666,8 @@ static errr init_misc(void) */ static errr init_towns(void) { + auto const &st_info = game->edit_data.st_info; + town_info = new town_type[max_towns]; for (std::size_t i = 1; i < max_towns; i++) @@ -676,7 +678,7 @@ static errr init_towns(void) } /* Fill in each store */ - for (std::size_t j = 0; j < max_st_idx; j++) + for (std::size_t j = 0; j < st_info.size(); j++) { /* Create the store */ town_info[i].store.emplace_back(store_type()); @@ -695,11 +697,13 @@ static errr init_towns(void) void create_stores_stock(int t) { + auto const &st_info = game->edit_data.st_info; + town_type *t_ptr = &town_info[t]; if (t_ptr->stocked) return; - for (int j = 0; j < max_st_idx; j++) + for (std::size_t j = 0; j < st_info.size(); j++) { store_type *st_ptr = &t_ptr->store[j]; @@ -709,6 +713,7 @@ void create_stores_stock(int t) /* Reserve space for stock */ st_ptr->stock.reserve(st_ptr->stock_size); } + t_ptr->stocked = TRUE; } diff --git a/src/loadsave.cc b/src/loadsave.cc index c100418e..64b4f6d6 100644 --- a/src/loadsave.cc +++ b/src/loadsave.cc @@ -2038,6 +2038,8 @@ static void do_timers(ls_flag_t flag) */ static void do_stores(ls_flag_t flag) { + auto const &st_info = game->edit_data.st_info; + // Indexes for "real" towns. std::vector<byte> reals; reals.reserve(max_towns); @@ -2059,9 +2061,9 @@ static void do_stores(ls_flag_t flag) do_vector(flag, reals, do_byte); /* Read the stores */ - u16b n_stores = max_st_idx; + u16b n_stores = st_info.size(); do_u16b(&n_stores, flag); - assert(n_stores <= max_st_idx); + assert(n_stores <= st_info.size()); for (auto const z: reals) { diff --git a/src/object1.cc b/src/object1.cc index 191b2046..b035326f 100644 --- a/src/object1.cc +++ b/src/object1.cc @@ -633,6 +633,7 @@ void flavor_init(void) */ void reset_visuals(void) { + auto &st_info = game->edit_data.st_info; auto &race_mod_info = game->edit_data.race_mod_info; int i; @@ -648,13 +649,11 @@ void reset_visuals(void) } /* Extract default attr/char code for stores */ - for (i = 0; i < max_st_idx; i++) + for (auto &st_ref: st_info) { - store_info_type *st_ptr = &st_info[i]; - /* Default attr/char */ - st_ptr->x_attr = st_ptr->d_attr; - st_ptr->x_char = st_ptr->d_char; + st_ref.x_attr = st_ref.d_attr; + st_ref.x_char = st_ref.d_char; } /* Extract default attr/char code for objects */ @@ -2515,6 +2514,7 @@ static cptr object_out_desc_where_found(s16b level, s16b dungeon) bool_ object_out_desc(object_type *o_ptr, FILE *fff, bool_ trim_down, bool_ wait_for_it) { auto const &set_info = game->edit_data.set_info; + auto const &st_info = game->edit_data.st_info; cptr vp[64]; byte vc[64]; diff --git a/src/store.cc b/src/store.cc index ab6e119b..161601e4 100644 --- a/src/store.cc +++ b/src/store.cc @@ -249,6 +249,8 @@ static owner_type const *ot_ptr = NULL; */ static s32b price_item(object_type *o_ptr, int greed, bool_ flip) { + auto const &st_info = game->edit_data.st_info; + int factor; int adjust; s32b price; @@ -572,6 +574,8 @@ static void store_object_absorb(object_type *o_ptr, object_type *j_ptr) */ static bool_ store_check_num(object_type *o_ptr) { + auto const &st_info = game->edit_data.st_info; + /* Free space is always usable */ if (st_ptr->stock.size() < st_ptr->stock_size) { @@ -626,6 +630,8 @@ static bool is_blessed(object_type const *o_ptr) */ static bool store_will_buy(object_type const *o_ptr) { + auto const &st_info = game->edit_data.st_info; + cptr store_name = st_info[st_ptr->st_idx].name; /* Hack -- The Home is simple */ @@ -1074,6 +1080,8 @@ static void store_item_optimize(int item) */ static bool_ black_market_crap(object_type *o_ptr) { + auto const &st_info = game->edit_data.st_info; + /* Ego items are never crap */ if (o_ptr->name2) return (FALSE); @@ -1083,7 +1091,7 @@ static bool_ black_market_crap(object_type *o_ptr) if (o_ptr->to_d > 0) return (FALSE); /* Check all stores */ - for (std::size_t i = 0; i < max_st_idx; i++) + for (std::size_t i = 0; i < st_info.size(); i++) { if (i == STORE_HOME) continue; if (st_info[i].flags & STF_MUSEUM) continue; @@ -1133,7 +1141,10 @@ static void store_delete(void) /* Analyze store flags and return a level */ int return_level() { - store_info_type *sti_ptr = &st_info[st_ptr->st_idx]; + auto const &st_info = game->edit_data.st_info; + + auto sti_ptr = &st_info[st_ptr->st_idx]; + int level; if (sti_ptr->flags & STF_RANDOM) level = 0; @@ -1186,6 +1197,8 @@ static bool_ kind_is_storeok(int k_idx) */ static void store_create(void) { + auto const &st_info = game->edit_data.st_info; + int i = 0, tries, level = 0; object_type forge; @@ -1400,6 +1413,8 @@ static void store_create(void) */ static void display_entry(int pos) { + auto const &st_info = game->edit_data.st_info; + /* Get the item */ auto o_ptr = &st_ptr->stock[pos]; @@ -1543,6 +1558,8 @@ void store_prt_gold(void) */ void display_store(void) { + auto const &st_info = game->edit_data.st_info; + char buf[80]; @@ -1825,7 +1842,9 @@ static bool_ sell_haggle(object_type *o_ptr, s32b *price) */ static bool retire_owner_p(void) { - store_info_type *sti_ptr = &st_info[town_info[p_ptr->town_num].store[cur_store_num].st_idx]; + auto const &st_info = game->edit_data.st_info; + + auto sti_ptr = &st_info[town_info[p_ptr->town_num].store[cur_store_num].st_idx]; if (sti_ptr->owners.size() > 1) { @@ -2070,6 +2089,8 @@ void store_stole(void) */ void store_purchase(void) { + auto const &st_info = game->edit_data.st_info; + /* Museum? */ if (st_info[st_ptr->st_idx].flags & STF_MUSEUM) { @@ -2379,6 +2400,8 @@ void store_purchase(void) */ void store_sell(void) { + auto const &st_info = game->edit_data.st_info; + int choice; int item, item_pos; int amt; @@ -2678,6 +2701,8 @@ void store_sell(void) */ void store_examine(void) { + auto const &st_info = game->edit_data.st_info; + /* Empty? */ if (st_ptr->stock.empty()) { @@ -2760,6 +2785,7 @@ static bool_ leave_store = FALSE; */ static store_action_type const *find_store_action(s16b command_cmd) { + auto const &st_info = game->edit_data.st_info; auto const &ba_info = game->edit_data.ba_info; for (std::size_t i = 0; i < st_info[st_ptr->st_idx].actions.size(); i++) @@ -3101,6 +3127,7 @@ void do_cmd_store(void) { auto const &ow_info = game->edit_data.ow_info; auto const &ba_info = game->edit_data.ba_info; + auto const &st_info = game->edit_data.st_info; int which; int maintain_num; @@ -3369,6 +3396,7 @@ void do_cmd_store(void) void store_shuffle(int which) { auto const &ow_info = game->edit_data.ow_info; + auto const &st_info = game->edit_data.st_info; /* Ignore home */ if (which == STORE_HOME) return; @@ -3418,6 +3446,7 @@ void store_shuffle(int which) void store_maint(int town_num, int store_num) { auto const &ow_info = game->edit_data.ow_info; + auto const &st_info = game->edit_data.st_info; int const old_rating = rating; @@ -3510,6 +3539,7 @@ void store_maint(int town_num, int store_num) void store_init(int town_num, int store_num) { auto const &ow_info = game->edit_data.ow_info; + auto const &st_info = game->edit_data.st_info; cur_store_num = store_num; @@ -3553,6 +3583,7 @@ void do_cmd_home_trump(void) { auto const &ow_info = game->edit_data.ow_info; auto const &ba_info = game->edit_data.ba_info; + auto const &st_info = game->edit_data.st_info; int which; int maintain_num; diff --git a/src/store_info_type_fwd.hpp b/src/store_info_type_fwd.hpp deleted file mode 100644 index a0dace90..00000000 --- a/src/store_info_type_fwd.hpp +++ /dev/null @@ -1,3 +0,0 @@ -#pragma once - -struct store_info_type; diff --git a/src/variable.cc b/src/variable.cc index 8356148b..89e0bd5b 100644 --- a/src/variable.cc +++ b/src/variable.cc @@ -484,11 +484,6 @@ wilderness_type_info *wf_info; int wildc2i[256]; /* - * The store/building types arrays - */ -store_info_type *st_info; - -/* * Default texts for feature information. */ cptr DEFAULT_FEAT_TEXT = "a wall blocking your way"; @@ -645,11 +640,6 @@ u16b max_a_idx; u16b max_e_idx; /* - * Maximum number of stores types in st_info.txt - */ -u16b max_st_idx; - -/* * Maximum number of objects in the level */ u16b max_o_idx; diff --git a/src/variable.hpp b/src/variable.hpp index a413a0f3..415b0676 100644 --- a/src/variable.hpp +++ b/src/variable.hpp @@ -31,7 +31,6 @@ #include "skill_modifiers_fwd.hpp" #include "skill_type_fwd.hpp" #include "skills_defs.hpp" -#include "store_info_type_fwd.hpp" #include "timer_type_fwd.hpp" #include "town_type_fwd.hpp" #include "trap_type_fwd.hpp" @@ -171,7 +170,6 @@ extern monster_ego *re_info; extern trap_type *t_info; extern wilderness_type_info *wf_info; extern int wildc2i[256]; -extern store_info_type *st_info; extern cptr DEFAULT_FEAT_TEXT; extern cptr DEFAULT_FEAT_TUNNEL; extern cptr DEFAULT_FEAT_BLOCK; @@ -193,7 +191,6 @@ extern u16b max_e_idx; extern u16b max_o_idx; extern u16b max_m_idx; extern u16b max_t_idx; -extern u16b max_st_idx; extern u16b max_wf_idx; extern int init_flags; extern bool_ ambush_flag; diff --git a/src/wild.cc b/src/wild.cc index 78a29f56..e4fdf33f 100644 --- a/src/wild.cc +++ b/src/wild.cc @@ -888,33 +888,51 @@ static void build_store_hidden(int n, int yy, int xx) } /* Return a list of stores */ -static int get_shops(int *rooms) +static std::vector<std::size_t> get_shops() { - int i, n, num = 0; + auto const &st_info = game->edit_data.st_info; - for (n = 0; n < max_st_idx; n++) - { - rooms[n] = 0; - } + std::vector<std::size_t> rooms; - for (n = 0; n < max_st_idx; n++) + for (std::size_t n = 0; n < st_info.size(); n++) { int chance = 50; - if (st_info[n].flags & STF_COMMON) chance += 30; - if (st_info[n].flags & STF_RARE) chance -= 20; - if (st_info[n].flags & STF_VERY_RARE) chance -= 30; + if (st_info[n].flags & STF_COMMON) + { + chance += 30; + } - if (!magik(chance)) continue; + if (st_info[n].flags & STF_RARE) + { + chance -= 20; + } - for (i = 0; i < num; ++i) + if (st_info[n].flags & STF_VERY_RARE) + { + chance -= 30; + } + + if (!magik(chance)) + { + continue; + } + + for (std::size_t i = 0; i < rooms.size(); ++i) + { if (rooms[i] == n) + { continue; + } + } - if (st_info[n].flags & STF_RANDOM) rooms[num++] = n; + if (st_info[n].flags & STF_RANDOM) + { + rooms.push_back(n); + } } - return num; + return rooms; } /* Generate town borders */ @@ -996,7 +1014,7 @@ static bool_ create_townpeople_hook(int r_idx) */ static void town_gen_hack(int t_idx, int qy, int qx) { - int y, x, floor, num = 0; + int y, x, floor; bool_ (*old_get_mon_num_hook)(int r_idx); /* Do we use dungeon floor or normal one */ @@ -1015,8 +1033,7 @@ static void town_gen_hack(int t_idx, int qy, int qx) } /* Prepare an Array of "remaining stores", and count them */ - std::unique_ptr<int[]> rooms(new int[max_st_idx]); - num = get_shops(rooms.get()); + auto rooms = get_shops(); /* Place two rows of stores */ for (y = 0; y < 2; y++) @@ -1024,10 +1041,14 @@ static void town_gen_hack(int t_idx, int qy, int qx) /* Place four stores per row */ for (x = 0; x < 4; x++) { - if(--num > -1) + if (!rooms.empty()) { + /* Extract store */ + auto room = rooms.back(); + rooms.pop_back(); + /* Build that store at the proper location */ - build_store(qy, qx, rooms[num], y, x); + build_store(qy, qx, room, y, x); } } } @@ -1084,7 +1105,7 @@ static void town_gen_hack(int t_idx, int qy, int qx) static void town_gen_circle(int t_idx, int qy, int qx) { - int y, x, cy, cx, rad, floor, num = 0; + int y, x, cy, cx, rad, floor; bool_ (*old_get_mon_num_hook)(int r_idx); /* Do we use dungeon floor or normal one */ @@ -1147,9 +1168,8 @@ static void town_gen_circle(int t_idx, int qy, int qx) } } - /* Prepare an Array of "remaining stores", and count them */ - std::unique_ptr<int[]> rooms(new int[max_st_idx]); - num = get_shops(rooms.get()); + /* Get "remaining stores" */ + auto rooms = get_shops(); /* Place two rows of stores */ for (y = 0; y < 2; y++) @@ -1157,10 +1177,14 @@ static void town_gen_circle(int t_idx, int qy, int qx) /* Place four stores per row */ for (x = 0; x < 4; x++) { - if(--num > -1) + if (!rooms.empty()) { + /* Extract store */ + auto room = rooms.back(); + rooms.pop_back(); + /* Build that store at the proper location */ - build_store_circle(qy, qx, rooms[num], y, x); + build_store_circle(qy, qx, room, y, x); } } } @@ -1213,31 +1237,38 @@ static void town_gen_circle(int t_idx, int qy, int qx) static void town_gen_hidden(int t_idx, int qy, int qx) { - int y, x, n, num = 0, i; - - /* Prepare an Array of "remaining stores", and count them */ - std::unique_ptr<int[]> rooms(new int[max_st_idx]); - num = get_shops(rooms.get()); + /* Get "remaining stores" */ + auto rooms = get_shops(); /* Get a number of stores to place */ - n = rand_int(num / 2) + (num / 2); + std::size_t n = rand_int(rooms.size() / 2) + (rooms.size() / 2); /* Place k stores */ - for (i = 0; i < n; i++) + for (std::size_t i = 0; i < n; i++) { /* Find a good spot */ + int x; + int y; while (TRUE) { y = rand_range(1, cur_hgt - 2); x = rand_range(1, cur_wid - 2); - if (cave_empty_bold(y, x)) break; + if (cave_empty_bold(y, x)) + { + break; + } } - if(--num > -1) + /* Any stores left? */ + if (!rooms.empty()) { + /* Extract store */ + auto room = rooms.back(); + rooms.pop_back(); + /* Build that store at the proper location */ - build_store_hidden(rooms[num], y, x); + build_store_hidden(room, y, x); } } } diff --git a/src/xtra2.cc b/src/xtra2.cc index 95234f79..d9de48cd 100644 --- a/src/xtra2.cc +++ b/src/xtra2.cc @@ -3889,6 +3889,7 @@ bool_ target_object(int y, int x, int mode, cptr info, bool_ *boring, static int target_set_aux(int y, int x, int mode, cptr info) { auto const &d_info = game->edit_data.d_info; + auto const &st_info = game->edit_data.st_info; cave_type *c_ptr = &cave[y][x]; |