OSDN Git Service

branch-nothere-terrainflags、゙。シ・ク.
[hengband/hengband.git] / src / xtra2.c
index b0d23fb..a7c2c5a 100644 (file)
@@ -111,7 +111,7 @@ msg_format("
                p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
 
                /* Redraw some stuff */
-               p_ptr->redraw |= (PR_LEV | PR_TITLE);
+               p_ptr->redraw |= (PR_LEV | PR_TITLE | PR_EXP);
 
                /* Window stuff */
                p_ptr->window |= (PW_PLAYER | PW_SPELL | PW_INVEN);
@@ -357,6 +357,24 @@ static bool kind_is_armor(int k_idx)
 
 
 /*
+ * Hack -- determine if a template is hafted weapon
+ */
+static bool kind_is_hafted(int k_idx)
+{
+       object_kind *k_ptr = &k_info[k_idx];
+
+       /* Analyze the item type */
+       if (k_ptr->tval == TV_HAFTED)
+       {
+               return (TRUE);
+       }
+
+       /* Assume not good */
+       return (FALSE);
+}
+
+
+/*
  * Check for "Quest" completion when a quest monster is killed or charmed.
  */
 void check_quest_completion(monster_type *m_ptr)
@@ -1145,6 +1163,26 @@ msg_print("
                        }
                        break;
 
+               case '\\':
+                       if (dun_level > 4)
+                       {
+                               /* Get local object */
+                               q_ptr = &forge;
+
+                               /* Wipe the object */
+                               object_wipe(q_ptr);
+
+                               /* Activate restriction */
+                               get_obj_num_hook = kind_is_hafted;
+
+                               /* Make a poleweapon */
+                               make_object(q_ptr, mo_mode);
+
+                               /* Drop it in the dungeon */
+                               (void)drop_near(q_ptr, -1, y, x);
+                       }
+                       break;
+
                case '|':
                        if (m_ptr->r_idx != MON_STORMBRINGER)
                        {
@@ -2881,62 +2919,11 @@ static bool target_set_accept(int y, int x)
        /* Interesting memorized features */
        if (c_ptr->info & (CAVE_MARK))
        {
-               /* Feature code (applying "mimic" field) */
-               byte feat = get_feat_mimic(c_ptr);
-
-               /* Notice glyphs */
+               /* Notice object features */
                if (c_ptr->info & CAVE_OBJECT) return (TRUE);
 
-               /* Notice the Pattern */
-               if ((feat <= FEAT_PATTERN_XTRA2) &&
-                   (feat >= FEAT_PATTERN_START))
-                       return (TRUE);
-
-               /* Notice doors */
-               if (feat == FEAT_OPEN) return (TRUE);
-               if (feat == FEAT_BROKEN) return (TRUE);
-
-               /* Notice stairs */
-               if (feat == FEAT_LESS) return (TRUE);
-               if (feat == FEAT_MORE) return (TRUE);
-               if (feat == FEAT_LESS_LESS) return (TRUE);
-               if (feat == FEAT_MORE_MORE) return (TRUE);
-
-               /* Notice shops */
-               if ((feat >= FEAT_SHOP_HEAD) &&
-                   (feat <= FEAT_SHOP_TAIL)) return (TRUE);
-
-               if (feat == FEAT_MUSEUM) return (TRUE);
-
-               /* Notice buildings -KMW- */
-               if ((feat >= FEAT_BLDG_HEAD) &&
-                   (feat <= FEAT_BLDG_TAIL)) return (TRUE);
-
-               /* Notice traps */
-               if (is_trap(feat)) return (TRUE);
-
-               /* Notice doors */
-               if ((feat >= FEAT_DOOR_HEAD) &&
-                   (feat <= FEAT_DOOR_TAIL)) return (TRUE);
-
-#if 0
-               /* Notice rubble */
-               /* I think FEAT_RUBBLEs should not be "interesting" */
-               if (feat == FEAT_RUBBLE) return (TRUE);
-
-               /* Notice veins with treasure */
-               /* Now veins with treasure are too many */
-               if (feat == FEAT_MAGMA_K) return (TRUE);
-               if (feat == FEAT_QUARTZ_K) return (TRUE);
-#endif
-
-               /* Notice quest features */
-               if (feat == FEAT_QUEST_ENTER) return (TRUE);
-               if (feat == FEAT_QUEST_EXIT) return (TRUE);
-               if (feat == FEAT_QUEST_DOWN) return (TRUE);
-               if (feat == FEAT_QUEST_UP) return (TRUE);
-               if (feat == FEAT_TOWN) return (TRUE);
-               if (feat == FEAT_ENTRANCE) return (TRUE);
+               /* Feature code (applying "mimic" field) */
+               if (have_flag(f_info[get_feat_mimic(c_ptr)].flags, FF_NOTICE)) return TRUE;
        }
 
        /* Nope */
@@ -3089,7 +3076,8 @@ static int target_set_aux(int y, int x, int mode, cptr info)
        s16b this_o_idx, next_o_idx = 0;
        cptr s1 = "", s2 = "", s3 = "", x_info = "";
        bool boring = TRUE;
-       byte feat;
+       s16b feat;
+       feature_type *f_ptr;
        int query = '\001';
        char out_val[MAX_NLEN+80];
 
@@ -3303,7 +3291,7 @@ static int target_set_aux(int y, int x, int mode, cptr info)
                        next_o_idx = o_ptr->next_o_idx;
 
                        /* Obtain an object description */
-                       object_desc(o_name, o_ptr, TRUE, 3);
+                       object_desc(o_name, o_ptr, 0);
 
                        /* Describe the object */
 #ifdef JP
@@ -3357,7 +3345,7 @@ static int target_set_aux(int y, int x, int mode, cptr info)
                                o_ptr = &o_list[floor_list[0]];
 
                                /* Describe the object */
-                               object_desc(o_name, o_ptr, TRUE, 3);
+                               object_desc(o_name, o_ptr, 0);
 
                                /* Message */
 #ifdef JP
@@ -3483,7 +3471,7 @@ static int target_set_aux(int y, int x, int mode, cptr info)
                        boring = FALSE;
 
                        /* Obtain an object description */
-                       object_desc(o_name, o_ptr, TRUE, 3);
+                       object_desc(o_name, o_ptr, 0);
 
                        /* Describe the object */
 #ifdef JP
@@ -3540,17 +3528,19 @@ static int target_set_aux(int y, int x, int mode, cptr info)
                feat = FEAT_NONE;
        }
 
+       f_ptr = &f_info[feat];
+
        /* Terrain feature if needed */
        if (boring || (feat > FEAT_INVIS))
        {
                cptr name;
 
                /* Hack -- special handling for building doors */
-               if ((feat >= FEAT_BLDG_HEAD) && (feat <= FEAT_BLDG_TAIL))
+               if (have_flag(f_ptr->flags, FF_BLDG))
                {
-                       name = building[feat - FEAT_BLDG_HEAD].name;
+                       name = building[f_ptr->power].name;
                }
-               else if (feat == FEAT_ENTRANCE)
+               else if (have_flag(f_ptr->flags, FF_ENTRANCE))
                {
 #ifdef JP
                        name = format("%s(%d³¬ÁêÅö)", d_text + d_info[c_ptr->special].text, d_info[c_ptr->special].mindepth);
@@ -3558,7 +3548,7 @@ static int target_set_aux(int y, int x, int mode, cptr info)
                        name = format("%s(level %d)", d_text + d_info[c_ptr->special].text, d_info[c_ptr->special].mindepth);
 #endif
                }
-               else if (feat == FEAT_TOWN)
+               else if (have_flag(f_ptr->flags, FF_TOWN))
                {
                        name = town[c_ptr->special].name;
                }
@@ -3572,80 +3562,59 @@ static int target_set_aux(int y, int x, int mode, cptr info)
                }
                else
                {
-                       name = f_name + f_info[feat].name;
+                       name = f_name + f_ptr->name;
                }
 
 
                /* Pick a prefix */
-               if (*s2 && ((feat >= FEAT_MINOR_GLYPH) &&
-                           (feat <= FEAT_PATTERN_XTRA2)))
-               {
-#ifdef JP
-                       s2 = "¤Î¾å";
-#else
-                       s2 = "on ";
-#endif
-
-               }
-               else if (*s2 && ((feat >= FEAT_DOOR_HEAD) &&
-                                (feat <= FEAT_PERM_SOLID)))
-               {
-#ifdef JP
-                       s2 = "¤ÎÃæ";
-#else
-                       s2 = "in ";
-#endif
-
-               }
-               else if (*s2 && (feat == FEAT_TOWN))
+               if (*s2 &&
+                   (!have_flag(f_ptr->flags, FF_MOVE) ||
+                   (!have_flag(f_ptr->flags, FF_LOS) &&
+                    !have_flag(f_ptr->flags, FF_TREE)) ||
+                    have_flag(f_ptr->flags, FF_TOWN)))
                {
 #ifdef JP
                        s2 = "¤ÎÃæ";
 #else
                        s2 = "in ";
 #endif
-
                }
 
                /* Hack -- special introduction for store & building doors -KMW- */
-               if (((feat >= FEAT_SHOP_HEAD) && (feat <= FEAT_SHOP_TAIL)) ||
-                   ((feat >= FEAT_BLDG_HEAD) && (feat <= FEAT_BLDG_TAIL)) ||
-                   (feat == FEAT_MUSEUM) ||
-                   (feat == FEAT_ENTRANCE))
+               if (have_flag(f_ptr->flags, FF_STORE) ||
+                   have_flag(f_ptr->flags, FF_BLDG) ||
+                   have_flag(f_ptr->flags, FF_ENTRANCE))
                {
 #ifdef JP
                        s2 = "¤ÎÆþ¸ý";
 #else
                        s3 = "";
 #endif
-
                }
-               else if ((feat == FEAT_TOWN) || (feat == FEAT_FLOOR) || (feat == FEAT_DIRT) || (feat == FEAT_FLOWER))
-               {
 #ifndef JP
+               else if (have_flag(f_ptr->flags, FF_FLOOR) || have_flag(f_ptr->flags, FF_TOWN))
+               {
                        s3 ="";
-#endif
                }
                else
                {
                        /* Pick proper indefinite article */
-#ifndef JP
                        s3 = (is_a_vowel(name[0])) ? "an " : "a ";
-#endif
                }
+#endif
 
                /* Display a message */
                if (p_ptr->wizard)
 #ifdef JP
                        sprintf(out_val, "%s%s%s%s[%s] %x %d %d %d %d (%d,%d)", s1, name, s2, s3, info, c_ptr->info, c_ptr->feat, c_ptr->dist, c_ptr->cost, c_ptr->when, x, y);
 #else
-               sprintf(out_val, "%s%s%s%s [%s] %x %d %d %d %d (%d,%d)", s1, s2, s3, name, info, c_ptr->info, c_ptr->feat, c_ptr->dist, c_ptr->cost, c_ptr->when, x, y);
+                       sprintf(out_val, "%s%s%s%s [%s] %x %d %d %d %d (%d,%d)", s1, s2, s3, name, info, c_ptr->info, c_ptr->feat, c_ptr->dist, c_ptr->cost, c_ptr->when, x, y);
 #endif
                else
 #ifdef JP
                        sprintf(out_val, "%s%s%s%s[%s]", s1, name, s2, s3, info);
 #else
-               sprintf(out_val, "%s%s%s%s [%s]", s1, s2, s3, name, info);
+                       sprintf(out_val, "%s%s%s%s [%s]", s1, s2, s3, name, info);
 #endif
 
                prt(out_val, 0, 0);
@@ -5245,7 +5214,7 @@ msg_print("
                        msg_print("'Thou reliest too much on thy weapon.'");
 #endif
 
-                       object_desc(o_name, &inventory[INVEN_RARM], TRUE, 0);
+                       object_desc(o_name, &inventory[INVEN_RARM], OD_NAME_ONLY);
                        (void)curse_weapon(FALSE, INVEN_RARM);
 #ifdef JP
                        reward = format("%s¤¬Ç˲õ¤µ¤ì¤¿¡£", o_name);
@@ -5269,7 +5238,7 @@ msg_print("
                        msg_print("'Thou reliest too much on thine equipment.'");
 #endif
 
-                       object_desc(o_name, &inventory[INVEN_BODY], TRUE, 0);
+                       object_desc(o_name, &inventory[INVEN_BODY], OD_NAME_ONLY);
                        (void)curse_armor();
 #ifdef JP
                        reward = format("%s¤¬Ç˲õ¤µ¤ì¤¿¡£", o_name);
@@ -5314,7 +5283,7 @@ msg_print("
                                        if (one_in_(2))
                                        {
                                                if (!buki_motteruka(INVEN_RARM)) break;
-                                               object_desc(o_name, &inventory[INVEN_RARM], TRUE, 0);
+                                               object_desc(o_name, &inventory[INVEN_RARM], OD_NAME_ONLY);
                                                (void)curse_weapon(FALSE, INVEN_RARM);
 #ifdef JP
                                                reward = format("%s¤¬Ç˲õ¤µ¤ì¤¿¡£", o_name);
@@ -5325,7 +5294,7 @@ msg_print("
                                        else
                                        {
                                                if (!inventory[INVEN_BODY].k_idx) break;
-                                               object_desc(o_name, &inventory[INVEN_BODY], TRUE, 0);
+                                               object_desc(o_name, &inventory[INVEN_BODY], OD_NAME_ONLY);
                                                (void)curse_armor();
 #ifdef JP
                                                reward = format("%s¤¬Ç˲õ¤µ¤ì¤¿¡£", o_name);