• R/O
  • HTTP
  • SSH
  • HTTPS

hengband: Commit

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


Commit MetaInfo

Revisioncb2ee6f16f9e7f62ba1f1b2b54e1ec3dd730c68b (tree)
Time2019-05-01 13:47:08
Authordeskull <deskull@user...>
Commiterdeskull

Log Message

[Refactor] #37353 object_type 構造体を object.h に移動.

Change Summary

Incremental Difference

--- a/src/artifact.c
+++ b/src/artifact.c
@@ -18,6 +18,7 @@
1818 #include "avatar.h"
1919 #include "floor.h"
2020 #include "cmd-activate.h"
21+#include "object.h"
2122 #include "objectkind.h"
2223 #include "object-boost.h"
2324 #include "object-curse.h"
--- a/src/externs.h
+++ b/src/externs.h
@@ -17,6 +17,7 @@
1717 #include "floor-save.h"
1818 #include "monster.h"
1919 #include "monsterrace.h"
20+#include "object.h"
2021
2122 /*
2223 * Automatically generated "variable" declarations
--- a/src/object.h
+++ b/src/object.h
@@ -1,3 +1,88 @@
11 #pragma once
22
3+/*
4+ * Object information, for a specific object.
5+ *
6+ * Note that a "discount" on an item is permanent and never goes away.
7+ *
8+ * Note that inscriptions are now handled via the "quark_str()" function
9+ * applied to the "note" field, which will return NULL if "note" is zero.
10+ *
11+ * Note that "object" records are "copied" on a fairly regular basis,
12+ * and care must be taken when handling such objects.
13+ *
14+ * Note that "object flags" must now be derived from the object kind,
15+ * the artifact and ego-item indexes, and the two "xtra" fields.
16+ *
17+ * Each grid points to one (or zero) objects via the "o_idx"
18+ * field (above). Each object then points to one (or zero) objects
19+ * via the "next_o_idx" field, forming a singly linked list, which
20+ * in game terms, represents a "stack" of objects in the same grid.
21+ *
22+ * Each monster points to one (or zero) objects via the "hold_o_idx"
23+ * field (below). Each object then points to one (or zero) objects
24+ * via the "next_o_idx" field, forming a singly linked list, which
25+ * in game terms, represents a pile of objects held by the monster.
26+ *
27+ * The "held_m_idx" field is used to indicate which monster, if any,
28+ * is holding the object. Objects being held have "ix=0" and "iy=0".
29+ */
30+
31+typedef struct object_type object_type;
32+
33+struct object_type
34+{
35+ KIND_OBJECT_IDX k_idx; /* Kind index (zero if "dead") */
36+
37+ POSITION iy; /* Y-position on map, or zero */
38+ POSITION ix; /* X-position on map, or zero */
39+
40+ OBJECT_TYPE_VALUE tval; /* Item type (from kind) */
41+ OBJECT_SUBTYPE_VALUE sval; /* Item sub-type (from kind) */
42+
43+ PARAMETER_VALUE pval; /* Item extra-parameter */
44+
45+ DISCOUNT_RATE discount; /* Discount (if any) */
46+
47+ ITEM_NUMBER number; /* Number of items */
48+
49+ WEIGHT weight; /* Item weight */
50+
51+ ARTIFACT_IDX name1; /* Artifact type, if any */
52+ EGO_IDX name2; /* Ego-Item type, if any */
53+
54+ XTRA8 xtra1; /* Extra info type (now unused) */
55+ XTRA8 xtra2; /* Extra info activation index */
56+ XTRA8 xtra3; /* Extra info for weaponsmith */
57+ XTRA16 xtra4; /*!< 光源の残り寿命、あるいは捕らえたモンスターの現HP / Extra info fuel or captured monster's current HP */
58+ XTRA16 xtra5; /*!< 捕らえたモンスターの最大HP / Extra info captured monster's max HP */
59+
60+ HIT_PROB to_h; /* Plusses to hit */
61+ HIT_POINT to_d; /* Plusses to damage */
62+ ARMOUR_CLASS to_a; /* Plusses to AC */
63+
64+ ARMOUR_CLASS ac; /* Normal AC */
65+
66+ DICE_NUMBER dd;
67+ DICE_SID ds; /* Damage dice/sides */
68+
69+ TIME_EFFECT timeout; /* Timeout Counter */
70+
71+ byte ident; /* Special flags */
72+ byte marked; /* Object is marked */
73+
74+ u16b inscription; /* Inscription index */
75+ u16b art_name; /* Artifact name (random artifacts) */
76+
77+ byte feeling; /* Game generated inscription number (eg, pseudo-id) */
78+
79+ BIT_FLAGS art_flags[TR_FLAG_SIZE]; /* Extra Flags for ego and artifacts */
80+ BIT_FLAGS curse_flags; /* Flags for curse */
81+
82+ OBJECT_IDX next_o_idx; /* Next object in stack (if any) */
83+ MONSTER_IDX held_m_idx; /* Monster holding us (if any) */
84+
85+ ARTIFACT_BIAS_IDX artifact_bias; /*!< ランダムアーティファクト生成時のバイアスID */
86+};
87+
388 extern int bow_tval_ammo(object_type *o_ptr);
--- a/src/types.h
+++ b/src/types.h
@@ -47,6 +47,8 @@
4747
4848 #include "h-type.h"
4949 #include "defines.h"
50+#include "object.h"
51+
5052 //#include "player-skill.h"
5153
5254
@@ -114,93 +116,6 @@ struct mbe_info_type
114116
115117
116118 /*
117- * Object information, for a specific object.
118- *
119- * Note that a "discount" on an item is permanent and never goes away.
120- *
121- * Note that inscriptions are now handled via the "quark_str()" function
122- * applied to the "note" field, which will return NULL if "note" is zero.
123- *
124- * Note that "object" records are "copied" on a fairly regular basis,
125- * and care must be taken when handling such objects.
126- *
127- * Note that "object flags" must now be derived from the object kind,
128- * the artifact and ego-item indexes, and the two "xtra" fields.
129- *
130- * Each grid points to one (or zero) objects via the "o_idx"
131- * field (above). Each object then points to one (or zero) objects
132- * via the "next_o_idx" field, forming a singly linked list, which
133- * in game terms, represents a "stack" of objects in the same grid.
134- *
135- * Each monster points to one (or zero) objects via the "hold_o_idx"
136- * field (below). Each object then points to one (or zero) objects
137- * via the "next_o_idx" field, forming a singly linked list, which
138- * in game terms, represents a pile of objects held by the monster.
139- *
140- * The "held_m_idx" field is used to indicate which monster, if any,
141- * is holding the object. Objects being held have "ix=0" and "iy=0".
142- */
143-
144-typedef struct object_type object_type;
145-
146-struct object_type
147-{
148- KIND_OBJECT_IDX k_idx; /* Kind index (zero if "dead") */
149-
150- POSITION iy; /* Y-position on map, or zero */
151- POSITION ix; /* X-position on map, or zero */
152-
153- OBJECT_TYPE_VALUE tval; /* Item type (from kind) */
154- OBJECT_SUBTYPE_VALUE sval; /* Item sub-type (from kind) */
155-
156- PARAMETER_VALUE pval; /* Item extra-parameter */
157-
158- DISCOUNT_RATE discount; /* Discount (if any) */
159-
160- ITEM_NUMBER number; /* Number of items */
161-
162- WEIGHT weight; /* Item weight */
163-
164- ARTIFACT_IDX name1; /* Artifact type, if any */
165- EGO_IDX name2; /* Ego-Item type, if any */
166-
167- XTRA8 xtra1; /* Extra info type (now unused) */
168- XTRA8 xtra2; /* Extra info activation index */
169- XTRA8 xtra3; /* Extra info for weaponsmith */
170- XTRA16 xtra4; /*!< 光源の残り寿命、あるいは捕らえたモンスターの現HP / Extra info fuel or captured monster's current HP */
171- XTRA16 xtra5; /*!< 捕らえたモンスターの最大HP / Extra info captured monster's max HP */
172-
173- HIT_PROB to_h; /* Plusses to hit */
174- HIT_POINT to_d; /* Plusses to damage */
175- ARMOUR_CLASS to_a; /* Plusses to AC */
176-
177- ARMOUR_CLASS ac; /* Normal AC */
178-
179- DICE_NUMBER dd;
180- DICE_SID ds; /* Damage dice/sides */
181-
182- TIME_EFFECT timeout; /* Timeout Counter */
183-
184- byte ident; /* Special flags */
185- byte marked; /* Object is marked */
186-
187- u16b inscription; /* Inscription index */
188- u16b art_name; /* Artifact name (random artifacts) */
189-
190- byte feeling; /* Game generated inscription number (eg, pseudo-id) */
191-
192- BIT_FLAGS art_flags[TR_FLAG_SIZE]; /* Extra Flags for ego and artifacts */
193- BIT_FLAGS curse_flags; /* Flags for curse */
194-
195- OBJECT_IDX next_o_idx; /* Next object in stack (if any) */
196- MONSTER_IDX held_m_idx; /* Monster holding us (if any) */
197-
198- ARTIFACT_BIAS_IDX artifact_bias; /*!< ランダムアーティファクト生成時のバイアスID */
199-};
200-
201-
202-
203-/*
204119 * An entry for the object/monster allocation functions
205120 *
206121 * Pass 1 is determined from allocation information
Show on old repository browser