OSDN Git Service

[Refactor] #37353 save.h を追加して宣言を移動.
[hengband/hengband.git] / src / core.c
index 8b74825..3fc0221 100644 (file)
 
 #include "angband.h"
 #include "util.h"
+#include "core.h"
 
 #include "birth.h"
 #include "bldg.h"
 #include "cmd-activate.h"
+#include "cmd-dump.h"
 #include "cmd-eat.h"
 #include "cmd-hissatsu.h"
 #include "cmd-item.h"
 #include "cmd-basic.h"
 #include "snipe.h"
 #include "dungeon.h"
+#include "feature.h"
 #include "floor.h"
 #include "floor-events.h"
+#include "floor-town.h"
 #include "grid.h"
 #include "object-curse.h"
 #include "object-flavor.h"
 #include "avatar.h"
 #include "player-move.h"
 #include "player-status.h"
+#include "player-class.h"
+#include "player-race.h"
 #include "cmd-spell.h"
 #include "realm-hex.h"
+#include "objectkind.h"
 #include "object-hook.h"
 #include "wild.h"
 #include "monster-process.h"
 #include "files.h"
 #include "player-effects.h"
 #include "scores.h"
+#include "autopick.h"
+#include "save.h"
+
+concptr ANGBAND_SYS = "xxx"; //!< Hack -- The special Angband "System Suffix" This variable is used to choose an appropriate "pref-xxx" file
+
+#ifdef JP
+concptr ANGBAND_KEYBOARD = "JAPAN"; //!< Hack -- The special Angband "Keyboard Suffix" This variable is used to choose an appropriate macro-trigger definition
+#else
+concptr ANGBAND_KEYBOARD = "0";
+#endif
+
+concptr ANGBAND_GRAF = "ascii"; //!< Hack -- The special Angband "Graphics Suffix" This variable is used to choose an appropriate "graf-xxx" file
 
 static bool load = TRUE; /*!<ロード処理中の分岐フラグ*/
 static int wild_regen = 20; /*!<広域マップ移動時の自然回復処理カウンタ(広域マップ1マス毎に20回処理を基本とする)*/
@@ -883,7 +902,7 @@ static void regen_monsters(void)
 
 
        /* Regenerate everyone */
