OSDN Git Service

Merge pull request #3721 from daradarach/feature/nodequest
[hengbandforosx/hengbandosx.git] / src / cmd-visual / cmd-map.cpp
1 #include "cmd-visual/cmd-map.h"
2 #include "autopick/autopick-methods-table.h"
3 #include "autopick/autopick-util.h"
4 #include "io/input-key-acceptor.h"
5 #include "system/player-type-definition.h"
6 #include "term/screen-processor.h"
7 #include "view/display-map.h"
8 #include "window/main-window-util.h"
9 #include <string_view>
10
11 /*
12  * Display a "small-scale" map of the dungeon for the player
13  *
14  * Currently, the "player" is displayed on the map.
15  */
16 void do_cmd_view_map(PlayerType *player_ptr)
17 {
18     screen_save();
19     prt(_("お待ち下さい...", "Please wait..."), 0, 0);
20     term_fresh();
21     term_clear();
22     display_autopick = 0;
23
24     int cy, cx;
25     display_map(player_ptr, &cy, &cx);
26     if (autopick_list.empty() || player_ptr->wild_mode) {
27         const auto &[wid, hgt] = term_get_size();
28         constexpr auto msg = _("何かキーを押すとゲームに戻ります", "Hit any key to continue");
29         const auto center_x = (wid - std::string_view(msg).length()) / 2;
30         put_str(msg, hgt - 1, center_x);
31         move_cursor(cy, cx);
32         inkey(true);
33         screen_load();
34         return;
35     }
36
37     display_autopick = ITEM_DISPLAY;
38     while (true) {
39         const auto &[wid, hgt] = term_get_size();
40         int row_message = hgt - 1;
41         put_str(_("何かキーを押してください('M':拾う 'N':放置 'D':M+N 'K':壊すアイテムを表示)",
42                     " Hit M, N(for ~), K(for !), or D(same as M+N) to display auto-picker items."),
43             row_message, 1);
44         move_cursor(cy, cx);
45         int i = inkey(true);
46         byte flag;
47         if ('M' == i) {
48             flag = (DO_AUTOPICK | DO_QUERY_AUTOPICK);
49         } else if ('N' == i) {
50             flag = DONT_AUTOPICK;
51         } else if ('K' == i) {
52             flag = DO_AUTODESTROY;
53         } else if ('D' == i) {
54             flag = (DO_AUTOPICK | DO_QUERY_AUTOPICK | DONT_AUTOPICK);
55         } else {
56             break;
57         }
58
59         term_fresh();
60         if (~display_autopick & flag) {
61             display_autopick |= flag;
62         } else {
63             display_autopick &= ~flag;
64         }
65
66         display_map(player_ptr, &cy, &cx);
67     }
68
69     display_autopick = 0;
70     screen_load();
71 }