OSDN Git Service

[Refactor] #40571 Separated target-setter.c/h from targeting.c/h
authorHourier <hourier@users.sourceforge.jp>
Sat, 25 Jul 2020 03:41:42 +0000 (12:41 +0900)
committerHourier <hourier@users.sourceforge.jp>
Sun, 26 Jul 2020 08:04:22 +0000 (17:04 +0900)
16 files changed:
Hengband/Hengband/Hengband.vcxproj
Hengband/Hengband/Hengband.vcxproj.filters
src/Makefile.am
src/blue-magic/blue-magic-caster.c
src/cmd-action/cmd-mane.c
src/cmd-action/cmd-pet.c
src/cmd-item/cmd-item.c
src/mind/mind-switcher.c
src/mutation/mutation-processor.c
src/realm/realm-trump.c
src/spell-kind/spells-fetcher.c
src/spell-kind/spells-world.c
src/target/target-setter.c [new file with mode: 0644]
src/target/target-setter.h [new file with mode: 0644]
src/target/targeting.c
src/target/targeting.h

index a478e1e..c6bf052 100644 (file)
     <ClCompile Include="..\..\src\target\grid-selector.c" />\r
     <ClCompile Include="..\..\src\target\target-describer.c" />\r
     <ClCompile Include="..\..\src\target\target-preparation.c" />\r
+    <ClCompile Include="..\..\src\target\target-setter.c" />\r
     <ClCompile Include="..\..\src\view\display-inventory.c" />\r
     <ClCompile Include="..\..\src\view\display-map.c" />\r
     <ClCompile Include="..\..\src\window\display-sub-window-items.c" />\r
     <ClInclude Include="..\..\src\target\grid-selector.h" />\r
     <ClInclude Include="..\..\src\target\target-describer.h" />\r
     <ClInclude Include="..\..\src\target\target-preparation.h" />\r
+    <ClInclude Include="..\..\src\target\target-setter.h" />\r
     <ClInclude Include="..\..\src\target\target-types.h" />\r
     <ClInclude Include="..\..\src\term\screen-processor.h" />\r
     <ClInclude Include="..\..\src\util\bit-flags-calculator.h" />\r
index 2f59350..93df0c4 100644 (file)
     <ClCompile Include="..\..\src\target\grid-selector.c">
       <Filter>target</Filter>
     </ClCompile>
+    <ClCompile Include="..\..\src\target\target-setter.c">
+      <Filter>target</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="..\..\src\combat\shoot.h">
     <ClInclude Include="..\..\src\target\grid-selector.h">
       <Filter>target</Filter>
     </ClInclude>
+    <ClInclude Include="..\..\src\target\target-setter.h">
+      <Filter>target</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <None Include="..\..\src\wall.bmp" />
index b1357e7..77761d3 100644 (file)
@@ -733,6 +733,7 @@ hengband_SOURCES = \
        target/grid-selector.c target/grid-selector.h \
        target/target-describer.c target/target-describer.h \
        target/target-preparation.c target/target-preparation.h \
+       target/target-setter.c target/target-setter.h \
        target/target-types.h \
        target/targeting.c target/targeting.h \
        \
index 50f6dc2..aaaf963 100644 (file)
@@ -29,6 +29,7 @@
 #include "status/body-improvement.h"
 #include "status/buff-setter.h"
 #include "system/floor-type-definition.h"
+#include "target/target-setter.h"
 #include "target/target-types.h"
 #include "target/targeting.h"
 #include "view/display-messages.h"
index 55350d1..3afafcd 100644 (file)
@@ -50,6 +50,7 @@
 #include "status/body-improvement.h"
 #include "status/buff-setter.h"
 #include "system/floor-type-definition.h"
+#include "target/target-setter.h"
 #include "target/target-types.h"
 #include "target/targeting.h"
 #include "term/screen-processor.h"
index c94802a..3957ae4 100644 (file)
@@ -42,6 +42,7 @@
 #include "player/special-defense-types.h"
 #include "status/action-setter.h"
 #include "system/floor-type-definition.h"
+#include "target/target-setter.h"
 #include "target/target-types.h"
 #include "target/targeting.h"
 #include "term/screen-processor.h"
