OSDN Git Service

[Refactor] #38993 floor_type 構造体作成。 / Create floor_type structure.
[hengbandforosx/hengbandosx.git] / src / player-status.c
index 42399d5..0be5720 100644 (file)
@@ -4,6 +4,11 @@
 #include "artifact.h"
 #include "avatar.h"
 #include "spells-status.h"
+#include "object-hook.h"
+
+/* Hack, monk armour */
+static bool monk_armour_aux;
+static bool monk_notify_aux;
 
 /*
  * Return alignment title
@@ -121,7 +126,7 @@ void calc_bonuses(void)
        bool old_mighty_throw = p_ptr->mighty_throw;
 
        /* Current feature under player. */
-       feature_type *f_ptr = &f_info[cave[p_ptr->y][p_ptr->x].feat];
+       feature_type *f_ptr = &f_info[current_floor->grid_array[p_ptr->y][p_ptr->x].feat];
 
        /* Save the old armor class */
        ARMOUR_CLASS old_dis_ac = p_ptr->dis_ac;
@@ -2639,7 +2644,7 @@ void calc_bonuses(void)
                if ((inventory[i].tval == TV_CRAFT_BOOK) && (inventory[i].sval == 2)) have_kabe = TRUE;
        }
 
-       for (this_o_idx = cave[p_ptr->y][p_ptr->x].o_idx; this_o_idx; this_o_idx = next_o_idx)
+       for (this_o_idx = current_floor->grid_array[p_ptr->y][p_ptr->x].o_idx; this_o_idx; this_o_idx = next_o_idx)
        {
                o_ptr = &o_list[this_o_idx];
 
@@ -2812,8 +2817,8 @@ static void calc_torch(void)
        }
 
        /* max radius is 14 (was 5) without rewriting other code -- */
-       /* see cave.c:update_lite() and defines.h:LITE_MAX */
-       if (d_info[dungeon_type].flags1 & DF1_DARKNESS && p_ptr->cur_lite > 1)
+       /* see current_floor->grid_array.c:update_lite() and defines.h:LITE_MAX */
+       if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS && p_ptr->cur_lite > 1)
                p_ptr->cur_lite = 1;
 
        /*
@@ -3674,8 +3679,6 @@ void update_creature(player_type *creature_ptr)
                creature_ptr->update &= ~(PU_AUTODESTROY);
                autopick_delayed_alter();
        }
-
-       /* Combine the pack */
        if (creature_ptr->update & (PU_COMBINE))
        {
                creature_ptr->update &= ~(PU_COMBINE);
@@ -3804,7 +3807,7 @@ bool player_has_no_spellbooks(void)
                if (o_ptr->k_idx && check_book_realm(o_ptr->tval, o_ptr->sval)) return FALSE;
        }
 
-       for (i = cave[p_ptr->y][p_ptr->x].o_idx; i; i = o_ptr->next_o_idx)
+       for (i = current_floor->grid_array[p_ptr->y][p_ptr->x].o_idx; i; i = o_ptr->next_o_idx)
        {
                o_ptr = &o_list[i];
                if (o_ptr->k_idx && (o_ptr->marked & OM_FOUND) && check_book_realm(o_ptr->tval, o_ptr->sval)) return FALSE;
@@ -3815,10 +3818,29 @@ bool player_has_no_spellbooks(void)
 
 void take_turn(player_type *creature_ptr, PERCENTAGE need_cost)
 {
-       p_ptr->energy_use = (ENERGY)need_cost;
+       creature_ptr->energy_use = (ENERGY)need_cost;
 }
 
 void free_turn(player_type *creature_ptr)
 {
-       p_ptr->energy_use = 0;
+       creature_ptr->energy_use = 0;
+}
+
+/*!
+ * @brief プレイヤーを指定座標に配置する / Place the player in the dungeon XXX XXX
+ * @param x 配置先X座標
+ * @param y 配置先Y座標
+ * @return 配置に成功したらTRUE
+ */
+bool player_place(POSITION y, POSITION x)
+{
+       /* Paranoia XXX XXX */
+       if (current_floor->grid_array[y][x].m_idx != 0) return FALSE;
+
+       /* Save player location */
+       p_ptr->y = y;
+       p_ptr->x = x;
+
+       /* Success */
+       return TRUE;
 }