OSDN Git Service

[Refactor] #38997 map_name() にplayer_type * 引数を追加 / Added player_type * argument...
authorHourier <hourier@users.sourceforge.jp>
Sun, 12 Jan 2020 13:40:16 +0000 (22:40 +0900)
committerHourier <hourier@users.sourceforge.jp>
Sun, 12 Jan 2020 16:06:59 +0000 (01:06 +0900)
src/core.c
src/files.c
src/view-mainwindow.c
src/view-mainwindow.h

index 95547cc..9eb2e30 100644 (file)
@@ -5536,19 +5536,16 @@ void play_game(player_type *player_ptr, bool new_game)
        /* Character is now "complete" */
        current_world_ptr->character_generated = TRUE;
 
-
        /* Hack -- Character is no longer "icky" */
        current_world_ptr->character_icky = FALSE;
 
-
        if (new_game)
        {
                char buf[80];
-               sprintf(buf, _("%sに降り立った。", "You are standing in the %s."), map_name());
+               sprintf(buf, _("%sに降り立った。", "You are standing in the %s."), map_name(player_ptr));
                exe_write_diary(player_ptr, NIKKI_BUNSHOU, 0, buf);
        }
 
-
        /* Start game */
        player_ptr->playing = TRUE;
 
index d6f6dcf..492799f 100644 (file)
@@ -3875,9 +3875,9 @@ void display_player(player_type *creature_ptr, int mode)
                else if (!floor_ptr->dun_level)
                {
 #ifdef JP
-                       sprintf(statmsg, "…あなたは%sで%sに殺された。", map_name(), creature_ptr->died_from);
+                       sprintf(statmsg, "…あなたは%sで%sに殺された。", map_name(creature_ptr), creature_ptr->died_from);
 #else
-                       sprintf(statmsg, "...You were killed by %s in %s.", creature_ptr->died_from, map_name());
+                       sprintf(statmsg, "...You were killed by %s in %s.", creature_ptr->died_from, map_name(creature_ptr));
 #endif
                }
                else if (floor_ptr->inside_quest && is_fixed_quest_idx(floor_ptr->inside_quest))
@@ -3897,9 +3897,9 @@ void display_player(player_type *creature_ptr, int mode)
                else
                {
 #ifdef JP
-                       sprintf(statmsg, "…あなたは、%sの%d階で%sに殺された。", map_name(), (int)floor_ptr->dun_level, creature_ptr->died_from);
+                       sprintf(statmsg, "…あなたは、%sの%d階で%sに殺された。", map_name(creature_ptr), (int)floor_ptr->dun_level, creature_ptr->died_from);
 #else
-                       sprintf(statmsg, "...You were killed by %s on level %d of %s.", creature_ptr->died_from, floor_ptr->dun_level, map_name());
+                       sprintf(statmsg, "...You were killed by %s on level %d of %s.", creature_ptr->died_from, floor_ptr->dun_level, map_name(creature_ptr));
 #endif
                }
        }
@@ -3907,7 +3907,7 @@ void display_player(player_type *creature_ptr, int mode)
        {
                if (!floor_ptr->dun_level)
                {
-                       sprintf(statmsg, _("…あなたは現在、 %s にいる。", "...Now, you are in %s."), map_name());
+                       sprintf(statmsg, _("…あなたは現在、 %s にいる。", "...Now, you are in %s."), map_name(creature_ptr));
                }
                else if (floor_ptr->inside_quest && is_fixed_quest_idx(floor_ptr->inside_quest))
                {
@@ -3929,9 +3929,9 @@ void display_player(player_type *creature_ptr, int mode)
                else
                {
 #ifdef JP
-                       sprintf(statmsg, "…あなたは現在、 %s の %d 階で探索している。", map_name(), (int)floor_ptr->dun_level);
+                       sprintf(statmsg, "…あなたは現在、 %s の %d 階で探索している。", map_name(creature_ptr), (int)floor_ptr->dun_level);
 #else
-                       sprintf(statmsg, "...Now, you are exploring level %d of %s.", floor_ptr->dun_level, map_name());
+                       sprintf(statmsg, "...Now, you are exploring level %d of %s.", floor_ptr->dun_level, map_name(creature_ptr));
 #endif
                }
        }
@@ -4248,7 +4248,6 @@ static void dump_aux_class_special(player_type *creature_ptr, FILE *fff)
        // Blue mage
        int l1 = 0;
        int l2 = 0;
-       int num = 0;
        int spellnum[MAX_MONSPELLS];
        BIT_FLAGS f4 = 0, f5 = 0, f6 = 0;
        char p[60][80];
@@ -4289,7 +4288,8 @@ static void dump_aux_class_special(player_type *creature_ptr, FILE *fff)
                        break;
                }
 