index c9cab56..3a151a7 100644 (file)
@@ -84,6 +84,7 @@
 #include "status/experience.h"
 #include "status/shape-changer.h"
 #include "sv-definition/sv-lite-types.h"
+#include "target/target-setter.h"
 #include "target/target-types.h"
 #include "target/targeting.h"
 #include "term/screen-processor.h"
index 7de5706..c2187dd 100644 (file)
@@ -79,6 +79,7 @@
 #include "status/sight-setter.h"
 #include "status/temporary-resistance.h"
 #include "system/floor-type-definition.h"
+#include "target/target-setter.h"
 #include "target/target-types.h"
 #include "target/targeting.h"
 #include "term/screen-processor.h"
index 94a64d0..6c85264 100644 (file)
@@ -38,6 +38,7 @@
 #include "store/store-util.h"
 #include "store/store.h"
 #include "system/floor-type-definition.h"
+#include "target/target-setter.h"
 #include "target/target-types.h"
 #include "target/targeting.h"
 #include "term/screen-processor.h"
index 53eb487..c82c00b 100644 (file)
@@ -20,6 +20,7 @@
 #include "spell/spells-status.h"
 #include "spell/spells-summon.h"
 #include "status/sight-setter.h"
+#include "target/target-setter.h"
 #include "target/target-types.h"
 #include "target/targeting.h"
 #include "view/display-messages.h"
index e9b2ba9..8e5f464 100644 (file)
@@ -16,6 +16,7 @@
 #include "system/floor-type-definition.h"
 #include "system/object-type-definition.h"
 #include "target/target-preparation.h"
+#include "target/target-setter.h"
 #include "target/target-types.h"
 #include "target/targeting.h"
 #include "util/bit-flags-calculator.h"
index 3fb4d6d..f699676 100644 (file)
@@ -28,6 +28,7 @@
 #include "monster/monster-info.h"
 #include "system/floor-type-definition.h"
 #include "system/monster-type-definition.h"
+#include "target/target-setter.h"
 #include "target/target-types.h"
 #include "target/targeting.h"
 #include "term/screen-processor.h"
