OSDN Git Service

[Refactor] #40416 Separated pet-util.h from cmd-pet.h
authorHourier <hourier@users.sourceforge.jp>
Sun, 31 May 2020 12:44:12 +0000 (21:44 +0900)
committerHourier <hourier@users.sourceforge.jp>
Sun, 31 May 2020 12:44:12 +0000 (21:44 +0900)
16 files changed:
Hengband/Hengband/Hengband.vcxproj
Hengband/Hengband/Hengband.vcxproj.filters
src/Makefile.am
src/birth/game-play-initializer.c
src/cmd/cmd-pet.c
src/cmd/cmd-pet.h
src/floor/floor-save.c
src/io/character-dump.c
src/io/load.c
src/monster/monster-direction.c
src/monster/monster-move.c
src/monster/pet-fall-off.c
src/mspell/mspells2.c
src/pet/pet-util.h [new file with mode: 0644]
src/player/player-status.c
src/spell/spells2.c

index 4f5db61..f76c457 100644 (file)
     <ClInclude Include="..\..\src\mind\samurai-slaying.h" />\r
     <ClInclude Include="..\..\src\mind\surprise-attack.h" />\r
     <ClInclude Include="..\..\src\monster\pet-fall-off.h" />\r
+    <ClInclude Include="..\..\src\pet\pet-util.h" />\r
     <ClInclude Include="..\..\src\mspell\assign-monster-spell.h" />\r
     <ClInclude Include="..\..\src\mspell\mspell-floor.h" />\r
     <ClInclude Include="..\..\src\mspell\mspell-particularity.h" />\r
index deb322c..158e7cd 100644 (file)
     <ClInclude Include="..\..\src\monster\pet-fall-off.h">
       <Filter>monster</Filter>
     </ClInclude>
+    <ClInclude Include="..\..\src\pet\pet-util.h">
+      <Filter>pet</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <None Include="..\..\src\wall.bmp" />
     <Filter Include="util">
       <UniqueIdentifier>{d9907626-9c01-48b8-89da-065f7b8540b5}</UniqueIdentifier>
     </Filter>
+    <Filter Include="pet">
+      <UniqueIdentifier>{7c81caa7-dbd8-43f3-8481-9a2ae3967776}</UniqueIdentifier>
+    </Filter>
   </ItemGroup>
   <ItemGroup>
     <ResourceCompile Include="..\..\src\angband.rc" />
index 9e79a1f..ee32b8e 100644 (file)
@@ -188,6 +188,8 @@ hengband_SOURCES = \
        monster/horror-descriptions.c monster/horror-descriptions.h \
        monster/pet-fall-off.c monster/pet-fall-off.h \
        \
+       pet/pet-util.h \
+       \
        mutation/mutation.c mutation/mutation.h \
        mutation/mutation-processor.c mutation/mutation-processor.h \
        \
@@ -409,8 +411,8 @@ COMPILE = $(srcdir)/gcc-wrap $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
        $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) \
        -Iautopick -Ibirth -Icmd -Icombat -Icore -Idungeon -Ieffect -Ifloor \
        -Igrid -Iinventory -Iio -Iknowledge -Imarket -Imind -Imonster -Imspell \
-       -Imutation -Iobject -Iplayer -Irealm -Iroom -Ispell -Isystem -Iterm -Iutil \
-       -Iview -Iwizard -Iworld
+       -Imutation -Iobject -Ipet -Iplayer -Irealm -Iroom -Ispell -Isystem -Iterm \
+       -Iutil -Iview -Iwizard -Iworld
 
 install-exec-hook:
 if SET_GID
index 01a12a1..2152196 100644 (file)
@@ -7,7 +7,7 @@
 #include "dungeon/dungeon.h"
 #include "dungeon/dungeon-file.h"
 #include "object/artifact.h"
-#include "cmd/cmd-pet.h"
+#include "pet/pet-util.h"
 #include "system/system-variables.h"
 #include "player/player-races-table.h"
 #include "market/arena.h"
