OSDN Git Service

[Refactor] #40014 Made lore-util.c/h to prepare to divide monster-lore.c
authorHourier <hourier@users.sourceforge.jp>
Thu, 11 Jun 2020 12:21:08 +0000 (21:21 +0900)
committerHourier <hourier@users.sourceforge.jp>
Thu, 11 Jun 2020 12:21:08 +0000 (21:21 +0900)
Hengband/Hengband/Hengband.vcxproj
Hengband/Hengband/Hengband.vcxproj.filters
src/Makefile.am
src/lore/lore-util.c [new file with mode: 0644]
src/lore/lore-util.h [new file with mode: 0644]

index e83d5aa..b53fe71 100644 (file)
     <ClCompile Include="..\..\src\info-reader\race-reader.c" />\r
     <ClCompile Include="..\..\src\info-reader\skill-reader.c" />\r
     <ClCompile Include="..\..\src\info-reader\vault-reader.c" />\r
+    <ClCompile Include="..\..\src\lore\lore-util.c" />\r
     <ClCompile Include="..\..\src\monster\monster-compaction.c" />\r
     <ClCompile Include="..\..\src\monster\monster-death.c" />\r
     <ClCompile Include="..\..\src\lore\lore-store.c" />\r
     <ClInclude Include="..\..\src\info-reader\random-grid-effect-types.h" />\r
     <ClInclude Include="..\..\src\info-reader\skill-reader.h" />\r
     <ClInclude Include="..\..\src\info-reader\vault-reader.h" />\r
+    <ClInclude Include="..\..\src\lore\lore-util.h" />\r
     <ClInclude Include="..\..\src\mind\drs-types.h" />\r
     <ClInclude Include="..\..\src\mind\snipe-types.h" />\r
     <ClInclude Include="..\..\src\monster\monster-compaction.h" />\r
index d083b2f..2e49422 100644 (file)
     <ClCompile Include="..\..\src\lore\monster-lore.c">
       <Filter>lore</Filter>
     </ClCompile>
+    <ClCompile Include="..\..\src\lore\lore-util.c">
+      <Filter>lore</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="..\..\src\cmd\cmd-basic.h">
     <ClInclude Include="..\..\src\lore\monster-lore.h">
       <Filter>lore</Filter>
     </ClInclude>
+    <ClInclude Include="..\..\src\lore\lore-util.h">
+      <Filter>lore</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <None Include="..\..\src\wall.bmp" />
index 3a82959..6db5364 100644 (file)
@@ -228,6 +228,10 @@ hengband_SOURCES = \
        \
        locale/japanese.c locale/japanese.h locale/english.c locale/english.h \
        \
+       lore/lore-store.c lore/lore-store.h \
+       lore/lore-util.c lore/lore-util.h \
+       lore/monster-lore.c lore/monster-lore.h \
+       \
        main.c main-x11.c main-gcu.c \
        \
        main/music-definitions-table.c main/music-definitions-table.h \
@@ -316,9 +320,6 @@ hengband_SOURCES = \
        monster-attack/monster-attack-util.c monster-attack/monster-attack-util.h \
        monster-attack/monster-eating.c monster-attack/monster-eating.h \
        \
-       lore/lore-store.c lore/lore-store.h \
-       lore/monster-lore.c lore/monster-lore.h \
-       \
        monster-race/monster-race.c monster-race/monster-race.h \
        monster-race/monster-race-hook.c monster-race/monster-race-hook.h \
        monster-race/race-flags-resistance.h \
diff --git a/src/lore/lore-util.c b/src/lore/lore-util.c
new file mode 100644 (file)
index 0000000..0836895
--- /dev/null
@@ -0,0 +1,20 @@
+#include "lore/lore-util.h"
+
+lore_type *initialize_lore_type(lore_type *lore_ptr, MONRACE_IDX r_idx, BIT_FLAGS mode)
+{
+    lore_ptr->nightmare = ironman_nightmare && !(mode & 0x02);
+    lore_ptr->r_ptr = &r_info[r_idx];
+    lore_ptr->speed = lore_ptr->nightmare ? lore_ptr->r_ptr->speed + 5 : lore_ptr->r_ptr->speed;
+    lore_ptr->drop_gold = lore_ptr->r_ptr->r_drop_gold;
+    lore_ptr->drop_item = lore_ptr->r_ptr->r_drop_item;
+    lore_ptr->flags1 = (lore_ptr->r_ptr->flags1 & lore_ptr->r_ptr->r_flags1);
+    lore_ptr->flags2 = (lore_ptr->r_ptr->flags2 & lore_ptr->r_ptr->r_flags2);
+    lore_ptr->flags3 = (lore_ptr->r_ptr->flags3 & lore_ptr->r_ptr->r_flags3);
+    lore_ptr->flags4 = (lore_ptr->r_ptr->flags4 & lore_ptr->r_ptr->r_flags4);
+    lore_ptr->a_ability_flags1 = (lore_ptr->r_ptr->a_ability_flags1 & lore_ptr->r_ptr->r_flags5);
+    lore_ptr->a_ability_flags2 = (lore_ptr->r_ptr->a_ability_flags2 & lore_ptr->r_ptr->r_flags6);
+    lore_ptr->flags7 = (lore_ptr->r_ptr->flags7 & lore_ptr->r_ptr->flags7);
+    lore_ptr->flagsr = (lore_ptr->r_ptr->flagsr & lore_ptr->r_ptr->r_flagsr);
+    lore_ptr->reinforce = FALSE;
+    return lore_ptr;
+}
diff --git a/src/lore/lore-util.h b/src/lore/lore-util.h
new file mode 100644 (file)
index 0000000..5b99f5a
--- /dev/null
@@ -0,0 +1,28 @@
+#pragma once
+
+#include "system/angband.h"
+#include "monster-race/monster-race.h"
+
+typedef struct lore_type {
+#ifdef JP
+    char jverb_buf[64];
+#else
+    bool sin = FALSE;
+#endif
+    bool nightmare;
+    monster_race *r_ptr;
+    SPEED speed;
+    ITEM_NUMBER drop_gold;
+    ITEM_NUMBER drop_item;
+    BIT_FLAGS flags1;
+    BIT_FLAGS flags2;
+    BIT_FLAGS flags3;
+    BIT_FLAGS flags4;
+    BIT_FLAGS a_ability_flags1;
+    BIT_FLAGS a_ability_flags2;
+    BIT_FLAGS flags7;
+    BIT_FLAGS flagsr;
+    bool reinforce;
+} lore_type;
+
+lore_type *initialize_lore_type(lore_type *lore_ptr, MONRACE_IDX r_idx, BIT_FLAGS mode);