diff --git a/src/target/target-setter.c b/src/target/target-setter.c
new file mode 100644 (file)
index 0000000..8049aac
--- /dev/null
@@ -0,0 +1,400 @@
+#include "target/target-setter.h"
+#include "core/player-redraw-types.h"
+#include "core/player-update-types.h"
+#include "core/window-redrawer.h"
+#include "core/stuff-handler.h"
+#include "floor/floor.h"
+#include "game-option/cheat-options.h"
+#include "game-option/game-play-options.h"
+#include "game-option/input-options.h"
+#include "grid/grid.h"
+#include "io/cursor.h"
+#include "io/input-key-requester.h"
+#include "io/screen-util.h"
+#include "main/sound-of-music.h"
+#include "system/floor-type-definition.h"
+#include "target/target-describer.h"
+#include "target/target-preparation.h"
+#include "target/target-types.h"
+#include "target/targeting.h" // todo 相互依存.
+#include "term/screen-processor.h"
+#include "util/int-char-converter.h"
+#include "window/main-window-util.h"
+
+/*!
+ * @brief フォーカスを当てるべきマップ描画の基準座標を指定する
+ * @param creature_ptr プレーヤーへの参照ポインタ
+ * @param y 変更先のフロアY座標
+ * @param x 変更先のフロアX座標
+ * @details
+ * Handle a request to change the current panel
+ * Return TRUE if the panel was changed.
+ * Also used in do_cmd_locate
+ * @return 実際に再描画が必要だった場合TRUEを返す
+ */
+static bool change_panel_xy(player_type *creature_ptr, POSITION y, POSITION x)
+{
+    POSITION dy = 0, dx = 0;
+    TERM_LEN wid, hgt;
+    get_screen_size(&wid, &hgt);
+    if (y < panel_row_min)
+        dy = -1;
+
+    if (y > panel_row_max)
+        dy = 1;
+
+    if (x < panel_col_min)
+        dx = -1;
+
+    if (x > panel_col_max)
+        dx = 1;
+
+    if (!dy && !dx)
+        return FALSE;
+
+    return change_panel(creature_ptr, dy, dx);
+}
+
+/*
+ * Help "select" a location (see below)
+ */
+static POSITION_IDX target_pick(POSITION y1, POSITION x1, POSITION dy, POSITION dx)
+{
+    POSITION_IDX b_i = -1, b_v = 9999;
+    for (POSITION_IDX i = 0; i < tmp_pos.n; i++) {
+        POSITION x2 = tmp_pos.x[i];
+        POSITION y2 = tmp_pos.y[i];
+        POSITION x3 = (x2 - x1);
+        POSITION y3 = (y2 - y1);
+        if (dx && (x3 * dx <= 0))
+            continue;
+
+        if (dy && (y3 * dy <= 0))
+            continue;
+
+        POSITION x4 = ABS(x3);
+        POSITION y4 = ABS(y3);
+        if (dy && !dx && (x4 > y4))
+            continue;
+
+        if (dx && !dy && (y4 > x4))
+            continue;
+
+        POSITION_IDX v = ((x4 > y4) ? (x4 + x4 + y4) : (y4 + y4 + x4));
+        if ((b_i >= 0) && (v >= b_v))
+            continue;
+
+        b_i = i;
+        b_v = v;
+    }
+
+    return b_i;
+}
+
+/*
+ * Handle "target" and "look".
+ */
+bool target_set(player_type *creature_ptr, target_type mode)
+{
+    POSITION y = creature_ptr->y;
+    POSITION x = creature_ptr->x;
+    bool done = FALSE;
+    bool flag = TRUE;
+    char query;
+    char info[80];
+    grid_type *g_ptr;
+    TERM_LEN wid, hgt;
+    get_screen_size(&wid, &hgt);
+    target_who = 0;
+    const char same_key = rogue_like_commands ? 'x' : 'l';
+    target_set_prepare(creature_ptr, mode);
+    int m = 0;
+    floor_type *floor_ptr = creature_ptr->current_floor_ptr;
+    while (!done) {
+        if (flag && tmp_pos.n) {
+            y = tmp_pos.y[m];
+            x = tmp_pos.x[m];
+            change_panel_xy(creature_ptr, y, x);
+            if (!(mode & TARGET_LOOK))
+                print_path(creature_ptr, y, x);
+
+            g_ptr = &floor_ptr->grid_array[y][x];
+            if (target_able(creature_ptr, g_ptr->m_idx))
+                strcpy(info, _("q止 t決 p自 o現 +次 -前", "q,t,p,o,+,-,<dir>"));
+            else
+                strcpy(info, _("q止 p自 o現 +次 -前", "q,p,o,+,-,<dir>"));
+
+            if (cheat_sight) {
+                char cheatinfo[30];
+                sprintf(cheatinfo, " LOS:%d, PROJECTABLE:%d", los(creature_ptr, creature_ptr->y, creature_ptr->x, y, x),
+                    projectable(creature_ptr, creature_ptr->y, creature_ptr->x, y, x));
+                strcat(info, cheatinfo);
+            }
+
+            while (TRUE) {
+                query = examine_grid(creature_ptr, y, x, mode, info);
+                if (query)
+                    break;
+            }
+
+            int d = 0;
+            if (use_menu) {
+                if (query == '\r')
+                    query = 't';
+            }
+
+            switch (query) {
+            case ESCAPE:
+            case 'q': {
+                done = TRUE;
+                break;
+            }
+            case 't':
+            case '.':
+            case '5':
+            case '0': {
+                if (!target_able(creature_ptr, g_ptr->m_idx)) {
+                    bell();
+                    break;
+                }
+
+                health_track(creature_ptr, g_ptr->m_idx);
+                target_who = g_ptr->m_idx;
+                target_row = y;
+                target_col = x;
+                done = TRUE;
+                break;
+            }
+            case ' ':
+            case '*':
+            case '+': {
+                if (++m == tmp_pos.n) {
+                    m = 0;
+                    if (!expand_list)
+                        done = TRUE;
+                }
+
+                break;
+            }
+            case '-': {
+                if (m-- == 0) {
+                    m = tmp_pos.n - 1;
+                    if (!expand_list)
+                        done = TRUE;
+                }
+
+                break;
+            }
+            case 'p': {
+                verify_panel(creature_ptr);
+                creature_ptr->update |= PU_MONSTERS;
+                creature_ptr->redraw |= PR_MAP;
+                creature_ptr->window |= PW_OVERHEAD;
+                handle_stuff(creature_ptr);
+                target_set_prepare(creature_ptr, mode);
+                y = creature_ptr->y;
+                x = creature_ptr->x;
+            }
+                /* Fall through */
+            case 'o':
+                flag = FALSE;
+                break;
+            case 'm':
+                break;
+            default: {
+                if (query == same_key) {
+                    if (++m == tmp_pos.n) {
+                        m = 0;
+                        if (!expand_list)
+                            done = TRUE;
+                    }
+                } else {
+                    d = get_keymap_dir(query);
+                    if (!d)
+                        bell();
+
+                    break;
+                }
+            }
+            }
+
+            if (d) {
+                POSITION y2 = panel_row_min;
+                POSITION x2 = panel_col_min;
+                int i = target_pick(tmp_pos.y[m], tmp_pos.x[m], ddy[d], ddx[d]);
+                while (flag && (i < 0)) {
+                    if (change_panel(creature_ptr, ddy[d], ddx[d])) {
+                        int v = tmp_pos.y[m];
+                        int u = tmp_pos.x[m];
+                        target_set_prepare(creature_ptr, mode);
+                        flag = TRUE;
+                        i = target_pick(v, u, ddy[d], ddx[d]);
+                        if (i >= 0)
+                            m = i;
+
+                        continue;
+                    }
+
+                    POSITION dx = ddx[d];
+                    POSITION dy = ddy[d];
+                    panel_row_min = y2;
+                    panel_col_min = x2;
+                    panel_bounds_center();
+                    creature_ptr->update |= (PU_MONSTERS);
+                    creature_ptr->redraw |= (PR_MAP);
+                    creature_ptr->window |= (PW_OVERHEAD);
+                    handle_stuff(creature_ptr);
+                    target_set_prepare(creature_ptr, mode);
+                    flag = FALSE;
+                    x += dx;
+                    y += dy;
+                    if (((x < panel_col_min + wid / 2) && (dx > 0)) || ((x > panel_col_min + wid / 2) && (dx < 0)))
+                        dx = 0;
+
+                    if (((y < panel_row_min + hgt / 2) && (dy > 0)) || ((y > panel_row_min + hgt / 2) && (dy < 0)))
+                        dy = 0;
+
+                    if ((y >= panel_row_min + hgt) || (y < panel_row_min) || (x >= panel_col_min + wid) || (x < panel_col_min)) {
+                        if (change_panel(creature_ptr, dy, dx))
+                            target_set_prepare(creature_ptr, mode);
+                    }
+
+                    if (x >= floor_ptr->width - 1)
+                        x = floor_ptr->width - 2;
+                    else if (x <= 0)
+                        x = 1;
+
+                    if (y >= floor_ptr->height - 1)
+                        y = floor_ptr->height - 2;
+                    else if (y <= 0)
+                        y = 1;
+                }
+
+                m = i;
+            }
+
+            continue;
+        }
+
+        bool move_fast = FALSE;
+        if (!(mode & TARGET_LOOK))
+            print_path(creature_ptr, y, x);
+
+        g_ptr = &floor_ptr->grid_array[y][x];
+        strcpy(info, _("q止 t決 p自 m近 +次 -前", "q,t,p,m,+,-,<dir>"));
+        if (cheat_sight) {
+            char cheatinfo[100];
+            sprintf(cheatinfo, " LOS:%d, PROJECTABLE:%d, SPECIAL:%d", los(creature_ptr, creature_ptr->y, creature_ptr->x, y, x),
+                projectable(creature_ptr, creature_ptr->y, creature_ptr->x, y, x), g_ptr->special);
+            strcat(info, cheatinfo);
+        }
+
+        /* Describe and Prompt (enable "TARGET_LOOK") */
+        while ((query = examine_grid(creature_ptr, y, x, mode | TARGET_LOOK, info)) == 0)
+            ;
+
+        int d = 0;
+        if (use_menu && (query == '\r'))
+            query = 't';
+
+        switch (query) {
+        case ESCAPE:
+        case 'q':
+            done = TRUE;
+            break;
+        case 't':
+        case '.':
+        case '5':
+        case '0':
+            target_who = -1;
+            target_row = y;
+            target_col = x;
+            done = TRUE;
+            break;
+        case 'p':
+            verify_panel(creature_ptr);
+            creature_ptr->update |= (PU_MONSTERS);
+            creature_ptr->redraw |= (PR_MAP);
+            creature_ptr->window |= (PW_OVERHEAD);
+            handle_stuff(creature_ptr);
+            target_set_prepare(creature_ptr, mode);
+            y = creature_ptr->y;
+            x = creature_ptr->x;
+        case 'o':
+            break;
+        case ' ':
+        case '*':
+        case '+':
+        case '-':
+        case 'm': {
+            flag = TRUE;
+            m = 0;
+            int bd = 999;
+            for (int i = 0; i < tmp_pos.n; i++) {
+                int t = distance(y, x, tmp_pos.y[i], tmp_pos.x[i]);
+                if (t < bd) {
+                    m = i;
+                    bd = t;
+                }
+            }
+
+            if (bd == 999)
+                flag = FALSE;
+
+            break;
+        }
+        default: {
+            d = get_keymap_dir(query);
+            if (isupper(query))
+                move_fast = TRUE;
+
+            if (!d)
+                bell();
+            break;
+        }
+        }
+
+        if (d) {
+            POSITION dx = ddx[d];
+            POSITION dy = ddy[d];
+            if (move_fast) {
+                int mag = MIN(wid / 2, hgt / 2);
+                x += dx * mag;
+                y += dy * mag;
+            } else {
+                x += dx;
+                y += dy;
+            }
+
+            if (((x < panel_col_min + wid / 2) && (dx > 0)) || ((x > panel_col_min + wid / 2) && (dx < 0)))
+                dx = 0;
+
+            if (((y < panel_row_min + hgt / 2) && (dy > 0)) || ((y > panel_row_min + hgt / 2) && (dy < 0)))
+                dy = 0;
+
+            if ((y >= panel_row_min + hgt) || (y < panel_row_min) || (x >= panel_col_min + wid) || (x < panel_col_min)) {
+                if (change_panel(creature_ptr, dy, dx))
+                    target_set_prepare(creature_ptr, mode);
+            }
+
+            if (x >= floor_ptr->width - 1)
+                x = floor_ptr->width - 2;
+            else if (x <= 0)
+                x = 1;
+
+            if (y >= floor_ptr->height - 1)
+                y = floor_ptr->height - 2;
+            else if (y <= 0)
+                y = 1;
+        }
+    }
+
+    tmp_pos.n = 0;
+    prt("", 0, 0);
+    verify_panel(creature_ptr);
+    creature_ptr->update |= (PU_MONSTERS);
+    creature_ptr->redraw |= (PR_MAP);
+    creature_ptr->window |= (PW_OVERHEAD);
+    handle_stuff(creature_ptr);
+    return target_who != 0;
+}
diff --git a/src/target/target-setter.h b/src/target/target-setter.h
new file mode 100644 (file)
index 0000000..87bffdc
--- /dev/null
@@ -0,0 +1,6 @@
+#pragma once
+
+#include "system/angband.h"
+
+typedef enum target_type target_type;
+bool target_set(player_type *creature_ptr, target_type mode);
index 99f7fb7..42c275a 100644 (file)
@@ -65,7 +65,8 @@
 #include "system/system-variables.h"
 #include "target/target-describer.h"
 #include "target/target-preparation.h"
