OSDN Git Service

[Refactor] #40634 Separated activation-teleport.c/h from activation-others.c/h
authorHourier <hourier@users.sourceforge.jp>
Wed, 19 Aug 2020 09:07:32 +0000 (18:07 +0900)
committerHourier <hourier@users.sourceforge.jp>
Wed, 19 Aug 2020 09:07:32 +0000 (18:07 +0900)
Hengband/Hengband/Hengband.vcxproj
Hengband/Hengband/Hengband.vcxproj.filters
src/Makefile.am
src/object-activation/activation-others.c
src/object-activation/activation-others.h
src/object-activation/activation-switcher.c
src/object-activation/activation-teleport.c [new file with mode: 0644]
src/object-activation/activation-teleport.h [new file with mode: 0644]

index ad0064f..d875504 100644 (file)
     <ClCompile Include="..\..\src\object-activation\activation-breath.c" />\r
     <ClCompile Include="..\..\src\object-activation\activation-charm.c" />\r
     <ClCompile Include="..\..\src\object-activation\activation-resistance.c" />\r
+    <ClCompile Include="..\..\src\object-activation\activation-teleport.c" />\r
     <ClCompile Include="..\..\src\object-activation\activation-util.c" />\r
     <ClCompile Include="..\..\src\specific-object\blade-turner.c" />\r
     <ClCompile Include="..\..\src\specific-object\monster-ball.c" />\r
     <ClInclude Include="..\..\src\object-activation\activation-breath.h" />\r
     <ClInclude Include="..\..\src\object-activation\activation-charm.h" />\r
     <ClInclude Include="..\..\src\object-activation\activation-resistance.h" />\r
+    <ClInclude Include="..\..\src\object-activation\activation-teleport.h" />\r
     <ClInclude Include="..\..\src\object-activation\activation-util.h" />\r
     <ClInclude Include="..\..\src\specific-object\blade-turner.h" />\r
     <ClInclude Include="..\..\src\specific-object\monster-ball.h" />\r
index 9d9df9a..ce4af86 100644 (file)
     <ClCompile Include="..\..\src\specific-object\blade-turner.c">
       <Filter>specific-object</Filter>
     </ClCompile>
+    <ClCompile Include="..\..\src\object-activation\activation-teleport.c">
+      <Filter>object-activation</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="..\..\src\combat\shoot.h">
     <ClInclude Include="..\..\src\specific-object\blade-turner.h">
       <Filter>specific-object</Filter>
     </ClInclude>
+    <ClInclude Include="..\..\src\object-activation\activation-teleport.h">
+      <Filter>object-activation</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <None Include="..\..\src\wall.bmp" />
index dc3d9f5..eec62ac 100644 (file)
@@ -544,6 +544,7 @@ hengband_SOURCES = \
        object-activation/activation-others.c object-activation/activation-others.h \
        object-activation/activation-resistance.c object-activation/activation-resistance.h \
        object-activation/activation-switcher.c object-activation/activation-switcher.h \
+       object-activation/activation-teleport.c object-activation/activation-teleport.h \
        \
        object-enchant/activation-info-table.c object-enchant/activation-info-table.h \
        object-enchant/apply-magic.c object-enchant/apply-magic.h \
index 6794b89..4371938 100644 (file)
@@ -60,16 +60,6 @@ bool activate_confusion(player_type *user_ptr)
     return TRUE;
 }
 
-bool activate_teleport_away(player_type *user_ptr)
-{
-    DIRECTION dir;
-    if (!get_aim_dir(user_ptr, &dir))
-        return FALSE;
-
-    (void)fire_beam(user_ptr, GF_AWAY_ALL, dir, user_ptr->lev);
-    return TRUE;
-}
-
 bool activate_banish_evil(player_type *user_ptr)
 {
     if (banish_evil(user_ptr, 100))
@@ -162,61 +152,6 @@ bool activate_unique_detection(player_type *user_ptr)
     return TRUE;
 }
 