index 6f91bf4..5ca5311 100644 (file)
@@ -22,6 +22,7 @@
 #include "world/world.h"
 #include "effect/spells-effect-util.h"
 #include "cmd/cmd-attack.h"
+#include "pet/pet-util.h"
 
 int total_friends = 0;
 
index 3aeae0d..2a65c2d 100644 (file)
@@ -2,47 +2,9 @@
 
 #include "grid/grid.h"
 
-extern bool do_cmd_riding(player_type *creature_ptr, bool force);
-extern void do_cmd_pet_dismiss(player_type *creature_pt);
-extern void do_cmd_pet(player_type *creature_ptr);
-extern bool player_can_ride_aux(player_type *creature_ptr, grid_type *g_ptr, bool now_riding);
-
 extern int total_friends;
 
-/*
- * ペットに関するコマンド群 / Pet Commands
- */
-#define PET_DISMISS                            1  /*!< ペットに関するコマンド: ペットを離す */
-#define PET_TARGET                             2  /*!< ペットに関するコマンド: ペットのターゲットを指定 */
-#define PET_STAY_CLOSE                 3  /*!< ペットに関するコマンド: 近くにいろ */
-#define PET_FOLLOW_ME                  4  /*!< ペットに関するコマンド: ついて来い */
-#define PET_SEEK_AND_DESTROY   5  /*!< ペットに関するコマンド: 敵を見つけて倒せ */
-#define PET_ALLOW_SPACE                        6  /*!< ペットに関するコマンド: 少し離れていろ */
-#define PET_STAY_AWAY                  7  /*!< ペットに関するコマンド: 離れていろ */
-#define PET_OPEN_DOORS                 8  /*!< ペットに関するコマンド: ドア解放の許可 */
-#define PET_TAKE_ITEMS                 9  /*!< ペットに関するコマンド: アイテム取得の許可 */
-#define PET_TELEPORT                   10 /*!< ペットに関するコマンド: テレポートの許可 */
-#define PET_ATTACK_SPELL               11 /*!< ペットに関するコマンド: 攻撃魔法の許可 */
-#define PET_SUMMON_SPELL               12 /*!< ペットに関するコマンド: 召喚魔法の許可 */
-#define PET_BALL_SPELL                 13 /*!< ペットに関するコマンド: プレイヤーを魔法に巻き込む許可 */
-#define PET_RIDING                             14 /*!< ペットに関するコマンド: ペットに乗る */
-#define PET_NAME                               15 /*!< ペットに関するコマンド: ペットに名前をつける */
-#define PET_TWO_HANDS                  16 /*!< ペットに関するコマンド: 騎乗中に両手で武器を使うかどうか */
-
- /*
-  * Follow distances
-  */
-#define PET_CLOSE_DIST                 1               /*!<ペットの行動範囲…近くにいろ */
-#define PET_FOLLOW_DIST                        6               /*!<ペットの行動範囲…ついて来い */
-#define PET_SEEK_DIST                  10              /*!<ペットの行動範囲…特になし? */
-#define PET_DESTROY_DIST               255             /*!<ペットの行動範囲…敵を見つけて倒せ */
-#define PET_SPACE_DIST                 (-10)   /*!<ペットの行動範囲…少し離れていろ */
-#define PET_AWAY_DIST                  (-25)   /*!<ペットの行動範囲…離れていろ */
-
-#define PF_OPEN_DOORS                  0x0001 /*!< ペットの行動許可…ドアを開けてよい */
-#define PF_PICKUP_ITEMS                        0x0002 /*!< ペットの行動許可…アイテムを拾ってよい */
-#define PF_TELEPORT                            0x0004 /*!< ペットの行動許可…テレポート魔法を使ってよい */
-#define PF_ATTACK_SPELL                        0x0008 /*!< ペットの行動許可…攻撃魔法を使ってよい */
-#define PF_SUMMON_SPELL                        0x0010 /*!< ペットの行動許可…召喚魔法を使ってよい */
-#define PF_BALL_SPELL                  0x0020 /*!< ペットの行動許可…ボール魔法でプレイヤーを巻き込んでよい */
-#define PF_TWO_HANDS                   0x0040 /*!< プレイヤーの騎乗フラグ…武器を片手で持つ */
+bool do_cmd_riding(player_type *creature_ptr, bool force);
+void do_cmd_pet_dismiss(player_type *creature_pt);
+void do_cmd_pet(player_type *creature_ptr);
+bool player_can_ride_aux(player_type *creature_ptr, grid_type *g_ptr, bool now_riding);
index e983003..c2cdb74 100644 (file)
@@ -32,7 +32,7 @@
 #include "monster/monster-status.h"
 #include "object/object2.h"
 #include "object/object-hook.h"
