OSDN Git Service

[Refactor] #3399 cmd_visual_aux() のシグネチャを変えて扱いやすくした
[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
10 /*
11  * Display a "small-scale" map of the dungeon for the player
12  *
13  * Currently, the "player" is displayed on the map.
14  */
15 void do_cmd_view_map(PlayerType *player_ptr)
16 {
17     screen_save();
18     prt(_("お待ち下さい...", "Please wait..."), 0, 0);
19     term_fresh();
20     term_clear();
21     display_autopick = 0;
22
23     int cy, cx;
24     display_map(player_ptr, &cy, &cx);
25     if (autopick_list.empty() || player_ptr->wild_mode) {
26         put_str(_("何かキーを押すとゲームに戻ります", "Hit any key to continue"), 23, 30);
27         move_cursor(cy, cx);
28         inkey(true);
29         screen_load();
30         return;
31     }
32
33     display_autopick = ITEM_DISPLAY;
34     while (true) {
35         int wid, hgt;
36         term_get_size(&wid, &hgt);
37         int row_message = hgt - 1;
38         put_str(_("何かキーを押してください('M':拾う 'N':放置 'D':M+N 'K':壊すアイテムを表示)",
39                     " Hit M, N(for ~), K(for !), or D(same as M+N) to display auto-picker items."),
40             row_message, 1);
41         move_cursor(cy, cx);
42         int i = inkey(true);
43         byte flag;
44         if ('M' == i) {
45             flag = (DO_AUTOPICK | DO_QUERY_AUTOPICK);
46         } else if ('N' == i) {
47             flag = DONT_AUTOPICK;
48         } else if ('K' == i) {
49             flag = DO_AUTODESTROY;
50         } else if ('D' == i) {
51             flag = (DO_AUTOPICK | DO_QUERY_AUTOPICK | DONT_AUTOPICK);
52         } else {
53             break;
54         }
55
56         term_fresh();
57         if (~display_autopick & flag) {
58             display_autopick |= flag;
59         } else {
60             display_autopick &= ~flag;
61         }
62
63         display_map(player_ptr, &cy, &cx);
64     }
65
66     display_autopick = 0;
67     screen_load();
68 }