• R/O
  • HTTP
  • SSH
  • HTTPS

hengband: Commit

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


Commit MetaInfo

Revision2f2336064ec491d528430b302e2207ddbab3199f (tree)
Time2019-02-22 22:16:39
Authordeskull <deskull@user...>
Commiterdeskull

Log Message

[Refactor] #37353 feature.c/h 追加。 / Add feature.c/h.

Change Summary

Incremental Difference

--- a/Hengband_vcs2017/Hengband/Hengband.vcxproj
+++ b/Hengband_vcs2017/Hengband/Hengband.vcxproj
@@ -146,6 +146,7 @@
146146 <ClCompile Include="..\..\src\cmd-pet.c" />
147147 <ClCompile Include="..\..\src\cmd-quaff.c" />
148148 <ClCompile Include="..\..\src\cmd-read.c" />
149+ <ClCompile Include="..\..\src\feature.c" />
149150 <ClCompile Include="..\..\src\floor-events.c" />
150151 <ClCompile Include="..\..\src\floor-generate.c" />
151152 <ClCompile Include="..\..\src\floor-save.c" />
@@ -275,6 +276,7 @@
275276 <ClInclude Include="..\..\src\cmd-usestaff.h" />
276277 <ClInclude Include="..\..\src\defines.h" />
277278 <ClInclude Include="..\..\src\externs.h" />
279+ <ClInclude Include="..\..\src\feature.h" />
278280 <ClInclude Include="..\..\src\floor-events.h" />
279281 <ClInclude Include="..\..\src\floor.h" />
280282 <ClInclude Include="..\..\src\gameoption.h" />
--- a/src/cmd2.c
+++ b/src/cmd2.c
@@ -26,6 +26,8 @@
2626 #include "realm-hex.h"
2727 #include "geometry.h"
2828 #include "wild.h"
29+#include "grid.h"
30+#include "feature.h"
2931
3032 /*!
3133 * @brief フロア脱出時に出戻りが不可能だった場合に警告を加える処理
--- a/src/externs.h
+++ b/src/externs.h
@@ -464,12 +464,9 @@ extern void get_height_weight(void);
464464 extern void player_outfit(void);
465465 extern void dump_yourself(FILE *fff);
466466
467+
467468 /* grids.c */
468469 extern POSITION distance(POSITION y1, POSITION x1, POSITION y2, POSITION x2);
469-extern bool is_trap(FEAT_IDX feat);
470-extern bool is_known_trap(grid_type *g_ptr);
471-extern bool is_closed_door(FEAT_IDX feat);
472-extern bool is_hidden_door(grid_type *g_ptr);
473470 extern bool los(POSITION y1, POSITION x1, POSITION y2, POSITION x2);
474471 extern void update_local_illumination(POSITION y, POSITION x);
475472 extern bool player_can_see_bold(POSITION y, POSITION x);
--- /dev/null
+++ b/src/feature.c
@@ -0,0 +1,27 @@
1+#include "angband.h"
2+#include "feature.h"
3+
4+
5+/*!
6+ * @brief 地形が罠持ちであるかの判定を行う。 / Return TRUE if the given feature is a trap
7+ * @param feat 地形情報のID
8+ * @return 罠持ちの地形ならばTRUEを返す。
9+ */
10+bool is_trap(FEAT_IDX feat)
11+{
12+ return have_flag(f_info[feat].flags, FF_TRAP);
13+}
14+
15+/*!
16+ * @brief 地形が閉じたドアであるかの判定を行う。 / Return TRUE if the given grid is a closed door
17+ * @param feat 地形情報のID
18+ * @return 閉じたドアのある地形ならばTRUEを返す。
19+ */
20+bool is_closed_door(FEAT_IDX feat)
21+{
22+ feature_type *f_ptr = &f_info[feat];
23+
24+ return (have_flag(f_ptr->flags, FF_OPEN) || have_flag(f_ptr->flags, FF_BASH)) &&
25+ !have_flag(f_ptr->flags, FF_MOVE);
26+}
27+
--- /dev/null
+++ b/src/feature.h
@@ -0,0 +1,3 @@
1+#pragma once
2+extern bool is_closed_door(FEAT_IDX feat);
3+extern bool is_trap(FEAT_IDX feat);
--- a/src/floor-streams.c
+++ b/src/floor-streams.c
@@ -19,6 +19,7 @@
1919 #include "generate.h"
2020 #include "floor-streams.h"
2121 #include "grid.h"
22+#include "feature.h"
2223
2324
2425 /*!
--- a/src/grid.c
+++ b/src/grid.c
@@ -27,6 +27,7 @@
2727 #include "rooms.h"
2828 #include "monster.h"
2929 #include "quest.h"
30+#include "feature.h"
3031
3132 static byte display_autopick; /*!< 自動拾い状態の設定フラグ */
3233 static int match_autopick;
@@ -831,15 +832,6 @@ POSITION distance(POSITION y1, POSITION x1, POSITION y2, POSITION x2)
831832 return d;
832833 }
833834
834-/*!
835- * @brief 地形が罠持ちであるかの判定を行う。 / Return TRUE if the given feature is a trap
836- * @param feat 地形情報のID
837- * @return 罠持ちの地形ならばTRUEを返す。
838- */
839-bool is_trap(FEAT_IDX feat)
840-{
841- return have_flag(f_info[feat].flags, FF_TRAP);
842-}
843835
844836 /*!
845837 * @brief マスに看破済みの罠があるかの判定を行う。 / Return TRUE if the given grid is a known trap
@@ -854,18 +846,7 @@ bool is_known_trap(grid_type *g_ptr)
854846 return FALSE;
855847 }
856848
857-/*!
858- * @brief 地形が閉じたドアであるかの判定を行う。 / Return TRUE if the given grid is a closed door
859- * @param feat 地形情報のID
860- * @return 閉じたドアのある地形ならばTRUEを返す。
861- */
862-bool is_closed_door(FEAT_IDX feat)
863-{
864- feature_type *f_ptr = &f_info[feat];
865849
866- return (have_flag(f_ptr->flags, FF_OPEN) || have_flag(f_ptr->flags, FF_BASH)) &&
867- !have_flag(f_ptr->flags, FF_MOVE);
868-}
869850
870851 /*!
871852 * @brief マスに隠されたドアがあるかの判定を行う。 / Return TRUE if the given grid is a hidden closed door
--- a/src/grid.h
+++ b/src/grid.h
@@ -283,3 +283,5 @@ extern bool get_is_floor(POSITION x, POSITION y);
283283 extern void set_floor(POSITION x, POSITION y);
284284 extern void place_bound_perm_wall(grid_type *g_ptr);
285285
286+extern bool is_known_trap(grid_type *g_ptr);
287+extern bool is_hidden_door(grid_type *g_ptr);
--- a/src/mind.c
+++ b/src/mind.c
@@ -23,6 +23,7 @@
2323 #include "spells-status.h"
2424 #include "cmd-spell.h"
2525 #include "spells-floor.h"
26+#include "feature.h"
2627
2728 /*! 特殊技能の一覧テーブル */
2829 mind_power const mind_powers[5] =
--- a/src/monster-process.c
+++ b/src/monster-process.c
@@ -23,6 +23,7 @@
2323 #include "avatar.h"
2424 #include "realm-hex.h"
2525 #include "object-hook.h"
26+#include "feature.h"
2627
2728
2829 /*!
--- a/src/object2.c
+++ b/src/object2.c
@@ -16,6 +16,7 @@
1616 #include "object-curse.h"
1717 #include "artifact.h"
1818 #include "player-status.h"
19+#include "feature.h"
1920
2021 static void one_sustain(object_type *o_ptr);
2122
--- a/src/player-move.c
+++ b/src/player-move.c
@@ -141,12 +141,14 @@
141141
142142 #include "angband.h"
143143 #include "melee.h"
144+#include "grid.h"
144145 #include "trap.h"
145146 #include "projection.h"
146147 #include "quest.h"
147148 #include "artifact.h"
148149 #include "player-status.h"
149150 #include "spells-floor.h"
151+#include "feature.h"
150152
151153
152154
--- a/src/realm-hissatsu.c
+++ b/src/realm-hissatsu.c
@@ -5,6 +5,7 @@
55 #include "projection.h"
66 #include "artifact.h"
77 #include "player-status.h"
8+#include "feature.h"
89
910 /*!
1011 * @brief 剣術の各処理を行う
--- a/src/rooms-special.c
+++ b/src/rooms-special.c
@@ -5,6 +5,7 @@
55 #include "monster.h"
66 #include "monsterrace-hook.h"
77 #include "objectkind-hook.h"
8+#include "feature.h"
89
910
1011 /*!
--- a/src/rooms-vault.c
+++ b/src/rooms-vault.c
@@ -5,6 +5,7 @@
55 #include "store.h"
66 #include "trap.h"
77 #include "monster.h"
8+#include "feature.h"
89
910 /*
1011 * This function creates a random vault that looks like a collection of bubbles.
--- a/src/spells1.c
+++ b/src/spells1.c
@@ -34,6 +34,8 @@
3434 #include "realm-hex.h"
3535 #include "object-hook.h"
3636 #include "term.h"
37+#include "grid.h"
38+#include "feature.h"
3739
3840
3941 static int rakubadam_m; /*!< 振り落とされた際のダメージ量 */
--- a/src/trap.c
+++ b/src/trap.c
@@ -6,6 +6,7 @@
66 #include "spells-summon.h"
77 #include "quest.h"
88 #include "artifact.h"
9+#include "feature.h"
910
1011 static s16b normal_traps[MAX_NORMAL_TRAPS];
1112
Show on old repository browser