OSDN Git Service

[Refactor] #37353 chest_traps を trap.c へ移動。
[hengband/hengband.git] / src / flavor.c
index e2eb9f7..f7f4f92 100644 (file)
  */
 
 #include "angband.h"
+#include "player-status.h"
+#include "shoot.h"
+#include "object-hook.h"
+#include "trap.h"
 
 /*!
  * @brief 最初から簡易な名称が明らかになるベースアイテムの判定。 /  Certain items, if aware, are known instantly 
@@ -65,7 +69,6 @@ static bool object_easy_know(int i)
                }
        }
 
-       /* Nope */
        return (FALSE);
 }
 
@@ -87,7 +90,7 @@ void get_table_name_aux(char *out_string)
 #else
 #define MAX_SYLLABLES 164       /* Used with scrolls (see below) */
 
-       static cptr syllables[MAX_SYLLABLES] = {
+       static concptr syllables[MAX_SYLLABLES] = {
                "a", "ab", "ag", "aks", "ala", "an", "ankh", "app",
                "arg", "arze", "ash", "aus", "ban", "bar", "bat", "bek",
                "bie", "bin", "bit", "bjor", "blu", "bot", "bu",
@@ -199,14 +202,14 @@ void get_table_sindarin(char *out_string)
  * @return なし
  * @details 巻物、各種魔道具などに利用される。
  */
-static void shuffle_flavors(byte tval)
+static void shuffle_flavors(OBJECT_TYPE_VALUE tval)
 {
-       IDX *k_idx_list;
-       IDX k_idx_list_num = 0;
-       IDX i;
+       KIND_OBJECT_IDX *k_idx_list;
+       KIND_OBJECT_IDX k_idx_list_num = 0;
+       KIND_OBJECT_IDX i;
 
        /* Allocate an array for a list of k_idx */
-       C_MAKE(k_idx_list, max_k_idx, s16b);
+       C_MAKE(k_idx_list, max_k_idx, KIND_OBJECT_IDX);
 
        /* Search objects with given tval for shuffle */
        for (i = 0; i < max_k_idx; i++)
@@ -367,8 +370,6 @@ static char *object_desc_chr(char *t, char c)
 
        /* Terminate */
        *t = '\0';
-
-       /* Result */
        return (t);
 }
 
@@ -381,15 +382,13 @@ static char *object_desc_chr(char *t, char c)
  * Print a string "s" into a string "t", as if by strcpy(t, s),
  * and return a pointer to the terminator.
  */
-static char *object_desc_str(char *t, cptr s)
+static char *object_desc_str(char *t, concptr s)
 {
        /* Copy the string */
        while (*s) *t++ = *s++;
 
        /* Terminate */
        *t = '\0';
-
-       /* Result */
        return (t);
 }
 
@@ -424,8 +423,6 @@ static char *object_desc_num(char *t, uint n)
 
        /* Terminate */
        *t = '\0';
-
-       /* Result */
        return (t);
 }
 
@@ -588,8 +585,6 @@ static char *object_desc_int(char *t, sint v)
 
        /* Terminate */
        *t = '\0';
-
-       /* Result */
        return (t);
 }
 
@@ -600,9 +595,9 @@ static char *object_desc_int(char *t, sint v)
 typedef struct flag_insc_table
 {
 #ifdef JP
-       cptr japanese;
+       concptr japanese;
 #endif
-       cptr english;
+       concptr english;
        int flag;
        int except_flag;
 } flag_insc_table;
