OSDN Git Service

[Refactor] #40414 Separated display_monster_kind() from process_monster_lore()
authorHourier <hourier@users.sourceforge.jp>
Thu, 11 Jun 2020 13:58:49 +0000 (22:58 +0900)
committerHourier <hourier@users.sourceforge.jp>
Thu, 11 Jun 2020 14:00:17 +0000 (23:00 +0900)
src/lore/monster-lore.c
src/view/display-monster-lore.c
src/view/display-monster-lore.h

index e156194..53ac327 100644 (file)
@@ -337,27 +337,7 @@ void process_monster_lore(player_type *player_ptr, MONRACE_IDX r_idx, BIT_FLAGS
         if (lore_ptr->flags3 & RF3_AMBERITE)
             hook_c_roff(TERM_VIOLET, _("アンバーの王族の", " Amberite"));
 
-        if ((lore_ptr->flags3 & (RF3_DRAGON | RF3_DEMON | RF3_GIANT | RF3_TROLL | RF3_ORC | RF3_ANGEL)) || (lore_ptr->flags2 & (RF2_QUANTUM | RF2_HUMAN))) {
-            if (lore_ptr->flags3 & RF3_DRAGON)
-                hook_c_roff(TERM_ORANGE, _("ドラゴン", " dragon"));
-            if (lore_ptr->flags3 & RF3_DEMON)
-                hook_c_roff(TERM_VIOLET, _("デーモン", " demon"));
-            if (lore_ptr->flags3 & RF3_GIANT)
-                hook_c_roff(TERM_L_UMBER, _("巨人", " giant"));
-            if (lore_ptr->flags3 & RF3_TROLL)
-                hook_c_roff(TERM_BLUE, _("トロル", " troll"));
-            if (lore_ptr->flags3 & RF3_ORC)
-                hook_c_roff(TERM_UMBER, _("オーク", " orc"));
-            if (lore_ptr->flags2 & RF2_HUMAN)
-                hook_c_roff(TERM_L_WHITE, _("人間", " human"));
-            if (lore_ptr->flags2 & RF2_QUANTUM)
-                hook_c_roff(TERM_VIOLET, _("量子生物", " quantum creature"));
-            if (lore_ptr->flags3 & RF3_ANGEL)
-                hook_c_roff(TERM_YELLOW, _("天使", " angel"));
-        } else {
-            hooked_roff(_("モンスター", " creature"));
-        }
-
+        display_monster_kind(lore_ptr);
 #ifdef JP
         hooked_roff("を倒すことは");
 #endif
index 9bc674e..8def5e7 100644 (file)
@@ -1,6 +1,8 @@
 #include "view/display-monster-lore.h"
 #include "lore/monster-lore.h"
 #include "monster-race/race-flags1.h"
+#include "monster-race/race-flags2.h"
+#include "monster-race/race-flags3.h"
 #include "monster-race/race-indice-types.h"
 #include "term/term-color-types.h"
 #include "world/world.h"
@@ -279,3 +281,35 @@ void display_monster_never_move(lore_type *lore_ptr)
 
     hooked_roff(_("侵入者を追跡しない", "does not deign to chase intruders"));
 }
+
+void display_monster_kind(lore_type *lore_ptr)
+{
+    if (((lore_ptr->flags3 & (RF3_DRAGON | RF3_DEMON | RF3_GIANT | RF3_TROLL | RF3_ORC | RF3_ANGEL)) == 0) && ((lore_ptr->flags2 & (RF2_QUANTUM | RF2_HUMAN)) == 0)) {
+        hooked_roff(_("モンスター", " creature"));
+        return;
+    }
+
+    if (lore_ptr->flags3 & RF3_DRAGON)
+        hook_c_roff(TERM_ORANGE, _("ドラゴン", " dragon"));
+
+    if (lore_ptr->flags3 & RF3_DEMON)
+        hook_c_roff(TERM_VIOLET, _("デーモン", " demon"));
+
+    if (lore_ptr->flags3 & RF3_GIANT)
+        hook_c_roff(TERM_L_UMBER, _("巨人", " giant"));
+
+    if (lore_ptr->flags3 & RF3_TROLL)
+        hook_c_roff(TERM_BLUE, _("トロル", " troll"));
+
+    if (lore_ptr->flags3 & RF3_ORC)
+        hook_c_roff(TERM_UMBER, _("オーク", " orc"));
+
+    if (lore_ptr->flags2 & RF2_HUMAN)
+        hook_c_roff(TERM_L_WHITE, _("人間", " human"));
+
+    if (lore_ptr->flags2 & RF2_QUANTUM)
+        hook_c_roff(TERM_VIOLET, _("量子生物", " quantum creature"));
+
+    if (lore_ptr->flags3 & RF3_ANGEL)
+        hook_c_roff(TERM_YELLOW, _("天使", " angel"));
+}
index 784c230..004be96 100644 (file)
@@ -12,3 +12,4 @@ bool display_where_to_appear(lore_type *lore_ptr);
 void display_random_move(lore_type *lore_ptr);
 void display_monster_move(lore_type *lore_ptr);
 void display_monster_never_move(lore_type *lore_ptr);
+void display_monster_kind(lore_type *lore_ptr);