• R/O
  • HTTP
  • SSH
  • HTTPS

hengband: Commit

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


Commit MetaInfo

Revision37da4d5af7e483c54c24d90a25d084b5ac760472 (tree)
Time2019-06-12 07:55:32
Authordeskull <deskull@user...>
Commiterdeskull

Log Message

[Refactor] #39076 冗長なコメントを削除しつつ、 OBJECT_IS_VALID() マクロに置換。

Change Summary

Incremental Difference

--- a/src/core.c
+++ b/src/core.c
@@ -2908,8 +2908,7 @@ static void process_world_aux_recharge(void)
29082908 {
29092909 object_type *o_ptr = &current_floor_ptr->o_list[i];
29102910
2911- /* Skip dead objects */
2912- if (!o_ptr->k_idx) continue;
2911+ if (!OBJECT_IS_VALID(o_ptr)) continue;
29132912
29142913 /* Recharge rods on the ground. No messages. */
29152914 if ((o_ptr->tval == TV_ROD) && (o_ptr->timeout))
--- a/src/floor-events.c
+++ b/src/floor-events.c
@@ -40,7 +40,6 @@ void day_break()
4040 /* Hack -- Memorize lit grids if allowed */
4141 if (view_perma_grids) g_ptr->info |= (CAVE_MARK);
4242
43- /* Hack -- Notice spot */
4443 note_spot(y, x);
4544 }
4645 }
@@ -85,13 +84,11 @@ void night_falls(void)
8584 /* Forget the normal floor grid */
8685 g_ptr->info &= ~(CAVE_MARK);
8786
88- /* Hack -- Notice spot */
8987 note_spot(y, x);
9088 }
9189 }
9290 }
9391
94- /* Glow deep lava and building entrances */
9592 glow_deep_lava_and_bldg();
9693 }
9794 }
@@ -205,8 +202,7 @@ byte get_dungeon_feeling(void)
205202 object_kind *k_ptr = &k_info[o_ptr->k_idx];
206203 int delta = 0;
207204
208- /* Skip dead objects */
209- if (!o_ptr->k_idx) continue;
205+ if (!OBJECT_IS_VALID(o_ptr)) continue;
210206
211207 /* Skip known objects */
212208 if (object_is_known(o_ptr))
--- a/src/floor-save.c
+++ b/src/floor-save.c
@@ -677,8 +677,7 @@ static void update_unique_artifact(s16b cur_floor_id)
677677 {
678678 object_type *o_ptr = &current_floor_ptr->o_list[i];
679679
680- /* Skip dead objects */
681- if (!o_ptr->k_idx) continue;
680+ if (!OBJECT_IS_VALID(o_ptr)) continue;
682681
683682 /* Memorize location of the artifact */
684683 if (object_is_fixed_artifact(o_ptr))
@@ -930,8 +929,7 @@ void leave_floor(void)
930929 {
931930 object_type *o_ptr = &p_ptr->inventory_list[i];
932931
933- /* Skip dead objects */
934- if (!o_ptr->k_idx) continue;
932+ if (!OBJECT_IS_VALID(o_ptr)) continue;
935933
936934 /* Delete old memorized location of the artifact */
937935 if (object_is_fixed_artifact(o_ptr))
@@ -1254,8 +1252,7 @@ void change_floor(void)
12541252 {
12551253 object_type *o_ptr = &current_floor_ptr->o_list[i];
12561254
1257- /* Skip dead objects */
1258- if (!o_ptr->k_idx) continue;
1255+ if (!OBJECT_IS_VALID(o_ptr)) continue;
12591256
12601257 /* Ignore non-artifact */
12611258 if (!object_is_fixed_artifact(o_ptr)) continue;
--- a/src/object-hook.h
+++ b/src/object-hook.h
@@ -68,6 +68,8 @@ extern bool object_is_quest_target(object_type *o_ptr);
6868 */
6969 #define object_is_known(T) (((T)->ident & (IDENT_KNOWN)) || (k_info[(T)->k_idx].easy_know && k_info[(T)->k_idx].aware))
7070
71+#define OBJECT_IS_VALID(T) ((T)->k_idx != 0)
72+
7173 /*
7274 * Artifacts use the "name1" field
7375 */
--- a/src/object2.c
+++ b/src/object2.c
@@ -344,8 +344,7 @@ void compact_objects(int size)
344344 {
345345 o_ptr = &current_floor_ptr->o_list[i];
346346
347- /* Skip dead objects */
348- if (!o_ptr->k_idx) continue;
347+ if (!OBJECT_IS_VALID(o_ptr)) continue;
349348
350349 /* Hack -- High level objects start out "immune" */
351350 if (k_info[o_ptr->k_idx].level > cur_lev) continue;
@@ -430,8 +429,7 @@ void wipe_o_list(void)
430429 {
431430 object_type *o_ptr = &current_floor_ptr->o_list[i];
432431
433- /* Skip dead objects */
434- if (!o_ptr->k_idx) continue;
432+ if (!OBJECT_IS_VALID(o_ptr)) continue;
435433
436434 /* Mega-Hack -- preserve artifacts */
437435 if (!current_world_ptr->character_dungeon || preserve_mode)
--- a/src/spells-floor.c
+++ b/src/spells-floor.c
@@ -11,6 +11,7 @@
1111 #include "player-effects.h"
1212 #include "feature.h"
1313 #include "view-mainwindow.h"
14+#include "object-hook.h"
1415
1516 /*
1617 * Light up the dungeon using "clairvoyance"
@@ -40,8 +41,7 @@ void wiz_lite(bool ninja)
4041 {
4142 object_type *o_ptr = &current_floor_ptr->o_list[i];
4243
43- /* Skip dead objects */
44- if (!o_ptr->k_idx) continue;
44+ if (!OBJECT_IS_VALID(o_ptr)) continue;
4545
4646 /* Skip held objects */
4747 if (o_ptr->held_m_idx) continue;
@@ -157,8 +157,7 @@ void wiz_dark(void)
157157 {
158158 object_type *o_ptr = &current_floor_ptr->o_list[i];
159159
160- /* Skip dead objects */
161- if (!o_ptr->k_idx) continue;
160+ if (!OBJECT_IS_VALID(o_ptr)) continue;
162161
163162 /* Skip held objects */
164163 if (o_ptr->held_m_idx) continue;
--- a/src/spells2.c
+++ b/src/spells2.c
@@ -207,8 +207,7 @@ bool detect_objects_gold(POSITION range)
207207 {
208208 object_type *o_ptr = &current_floor_ptr->o_list[i];
209209
210- /* Skip dead objects */
211- if (!o_ptr->k_idx) continue;
210+ if (!OBJECT_IS_VALID(o_ptr)) continue;
212211
213212 /* Skip held objects */
214213 if (o_ptr->held_m_idx) continue;
@@ -262,8 +261,7 @@ bool detect_objects_normal(POSITION range)
262261 {
263262 object_type *o_ptr = &current_floor_ptr->o_list[i];
264263
265- /* Skip dead objects */
266- if (!o_ptr->k_idx) continue;
264+ if (!OBJECT_IS_VALID(o_ptr)) continue;
267265
268266 /* Skip held objects */
269267 if (o_ptr->held_m_idx) continue;
@@ -325,8 +323,7 @@ bool detect_objects_magic(POSITION range)
325323 {
326324 object_type *o_ptr = &current_floor_ptr->o_list[i];
327325
328- /* Skip dead objects */
329- if (!o_ptr->k_idx) continue;
326+ if (!OBJECT_IS_VALID(o_ptr)) continue;
330327
331328 /* Skip held objects */
332329 if (o_ptr->held_m_idx) continue;
Show on old repository browser