-#include "cmd-pet.h"
+#include "pet/pet-util.h"
 #include "cmd-basic.h"
 #include "io/uid-checker.h"
 #include "io/files-util.h"
index bd0a62d..b09c1c6 100644 (file)
@@ -5,7 +5,7 @@
 #include "floor/floor-town.h"
 #include "dungeon/dungeon.h"
 #include "store/store.h"
-#include "cmd/cmd-pet.h"
+#include "pet/pet-util.h"
 #include "monster/monster-status.h"
 #include "core/sort.h"
 #include "dungeon/quest.h"
index c8e9d6e..39d3c6f 100644 (file)
@@ -70,7 +70,7 @@
 #include "floor/floor-town.h"
 #include "grid/grid.h"
 
-#include "cmd-pet.h"
+#include "pet/pet-util.h"
 #include "dungeon/dungeon-file.h"
 #include "io/uid-checker.h"
 #include "io/files-util.h"
index 1deb1b8..ee2b4af 100644 (file)
@@ -9,7 +9,7 @@
 #include "monster/monster-sweep-grid.h"
 #include "monster/monster-util.h"
 #include "monster/monster-status.h"
-#include "cmd/cmd-pet.h"
+#include "pet/pet-util.h"
 
 /*!
  * @brief ペットが敵に接近するための方向を決定する
index cf92503..fd69d32 100644 (file)
@@ -8,7 +8,7 @@
 #include "monster/monster-attack.h"
 #include "monster/monster-object.h"
 #include "monster/monster-update.h"
-#include "cmd/cmd-pet.h"
+#include "pet/pet-util.h"
 #include "monster/creature.h"
 #include "io/files-util.h"
 #include "monster/monster-status.h"
index b74a742..ab163fb 100644 (file)
@@ -1,8 +1,9 @@
 #include "monster/pet-fall-off.h"
+#include "cmd/cmd-pet.h" // 暫定、player_can_ride_aux() を移動する
 #include "core/stuff-handler.h"
-#include "cmd/cmd-pet.h" // 暫定、定数を見ているだけなのでutilへの分離を検討する.
 #include "floor/floor.h"
 #include "io/targeting.h"
+#include "pet/pet-util.h"
 #include "player/player-damage.h"
 #include "player/player-move.h"
 #include "player/player-skill.h"
index b12cbdb..a79ea48 100644 (file)
@@ -15,7 +15,7 @@
 #include "util/util.h"
 #include "main/sound-definitions-table.h"
 
-#include "cmd-pet.h"
+#include "pet/pet-util.h"
 #include "effect/effect-characteristics.h"
 #include "grid/grid.h"
 #include "dungeon/quest.h"
diff --git a/src/pet/pet-util.h b/src/pet/pet-util.h
new file mode 100644 (file)
index 0000000..8ac500c
--- /dev/null
@@ -0,0 +1,39 @@
+#pragma once
+
+typedef enum pet_command {
+       PET_DISMISS = 1, /*!< ペットに関するコマンド: ペットを離す */
+    PET_TARGET = 2, /*!< ペットに関するコマンド: ペットのターゲットを指定 */
+    PET_STAY_CLOSE = 3, /*!< ペットに関するコマンド: 近くにいろ */
+    PET_FOLLOW_ME = 4, /*!< ペットに関するコマンド: ついて来い */
+    PET_SEEK_AND_DESTROY = 5, /*!< ペットに関するコマンド: 敵を見つけて倒せ */
+    PET_ALLOW_SPACE = 6, /*!< ペットに関するコマンド: 少し離れていろ */
+    PET_STAY_AWAY = 7, /*!< ペットに関するコマンド: 離れていろ */
+    PET_OPEN_DOORS = 8, /*!< ペットに関するコマンド: ドア解放の許可 */
+    PET_TAKE_ITEMS = 9, /*!< ペットに関するコマンド: アイテム取得の許可 */
+    PET_TELEPORT = 10, /*!< ペットに関するコマンド: テレポートの許可 */
+    PET_ATTACK_SPELL = 11, /*!< ペットに関するコマンド: 攻撃魔法の許可 */
+    PET_SUMMON_SPELL = 12, /*!< ペットに関するコマンド: 召喚魔法の許可 */
+    PET_BALL_SPELL = 13, /*!< ペットに関するコマンド: プレイヤーを魔法に巻き込む許可 */
+    PET_RIDING = 14, /*!< ペットに関するコマンド: ペットに乗る */
+    PET_NAME = 15, /*!< ペットに関するコマンド: ペットに名前をつける */
+    PET_TWO_HANDS = 16, /*!< ペットに関するコマンド: 騎乗中に両手で武器を使うかどうか */
+} pet_command;
+
+typedef enum pet_follow_distance {
+    PET_CLOSE_DIST = 1, /*!<ペットの行動範囲…近くにいろ */
+    PET_FOLLOW_DIST = 6, /*!<ペットの行動範囲…ついて来い */
+    PET_SEEK_DIST = 10, /*!<ペットの行動範囲…特になし? */
+    PET_DESTROY_DIST = 255, /*!<ペットの行動範囲…敵を見つけて倒せ */
+    PET_SPACE_DIST = -10, /*!<ペットの行動範囲…少し離れていろ */
+    PET_AWAY_DIST = -25, /*!<ペットの行動範囲…離れていろ */
+} pet_follow_distance;
+
+typedef enum pet_permission {
+    PF_OPEN_DOORS = 0x0001, /*!< ペットの行動許可…ドアを開けてよい */
+    PF_PICKUP_ITEMS = 0x0002, /*!< ペットの行動許可…アイテムを拾ってよい */
+    PF_TELEPORT = 0x0004, /*!< ペットの行動許可…テレポート魔法を使ってよい */
+    PF_ATTACK_SPELL = 0x0008, /*!< ペットの行動許可…攻撃魔法を使ってよい */
+    PF_SUMMON_SPELL = 0x0010, /*!< ペットの行動許可…召喚魔法を使ってよい */
+    PF_BALL_SPELL = 0x0020, /*!< ペットの行動許可…ボール魔法でプレイヤーを巻き込んでよい */
+    PF_TWO_HANDS = 0x0040, /*!< プレイヤーの騎乗フラグ…武器を片手で持つ */
+} pet_permission;
index 5bc3ba8..706b0fa 100644 (file)
@@ -37,6 +37,7 @@
 #include "realm/realm-hex.h"
 #include "realm/realm-song.h"
 #include "cmd/cmd-pet.h"
+#include "pet/pet-util.h"
 #include "cmd/cmd-spell.h"
 #include "dungeon/dungeon.h"
 #include "object/object-kind.h"
index 59be051..149b287 100644 (file)
@@ -22,6 +22,7 @@
 #include "object/artifact.h"
 #include "io/write-diary.h"
 #include "cmd/cmd-pet.h"
+#include "pet/pet-util.h"
 #include "monster/pet-fall-off.h"
 #include "cmd/cmd-dump.h"
 #include "effect/effect-characteristics.h"