OSDN Git Service

[Refactor] #38997 do_cmd_travel() に player_type * 引数を追加. / Add player_type * argument...
authordeskull <deskull@users.sourceforge.jp>
Sun, 15 Sep 2019 03:59:23 +0000 (12:59 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Sun, 15 Sep 2019 03:59:23 +0000 (12:59 +0900)
src/core.c
src/player-move.c
src/player-move.h

index cf86d4b..98cbff5 100644 (file)
@@ -4267,7 +4267,7 @@ static void process_command(void)
 #ifdef TRAVEL
                case '`':
                {
-                       if (!p_ptr->wild_mode) do_cmd_travel();
+                       if (!p_ptr->wild_mode) do_cmd_travel(p_ptr);
                        if (p_ptr->special_defense & KATA_MUSOU)
                        {
                                set_action(p_ptr, ACTION_NONE);
index 9658c3a..77fe5ee 100644 (file)
@@ -2212,7 +2212,7 @@ static void travel_flow(POSITION ty, POSITION tx)
  * @brief トラベル処理のメインルーチン
  * @return なし
  */
-void do_cmd_travel(void)
+void do_cmd_travel(player_type *creature_ptr)
 {
        POSITION x, y;
        int i;
@@ -2227,7 +2227,7 @@ void do_cmd_travel(void)
        }
        else if (!tgt_pt(&x, &y)) return;
 
-       if ((x == p_ptr->x) && (y == p_ptr->y))
+       if ((x == creature_ptr->x) && (y == creature_ptr->y))
        {
                msg_print(_("すでにそこにいます!", "You are already there!!"));
                return;
@@ -2255,10 +2255,10 @@ void do_cmd_travel(void)
        travel.dir = 0;
 
        /* Decides first direction */
-       dx = abs(p_ptr->x - x);
-       dy = abs(p_ptr->y - y);
-       sx = ((x == p_ptr->x) || (dx < dy)) ? 0 : ((x > p_ptr->x) ? 1 : -1);
-       sy = ((y == p_ptr->y) || (dy < dx)) ? 0 : ((y > p_ptr->y) ? 1 : -1);
+       dx = abs(creature_ptr->x - x);
+       dy = abs(creature_ptr->y - y);
+       sx = ((x == creature_ptr->x) || (dx < dy)) ? 0 : ((x > creature_ptr->x) ? 1 : -1);
+       sy = ((y == creature_ptr->y) || (dy < dx)) ? 0 : ((y > creature_ptr->y) ? 1 : -1);
 
        for (i = 1; i <= 9; i++)
        {
index b938d4a..bff829f 100644 (file)
@@ -26,7 +26,7 @@ extern bool trap_can_be_ignored(player_type *creature_ptr, FEAT_IDX feat);
 extern void search(player_type *creature_ptr);
 extern void carry(bool pickup);
 #ifdef TRAVEL
-extern void do_cmd_travel(void);
+extern void do_cmd_travel(player_type *creature_ptr);
 extern void travel_step(void);
 #endif