OSDN Git Service

[Refactor] #38997 player_has_no_spellbooks() に player_type * 引数を追加.
authordeskull <deskull@users.sourceforge.jp>
Wed, 10 Jul 2019 03:25:27 +0000 (12:25 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Wed, 10 Jul 2019 03:25:27 +0000 (12:25 +0900)
src/cmd-spell.c
src/player-status.c
src/player-status.h

index 372e62a..8d66da9 100644 (file)
@@ -656,7 +656,7 @@ void do_cmd_browse(void)
 
        if (p_ptr->pclass == CLASS_FORCETRAINER)
        {
-               if (player_has_no_spellbooks())
+               if (player_has_no_spellbooks(p_ptr))
                {
                        confirm_use_force(TRUE);
                        return;
@@ -1095,7 +1095,7 @@ void do_cmd_cast(void)
 
        if (p_ptr->pclass == CLASS_FORCETRAINER)
        {
-               if (player_has_no_spellbooks())
+               if (player_has_no_spellbooks(p_ptr))
                {
                        confirm_use_force(FALSE);
                        return;
index 2127383..fd9fb9b 100644 (file)
@@ -5109,18 +5109,18 @@ void update_creature(player_type *creature_ptr)
  * @brief プレイヤーが魔道書を一冊も持っていないかを判定する
  * @return 魔道書を一冊も持っていないならTRUEを返す
  */
-bool player_has_no_spellbooks(void)
+bool player_has_no_spellbooks(player_type *creature_ptr)
 {
        int i;
        object_type *o_ptr;
 
        for (i = 0; i < INVEN_PACK; i++)
        {
-               o_ptr = &p_ptr->inventory_list[i];
+               o_ptr = &creature_ptr->inventory_list[i];
                if (o_ptr->k_idx && check_book_realm(o_ptr->tval, o_ptr->sval)) return FALSE;
        }
 
-       for (i = current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].o_idx; i; i = o_ptr->next_o_idx)
+       for (i = current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].o_idx; i; i = o_ptr->next_o_idx)
        {
                o_ptr = &current_floor_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;
index 9b0259f..d7b0ee6 100644 (file)
@@ -739,7 +739,7 @@ extern bool is_heavy_shoot(object_type *o_ptr);
 extern bool heavy_armor(player_type *creature_ptr);
 extern void update_creature(player_type *creature_ptr);
 extern BIT_FLAGS16 empty_hands(bool riding_control);
-extern bool player_has_no_spellbooks(void);
+extern bool player_has_no_spellbooks(player_type *creature_ptr);
 
 extern void take_turn(player_type *creature_ptr, PERCENTAGE need_cost);
 extern void free_turn(player_type *creature_ptr);