OSDN Git Service

[Refactor] #38932 文字コードを UTF-8(BOM) / LF に統一。 / Unify UTF-8(BOM) + LF.
[hengband/hengband.git] / src / floor-events.c
index 2f0cc73..02f4db4 100644 (file)
-#include "angband.h"\r
-\r
-void day_break()\r
-{\r
-       POSITION y, x;\r
-       msg_print(_("夜が明けた。", "The sun has risen."));\r
-\r
-       if (!p_ptr->wild_mode)\r
-       {\r
-               /* Hack -- Scan the town */\r
-               for (y = 0; y < cur_hgt; y++)\r
-               {\r
-                       for (x = 0; x < cur_wid; x++)\r
-                       {\r
-                               /* Get the cave grid */\r
-                               cave_type *c_ptr = &cave[y][x];\r
-\r
-                               /* Assume lit */\r
-                               c_ptr->info |= (CAVE_GLOW);\r
-\r
-                               /* Hack -- Memorize lit grids if allowed */\r
-                               if (view_perma_grids) c_ptr->info |= (CAVE_MARK);\r
-\r
-                               /* Hack -- Notice spot */\r
-                               note_spot(y, x);\r
-                       }\r
-               }\r
-       }\r
-\r
-       /* Update the monsters */\r
-       p_ptr->update |= (PU_MONSTERS | PU_MON_LITE);\r
-\r
-       /* Redraw map */\r
-       p_ptr->redraw |= (PR_MAP);\r
-\r
-       p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);\r
-\r
-       if (p_ptr->special_defense & NINJA_S_STEALTH)\r
-       {\r
-               if (cave[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);\r
-       }\r
-\r
-}\r
-\r
-void night_falls(void)\r
-{\r
-       POSITION y, x;\r
-       msg_print(_("日が沈んだ。", "The sun has fallen."));\r
-\r
-       if (!p_ptr->wild_mode)\r
-       {\r
-               /* Hack -- Scan the town */\r
-               for (y = 0; y < cur_hgt; y++)\r
-               {\r
-                       for (x = 0; x < cur_wid; x++)\r
-                       {\r
-                               /* Get the cave grid */\r
-                               cave_type *c_ptr = &cave[y][x];\r
-\r
-                               /* Feature code (applying "mimic" field) */\r
-                               feature_type *f_ptr = &f_info[get_feat_mimic(c_ptr)];\r
-\r
-                               if (!is_mirror_grid(c_ptr) && !have_flag(f_ptr->flags, FF_QUEST_ENTER) &&\r
-                                       !have_flag(f_ptr->flags, FF_ENTRANCE))\r
-                               {\r
-                                       /* Assume dark */\r
-                                       c_ptr->info &= ~(CAVE_GLOW);\r
-\r
-                                       if (!have_flag(f_ptr->flags, FF_REMEMBER))\r
-                                       {\r
-                                               /* Forget the normal floor grid */\r
-                                               c_ptr->info &= ~(CAVE_MARK);\r
-\r
-                                               /* Hack -- Notice spot */\r
-                                               note_spot(y, x);\r
-                                       }\r
-                               }\r
-                       }\r
-\r
-                       /* Glow deep lava and building entrances */\r
-                       glow_deep_lava_and_bldg();\r
-               }\r
-       }\r
-\r
-       /* Update the monsters */\r
-       p_ptr->update |= (PU_MONSTERS | PU_MON_LITE);\r
-\r
-       /* Redraw map */\r
-       p_ptr->redraw |= (PR_MAP);\r
-\r
-       p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);\r
-\r
-       if (p_ptr->special_defense & NINJA_S_STEALTH)\r
-       {\r
-               if (cave[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);\r
-       }\r
-\r
-}\r
+#include "angband.h"
+
+void day_break()
+{
+       POSITION y, x;
+       msg_print(_("夜が明けた。", "The sun has risen."));
+
+       if (!p_ptr->wild_mode)
+       {
+               /* Hack -- Scan the town */
+               for (y = 0; y < cur_hgt; y++)
+               {
+                       for (x = 0; x < cur_wid; x++)
+                       {
+                               /* Get the cave grid */
+                               cave_type *c_ptr = &cave[y][x];
+
+                               /* Assume lit */
+                               c_ptr->info |= (CAVE_GLOW);
+
+                               /* Hack -- Memorize lit grids if allowed */
+                               if (view_perma_grids) c_ptr->info |= (CAVE_MARK);
+
+                               /* Hack -- Notice spot */
+                               note_spot(y, x);
+                       }
+               }
+       }
+
+       p_ptr->update |= (PU_MONSTERS | PU_MON_LITE);
+       p_ptr->redraw |= (PR_MAP);
+       p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
+
+       if (p_ptr->special_defense & NINJA_S_STEALTH)
+       {
+               if (cave[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);
+       }
+
+}
+
+void night_falls(void)
+{
+       POSITION y, x;
+       msg_print(_("日が沈んだ。", "The sun has fallen."));
+
+       if (!p_ptr->wild_mode)
+       {
+               /* Hack -- Scan the town */
+               for (y = 0; y < cur_hgt; y++)
+               {
+                       for (x = 0; x < cur_wid; x++)
+                       {
+                               /* Get the cave grid */
+                               cave_type *c_ptr = &cave[y][x];
+
+                               /* Feature code (applying "mimic" field) */
+                               feature_type *f_ptr = &f_info[get_feat_mimic(c_ptr)];
+
+                               if (!is_mirror_grid(c_ptr) && !have_flag(f_ptr->flags, FF_QUEST_ENTER) &&
+                                       !have_flag(f_ptr->flags, FF_ENTRANCE))
+                               {
+                                       /* Assume dark */
+                                       c_ptr->info &= ~(CAVE_GLOW);
+
+                                       if (!have_flag(f_ptr->flags, FF_REMEMBER))
+                                       {
+                                               /* Forget the normal floor grid */
+                                               c_ptr->info &= ~(CAVE_MARK);
+
+                                               /* Hack -- Notice spot */
+                                               note_spot(y, x);
+                                       }
+                               }
+                       }
+
+                       /* Glow deep lava and building entrances */
+                       glow_deep_lava_and_bldg();
+               }
+       }
+
+       p_ptr->update |= (PU_MONSTERS | PU_MON_LITE);
+       p_ptr->redraw |= (PR_MAP);
+       p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
+
+       if (p_ptr->special_defense & NINJA_S_STEALTH)
+       {
+               if (cave[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);
+       }
+
+}
+
+/*!
+ * @brief 現在フロアに残っている敵モンスターの数を返す /
+ * @return 現在の敵モンスターの数
+ */
+MONSTER_NUMBER count_all_hostile_monsters(void)
+{
+       POSITION x, y;
+       MONSTER_NUMBER number_mon = 0;
+
+       for (x = 0; x < cur_wid; ++x)
+       {
+               for (y = 0; y < cur_hgt; ++y)
+               {
+                       MONSTER_IDX m_idx = cave[y][x].m_idx;
+
+                       if (m_idx > 0 && is_hostile(&m_list[m_idx]))
+                       {
+                               ++number_mon;
+                       }
+               }
+       }
+
+       return number_mon;
+}