OSDN Git Service

[Refactor] #40570 Separated room-info-table.c/h from rooms.c/h
authorHourier <hourier@users.sourceforge.jp>
Fri, 24 Jul 2020 01:26:28 +0000 (10:26 +0900)
committerHourier <hourier@users.sourceforge.jp>
Sun, 26 Jul 2020 08:04:20 +0000 (17:04 +0900)
Hengband/Hengband/Hengband.vcxproj
Hengband/Hengband/Hengband.vcxproj.filters
src/Makefile.am
src/room/room-info-table.c [new file with mode: 0644]
src/room/room-info-table.h [new file with mode: 0644]
src/room/rooms.c
src/room/rooms.h

index 1c206e8..f913f6c 100644 (file)
     <ClCompile Include="..\..\src\load\player-info-loader.c" />\r
     <ClCompile Include="..\..\src\load\store-loader.c" />\r
     <ClCompile Include="..\..\src\load\world-loader.c" />\r
+    <ClCompile Include="..\..\src\room\room-info-table.c" />\r
     <ClCompile Include="..\..\src\save\floor-writer.c" />\r
     <ClCompile Include="..\..\src\save\info-writer.c" />\r
     <ClCompile Include="..\..\src\save\item-writer.c" />\r
     <ClInclude Include="..\..\src\load\store-loader.h" />\r
     <ClInclude Include="..\..\src\load\world-loader.h" />\r
     <ClInclude Include="..\..\src\room\lake-types.h" />\r
+    <ClInclude Include="..\..\src\room\room-info-table.h" />\r
     <ClInclude Include="..\..\src\room\room-types.h" />\r
     <ClInclude Include="..\..\src\save\floor-writer.h" />\r
     <ClInclude Include="..\..\src\save\info-writer.h" />\r
index 5d4b0b4..410fbcd 100644 (file)
     <ClCompile Include="..\..\src\player\player-status-flags.c">
       <Filter>player</Filter>
     </ClCompile>
+    <ClCompile Include="..\..\src\room\room-info-table.c">
+      <Filter>room</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="..\..\src\combat\shoot.h">
     <ClInclude Include="..\..\src\room\lake-types.h">
       <Filter>room</Filter>
     </ClInclude>
+    <ClInclude Include="..\..\src\room\room-info-table.h">
+      <Filter>room</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <None Include="..\..\src\wall.bmp" />
index 88d9856..5f63d89 100644 (file)
@@ -603,6 +603,7 @@ hengband_SOURCES = \
        realm/realm-types.h \
        \
        room/lake-types.h room/room-types.h \
+       room/room-info-table.c room/room-info-table.h \
        room/rooms.c room/rooms.h \
        room/rooms-city.c room/rooms-city.h \
        room/rooms-fractal.c room/rooms-fractal.h \
