OSDN Git Service

[Refactor] #38997 change_wild_mode() に player_type * 引数を追加. / Add player_type * argum...
authordeskull <deskull@users.sourceforge.jp>
Sun, 3 Nov 2019 12:36:14 +0000 (21:36 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Sun, 3 Nov 2019 12:36:14 +0000 (21:36 +0900)
src/cmd/cmd-basic.c
src/core.c
src/player-damage.c
src/player-effects.c
src/wild.c
src/wild.h

index 89748dc..dce08b3 100644 (file)
@@ -2083,7 +2083,7 @@ void do_cmd_walk(player_type *creature_ptr, bool pickup)
                        /* Go into large wilderness view */
                        creature_ptr->oldpy = randint1(MAX_HGT-2);
                        creature_ptr->oldpx = randint1(MAX_WID-2);
-                       change_wild_mode(TRUE);
+                       change_wild_mode(creature_ptr, TRUE);
 
                        /* Give first move to monsters */
                        take_turn(creature_ptr, 100);
index 605368f..536c168 100644 (file)
@@ -3344,7 +3344,7 @@ static void process_world(void)
                                /* Go into large wilderness view */
                                p_ptr->oldpy = randint1(MAX_HGT - 2);
                                p_ptr->oldpx = randint1(MAX_WID - 2);
-                               change_wild_mode(TRUE);
+                               change_wild_mode(p_ptr, TRUE);
 
                                /* Give first move to monsters */
                                take_turn(p_ptr, 100);
@@ -3760,7 +3760,7 @@ static void process_command(player_type *creature_ptr)
                                        break;
                                }
 
-                               change_wild_mode(FALSE);
+                               change_wild_mode(creature_ptr, FALSE);
                        }
                        else
                                do_cmd_go_up(creature_ptr);
@@ -3771,7 +3771,7 @@ static void process_command(player_type *creature_ptr)
                case '>':
                {
                        if (creature_ptr->wild_mode)
-                               change_wild_mode(FALSE);
+                               change_wild_mode(creature_ptr, FALSE);
                        else
                                do_cmd_go_down(creature_ptr);
                        break;
index daafb1e..e63bfff 100644 (file)
@@ -715,7 +715,7 @@ int take_hit(player_type *creature_ptr, int damage_type, HIT_POINT damage, concp
        }
        if (creature_ptr->wild_mode && !creature_ptr->leaving && (creature_ptr->chp < MAX(warning, creature_ptr->mhp / 5)))
        {
-               change_wild_mode(FALSE);
+               change_wild_mode(creature_ptr, FALSE);
        }
        return damage;
 }
index 74021d8..9984f4f 100644 (file)
@@ -3094,7 +3094,7 @@ bool set_food(player_type *creature_ptr, TIME_EFFECT v)
 
                if (creature_ptr->wild_mode && (new_aux < 2))
                {
-                       change_wild_mode(FALSE);
+                       change_wild_mode(creature_ptr, FALSE);
                }
 
                /* Change */
index d794965..50070db 100644 (file)
@@ -1111,14 +1111,14 @@ void init_wilderness_terrains(void)
  * @param encount 襲撃時TRUE
  * @return 切り替えが行われた場合はTRUEを返す。
  */
-bool change_wild_mode(bool encount)
+bool change_wild_mode(player_type *creature_ptr, bool encount)
 {
        int i;
        bool have_pet = FALSE;
        generate_encounter = encount;
 
        /* It is in the middle of changing map */
-       if (p_ptr->leaving) return FALSE;
+       if (creature_ptr->leaving) return FALSE;
 
 
        if (lite_town || vanilla_town)
@@ -1127,35 +1127,35 @@ bool change_wild_mode(bool encount)
                return FALSE;
        }
 
-       if (p_ptr->wild_mode)
+       if (creature_ptr->wild_mode)
        {
                /* Save the location in the global map */
-               p_ptr->wilderness_x = p_ptr->x;
-               p_ptr->wilderness_y = p_ptr->y;
+               creature_ptr->wilderness_x = creature_ptr->x;
+               creature_ptr->wilderness_y = creature_ptr->y;
 
                /* Give first move to the player */
-               p_ptr->energy_need = 0;
+               creature_ptr->energy_need = 0;
 
                /* Go back to the ordinary map */
-               p_ptr->wild_mode = FALSE;
-               p_ptr->leaving = TRUE;
+               creature_ptr->wild_mode = FALSE;
+               creature_ptr->leaving = TRUE;
 
                /* Succeed */
                return TRUE;
        }
 
-       for (i = 1; i < p_ptr->current_floor_ptr->m_max; i++)
+       for (i = 1; i < creature_ptr->current_floor_ptr->m_max; i++)
        {
-               monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[i];
+               monster_type *m_ptr = &creature_ptr->current_floor_ptr->m_list[i];
 
                if (!monster_is_valid(m_ptr)) continue;
-               if (is_pet(m_ptr) && i != p_ptr->riding) have_pet = TRUE;
+               if (is_pet(m_ptr) && i != creature_ptr->riding) have_pet = TRUE;
                if (MON_CSLEEP(m_ptr)) continue;
                if (m_ptr->cdis > MAX_SIGHT) continue;
                if (!is_hostile(m_ptr)) continue;
                msg_print(_("敵がすぐ近くにいるときは広域マップに入れない!",
                        "You cannot enter global map, since there is some monsters nearby!"));
-               free_turn(p_ptr);
+               free_turn(creature_ptr);
                return FALSE;
        }
 
@@ -1166,26 +1166,26 @@ bool change_wild_mode(bool encount)
 
                if (!get_check_strict(msg, CHECK_OKAY_CANCEL))
                {
-                       free_turn(p_ptr);
+                       free_turn(creature_ptr);
                        return FALSE;
                }
        }
 
-       take_turn(p_ptr, 1000);
+       take_turn(creature_ptr, 1000);
 
        /* Remember the position */
-       p_ptr->oldpx = p_ptr->x;
-       p_ptr->oldpy = p_ptr->y;
+       creature_ptr->oldpx = creature_ptr->x;
+       creature_ptr->oldpy = creature_ptr->y;
 
        /* Cancel hex spelling */
-       if (hex_spelling_any(p_ptr)) stop_hex_spell_all();
+       if (hex_spelling_any(creature_ptr)) stop_hex_spell_all();
 
        /* Cancel any special action */
-       set_action(p_ptr, ACTION_NONE);
+       set_action(creature_ptr, ACTION_NONE);
 
        /* Go into the global map */
-       p_ptr->wild_mode = TRUE;
-       p_ptr->leaving = TRUE;
+       creature_ptr->wild_mode = TRUE;
+       creature_ptr->leaving = TRUE;
 
        /* Succeed */
        return TRUE;
index 4aaafe0..87325a1 100644 (file)
@@ -32,7 +32,7 @@ extern errr init_wilderness(void);
 extern void init_wilderness_terrains(void);
 extern void seed_wilderness(void);
 extern errr parse_line_wilderness(char *buf, int ymin, int xmin, int ymax, int xmax, int *y, int *x);
-extern bool change_wild_mode(bool encount);
+extern bool change_wild_mode(player_type *creature_ptr, bool encount);
 
 /* Border */
 typedef struct border_type border_type;