OSDN Git Service

[Refactor] #37353 floor-town.c/h を作成して関連構造体と変数を移動.
[hengband/hengband.git] / src / xtra2.c
index f11c756..29da228 100644 (file)
 
 
 #include "angband.h"
+#include "util.h"
+
+#include "bldg.h"
 #include "cmd-pet.h"
+#include "dungeon-file.h"
 #include "object-curse.h"
+#include "object-flavor.h"
 #include "monster.h"
 #include "monsterrace-hook.h"
 #include "objectkind-hook.h"
 #include "sort.h"
-#include "projection.h"
 #include "spells-summon.h"
+#include "grid.h"
+#include "floor.h"
 #include "floor-events.h"
+#include "floor-town.h"
 #include "player-move.h"
+#include "player-status.h"
 #include "monster-status.h"
-
-#define REWARD_CHANCE 10
-
-
+#include "view-mainwindow.h"
+#include "feature.h"
+#include "quest.h"
+#include "dungeon.h"
 
 /*!
  * @brief コンソール上におけるマップ表示の左上位置を返す /
@@ -171,7 +179,6 @@ void verify_panel(void)
        /* Hack -- optional disturb on "panel change" */
        if (disturb_panel && !center_player) disturb(FALSE, FALSE);
 
-       /* Recalculate the boundaries */
        panel_bounds_center();
 
        p_ptr->update |= (PU_MONSTERS);
@@ -180,11 +187,8 @@ void verify_panel(void)
 }
 
 
-
-
 /*** Targeting Code ***/
 
-
 /*
  * Determine is a monster makes a reasonable target
  *
@@ -284,7 +288,6 @@ static POSITION_IDX target_pick(POSITION y1, POSITION x1, POSITION dy, POSITION
                if (dx && (x3 * dx <= 0)) continue;
                if (dy && (y3 * dy <= 0)) continue;
 
-               /* Absolute distance */
                x4 = ABS(x3);
                y4 = ABS(y3);
 
@@ -296,11 +299,7 @@ static POSITION_IDX target_pick(POSITION y1, POSITION x1, POSITION dy, POSITION
                v = ((x4 > y4) ? (x4 + x4 + y4) : (y4 + y4 + x4));
 
                /* Penalize location */
-
-               /* Track best */
                if ((b_i >= 0) && (v >= b_v)) continue;
-
-               /* Track best */
                b_i = i; b_v = v;
        }
        return (b_i);
@@ -315,16 +314,13 @@ static bool target_set_accept(POSITION y, POSITION x)
        grid_type *g_ptr;
        OBJECT_IDX this_o_idx, next_o_idx = 0;
 
-       /* Bounds */
        if (!(in_bounds(y, x))) return (FALSE);
 
        /* Player grid is always interesting */
        if (player_bold(y, x)) return (TRUE);
 
-       /* Handle hallucination */
        if (p_ptr->image) return (FALSE);
 
-       /* Examine the grid */
        g_ptr = &current_floor_ptr->grid_array[y][x];
 
        /* Visible monsters */
@@ -418,20 +414,13 @@ static void target_set_prepare(BIT_FLAGS mode)
        /* Set the sort hooks */
        if (mode & (TARGET_KILL))
        {
-               /* Target the nearest monster for shooting */
-               ang_sort_comp = ang_sort_comp_distance;
-               ang_sort_swap = ang_sort_swap_distance;
+               ang_sort(tmp_pos.x, tmp_pos.y, tmp_pos.n, ang_sort_comp_distance, ang_sort_swap_distance);
        }
        else
        {
-               /* Look important grids first in Look command */
-               ang_sort_comp = ang_sort_comp_importance;
-               ang_sort_swap = ang_sort_swap_distance;
+               ang_sort(tmp_pos.x, tmp_pos.y, tmp_pos.n, ang_sort_comp_importance, ang_sort_swap_distance);
        }
 
-       /* Sort the positions */
-       ang_sort(tmp_pos.x, tmp_pos.y, tmp_pos.n);
-
        if (p_ptr->riding && target_pet && (tmp_pos.n > 1) && (mode & (TARGET_KILL)))
        {
                POSITION tmp;
@@ -1946,16 +1935,13 @@ static bool tgt_pt_accept(POSITION y, POSITION x)
 {
        grid_type *g_ptr;
 
-       /* Bounds */
        if (!(in_bounds(y, x))) return (FALSE);
 
        /* Player grid is always interesting */
        if ((y == p_ptr->y) && (x == p_ptr->x)) return (TRUE);
 
-       /* Handle hallucination */
        if (p_ptr->image) return (FALSE);
 
-       /* Examine the grid */
        g_ptr = &current_floor_ptr->grid_array[y][x];
 
        /* Interesting memorized features */
@@ -2002,12 +1988,8 @@ static void tgt_pt_prepare(void)
                }
        }
 
-       /* Target the nearest monster for shooting */
-       ang_sort_comp = ang_sort_comp_distance;
-       ang_sort_swap = ang_sort_swap_distance;
-
        /* Sort the positions */
-       ang_sort(tmp_pos.x, tmp_pos.y, tmp_pos.n);
+       ang_sort(tmp_pos.x, tmp_pos.y, tmp_pos.n, ang_sort_comp_distance, ang_sort_swap_distance);
 }
 
 /*