-               for (int i = 0, num = 0; i < 32; i++)
+               int num = 0;
+               for (int i = 0; i < 32; i++)
                {
                        if ((0x00000001 << i) & f4) spellnum[num++] = i;
                }
index 497bb0f..bf697d0 100644 (file)
@@ -185,30 +185,33 @@ void prt_time(void)
 
 /*!
  * @brief 現在のマップ名を返す /
+ * @param creature_ptr プレーヤーへの参照ポインタ
  * @return マップ名の文字列参照ポインタ
  */
-concptr map_name(void)
+concptr map_name(player_type *creature_ptr)
 {
-       if (p_ptr->current_floor_ptr->inside_quest && is_fixed_quest_idx(p_ptr->current_floor_ptr->inside_quest)
-           && (quest[p_ptr->current_floor_ptr->inside_quest].flags & QUEST_FLAG_PRESET))
+       floor_type *floor_ptr = creature_ptr->current_floor_ptr;
+       if (floor_ptr->inside_quest && is_fixed_quest_idx(floor_ptr->inside_quest)
+           && (quest[floor_ptr->inside_quest].flags & QUEST_FLAG_PRESET))
                return _("クエスト", "Quest");
-       else if (p_ptr->wild_mode)
+       else if (creature_ptr->wild_mode)
                return _("地上", "Surface");
-       else if (p_ptr->current_floor_ptr->inside_arena)
+       else if (creature_ptr->current_floor_ptr->inside_arena)
                return _("アリーナ", "Arena");
-       else if (p_ptr->phase_out)
+       else if (creature_ptr->phase_out)
                return _("闘技場", "Monster Arena");
-       else if (!p_ptr->current_floor_ptr->dun_level && p_ptr->town_num)
-               return town_info[p_ptr->town_num].name;
+       else if (!floor_ptr->dun_level && creature_ptr->town_num)
+               return town_info[creature_ptr->town_num].name;
        else
-               return d_name+d_info[p_ptr->dungeon_idx].name;
+               return d_name+d_info[creature_ptr->dungeon_idx].name;
 }
 
 /*!
  * @brief 現在のマップ名を描画する / Print dungeon
+ * @param creature_ptr プレーヤーへの参照ポインタ
  * @return なし
  */
-static void prt_dungeon(void)
+static void print_dungeon(player_type *creature_ptr)
 {
        concptr dungeon_name;
        TERM_LEN col;
@@ -216,7 +219,7 @@ static void prt_dungeon(void)
        /* Dump 13 spaces to clear */
        c_put_str(TERM_WHITE, "             ", ROW_DUNGEON, COL_DUNGEON);
 
-       dungeon_name = map_name();
+       dungeon_name = map_name(creature_ptr);
 
        col = COL_DUNGEON + 6 - strlen(dungeon_name)/2;
        if (col < 0) col = 0;
@@ -2107,7 +2110,7 @@ void redraw_stuff(player_type *creature_ptr)
                creature_ptr->redraw &= ~(PR_DEPTH | PR_HEALTH | PR_UHEALTH);
                prt_frame_basic();
                prt_time();
-               prt_dungeon();
+               print_dungeon(creature_ptr);
        }
 
        if (creature_ptr->redraw & (PR_EQUIPPY))
index fbc146b..5759091 100644 (file)
@@ -11,7 +11,7 @@ extern void do_cmd_view_map(void);
 
 extern void health_track(MONSTER_IDX m_idx);
 extern void prt_time(void);
-extern concptr map_name(void);
+extern concptr map_name(player_type *creature_ptr);
 extern void print_monster_list(floor_type *floor_ptr, TERM_LEN x, TERM_LEN y, TERM_LEN max_lines);
 extern void move_cursor_relative(int row, int col);
 extern void prt_path(floor_type *floor_ptr, POSITION y, POSITION x);