-#include "target/target-types.h"
+#include "target/target-setter.h"
+#include "target/target-types.h" // todo 相互依存.
 #include "term/screen-processor.h"
 #include "term/term-color-types.h"
 #include "util/bit-flags-calculator.h"
@@ -186,384 +187,6 @@ bool target_okay(player_type *creature_ptr)
     return TRUE;
 }
 
-/*!
- * @brief フォーカスを当てるべきマップ描画の基準座標を指定する
- * @param creature_ptr プレーヤーへの参照ポインタ
- * @param y 変更先のフロアY座標
- * @param x 変更先のフロアX座標
- * @details
- * Handle a request to change the current panel
- * Return TRUE if the panel was changed.
- * Also used in do_cmd_locate
- * @return 実際に再描画が必要だった場合TRUEを返す
- */
-static bool change_panel_xy(player_type *creature_ptr, POSITION y, POSITION x)
-{
-    POSITION dy = 0, dx = 0;
-    TERM_LEN wid, hgt;
-    get_screen_size(&wid, &hgt);
-    if (y < panel_row_min)
-        dy = -1;
-
-    if (y > panel_row_max)
-        dy = 1;
-
-    if (x < panel_col_min)
-        dx = -1;
-
-    if (x > panel_col_max)
-        dx = 1;
-
-    if (!dy && !dx)
-        return FALSE;
-
-    return change_panel(creature_ptr, dy, dx);
-}
-
-/*
- * Help "select" a location (see below)
- */
-static POSITION_IDX target_pick(POSITION y1, POSITION x1, POSITION dy, POSITION dx)
-{
-    POSITION_IDX b_i = -1, b_v = 9999;
-    for (POSITION_IDX i = 0; i < tmp_pos.n; i++) {
-        POSITION x2 = tmp_pos.x[i];
-        POSITION y2 = tmp_pos.y[i];
-        POSITION x3 = (x2 - x1);
-        POSITION y3 = (y2 - y1);
-        if (dx && (x3 * dx <= 0))
-            continue;
-
-        if (dy && (y3 * dy <= 0))
-            continue;
-
-        POSITION x4 = ABS(x3);
-        POSITION y4 = ABS(y3);
-        if (dy && !dx && (x4 > y4))
-            continue;
-
-        if (dx && !dy && (y4 > x4))
-            continue;
-
-        POSITION_IDX v = ((x4 > y4) ? (x4 + x4 + y4) : (y4 + y4 + x4));
-        if ((b_i >= 0) && (v >= b_v))
-            continue;
-
-        b_i = i;
-        b_v = v;
-    }
-
-    return b_i;
-}
-
-/*
- * Handle "target" and "look".
- */
-bool target_set(player_type *creature_ptr, target_type mode)
-{
-    POSITION y = creature_ptr->y;
-    POSITION x = creature_ptr->x;
-    bool done = FALSE;
-    bool flag = TRUE;
-    char query;
-    char info[80];
-    grid_type *g_ptr;
-    TERM_LEN wid, hgt;
-    get_screen_size(&wid, &hgt);
-    target_who = 0;
-    const char same_key = rogue_like_commands ? 'x' : 'l';
-    target_set_prepare(creature_ptr, mode);
-    int m = 0;
-    floor_type *floor_ptr = creature_ptr->current_floor_ptr;
-    while (!done) {
-        if (flag && tmp_pos.n) {
-            y = tmp_pos.y[m];
-            x = tmp_pos.x[m];
-            change_panel_xy(creature_ptr, y, x);
-            if (!(mode & TARGET_LOOK))
-                print_path(creature_ptr, y, x);
-
-            g_ptr = &floor_ptr->grid_array[y][x];
-            if (target_able(creature_ptr, g_ptr->m_idx))
-                strcpy(info, _("q止 t決 p自 o現 +次 -前", "q,t,p,o,+,-,<dir>"));
-            else
-                strcpy(info, _("q止 p自 o現 +次 -前", "q,p,o,+,-,<dir>"));
-
-            if (cheat_sight) {
-                char cheatinfo[30];
-                sprintf(cheatinfo, " LOS:%d, PROJECTABLE:%d", los(creature_ptr, creature_ptr->y, creature_ptr->x, y, x),
-                    projectable(creature_ptr, creature_ptr->y, creature_ptr->x, y, x));
-                strcat(info, cheatinfo);
-            }
-
-            while (TRUE) {
-                query = examine_grid(creature_ptr, y, x, mode, info);
-                if (query)
-                    break;
-            }
-
-            int d = 0;
-            if (use_menu) {
-                if (query == '\r')
-                    query = 't';
-            }
-
-            switch (query) {
-            case ESCAPE:
-            case 'q': {
-                done = TRUE;
-                break;
-            }
-            case 't':
-            case '.':
-            case '5':
-            case '0': {
-                if (!target_able(creature_ptr, g_ptr->m_idx)) {
-                    bell();
-                    break;
-                }
-
-                health_track(creature_ptr, g_ptr->m_idx);
-                target_who = g_ptr->m_idx;
-                target_row = y;
-                target_col = x;
-                done = TRUE;
-                break;
-            }
-            case ' ':
-            case '*':
-            case '+': {
-                if (++m == tmp_pos.n) {
-                    m = 0;
-                    if (!expand_list)
-                        done = TRUE;
-                }
-
-                break;
-            }
-            case '-': {
-                if (m-- == 0) {
-                    m = tmp_pos.n - 1;
-                    if (!expand_list)
-                        done = TRUE;
-                }
-
-                break;
-            }
-            case 'p': {
-                verify_panel(creature_ptr);
-                creature_ptr->update |= (PU_MONSTERS);
-                creature_ptr->redraw |= (PR_MAP);
-                creature_ptr->window |= (PW_OVERHEAD);
-                handle_stuff(creature_ptr);
-                target_set_prepare(creature_ptr, mode);
-                y = creature_ptr->y;
-                x = creature_ptr->x;
-            }
-                /* Fall through */
-            case 'o':
-                flag = FALSE;
-                break;
-            case 'm':
-                break;
-            default: {
-                if (query == same_key) {
-                    if (++m == tmp_pos.n) {
-                        m = 0;
-                        if (!expand_list)
-                            done = TRUE;
-                    }
-                } else {
-                    d = get_keymap_dir(query);
-                    if (!d)
-                        bell();
-
-                    break;
-                }
-            }
-            }
-
-            if (d) {
-                POSITION y2 = panel_row_min;
-                POSITION x2 = panel_col_min;
-                int i = target_pick(tmp_pos.y[m], tmp_pos.x[m], ddy[d], ddx[d]);
-                while (flag && (i < 0)) {
-                    if (change_panel(creature_ptr, ddy[d], ddx[d])) {
-                        int v = tmp_pos.y[m];
-                        int u = tmp_pos.x[m];
-                        target_set_prepare(creature_ptr, mode);
-                        flag = TRUE;
-                        i = target_pick(v, u, ddy[d], ddx[d]);
-                        if (i >= 0)
-                            m = i;
-
-                        continue;
-                    }
-
-                    POSITION dx = ddx[d];
-                    POSITION dy = ddy[d];
-                    panel_row_min = y2;
-                    panel_col_min = x2;
-                    panel_bounds_center();
-                    creature_ptr->update |= (PU_MONSTERS);
-                    creature_ptr->redraw |= (PR_MAP);
-                    creature_ptr->window |= (PW_OVERHEAD);
-                    handle_stuff(creature_ptr);
-                    target_set_prepare(creature_ptr, mode);
-                    flag = FALSE;
-                    x += dx;
-                    y += dy;
-                    if (((x < panel_col_min + wid / 2) && (dx > 0)) || ((x > panel_col_min + wid / 2) && (dx < 0)))
-                        dx = 0;
-
-                    if (((y < panel_row_min + hgt / 2) && (dy > 0)) || ((y > panel_row_min + hgt / 2) && (dy < 0)))
-                        dy = 0;
-
-                    if ((y >= panel_row_min + hgt) || (y < panel_row_min) || (x >= panel_col_min + wid) || (x < panel_col_min)) {
-                        if (change_panel(creature_ptr, dy, dx))
-                            target_set_prepare(creature_ptr, mode);
-                    }
-
-                    if (x >= floor_ptr->width - 1)
-                        x = floor_ptr->width - 2;
-                    else if (x <= 0)
-                        x = 1;
-
-                    if (y >= floor_ptr->height - 1)
-                        y = floor_ptr->height - 2;
-                    else if (y <= 0)
-                        y = 1;
-                }
-
-                m = i;
-            }
-
-            continue;
-        }
-
-        bool move_fast = FALSE;
-        if (!(mode & TARGET_LOOK))
-            print_path(creature_ptr, y, x);
-
-        g_ptr = &floor_ptr->grid_array[y][x];
-        strcpy(info, _("q止 t決 p自 m近 +次 -前", "q,t,p,m,+,-,<dir>"));
-        if (cheat_sight) {
-            char cheatinfo[100];
-            sprintf(cheatinfo, " LOS:%d, PROJECTABLE:%d, SPECIAL:%d", los(creature_ptr, creature_ptr->y, creature_ptr->x, y, x),
-                projectable(creature_ptr, creature_ptr->y, creature_ptr->x, y, x), g_ptr->special);
-            strcat(info, cheatinfo);
-        }
-
-        /* Describe and Prompt (enable "TARGET_LOOK") */
-        while ((query = examine_grid(creature_ptr, y, x, mode | TARGET_LOOK, info)) == 0)
-            ;
-
-        int d = 0;
-        if (use_menu && (query == '\r'))
-            query = 't';
-
-        switch (query) {
-        case ESCAPE:
-        case 'q':
-            done = TRUE;
-            break;
-        case 't':
-        case '.':
-        case '5':
-        case '0':
-            target_who = -1;
-            target_row = y;
-            target_col = x;
-            done = TRUE;
-            break;
-        case 'p':
-            verify_panel(creature_ptr);
-            creature_ptr->update |= (PU_MONSTERS);
-            creature_ptr->redraw |= (PR_MAP);
-            creature_ptr->window |= (PW_OVERHEAD);
-            handle_stuff(creature_ptr);
-            target_set_prepare(creature_ptr, mode);
-            y = creature_ptr->y;
-            x = creature_ptr->x;
-        case 'o':
-            break;
-        case ' ':
-        case '*':
-        case '+':
-        case '-':
-        case 'm': {
-            flag = TRUE;
-            m = 0;
-            int bd = 999;
-            for (int i = 0; i < tmp_pos.n; i++) {
-                int t = distance(y, x, tmp_pos.y[i], tmp_pos.x[i]);
-                if (t < bd) {
-                    m = i;
-                    bd = t;
-                }
-            }
-
-            if (bd == 999)
-                flag = FALSE;
-
-            break;
-        }
-        default: {
-            d = get_keymap_dir(query);
-            if (isupper(query))
-                move_fast = TRUE;
-
-            if (!d)
-                bell();
-            break;
-        }
-        }
-
-        if (d) {
-            POSITION dx = ddx[d];
-            POSITION dy = ddy[d];
-            if (move_fast) {
-                int mag = MIN(wid / 2, hgt / 2);
-                x += dx * mag;
-                y += dy * mag;
-            } else {
-                x += dx;
-                y += dy;
-            }
-
-            if (((x < panel_col_min + wid / 2) && (dx > 0)) || ((x > panel_col_min + wid / 2) && (dx < 0)))
-                dx = 0;
-
-            if (((y < panel_row_min + hgt / 2) && (dy > 0)) || ((y > panel_row_min + hgt / 2) && (dy < 0)))
-                dy = 0;
-
-            if ((y >= panel_row_min + hgt) || (y < panel_row_min) || (x >= panel_col_min + wid) || (x < panel_col_min)) {
-                if (change_panel(creature_ptr, dy, dx))
-                    target_set_prepare(creature_ptr, mode);
-            }
-
-            if (x >= floor_ptr->width - 1)
-                x = floor_ptr->width - 2;
-            else if (x <= 0)
-                x = 1;
-
-            if (y >= floor_ptr->height - 1)
-                y = floor_ptr->height - 2;
-            else if (y <= 0)
-                y = 1;
-        }
-    }
-
-    tmp_pos.n = 0;
-    prt("", 0, 0);
-    verify_panel(creature_ptr);
-    creature_ptr->update |= (PU_MONSTERS);
-    creature_ptr->redraw |= (PR_MAP);
-    creature_ptr->window |= (PW_OVERHEAD);
-    handle_stuff(creature_ptr);
-    return target_who != 0;
-}
-
 /*
  * Get an "aiming direction" from the user.
  *
index b022d9f..36ac3e9 100644 (file)
@@ -6,9 +6,6 @@ extern MONSTER_IDX target_who;
 extern POSITION target_col;
 extern POSITION target_row;
 
-typedef enum target_type target_type;
-bool target_set(player_type *creature_ptr, target_type mode);
-
 void verify_panel(player_type *creature_ptr);
 bool target_okay(player_type *creature_ptr);
 bool get_aim_dir(player_type *creature_ptr, DIRECTION *dp);