OSDN Git Service

[Refactor] #38997 extract_day_hour_min() にplayer_type * 引数を追加 / Added player_type...
authorHourier <hourier@users.sourceforge.jp>
Mon, 13 Jan 2020 04:35:45 +0000 (13:35 +0900)
committerHourier <hourier@users.sourceforge.jp>
Mon, 13 Jan 2020 04:35:45 +0000 (13:35 +0900)
src/bldg.c
src/cmd/cmd-dump.c
src/core.c
src/files.c
src/view-mainwindow.c
src/view-mainwindow.h
src/world.c
src/world.h

index ae0730f..deb2e9e 100644 (file)
@@ -2128,7 +2128,7 @@ static bool inn_comm(player_type *customer_ptr, int cmd)
                s32b oldturn = current_world_ptr->game_turn;
                int prev_day, prev_hour, prev_min;
 
-               extract_day_hour_min(&prev_day, &prev_hour, &prev_min);
+               extract_day_hour_min(customer_ptr, &prev_day, &prev_hour, &prev_min);
                if ((prev_hour >= 6) && (prev_hour <= 17))
                        exe_write_diary(customer_ptr, NIKKI_BUNSHOU, 0, _("宿屋に泊まった。", "stay over daytime at the inn."));
                else
index 578db2c..16e41f0 100644 (file)
@@ -413,7 +413,7 @@ errr exe_write_diary(player_type *creature_ptr, int type, int num, concptr note)
 
        static bool disable_diary = FALSE;
 
-       extract_day_hour_min(&day, &hour, &min);
+       extract_day_hour_min(creature_ptr, &day, &hour, &min);
 
        if (disable_diary) return(-1);
 
@@ -7008,7 +7008,7 @@ void do_cmd_checkquest(player_type *creature_ptr)
 void do_cmd_time(player_type *creature_ptr)
 {
        int day, hour, min;
-       extract_day_hour_min(&day, &hour, &min);
+       extract_day_hour_min(creature_ptr, &day, &hour, &min);
 
        char desc[1024];
        strcpy(desc, _("変な時刻だ。", "It is a strange time."));
index 53aed17..fb31c8f 100644 (file)
@@ -3101,7 +3101,7 @@ static void process_world(player_type *player_ptr)
        s32b prev_turn_in_today = ((current_world_ptr->game_turn - TURNS_PER_TICK) % A_DAY + A_DAY / 4) % A_DAY;
        int prev_min = (1440 * prev_turn_in_today / A_DAY) % 60;
        
-       extract_day_hour_min(&day, &hour, &min);
+       extract_day_hour_min(player_ptr, &day, &hour, &min);
 
        /* Update dungeon feeling, and announce it if changed */
        update_dungeon_feeling(player_ptr);
@@ -4431,7 +4431,7 @@ static void process_player(player_type *creature_ptr)
                        update_monster(creature_ptr, m_idx, FALSE);
                }
 
-               print_time();
+               print_time(creature_ptr);
        }
 
        /* Give the player some energy */
@@ -4442,7 +4442,7 @@ static void process_player(player_type *creature_ptr)
 
        /* No turn yet */
        if (creature_ptr->energy_need > 0) return;
-       if (!command_rep) print_time();
+       if (!command_rep) print_time(creature_ptr);
 
        /*** Check for interupts ***/
 
index c0a08e8..d129c18 100644 (file)
@@ -1879,7 +1879,7 @@ static void display_player_middle(player_type *creature_ptr)
 
        /* Dump Day */
        int day, hour, min;
-       extract_day_hour_min(&day, &hour, &min);
+       extract_day_hour_min(creature_ptr, &day, &hour, &min);
 
        if (day < MAX_DAYS) sprintf(buf, _("%d日目 %2d:%02d", "Day %d %2d:%02d"), day, hour, min);
        else sprintf(buf, _("*****日目 %2d:%02d", "Day ***** %2d:%02d"), hour, min);
index 3eb88b9..6fc8cb1 100644 (file)
@@ -171,14 +171,14 @@ static void print_field(concptr info, TERM_LEN row, TERM_LEN col)
  * Print time
  * @return なし
  */
-void print_time(void)
+void print_time(player_type *player_ptr)
 {
        int day, hour, min;
 
        /* Dump 13 spaces to clear */
        c_put_str(TERM_WHITE, "             ", ROW_DAY, COL_DAY);
 
-       extract_day_hour_min(&day, &hour, &min);
+       extract_day_hour_min(player_ptr, &day, &hour, &min);
 
        /* Dump the info itself */
        if (day < 1000) c_put_str(TERM_WHITE, format(_("%2d日目", "Day%3d"), day), ROW_DAY, COL_DAY);
@@ -2096,7 +2096,7 @@ void redraw_stuff(player_type *creature_ptr)
                creature_ptr->redraw &= ~(PR_ARMOR | PR_HP | PR_MANA);
                creature_ptr->redraw &= ~(PR_DEPTH | PR_HEALTH | PR_UHEALTH);
                print_frame_basic(creature_ptr);
-               print_time();
+               print_time(creature_ptr);
                print_dungeon(creature_ptr);
        }
 
index 9e3faa1..e4bf0c1 100644 (file)
@@ -8,7 +8,7 @@ extern void map_info(POSITION y, POSITION x, TERM_COLOR *ap, SYMBOL_CODE *cp, TE
 extern void do_cmd_view_map(player_type *player_ptr);
 
 extern void health_track(player_type *player_ptr, MONSTER_IDX m_idx);
-extern void print_time(void);
+extern void print_time(player_type *player_ptr);
 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);
index 0d7d5f1..f034cb9 100644 (file)
@@ -21,16 +21,17 @@ bool is_daytime(void)
 /*!
  * @brief 現在の日数、時刻を返す /
  * Extract day, hour, min
+ * @param player_ptr プレーヤーへの参照ポインタ
  * @param day 日数を返すための参照ポインタ
  * @param hour 時数を返すための参照ポインタ
  * @param min 分数を返すための参照ポインタ
  */
-void extract_day_hour_min(int *day, int *hour, int *min)
+void extract_day_hour_min(player_type *player_ptr, int *day, int *hour, int *min)
 {
        const s32b A_DAY = TURNS_PER_TICK * TOWN_DAWN;
        s32b turn_in_today = (current_world_ptr->game_turn + A_DAY / 4) % A_DAY;
 
-       switch (p_ptr->start_race)
+       switch (player_ptr->start_race)
        {
        case RACE_VAMPIRE:
        case RACE_SKELETON:
index f434456..4b11821 100644 (file)
@@ -67,5 +67,5 @@ typedef struct {
 } world_type;
 
 extern bool is_daytime(void);
-extern void extract_day_hour_min(int *day, int *hour, int *min);
+extern void extract_day_hour_min(player_type *player_ptr, int *day, int *hour, int *min);
 extern world_type *current_world_ptr;