OSDN Git Service

[Refactor] #37353 player-item.c/h 削除。 xtra2.c を player-status.c に分離。 / Delete player...
authorDeskull <deskull@users.sourceforge.jp>
Sun, 6 Jan 2019 05:25:54 +0000 (14:25 +0900)
committerDeskull <deskull@users.sourceforge.jp>
Sun, 6 Jan 2019 05:25:54 +0000 (14:25 +0900)
13 files changed:
Hengband_vcs2017/Hengband/Hengband.vcxproj
src/Makefile.am
src/cmd-item.c
src/cmd4.c
src/externs.h
src/files.c
src/player-item.c [deleted file]
src/player-item.h [deleted file]
src/player-status.c [new file with mode: 0644]
src/player-status.h [new file with mode: 0644]
src/selfinfo.c
src/spells3.c
src/xtra2.c

index 0c0c645..88aec26 100644 (file)
     <ClCompile Include="..\..\src\object-hook.c" />\r
     <ClCompile Include="..\..\src\objectkind-hook.c" />\r
     <ClCompile Include="..\..\src\player-damage.c" />\r
-    <ClCompile Include="..\..\src\player-item.c" />\r
+    <ClCompile Include="..\..\src\player-status.c" />\r
     <ClCompile Include="..\..\src\realm-craft.c" />\r
     <ClCompile Include="..\..\src\realm-crusade.c" />\r
     <ClCompile Include="..\..\src\realm-daemon.c" />\r
     <ClInclude Include="..\..\src\object-hook.h" />\r
     <ClInclude Include="..\..\src\objectkind-hook.h" />\r
     <ClInclude Include="..\..\src\player-damage.h" />\r
-    <ClInclude Include="..\..\src\player-item.h" />\r
+    <ClInclude Include="..\..\src\player-status.h" />\r
     <ClInclude Include="..\..\src\readdib.h" />\r
     <ClInclude Include="..\..\src\realm-arcane.h" />\r
     <ClInclude Include="..\..\src\realm-chaos.h" />\r
index b2127a3..fbfe7cd 100644 (file)
@@ -25,7 +25,7 @@ hengband_SOURCES = \
        object-curse.c object-curse.h \
        object-hook.c object-hook.h object1.c object2.c \
        objectkind-hook.c objectkind-hook.h obj_kind.c \
-       player-damage.c player-damage.h \
+       player-damage.c player-damage.h player-status.c player-status.h \
        racial.c \
        realm-arcane.c \
        realm-arcane.h realm-chaos.c realm-chaos.h realm-craft.c realm-craft.h \
index ecd9f83..ce1b30b 100644 (file)
@@ -21,7 +21,6 @@
 #include "cmd-zaprod.h"
 #include "cmd-zapwand.h"
 
-#include "player-item.h"
 #include "object-hook.h"
 
 
index 3d433bf..4004316 100644 (file)
@@ -42,6 +42,7 @@
 #include "angband.h"
 #include "cmd-pet.h"
 #include "world.h"
+#include "player-status.h"
 
 
 /*
index 414205e..77a30f5 100644 (file)
@@ -1285,10 +1285,6 @@ extern void change_race(CHARACTER_IDX new_race, cptr effect_msg);
 extern HIT_POINT mon_damage_mod(monster_type *m_ptr, HIT_POINT dam, bool is_psy_spear);
 extern ENERGY bow_energy(OBJECT_SUBTYPE_VALUE sval);
 extern int bow_tmul(OBJECT_SUBTYPE_VALUE sval);
-extern cptr your_alignment(void);
-extern int weapon_exp_level(int weapon_exp);
-extern int riding_exp_level(int riding_exp);
-extern int spell_exp_level(int spell_exp);
 extern void display_rumor(bool ex);
 
 /* artifact.c */
index 2bd5070..4984438 100644 (file)
@@ -15,6 +15,7 @@
 
 #include "angband.h"
 #include "world.h"