diff --git a/src/room/room-info-table.c b/src/room/room-info-table.c
new file mode 100644 (file)
index 0000000..6926a8c
--- /dev/null
@@ -0,0 +1,60 @@
+#include "room/room-info-table.h"
+
+/*!
+ * 各部屋タイプの生成比定義
+ *[from SAngband (originally from OAngband)]\n
+ *\n
+ * Table of values that control how many times each type of room will\n
+ * appear.  Each type of room has its own row, and each column\n
+ * corresponds to dungeon levels 0, 10, 20, and so on.  The final\n
+ * value is the minimum depth the room can appear at.  -LM-\n
+ *\n
+ * Level 101 and below use the values for level 100.\n
+ *\n
+ * Rooms with lots of monsters or loot may not be generated if the\n
+ * object or monster lists are already nearly full.  Rooms will not\n
+ * appear above their minimum depth.  Tiny levels will not have space\n
+ * for all the rooms you ask for.\n
+ */
+room_info_type room_info_normal[ROOM_T_MAX] = {
+    /* Depth */
+    /*  0  10  20  30  40  50  60  70  80  90 100  min limit */
+    { { 999, 900, 800, 700, 600, 500, 400, 300, 200, 100, 0 }, 0 }, /*NORMAL   */
+    { { 1, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100 }, 1 }, /*OVERLAP  */
+    { { 1, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100 }, 3 }, /*CROSS    */
+    { { 1, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100 }, 3 }, /*INNER_F  */
+    { { 0, 1, 1, 1, 2, 3, 5, 6, 8, 10, 13 }, 10 }, /*NEST     */
+    { { 0, 1, 1, 2, 3, 4, 6, 8, 10, 13, 16 }, 10 }, /*PIT      */
+    { { 0, 1, 1, 1, 2, 2, 3, 5, 6, 8, 10 }, 10 }, /*LESSER_V */
+    { { 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 4 }, 20 }, /*GREATER_V*/
+    { { 0, 100, 200, 300, 400, 500, 600, 700, 800, 900, 999 }, 10 }, /*FRACAVE  */
+    { { 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2 }, 10 }, /*RANDOM_V */
+    { { 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40 }, 3 }, /*OVAL     */
+    { { 1, 6, 12, 18, 24, 30, 36, 42, 48, 54, 60 }, 10 }, /*CRYPT    */
+    { { 0, 0, 1, 1, 1, 2, 3, 4, 5, 6, 8 }, 20 }, /*TRAP_PIT */
+    { { 0, 0, 1, 1, 1, 2, 3, 4, 5, 6, 8 }, 20 }, /*TRAP     */
+    { { 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 2 }, 40 }, /*GLASS    */
+    { { 1, 1, 1, 1, 1, 1, 1, 2, 2, 3, 3 }, 1 }, /*ARCADE   */
+    { { 1, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80 }, 1 }, /*FIX      */
+};
+
+/*! 部屋の生成処理順 / Build rooms in descending order of difficulty. */
+byte room_build_order[ROOM_T_MAX] = {
+    ROOM_T_GREATER_VAULT,
+    ROOM_T_ARCADE,
+    ROOM_T_RANDOM_VAULT,
+    ROOM_T_LESSER_VAULT,
+    ROOM_T_TRAP_PIT,
+    ROOM_T_PIT,
+    ROOM_T_NEST,
+    ROOM_T_TRAP,
+    ROOM_T_GLASS,
+    ROOM_T_INNER_FEAT,
+    ROOM_T_FIXED,
+    ROOM_T_OVAL,
+    ROOM_T_CRYPT,
+    ROOM_T_OVERLAP,
+    ROOM_T_CROSS,
+    ROOM_T_FRACAVE,
+    ROOM_T_NORMAL,
+};
diff --git a/src/room/room-info-table.h b/src/room/room-info-table.h
new file mode 100644 (file)
index 0000000..a7ee3c8
--- /dev/null
@@ -0,0 +1,13 @@
+#pragma once
+
+#include "room/room-types.h"
+#include "system/angband.h"
+
+/* Room type information */
+typedef struct room_info_type {
+    s16b prob[ROOM_T_MAX]; /* Allocation information. */
+    byte min_level; /* Minimum level on which room can appear. */
+} room_info_type;
+
+extern room_info_type room_info_normal[ROOM_T_MAX];
+extern byte room_build_order[ROOM_T_MAX];
index 459cf9b..8904794 100644 (file)
@@ -50,6 +50,7 @@
 #include "monster-floor/place-monster-types.h"
 #include "object-enchant/item-apply-magic.h"
 #include "room/lake-types.h"
