OSDN Git Service

[Refactor] #3681 terrains_info[] へアクセスしている周辺のコードを参照を使う形にまとめた その7
authorHourier <66951241+Hourier@users.noreply.github.com>
Wed, 1 Nov 2023 12:03:30 +0000 (21:03 +0900)
committerHourier <66951241+Hourier@users.noreply.github.com>
Thu, 2 Nov 2023 13:33:58 +0000 (22:33 +0900)
src/monster-floor/monster-sweep-grid.cpp
src/pet/pet-util.cpp
src/pet/pet-util.h

index 0b9f5bb..cbfd43f 100644 (file)
@@ -274,7 +274,7 @@ void MonsterSweepGrid::sweep_movable_grid(POSITION *yp, POSITION *xp, bool no_fl
     if (grid.get_cost(&monrace)) {
         this->best = 999;
     } else if (grid.when) {
-        const Pos2D p_pos(this->player_ptr->y, this->player_ptr->x);
+        const auto p_pos = this->player_ptr->get_position();
         if (floor.get_grid(p_pos).when - grid.when > 127) {
             return;
         }
index 0e215cf..7cfab81 100644 (file)
@@ -24,7 +24,7 @@ int total_friends = 0;
  * @param now_riding trueなら下馬処理、falseならば騎乗処理
  * @return 可能ならばtrueを返す
  */
-bool can_player_ride_pet(PlayerType *player_ptr, Grid *g_ptr, bool now_riding)
+bool can_player_ride_pet(PlayerType *player_ptr, const Grid *g_ptr, bool now_riding)
 {
     bool old_character_xtra = w_ptr->character_xtra;
     MONSTER_IDX old_riding = player_ptr->riding;
index c9a2d8d..3027330 100644 (file)
@@ -44,5 +44,5 @@ extern int total_friends;
 
 class Grid;
 class PlayerType;
-bool can_player_ride_pet(PlayerType *player_ptr, Grid *g_ptr, bool now_riding);
+bool can_player_ride_pet(PlayerType *player_ptr, const Grid *g_ptr, bool now_riding);
 PERCENTAGE calculate_upkeep(PlayerType *player_ptr);