@@ -1019,8 +1014,6 @@ static char *get_ability_abbreviation(char *ptr, object_type *o_ptr, bool kanji,
 {
        char *prev_ptr = ptr;
        BIT_FLAGS flgs[TR_FLAG_SIZE];
-
-       /* Extract the flags */
        object_flags(o_ptr, flgs);
 
        /* Remove obvious flags */
@@ -1170,7 +1163,7 @@ static char *get_ability_abbreviation(char *ptr, object_type *o_ptr, bool kanji,
  */
 static void get_inscription(char *buff, object_type *o_ptr)
 {
-       cptr insc = quark_str(o_ptr->inscription);
+       concptr insc = quark_str(o_ptr->inscription);
        char *ptr = buff;
 
        /* Not fully identified */
@@ -1201,7 +1194,7 @@ static void get_inscription(char *buff, object_type *o_ptr)
                {
                        bool kanji = FALSE;
                        bool all;
-                       cptr start = ptr;
+                       concptr start = ptr;
 
                        /* check for too long inscription */
                        if (ptr >= buff + MAX_NLEN) continue;
@@ -1240,31 +1233,6 @@ static void get_inscription(char *buff, object_type *o_ptr)
        *ptr = '\0';
 }
 
-/*!
- * @brief オブジェクトがクエストの達成目的か否かを返す。
- * @param o_ptr 特性短縮表記を得たいオブジェクト構造体の参照ポインタ
- * @return 現在クエスト達成目的のアイテムならばTRUEを返す。
- */
-bool object_is_quest_target(object_type *o_ptr)
-{
-       if (p_ptr->inside_quest)
-       {
-               int a_idx = quest[p_ptr->inside_quest].k_idx;
-               if (a_idx)
-               {
-                       artifact_type *a_ptr = &a_info[a_idx];
-                       if (!(a_ptr->gen_flags & TRG_INSTA_ART))
-                       {
-                               if((o_ptr->tval == a_ptr->tval) && (o_ptr->sval == a_ptr->sval))
-                               {
-                                       return TRUE;
-                               }
-                       }
-               }
-       }
-       return FALSE;
-}
-
 
 /*!
  * @brief オブジェクトの各表記を返すメイン関数 / Creates a description of the item "o_ptr", and stores it in "out_val".
@@ -1319,13 +1287,13 @@ bool object_is_quest_target(object_type *o_ptr)
 void object_desc(char *buf, object_type *o_ptr, BIT_FLAGS mode)
 {
        /* Extract object kind name */
-       cptr            kindname = k_name + k_info[o_ptr->k_idx].name;
+       concptr            kindname = k_name + k_info[o_ptr->k_idx].name;
 
        /* Extract default "base" string */
-       cptr            basenm = kindname;
+       concptr            basenm = kindname;
 
        /* Assume no "modifier" string */
-       cptr            modstr = "";
+       concptr            modstr = "";
 
        int power;
        int fire_rate;
@@ -1337,7 +1305,7 @@ void object_desc(char *buf, object_type *o_ptr, BIT_FLAGS mode)
        bool            show_weapon = FALSE;
        bool            show_armour = FALSE;
 
-       cptr            s, s0;
+       concptr            s, s0;
        char            *t;
 
        char            p1 = '(', p2 = ')';
@@ -1420,7 +1388,7 @@ void object_desc(char *buf, object_type *o_ptr, BIT_FLAGS mode)
                                        sprintf(tmp_val2, " (%s)",r_name + r_ptr->name);
                                        modstr = tmp_val2;
 #else
-                                       cptr t = r_name + r_ptr->name;
+                                       concptr t = r_name + r_ptr->name;
 
                                        if (!(r_ptr->flags1 & RF1_UNIQUE))
                                        {
@@ -1449,7 +1417,7 @@ void object_desc(char *buf, object_type *o_ptr, BIT_FLAGS mode)
 #ifdef JP
                        modstr = r_name + r_ptr->name;
 #else
-                       cptr t = r_name + r_ptr->name;
+                       concptr t = r_name + r_ptr->name;
 
                        if (!(r_ptr->flags1 & RF1_UNIQUE))
                        {
@@ -2029,7 +1997,7 @@ void object_desc(char *buf, object_type *o_ptr, BIT_FLAGS mode)
                /* ランダム・アーティファクト */
                if (o_ptr->art_name)
                {
-                       cptr temp = quark_str(o_ptr->art_name);
+                       concptr temp = quark_str(o_ptr->art_name);
 
                        /* '『' から始まらない伝説のアイテムの名前は最初に付加する */
                        /* 英語版のセーブファイルから来た 'of XXX' は,「XXXの」と表示する */
@@ -2101,7 +2069,7 @@ void object_desc(char *buf, object_type *o_ptr, BIT_FLAGS mode)
                        {
                                char k = t[-1];
 
-                               /* XXX XXX XXX Mega-Hack */
+                               /* Mega-Hack */
 
                                /* Hack -- "Cutlass-es" and "Torch-es" */
                                if ((k == 's') || (k == 'h')) *t++ = 'e';
@@ -2159,7 +2127,7 @@ void object_desc(char *buf, object_type *o_ptr, BIT_FLAGS mode)
                }
                else if (o_ptr->inscription)
                {
-                       cptr str = quark_str(o_ptr->inscription);
+                       concptr str = quark_str(o_ptr->inscription);
 
                        while(*str)
                        {
@@ -2174,7 +2142,7 @@ void object_desc(char *buf, object_type *o_ptr, BIT_FLAGS mode)
                        if (*str)
                        {
                                /* Find the '#' */
-                               cptr str_aux = my_strchr(quark_str(o_ptr->inscription), '#');
+                               concptr str_aux = my_strchr(quark_str(o_ptr->inscription), '#');
 
                                /* Add the false name */
                                t = object_desc_str(t,"『");
@@ -2222,7 +2190,7 @@ void object_desc(char *buf, object_type *o_ptr, BIT_FLAGS mode)
                        if (o_ptr->inscription && my_strchr(quark_str(o_ptr->inscription), '#'))
                        {
                                /* Find the '#' */
-                               cptr str = my_strchr(quark_str(o_ptr->inscription), '#');
+                               concptr str = my_strchr(quark_str(o_ptr->inscription), '#');
 
                                /* Add the false name */
                                t = object_desc_chr(t, ' ');
@@ -2498,7 +2466,7 @@ void object_desc(char *buf, object_type *o_ptr, BIT_FLAGS mode)
                        avgdam *= (p_ptr->num_fire * 100);
                        avgdam /= energy_fire;
                        t = object_desc_num(t, avgdam);
-                       t = object_desc_str(t, show_ammo_detail ? "/turn" : "");
+                       t = object_desc_str(t, show_ammo_detail ? "/current_world_ptr->game_turn" : "");
                        
                        if(show_ammo_crit_ratio)
                        {
@@ -2656,7 +2624,6 @@ void object_desc(char *buf, object_type *o_ptr, BIT_FLAGS mode)
                                /* Nothing */
                        }
 
-                       /* Speed */
                        else if (have_flag(flgs, TR_SPEED))
                        {
                                /* Dump " to speed" */