• R/O
  • HTTP
  • SSH
  • HTTPS

hengband: Commit

変愚蛮怒のメインリポジトリです


Commit MetaInfo

Revisionb6aa5f0bc7bb9daafc97f5d1a390af75a198a63a (tree)
Time2019-05-01 13:46:53
Authordeskull <deskull@user...>
Commiterdeskull

Log Message

[Refactor] #37353 grid_type 構造体を grid.h に移動.

Change Summary

Incremental Difference

--- a/src/artifact.c
+++ b/src/artifact.c
@@ -25,6 +25,7 @@
2525 #include "object-hook.h"
2626 #include "spells-object.h"
2727 #include "files.h"
28+#include "grid.h"
2829
2930 /*
3031 * The artifact arrays
--- a/src/chest.c
+++ b/src/chest.c
@@ -8,6 +8,7 @@
88 #include "trap.h"
99 #include "player-status.h"
1010 #include "player-effects.h"
11+#include "grid.h"
1112
1213 /*!
1314 * @brief 箱からアイテムを引き出す /
--- a/src/cmd-activate.c
+++ b/src/cmd-activate.c
@@ -27,6 +27,7 @@
2727 #include "monster-status.h"
2828 #include "files.h"
2929 #include "objectkind.h"
30+#include "grid.h"
3031
3132 /*!
3233 * @brief アイテムの発動効果テーブル /
--- a/src/cmd-pet.h
+++ b/src/cmd-pet.h
@@ -1,4 +1,7 @@
1-extern bool do_riding(bool force);
1+#pragma once
2+#include "grid.h"
3+
4+extern bool do_riding(bool force);
25 extern PERCENTAGE calculate_upkeep(void);
36 extern void do_cmd_pet_dismiss(void);
47 extern void do_cmd_pet(void);
--- a/src/externs.h
+++ b/src/externs.h
@@ -13,6 +13,7 @@
1313 * (z-virt.h, z-util.h, z-form.h, term.h, random.h)
1414 */
1515 #include "geometry.h"
16+#include "grid.h"
1617 #include "floor-save.h"
1718
1819 /*
--- a/src/floor.h
+++ b/src/floor.h
@@ -1,6 +1,7 @@
11 #pragma once
22
33 #include "feature.h"
4+#include "grid.h"
45
56 typedef struct {
67 grid_type *grid_array[MAX_HGT];
--- a/src/grid.h
+++ b/src/grid.h
@@ -1,4 +1,6 @@
1-/*!
1+#pragma once
2+
3+/*!
24 * @file grid.h
35 * @brief ダンジョンの生成処理の基幹部分ヘッダーファイル
46 * @date 2014/08/15
@@ -12,6 +14,57 @@
1214 * included in all such copies.
1315 */
1416
17+
18+ /*
19+ * A single "grid" in a Cave
20+ *
21+ * Note that several aspects of the code restrict the actual current_floor_ptr->grid_array
22+ * to a max size of 256 by 256. In partcular, locations are often
23+ * saved as bytes, limiting each coordinate to the 0-255 range.
24+ *
25+ * The "o_idx" and "m_idx" fields are very interesting. There are
26+ * many places in the code where we need quick access to the actual
27+ * monster or object(s) in a given grid. The easiest way to
28+ * do this is to simply keep the index of the monster and object
29+ * (if any) with the grid, but this takes 198*66*4 bytes of memory.
30+ * Several other methods come to mind, which require only half this
31+ * amound of memory, but they all seem rather complicated, and would
32+ * probably add enough code that the savings would be lost. So for
33+ * these reasons, we simply store an index into the "o_list" and
34+ * "current_floor_ptr->m_list" arrays, using "zero" when no monster/object is present.
35+ *
36+ * Note that "o_idx" is the index of the top object in a stack of
37+ * objects, using the "next_o_idx" field of objects (see below) to
38+ * create the singly linked list of objects. If "o_idx" is zero
39+ * then there are no objects in the grid.
40+ *
41+ * Note the special fields for the "MONSTER_FLOW" code.
42+ */
43+
44+typedef struct grid_type grid_type;
45+
46+struct grid_type
47+{
48+ BIT_FLAGS info; /* Hack -- current_floor_ptr->grid_array flags */
49+
50+ FEAT_IDX feat; /* Hack -- feature type */
51+ OBJECT_IDX o_idx; /* Object in this grid */
52+ MONSTER_IDX m_idx; /* Monster in this grid */
53+
54+ /*! 地形の特別な情報を保存する / Special current_floor_ptr->grid_array info
55+ * 具体的な使用一覧はクエスト行き階段の移行先クエストID、
56+ * 各ダンジョン入口の移行先ダンジョンID、
57+ *
58+ */
59+ s16b special;
60+
61+ FEAT_IDX mimic; /* Feature to mimic */
62+
63+ byte cost; /* Hack -- cost of flowing */
64+ byte dist; /* Hack -- distance from player */
65+ byte when; /* Hack -- when cost was computed */
66+};
67+
1568 /* Macros */
1669
1770 #define set_cave_feat(Y,X,F) (current_floor_ptr->grid_array[(Y)][(X)].feat = (F))
--- a/src/types.h
+++ b/src/types.h
@@ -530,58 +530,6 @@ struct monster_race
530530 u32b r_flagsr; /* Observed racial resistance flags */
531531 };
532532
533-
534-/*
535- * A single "grid" in a Cave
536- *
537- * Note that several aspects of the code restrict the actual current_floor_ptr->grid_array
538- * to a max size of 256 by 256. In partcular, locations are often
539- * saved as bytes, limiting each coordinate to the 0-255 range.
540- *
541- * The "o_idx" and "m_idx" fields are very interesting. There are
542- * many places in the code where we need quick access to the actual
543- * monster or object(s) in a given grid. The easiest way to
544- * do this is to simply keep the index of the monster and object
545- * (if any) with the grid, but this takes 198*66*4 bytes of memory.
546- * Several other methods come to mind, which require only half this
547- * amound of memory, but they all seem rather complicated, and would
548- * probably add enough code that the savings would be lost. So for
549- * these reasons, we simply store an index into the "o_list" and
550- * "current_floor_ptr->m_list" arrays, using "zero" when no monster/object is present.
551- *
552- * Note that "o_idx" is the index of the top object in a stack of
553- * objects, using the "next_o_idx" field of objects (see below) to
554- * create the singly linked list of objects. If "o_idx" is zero
555- * then there are no objects in the grid.
556- *
557- * Note the special fields for the "MONSTER_FLOW" code.
558- */
559-
560-typedef struct grid_type grid_type;
561-
562-struct grid_type
563-{
564- BIT_FLAGS info; /* Hack -- current_floor_ptr->grid_array flags */
565-
566- FEAT_IDX feat; /* Hack -- feature type */
567- OBJECT_IDX o_idx; /* Object in this grid */
568- MONSTER_IDX m_idx; /* Monster in this grid */
569-
570- /*! 地形の特別な情報を保存する / Special current_floor_ptr->grid_array info
571- * 具体的な使用一覧はクエスト行き階段の移行先クエストID、
572- * 各ダンジョン入口の移行先ダンジョンID、
573- *
574- */
575- s16b special;
576-
577- FEAT_IDX mimic; /* Feature to mimic */
578-
579- byte cost; /* Hack -- cost of flowing */
580- byte dist; /* Hack -- distance from player */
581- byte when; /* Hack -- when cost was computed */
582-};
583-
584-
585533 /*
586534 * Object information, for a specific object.
587535 *
Show on old repository browser