+#include "room/room-info-table.h"
 #include "room/rooms-city.h"
 #include "room/rooms-fractal.h"
 #include "room/rooms-normal.h"
 door_type feat_door[MAX_DOOR_TYPES];
 
 /*!
- * 各部屋タイプの生成比定義
- *[from SAngband (originally from OAngband)]\n
- *\n
- * Table of values that control how many times each type of room will\n
- * appear.  Each type of room has its own row, and each column\n
- * corresponds to dungeon levels 0, 10, 20, and so on.  The final\n
- * value is the minimum depth the room can appear at.  -LM-\n
- *\n
- * Level 101 and below use the values for level 100.\n
- *\n
- * Rooms with lots of monsters or loot may not be generated if the\n
- * object or monster lists are already nearly full.  Rooms will not\n
- * appear above their minimum depth.  Tiny levels will not have space\n
- * for all the rooms you ask for.\n
- */
-static room_info_type room_info_normal[ROOM_T_MAX] = {
-    /* Depth */
-    /*  0  10  20  30  40  50  60  70  80  90 100  min limit */
-    { { 999, 900, 800, 700, 600, 500, 400, 300, 200, 100, 0 }, 0 }, /*NORMAL   */
-    { { 1, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100 }, 1 }, /*OVERLAP  */
-    { { 1, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100 }, 3 }, /*CROSS    */
-    { { 1, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100 }, 3 }, /*INNER_F  */
-    { { 0, 1, 1, 1, 2, 3, 5, 6, 8, 10, 13 }, 10 }, /*NEST     */
-    { { 0, 1, 1, 2, 3, 4, 6, 8, 10, 13, 16 }, 10 }, /*PIT      */
-    { { 0, 1, 1, 1, 2, 2, 3, 5, 6, 8, 10 }, 10 }, /*LESSER_V */
-    { { 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 4 }, 20 }, /*GREATER_V*/
-    { { 0, 100, 200, 300, 400, 500, 600, 700, 800, 900, 999 }, 10 }, /*FRACAVE  */
-    { { 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2 }, 10 }, /*RANDOM_V */
-    { { 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40 }, 3 }, /*OVAL     */
-    { { 1, 6, 12, 18, 24, 30, 36, 42, 48, 54, 60 }, 10 }, /*CRYPT    */
-    { { 0, 0, 1, 1, 1, 2, 3, 4, 5, 6, 8 }, 20 }, /*TRAP_PIT */
-    { { 0, 0, 1, 1, 1, 2, 3, 4, 5, 6, 8 }, 20 }, /*TRAP     */
-    { { 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 2 }, 40 }, /*GLASS    */
-    { { 1, 1, 1, 1, 1, 1, 1, 2, 2, 3, 3 }, 1 }, /*ARCADE   */
-    { { 1, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80 }, 1 }, /*FIX      */
-};
-
-/*! 部屋の生成処理順 / Build rooms in descending order of difficulty. */
-static byte room_build_order[ROOM_T_MAX] = {
-    ROOM_T_GREATER_VAULT,
-    ROOM_T_ARCADE,
-    ROOM_T_RANDOM_VAULT,
-    ROOM_T_LESSER_VAULT,
-    ROOM_T_TRAP_PIT,
-    ROOM_T_PIT,
-    ROOM_T_NEST,
-    ROOM_T_TRAP,
-    ROOM_T_GLASS,
-    ROOM_T_INNER_FEAT,
-    ROOM_T_FIXED,
-    ROOM_T_OVAL,
-    ROOM_T_CRYPT,
-    ROOM_T_OVERLAP,
-    ROOM_T_CROSS,
-    ROOM_T_FRACAVE,
-    ROOM_T_NORMAL,
-};
-
-/*!
  * @brief 1マスだけの部屋を作成し、上下左右いずれか一つに隠しドアを配置する。
  * @param player_ptr プレーヤーへの参照ポインタ
  * @param y0 配置したい中心のY座標
index 17d6ac3..5be85d0 100644 (file)
@@ -1,6 +1,5 @@
 #pragma once
 
-#include "room/room-types.h"
 #include "system/angband.h"
 
 #define DUN_ROOMS_MAX 40 /*!< 部屋生成処理の最大試行数 / Number of rooms to attempt (was 50) */
@@ -10,12 +9,6 @@
 
 #define MAX_DOOR_TYPES 3
 
-/* Room type information */
-typedef struct room_info_type {
-    s16b prob[ROOM_T_MAX]; /* Allocation information. */
-    byte min_level; /* Minimum level on which room can appear. */
-} room_info_type;
-
 /* A structure type for doors */
 typedef struct door_type {
     FEAT_IDX open;