OSDN Git Service

[Refactor] #38844 start_time を world_type 構造体へ移動.
authordeskull <deskull@users.sourceforge.jp>
Sun, 19 May 2019 07:00:25 +0000 (16:00 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Sun, 19 May 2019 07:00:25 +0000 (16:00 +0900)
src/autopick.c
src/core.c
src/externs.h
src/variable.c
src/view-mainwindow.c
src/world.h

index bf22f11..82268b6 100644 (file)
@@ -6029,7 +6029,7 @@ void do_cmd_edit_autopick(void)
                old_autosave_turn = current_world_ptr->game_turn;
        }
 
-       /* HACK -- Reset start_time to stop counting current_world_ptr->play_time while edit */
+       /* HACK -- Reset current_world_ptr->start_time to stop counting current_world_ptr->play_time while edit */
        update_playtime();
 
        /* Free old entries */
@@ -6155,8 +6155,8 @@ void do_cmd_edit_autopick(void)
        /* Reload autopick pref */
        process_autopick_file(buf);
 
-       /* HACK -- reset start_time so that current_world_ptr->play_time is not increase while edit */
-       start_time = (u32b)time(NULL);
+       /* HACK -- reset current_world_ptr->start_time so that current_world_ptr->play_time is not increase while edit */
+       current_world_ptr->start_time = (u32b)time(NULL);
 
        /* Save cursor location */
        cx_save = tb->cx;
index cf6b50d..212f568 100644 (file)
@@ -5324,7 +5324,7 @@ void play_game(bool new_game)
 
                p_ptr->is_dead = TRUE;
 
-               start_time = (u32b)time(NULL);
+               current_world_ptr->start_time = (u32b)time(NULL);
 
                /* No suspending now */
                signals_ignore_tstp();
@@ -5472,7 +5472,7 @@ void play_game(bool new_game)
        current_world_ptr->timewalk_m_idx = 0;
        p_ptr->now_damaged = FALSE;
        now_message = 0;
-       start_time = time(NULL) - 1;
+       current_world_ptr->start_time = time(NULL) - 1;
        record_o_name[0] = '\0';
 
        /* Reset map panel */
index 167f7e6..00f3276 100644 (file)
@@ -74,7 +74,6 @@ extern player_type *p_ptr;
 extern MONSTER_IDX pet_t_m_idx;
 extern MONSTER_IDX riding_t_m_idx;
 extern MONRACE_IDX today_mon;
-extern u32b start_time;
 extern bool sukekaku;
 extern bool new_mane;
 
index 8937073..2ebba31 100644 (file)
@@ -76,8 +76,6 @@ MONSTER_IDX riding_t_m_idx;
 
 MONSTER_IDX today_mon;
 
-u32b start_time;
-
 bool sukekaku;
 bool new_mane;
 
index 9004a8f..b66b8d6 100644 (file)
@@ -3881,11 +3881,11 @@ void object_kind_track(KIND_OBJECT_IDX k_idx)
 void update_playtime(void)
 {
        /* Check if the game has started */
-       if (start_time != 0)
+       if (current_world_ptr->start_time != 0)
        {
                u32b tmp = (u32b)time(NULL);
-               current_world_ptr->play_time += (tmp - start_time);
-               start_time = tmp;
+               current_world_ptr->play_time += (tmp - current_world_ptr->start_time);
+               current_world_ptr->start_time = tmp;
        }
 }
 
index 64f15a8..9887f26 100644 (file)
@@ -9,6 +9,7 @@ typedef struct {
        GAME_TURN dungeon_turn;                 /*!< NASTY生成の計算に関わる内部ターン値 / Game current_world_ptr->game_turn in dungeon */
        GAME_TURN dungeon_turn_limit;   /*!< dungeon_turnの最大値 / Limit of game_turn in dungeon */
        GAME_TURN arena_start_turn;             /*!< 闘技場賭博の開始ターン値 */
+       u32b start_time;
 
        MONSTER_IDX timewalk_m_idx;     /*!< 現在時間停止を行っているモンスターのID */
 
@@ -53,6 +54,7 @@ typedef struct {
 
        bool creating_savefile;         /* New savefile is currently created */
 
+
 } world_type;
 
 extern bool is_daytime(void);