+#include "player-status.h"
 
 
 /*
diff --git a/src/player-item.c b/src/player-item.c
deleted file mode 100644 (file)
index 19ca9ad..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-#include "angband.h"
-#include "player-item.h"
-
-/*!
- * @brief get_item()からのリファクタリング
- * @return アイテムのポインタ、キャンセルや不能ならNULLを返す。
- */
-object_type *ref_item(player_type *player_ptr, cptr pmt, cptr str, BIT_FLAGS mode)
-{
-       OBJECT_IDX idx;
-       (player_ptr); // しばらくは未使用
-
-       if(!get_item(&idx, pmt, str, mode)) return NULL;
-       return idx >= 0 ? &inventory[idx] : &o_list[0 - idx];
-}
\ No newline at end of file
diff --git a/src/player-item.h b/src/player-item.h
deleted file mode 100644 (file)
index c76647c..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-
-extern object_type *ref_item(player_type *player_ptr, cptr pmt, cptr str, BIT_FLAGS mode);
-
diff --git a/src/player-status.c b/src/player-status.c
new file mode 100644 (file)
index 0000000..3d7f389
--- /dev/null
@@ -0,0 +1,56 @@
+#include "angband.h"
+#include "player-status.h"
+
+/*
+ * Return alignment title
+ */
+cptr your_alignment(void)
+{
+       if (p_ptr->align > 150) return _("大善", "Lawful");
+       else if (p_ptr->align > 50) return _("中善", "Good");
+       else if (p_ptr->align > 10) return _("小善", "Neutral Good");
+       else if (p_ptr->align > -11) return _("中立", "Neutral");
+       else if (p_ptr->align > -51) return _("小悪", "Neutral Evil");
+       else if (p_ptr->align > -151) return _("中悪", "Evil");
+       else return _("大悪", "Chaotic");
+}
+
+
+/*
+ * Return proficiency level of weapons and misc. skills (except riding)
+ */
+int weapon_exp_level(int weapon_exp)
+{
+       if (weapon_exp < WEAPON_EXP_BEGINNER) return EXP_LEVEL_UNSKILLED;
+       else if (weapon_exp < WEAPON_EXP_SKILLED) return EXP_LEVEL_BEGINNER;
+       else if (weapon_exp < WEAPON_EXP_EXPERT) return EXP_LEVEL_SKILLED;
+       else if (weapon_exp < WEAPON_EXP_MASTER) return EXP_LEVEL_EXPERT;
+       else return EXP_LEVEL_MASTER;
+}
+
+
+/*
+ * Return proficiency level of riding
+ */
+int riding_exp_level(int riding_exp)
+{
+       if (riding_exp < RIDING_EXP_BEGINNER) return EXP_LEVEL_UNSKILLED;
+       else if (riding_exp < RIDING_EXP_SKILLED) return EXP_LEVEL_BEGINNER;
+       else if (riding_exp < RIDING_EXP_EXPERT) return EXP_LEVEL_SKILLED;
+       else if (riding_exp < RIDING_EXP_MASTER) return EXP_LEVEL_EXPERT;
+       else return EXP_LEVEL_MASTER;
+}
+
+
+/*
+ * Return proficiency level of spells
+ */
+int spell_exp_level(int spell_exp)
+{
+       if (spell_exp < SPELL_EXP_BEGINNER) return EXP_LEVEL_UNSKILLED;
+       else if (spell_exp < SPELL_EXP_SKILLED) return EXP_LEVEL_BEGINNER;
+       else if (spell_exp < SPELL_EXP_EXPERT) return EXP_LEVEL_SKILLED;
+       else if (spell_exp < SPELL_EXP_MASTER) return EXP_LEVEL_EXPERT;
+       else return EXP_LEVEL_MASTER;
+}
+
diff --git a/src/player-status.h b/src/player-status.h
new file mode 100644 (file)
index 0000000..070a28a
--- /dev/null
@@ -0,0 +1,4 @@
+extern cptr your_alignment(void);
+extern int weapon_exp_level(int weapon_exp);
+extern int riding_exp_level(int riding_exp);
+extern int spell_exp_level(int spell_exp);
index 718c119..302f101 100644 (file)
@@ -15,6 +15,7 @@
  */\r
 \r
 #include "angband.h"\r
+#include "player-status.h"\r
 \r
 /*!\r
  * @brief 自己分析処理(Nethackからのアイデア) / self-knowledge... idea from nethack.\r
index e62ee3d..b614987 100644 (file)
@@ -14,6 +14,7 @@
 #include "angband.h"
 #include "object-hook.h"
 #include "melee.h"
+#include "player-status.h"
 
 /*! テレポート先探索の試行数 / Maximum number of tries for teleporting */
 #define MAX_TRIES 100
index 5271123..ef5e194 100644 (file)
@@ -5149,59 +5149,6 @@ int bow_tmul(OBJECT_SUBTYPE_VALUE sval)
        return (tmul);
 }
 
-/*
- * Return alignment title
- */
-cptr your_alignment(void)
-{
-       if (p_ptr->align > 150) return _("大善", "Lawful");
-       else if (p_ptr->align > 50) return _("中善", "Good");
-       else if (p_ptr->align > 10) return _("小善", "Neutral Good");
-       else if (p_ptr->align > -11) return _("中立", "Neutral");
-       else if (p_ptr->align > -51) return _("小悪", "Neutral Evil");
-       else if (p_ptr->align > -151) return _("中悪", "Evil");
-       else return _("大悪", "Chaotic");
-}
-
-
-/*
- * Return proficiency level of weapons and misc. skills (except riding)
- */
-int weapon_exp_level(int weapon_exp)
-{
-       if (weapon_exp < WEAPON_EXP_BEGINNER) return EXP_LEVEL_UNSKILLED;
-       else if (weapon_exp < WEAPON_EXP_SKILLED) return EXP_LEVEL_BEGINNER;
-       else if (weapon_exp < WEAPON_EXP_EXPERT) return EXP_LEVEL_SKILLED;
-       else if (weapon_exp < WEAPON_EXP_MASTER) return EXP_LEVEL_EXPERT;
-       else return EXP_LEVEL_MASTER;
-}
-
-
-/*
- * Return proficiency level of riding
- */
-int riding_exp_level(int riding_exp)
-{
-       if (riding_exp < RIDING_EXP_BEGINNER) return EXP_LEVEL_UNSKILLED;
-       else if (riding_exp < RIDING_EXP_SKILLED) return EXP_LEVEL_BEGINNER;
-       else if (riding_exp < RIDING_EXP_EXPERT) return EXP_LEVEL_SKILLED;
-       else if (riding_exp < RIDING_EXP_MASTER) return EXP_LEVEL_EXPERT;
-       else return EXP_LEVEL_MASTER;
-}
-
-
-/*
- * Return proficiency level of spells
- */
-int spell_exp_level(int spell_exp)
-{
-       if (spell_exp < SPELL_EXP_BEGINNER) return EXP_LEVEL_UNSKILLED;
-       else if (spell_exp < SPELL_EXP_SKILLED) return EXP_LEVEL_BEGINNER;
-       else if (spell_exp < SPELL_EXP_EXPERT) return EXP_LEVEL_SKILLED;
-       else if (spell_exp < SPELL_EXP_MASTER) return EXP_LEVEL_EXPERT;
-       else return EXP_LEVEL_MASTER;
-}
-
 
 /*
  * Display a rumor and apply its effects