-bool activate_escape(player_type *user_ptr)
-{
-    switch (randint1(13)) {
-    case 1:
-    case 2:
-    case 3:
-    case 4:
-    case 5:
-        teleport_player(user_ptr, 10, TELEPORT_SPONTANEOUS);
-        return TRUE;
-    case 6:
-    case 7:
-    case 8:
-    case 9:
-    case 10:
-        teleport_player(user_ptr, 222, TELEPORT_SPONTANEOUS);
-        return TRUE;
-    case 11:
-    case 12:
-        (void)stair_creation(user_ptr);
-        return TRUE;
-    default:
-        if (!get_check(_("\82±\82Ì\8aK\82ð\8b\8e\82è\82Ü\82·\82©\81H", "Leave this level? ")))
-            return TRUE;
-
-        if (autosave_l)
-            do_cmd_save_game(user_ptr, TRUE);
-
-        user_ptr->leaving = TRUE;
-        return TRUE;
-    }
-}
-
-bool activate_teleport_level(player_type *user_ptr)
-{
-    if (!get_check(_("\96{\93\96\82É\91¼\82Ì\8aK\82É\83e\83\8c\83|\81[\83g\82µ\82Ü\82·\82©\81H", "Are you sure? (Teleport Level)")))
-        return FALSE;
-
-    teleport_level(user_ptr, 0);
-    return TRUE;
-}
-
-bool activate_dimension_door(player_type *user_ptr)
-{
-    msg_print(_("\8e\9f\8c³\82Ì\94à\82ª\8aJ\82¢\82½\81B\96Ú\93I\92n\82ð\91I\82ñ\82Å\89º\82³\82¢\81B", "You open a dimensional gate. Choose a destination."));
-    return dimension_door(user_ptr);
-}
-
-bool activate_teleport(player_type *user_ptr)
-{
-    msg_print(_("\8eü\82è\82Ì\8bó\8aÔ\82ª\98c\82ñ\82Å\82¢\82é...", "It twists space around you..."));
-    teleport_player(user_ptr, 100, TELEPORT_SPONTANEOUS);
-    return TRUE;
-}
-
 bool activate_dispel_curse(player_type *user_ptr, concptr name)
 {
     msg_format(_("%s\82ª\90^\8eÀ\82ð\8fÆ\82ç\82µ\8fo\82·...", "The %s exhibits the truth..."), name);
index ae9e12c..53da44a 100644 (file)
@@ -4,7 +4,6 @@
 
 bool activate_sunlight(player_type *user_ptr);
 bool activate_confusion(player_type *user_ptr);
-bool activate_teleport_away(player_type *user_ptr);
 bool activate_banish_evil(player_type *user_ptr);
 bool activate_scare(player_type *user_ptr);
 bool activate_aggravation(player_type *user_ptr, object_type *o_ptr, concptr name);
@@ -12,10 +11,6 @@ bool activate_stone_mud(player_type *user_ptr);
 bool activate_judgement(player_type *user_ptr, concptr name);
 bool activate_telekinesis(player_type *user_ptr, concptr name);
 bool activate_unique_detection(player_type *user_ptr);
-bool activate_escape(player_type *user_ptr);
-bool activate_teleport_level(player_type *user_ptr);
-bool activate_dimension_door(player_type *user_ptr);
-bool activate_teleport(player_type *user_ptr);
 bool activate_dispel_curse(player_type *user_ptr, concptr name);
 bool activate_cure_lw(player_type *user_ptr);
 bool activate_grand_cross(player_type *user_ptr);
index 9fb51d4..ed24c69 100644 (file)
@@ -13,6 +13,7 @@
 #include "object-activation/activation-charm.h"
 #include "object-activation/activation-others.h"
 #include "object-activation/activation-resistance.h"
+#include "object-activation/activation-teleport.h"
 #include "object-enchant/activation-info-table.h"
 #include "player-attack/player-attack.h"
 #include "player/digestion-processor.h"
diff --git a/src/object-activation/activation-teleport.c b/src/object-activation/activation-teleport.c
new file mode 100644 (file)
index 0000000..7004115
--- /dev/null
@@ -0,0 +1,76 @@
+#include "object-activation/activation-teleport.h"
+#include "cmd-io/cmd-save.h"
+#include "core/asking-player.h"
+#include "game-option/special-options.h"
+#include "spell-kind/spells-grid.h"
+#include "spell-kind/spells-launcher.h"
+#include "spell-kind/spells-teleport.h"
+#include "spell-kind/spells-world.h"
+#include "spell/spell-types.h"
+#include "target/target-getter.h"
+#include "view/display-messages.h"
+
+bool activate_teleport_away(player_type *user_ptr)
+{
+    DIRECTION dir;
+    if (!get_aim_dir(user_ptr, &dir))
+        return FALSE;
+
+    (void)fire_beam(user_ptr, GF_AWAY_ALL, dir, user_ptr->lev);
+    return TRUE;
+}
+
+bool activate_escape(player_type *user_ptr)
+{
+    switch (randint1(13)) {
+    case 1:
+    case 2:
+    case 3:
+    case 4:
+    case 5:
+        teleport_player(user_ptr, 10, TELEPORT_SPONTANEOUS);
+        return TRUE;
+    case 6:
+    case 7:
+    case 8:
+    case 9:
+    case 10:
+        teleport_player(user_ptr, 222, TELEPORT_SPONTANEOUS);
+        return TRUE;
+    case 11:
+    case 12:
+        (void)stair_creation(user_ptr);
+        return TRUE;
+    default:
+        if (!get_check(_("\82±\82Ì\8aK\82ð\8b\8e\82è\82Ü\82·\82©\81H", "Leave this level? ")))
+            return TRUE;
+
+        if (autosave_l)
+            do_cmd_save_game(user_ptr, TRUE);
+
+        user_ptr->leaving = TRUE;
+        return TRUE;
+    }
+}
+
+bool activate_teleport_level(player_type *user_ptr)
+{
+    if (!get_check(_("\96{\93\96\82É\91¼\82Ì\8aK\82É\83e\83\8c\83|\81[\83g\82µ\82Ü\82·\82©\81H", "Are you sure? (Teleport Level)")))
+        return FALSE;
+
+    teleport_level(user_ptr, 0);
+    return TRUE;
+}
+
+bool activate_dimension_door(player_type *user_ptr)
+{
+    msg_print(_("\8e\9f\8c³\82Ì\94à\82ª\8aJ\82¢\82½\81B\96Ú\93I\92n\82ð\91I\82ñ\82Å\89º\82³\82¢\81B", "You open a dimensional gate. Choose a destination."));
+    return dimension_door(user_ptr);
+}
+
+bool activate_teleport(player_type *user_ptr)
+{
+    msg_print(_("\8eü\82è\82Ì\8bó\8aÔ\82ª\98c\82ñ\82Å\82¢\82é...", "It twists space around you..."));
+    teleport_player(user_ptr, 100, TELEPORT_SPONTANEOUS);
+    return TRUE;
+}
diff --git a/src/object-activation/activation-teleport.h b/src/object-activation/activation-teleport.h
new file mode 100644 (file)
index 0000000..2cd073f
--- /dev/null
@@ -0,0 +1,9 @@
+#pragma once
+
+#include "system/angband.h"
+
+bool activate_teleport_away(player_type *user_ptr);
+bool activate_escape(player_type *user_ptr);
+bool activate_teleport_level(player_type *user_ptr);
+bool activate_dimension_door(player_type *user_ptr);
+bool activate_teleport(player_type *user_ptr);