diff options
author | Bardur Arantsson <bardur@scientician.net> | 2016-09-17 09:58:15 +0200 |
---|---|---|
committer | Bardur Arantsson <bardur@scientician.net> | 2016-09-17 09:58:15 +0200 |
commit | dc261d2c9732554d9f510e11711ac84d028e5ac1 (patch) | |
tree | 2eeb12d57fa130309f26160277fb2677bf928c37 /src/wizard2.cc | |
parent | eea082ffd1a3ecf73b7c464cc28da5ef74d3a30f (diff) |
Use grid<> for wilderness grid
Diffstat (limited to 'src/wizard2.cc')
-rw-r--r-- | src/wizard2.cc | 31 |
1 files changed, 19 insertions, 12 deletions
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; + } + } + } } |