-       for (i = 1; i < m_max; i++)
+       for (i = 1; i < current_floor_ptr->m_max; i++)
        {
                /* Check the i'th monster */
                monster_type *m_ptr = &current_floor_ptr->m_list[i];
@@ -2432,7 +2451,7 @@ static void process_world_aux_mutation(void)
                int danger_amount = 0;
                MONSTER_IDX monster;
 
-               for (monster = 0; monster < m_max; monster++)
+               for (monster = 0; monster < current_floor_ptr->m_max; monster++)
                {
                        monster_type *m_ptr = &current_floor_ptr->m_list[monster];
                        monster_race *r_ptr = &r_info[m_ptr->r_idx];
@@ -2849,7 +2868,7 @@ static void process_world_aux_recharge(void)
        }
 
        /* Process objects on floor */
-       for (i = 1; i < o_max; i++)
+       for (i = 1; i < current_floor_ptr->o_max; i++)
        {
                object_type *o_ptr = &current_floor_ptr->o_list[i];
 
@@ -3128,38 +3147,6 @@ static void process_world(void)
        /* Every 10 game turns */
        if (current_world_ptr->game_turn % TURNS_PER_TICK) return;
 
-       /*** Check the Time and Load ***/
-
-       if (!(current_world_ptr->game_turn % (50*TURNS_PER_TICK)))
-       {
-               /* Check time and load */
-               if ((0 != check_time()) || (0 != check_load()))
-               {
-                       /* Warning */
-                       if (closing_flag <= 2)
-                       {
-                               disturb(FALSE, TRUE);
-
-                               /* Count warnings */
-                               closing_flag++;
-
-                               msg_print(_("アングバンドへの門が閉じかかっています...", "The gates to ANGBAND are closing..."));
-                               msg_print(_("ゲームを終了するかセーブするかして下さい。", "Please finish up and/or save your game."));
-
-                       }
-
-                       /* Slam the gate */
-                       else
-                       {
-                               msg_print(_("今、アングバンドへの門が閉ざされました。", "The gates to ANGBAND are now closed."));
-
-                               /* Stop playing */
-                               p_ptr->playing = FALSE;
-                               p_ptr->leaving = TRUE;
-                       }
-               }
-       }
-
        /*** Attempt timed autosave ***/
        if (autosave_t && autosave_freq && !p_ptr->inside_battle)
        {
@@ -4387,12 +4374,12 @@ static void process_player(void)
 
        /*** Apply energy ***/
 
-       if (hack_mutation)
+       if (p_ptr->hack_mutation)
        {
                msg_print(_("何か変わった気がする!", "You feel different!"));
 
                (void)gain_mutation(p_ptr, 0);
-               hack_mutation = FALSE;
+               p_ptr->hack_mutation = FALSE;
        }
 
        if (invoking_midnight_curse)
@@ -4404,7 +4391,7 @@ static void process_player(void)
 
        if (p_ptr->inside_battle)
        {
-               for(m_idx = 1; m_idx < m_max; m_idx++)
+               for(m_idx = 1; m_idx < current_floor_ptr->m_max; m_idx++)
                {
                        monster_type *m_ptr = &current_floor_ptr->m_list[m_idx];
 
@@ -4766,7 +4753,7 @@ static void process_player(void)
                                shimmer_monsters = FALSE;
 
                                /* Shimmer multi-hued monsters */
-                               for (m_idx = 1; m_idx < m_max; m_idx++)
+                               for (m_idx = 1; m_idx < current_floor_ptr->m_max; m_idx++)
                                {
                                        monster_type *m_ptr;
                                        monster_race *r_ptr;
@@ -4800,7 +4787,7 @@ static void process_player(void)
                                repair_monsters = FALSE;
 
                                /* Rotate detection flags */
-                               for (m_idx = 1; m_idx < m_max; m_idx++)
+                               for (m_idx = 1; m_idx < current_floor_ptr->m_max; m_idx++)
                                {
                                        monster_type *m_ptr;
                                        m_ptr = &current_floor_ptr->m_list[m_idx];
@@ -5078,17 +5065,17 @@ static void dungeon(bool load_game)
        while (TRUE)
        {
                /* Hack -- Compact the monster list occasionally */
-               if ((m_cnt + 32 > current_floor_ptr->max_m_idx) && !p_ptr->inside_battle) compact_monsters(64);
+               if ((current_floor_ptr->m_cnt + 32 > current_floor_ptr->max_m_idx) && !p_ptr->inside_battle) compact_monsters(64);
 
                /* Hack -- Compress the monster list occasionally */
-               if ((m_cnt + 32 < m_max) && !p_ptr->inside_battle) compact_monsters(0);
+               if ((current_floor_ptr->m_cnt + 32 < current_floor_ptr->m_max) && !p_ptr->inside_battle) compact_monsters(0);
 
 
                /* Hack -- Compact the object list occasionally */
-               if (o_cnt + 32 > current_floor_ptr->max_o_idx) compact_objects(64);
+               if (current_floor_ptr->o_cnt + 32 > current_floor_ptr->max_o_idx) compact_objects(64);
 
                /* Hack -- Compress the object list occasionally */
-               if (o_cnt + 32 < o_max) compact_objects(0);
+               if (current_floor_ptr->o_cnt + 32 < current_floor_ptr->o_max) compact_objects(0);
 
                /* Process the player */
                process_player();
@@ -5274,7 +5261,7 @@ void play_game(bool new_game)
                return;
        }
 
-       hack_mutation = FALSE;
+       p_ptr->hack_mutation = FALSE;
 
        /* Hack -- Character is "icky" */
        character_icky = TRUE;
@@ -5418,10 +5405,10 @@ void play_game(bool new_game)
                write_level = TRUE;
 
                /* Hack -- seed for flavors */
-               seed_flavor = randint0(0x10000000);
+               current_world_ptr->seed_flavor = randint0(0x10000000);
 
                /* Hack -- seed for town layout */
-               seed_town = randint0(0x10000000);
+               current_world_ptr->seed_town = randint0(0x10000000);
 
                /* Roll up a new character */
                player_birth();
@@ -5452,7 +5439,7 @@ void play_game(bool new_game)
                if (p_ptr->riding == -1)
                {
                        p_ptr->riding = 0;
-                       for (i = m_max; i > 0; i--)
+                       for (i = current_floor_ptr->m_max; i > 0; i--)
                        {
                                if (player_bold(current_floor_ptr->m_list[i].fy, current_floor_ptr->m_list[i].fx))
                                {