OSDN Git Service

自動破壊の自動登録で、簡易鑑定されたアイテムを考慮していなかったので、
authormogami <mogami@0568b783-4c39-0410-ac80-bf13821ea2a2>
Sat, 27 Sep 2003 09:36:44 +0000 (09:36 +0000)
committermogami <mogami@0568b783-4c39-0410-ac80-bf13821ea2a2>
Sat, 27 Sep 2003 09:36:44 +0000 (09:36 +0000)
考慮するように修正。
その過程で「無銘の」キーワードを{並}{上質}にもマッチするようにした。
また、tvalが武器かどうか確かめるのにTV_BOW等を直接使っているのが
わかりにく過ぎるので、TV_WEAPON_BEGIN 等のマクロを定義してそれを使うように置換した。

14 files changed:
src/artifact.c
src/autopick.c
src/birth.c
src/cmd1.c
src/cmd3.c
src/cmd4.c
src/defines.h
src/dungeon.c
src/effects.c
src/mspells1.c
src/object2.c
src/spells3.c
src/wizard2.c
src/xtra1.c

index fd27f79..b2e2a47 100644 (file)
@@ -207,7 +207,7 @@ static void curse_artifact(object_type * o_ptr)
 
 static void random_plus(object_type * o_ptr)
 {
-       int this_type = (o_ptr->tval < TV_BOOTS ? 23 : 19);
+       int this_type = (o_ptr->tval <= TV_WEAPON_END ? 23 : 19);
 
        switch (artifact_bias)
        {
@@ -892,7 +892,7 @@ static void random_misc(object_type * o_ptr)
                case 24:
                case 25:
                case 26:
-                       if (o_ptr->tval >= TV_BOOTS && o_ptr->tval <= TV_DRAG_ARMOR)
+                       if (TV_ARMOR_BEGIN <= o_ptr->tval && o_ptr->tval <= TV_ARMOR_END)
                                random_misc(o_ptr);
                        else
                        {
@@ -1633,7 +1633,7 @@ bool create_artifact(object_type *o_ptr, bool a_scroll)
        char    new_name[1024];
        int     has_pval = 0;
        int     powers = randint1(5) + 1;
-       int     max_type = (o_ptr->tval < TV_BOOTS ? 7 : 5);
+       int     max_type = (o_ptr->tval <= TV_WEAPON_END ? 7 : 5);
        int     power_level;
        s32b    total_flags;
        bool    a_cursed = FALSE;
@@ -1755,7 +1755,7 @@ bool create_artifact(object_type *o_ptr, bool a_scroll)
                                has_pval = TRUE;
                                break;
                        case 3: case 4:
-                               if (one_in_(2) && (o_ptr->tval < TV_BOOTS) && (o_ptr->tval != TV_BOW))
+                               if (one_in_(2) && (o_ptr->tval <= TV_WEAPON_END) && (o_ptr->tval != TV_BOW))
                                {
                                        if (a_cursed && !one_in_(13)) break;
                                        if (one_in_(13))
@@ -1812,7 +1812,7 @@ bool create_artifact(object_type *o_ptr, bool a_scroll)
        }
 
        /* give it some plusses... */
-       if (o_ptr->tval >= TV_BOOTS && o_ptr->tval <= TV_DRAG_ARMOR)
+       if (TV_ARMOR_BEGIN <= o_ptr->tval && o_ptr->tval <= TV_ARMOR_END)
                o_ptr->to_a += randint1(o_ptr->to_a > 19 ? 1 : 20 - o_ptr->to_a);
        else if (o_ptr->tval <= TV_SWORD)
        {
@@ -1833,14 +1833,14 @@ bool create_artifact(object_type *o_ptr, bool a_scroll)
        if (a_cursed) curse_artifact(o_ptr);
 
        if (!a_cursed &&
-           (randint1((o_ptr->tval >= TV_BOOTS)
+           (randint1((o_ptr->tval >= TV_ARMOR_BEGIN)
            ? ACTIVATION_CHANCE * 2 : ACTIVATION_CHANCE) == 1))
        {
                o_ptr->xtra2 = 0;
                give_activation_power(o_ptr);
        }
 
-       if ((o_ptr->tval >= TV_BOOTS) && (o_ptr->tval <= TV_DRAG_ARMOR))
+       if (TV_ARMOR_BEGIN <= o_ptr->tval && o_ptr->tval <= TV_ARMOR_END)
        {
                while ((o_ptr->to_d+o_ptr->to_h) > 20)
                {
@@ -1882,7 +1882,7 @@ bool create_artifact(object_type *o_ptr, bool a_scroll)
                remove_flag(o_ptr->art_flags, TR_BRAND_COLD);
        }
 
-       if (o_ptr->tval >= TV_BOOTS)
+       if (o_ptr->tval >= TV_ARMOR_BEGIN)
        {
                /* For armors */
                if (a_cursed) power_level = 0;
@@ -1920,7 +1920,7 @@ bool create_artifact(object_type *o_ptr, bool a_scroll)
 #endif
 
                {
-                       get_random_name(new_name, (bool)(o_ptr->tval >= TV_BOOTS), power_level);
+                       get_random_name(new_name, (bool)(o_ptr->tval >= TV_ARMOR_BEGIN), power_level);
                }
                else
                {
@@ -1945,7 +1945,7 @@ bool create_artifact(object_type *o_ptr, bool a_scroll)
        }
        else
        {
-               get_random_name(new_name, (bool)(o_ptr->tval >= TV_BOOTS), power_level);
+               get_random_name(new_name, (bool)(o_ptr->tval >= TV_ARMOR_BEGIN), power_level);
        }
 
        if (cheat_xtra)
index b527f89..6361ecc 100644 (file)
@@ -426,16 +426,11 @@ static bool autopick_new_entry(autopick_type *entry, cptr str, bool allow_defaul
 /*
  * Favorite weapons
  */
-static bool is_favorite(object_type *o_ptr, bool others_ok)
+static bool is_favorite(object_type *o_ptr)
 {
        /* Only weapons match */
-       switch(o_ptr->tval)
-       {
-       case TV_BOW: case TV_HAFTED: case TV_POLEARM:
-       case TV_SWORD: case TV_DIGGING:
-               break;
-       default: return FALSE;
-       }
+       if (!(TV_WEAPON_BEGIN <= o_ptr->tval && o_ptr->tval <= TV_WEAPON_END))
+               return FALSE;
 
        /* Favorite weapons are varied depend on the class */
        switch (p_ptr->pclass)
@@ -454,7 +449,7 @@ static bool is_favorite(object_type *o_ptr, bool others_ok)
        case CLASS_MONK:
        case CLASS_FORCETRAINER:
                /* Icky to wield? */
-               if (!(s_info[p_ptr->pclass].w_max[o_ptr->tval-TV_BOW][o_ptr->sval]))
+               if (!(s_info[p_ptr->pclass].w_max[o_ptr->tval-TV_WEAPON_BEGIN][o_ptr->sval]))
                        return FALSE;
                break;
 
@@ -473,14 +468,13 @@ static bool is_favorite(object_type *o_ptr, bool others_ok)
 
        case CLASS_NINJA:
                /* Icky to wield? */
-               if (s_info[p_ptr->pclass].w_max[o_ptr->tval-TV_BOW][o_ptr->sval] <= WEAPON_EXP_BEGINNER)
+               if (s_info[p_ptr->pclass].w_max[o_ptr->tval-TV_WEAPON_BEGIN][o_ptr->sval] <= WEAPON_EXP_BEGINNER)
                        return FALSE;
                break;
 
        default:
-               /* Non-special class */
-               if (others_ok) return TRUE;
-               else return FALSE;
+               /* All weapons are okay for non-special classes */
+               return TRUE;
        }
 
        return TRUE;
@@ -501,16 +495,52 @@ static void autopick_entry_from_object(autopick_type *entry, object_type *o_ptr)
        entry->flag[0] = entry->flag[1] = 0L;
        entry->dice = 0;
 
+       /* Unaware */
        if (!object_aware_p(o_ptr))
        {
                ADD_FLG(FLG_UNAWARE);
        }
+
+       /* Not really identified */
        else if (!object_known_p(o_ptr))
        {
-               ADD_FLG(FLG_UNIDENTIFIED);
+               if (!(o_ptr->ident & IDENT_SENSE))
+               {
+                       ADD_FLG(FLG_UNIDENTIFIED);
+               }
+               else
+               {
+                       /* Pseudo-identified */
+                       switch (o_ptr->feeling)
+                       {
+                       case FEEL_AVERAGE:
+                       case FEEL_GOOD:
+                               ADD_FLG(FLG_NAMELESS);
+                               break;
+
+                       case FEEL_BROKEN:
+                       case FEEL_CURSED:
+                               ADD_FLG(FLG_NAMELESS);
+                               ADD_FLG(FLG_WORTHLESS);
+                               break;
+
+                       case FEEL_TERRIBLE:
+                       case FEEL_WORTHLESS:
+                               ADD_FLG(FLG_WORTHLESS);
+                               break;
+
+                       default:
+                               /* It's not know as useless so... */
+                               ADD_FLG(FLG_UNIDENTIFIED);
+                               break;
+                       }
+               }
        }
+
+       /* Identified */
        else
        {
+               /* Ego object */
                if (o_ptr->name2)
                {
                        ego_item_type *e_ptr = &e_info[o_ptr->name2];
@@ -518,24 +548,17 @@ static void autopick_entry_from_object(autopick_type *entry, object_type *o_ptr)
                        name = FALSE;
                        ADD_FLG(FLG_EGO);
                }
+
+               /* Artifact */
                else if (o_ptr->name1 || o_ptr->art_name)
                        ADD_FLG(FLG_ARTIFACT);
+
+               /* Non-ego, non-artifact */
                else
                {
                        /* Wearable nameless object */
-                       switch (o_ptr->tval)
-                       {
-                       case TV_WHISTLE:
-                       case TV_SHOT: case TV_ARROW: case TV_BOLT: case TV_BOW:
-                       case TV_DIGGING: case TV_HAFTED: case TV_POLEARM: case TV_SWORD: 
-                       case TV_BOOTS: case TV_GLOVES: case TV_HELM: case TV_CROWN:
-                       case TV_SHIELD: case TV_CLOAK:
-                       case TV_SOFT_ARMOR: case TV_HARD_ARMOR: case TV_DRAG_ARMOR:
-                       case TV_LITE: case TV_AMULET: case TV_RING: case TV_CARD:
-
+                       if ((TV_EQUIP_BEGIN <= o_ptr->tval && o_ptr->tval <= TV_EQUIP_END))
                                ADD_FLG(FLG_NAMELESS);
-                               break;
-                       }
                }
 
        }
@@ -612,8 +635,6 @@ static void autopick_entry_from_object(autopick_type *entry, object_type *o_ptr)
                ADD_FLG(FLG_JUNKS);
        else if (o_ptr->tval >= TV_LIFE_BOOK)
                ADD_FLG(FLG_SPELLBOOKS);
-       else if (is_favorite(o_ptr, FALSE))
-               ADD_FLG(FLG_FAVORITE);
        else if (o_ptr->tval == TV_POLEARM || o_ptr->tval == TV_SWORD
                 || o_ptr->tval == TV_DIGGING || o_ptr->tval == TV_HAFTED)
                ADD_FLG(FLG_WEAPONS);
@@ -987,22 +1008,36 @@ static bool is_autopick_aux(object_type *o_ptr, autopick_type *entry, cptr o_nam
        /*** Nameless ***/
        if (IS_FLG(FLG_NAMELESS))
        {
-               switch (o_ptr->tval)
+               if (!(TV_EQUIP_BEGIN <= o_ptr->tval && o_ptr->tval <= TV_EQUIP_END))
+                       return FALSE;
+
+               /* Inscription is a some sort of 'name' */
+               if (o_ptr->inscription) return FALSE;
+
+               /* Identified */
+               if (object_known_p(o_ptr))
                {
-               case TV_WHISTLE:
-               case TV_SHOT: case TV_ARROW: case TV_BOLT: case TV_BOW:
-               case TV_DIGGING: case TV_HAFTED: case TV_POLEARM: case TV_SWORD: 
-               case TV_BOOTS: case TV_GLOVES: case TV_HELM: case TV_CROWN:
-               case TV_SHIELD: case TV_CLOAK:
-               case TV_SOFT_ARMOR: case TV_HARD_ARMOR: case TV_DRAG_ARMOR:
-               case TV_LITE: case TV_AMULET: case TV_RING: case TV_CARD:
-                       if ((!object_known_p(o_ptr) || o_ptr->inscription
-                            || o_ptr->name1 || o_ptr->name2 || o_ptr->art_name))
+                       /* Artifacts and Ego objects are not okay */
+                       if (o_ptr->name1 || o_ptr->art_name || o_ptr->name2)
                                return FALSE;
-                       break;
-               default:
-                       /* don't match */
-                       return FALSE;
+               }
+
+               /* Pseudo-identified */
+               else if (o_ptr->ident & IDENT_SENSE)
+               {
+                       switch (o_ptr->feeling)
+                       {
+                       case FEEL_AVERAGE:
+                       case FEEL_GOOD:
+                       case FEEL_BROKEN:
+                       case FEEL_CURSED:
+                               /* It's nameless */
+                               break;
+
+                       default:
+                               /* It's not nameless */
+                               return FALSE;
+                       }
                }
        }
 
@@ -1070,24 +1105,13 @@ static bool is_autopick_aux(object_type *o_ptr, autopick_type *entry, cptr o_nam
        /*** Items ***/
        if (IS_FLG(FLG_WEAPONS))
        {
-               switch(o_ptr->tval)
-               {
-               case TV_BOW: case TV_HAFTED: case TV_POLEARM:
-               case TV_SWORD: case TV_DIGGING:
-                       break;
-               default: return FALSE;
-               }
+               if (!(TV_WEAPON_BEGIN <= o_ptr->tval && o_ptr->tval <= TV_WEAPON_END))
+                       return FALSE;
        }
        else if (IS_FLG(FLG_ARMORS))
        {
-               switch(o_ptr->tval)
-               {
-               case TV_BOOTS: case TV_GLOVES: case TV_CLOAK: case TV_CROWN:
-               case TV_HELM: case TV_SHIELD: case TV_SOFT_ARMOR:
-               case TV_HARD_ARMOR: case TV_DRAG_ARMOR:
-                       break;
-               default: return FALSE;
-               }
+               if (!(TV_ARMOR_BEGIN <= o_ptr->tval && o_ptr->tval <= TV_ARMOR_END))
+                       return FALSE;
        }
        else if (IS_FLG(FLG_MISSILES))
        {
@@ -1181,7 +1205,7 @@ static bool is_autopick_aux(object_type *o_ptr, autopick_type *entry, cptr o_nam
        }
        else if (IS_FLG(FLG_FAVORITE))
        {
-               if (!is_favorite(o_ptr, TRUE))
+               if (!is_favorite(o_ptr))
                        return FALSE;
        }
 
@@ -1306,7 +1330,7 @@ static bool is_opt_confirm_destroy(object_type *o_ptr)
                if (object_value(o_ptr) > 0) return FALSE;
        
        if (leave_equip)
-               if ((o_ptr->tval >= TV_SHOT) && (o_ptr->tval <= TV_DRAG_ARMOR)) return FALSE;
+               if ((o_ptr->tval >= TV_MISSILE_BEGIN) && (o_ptr->tval <= TV_ARMOR_END)) return FALSE;
        
        if (leave_chest)
                if ((o_ptr->tval == TV_CHEST) && o_ptr->pval) return FALSE;
@@ -3556,7 +3580,7 @@ command_menu_type menu_data[] =
        {MN_SEARCH_STR, 1, KTRL('s'), EC_SEARCH_STR},
        {MN_SEARCH_FORW, 1, -1, EC_SEARCH_FORW},
        {MN_SEARCH_BACK, 1, KTRL('r'), EC_SEARCH_BACK},
-       {MN_SEARCH_OBJ, 1, KTRL('t'), EC_SEARCH_OBJ},
+       {MN_SEARCH_OBJ, 1, KTRL('y'), EC_SEARCH_OBJ},
        {MN_SEARCH_DESTROYED, 1, -1, EC_SEARCH_DESTROYED},
 
        {MN_MOVE, 0, -1, -1},
@@ -3568,7 +3592,7 @@ command_menu_type menu_data[] =
        {MN_EOL, 1, KTRL('e'), EC_EOL},
        {MN_PGUP, 1, KTRL('o'), EC_PGUP},
        {MN_PGDOWN, 1, KTRL('l'), EC_PGDOWN},
-       {MN_TOP, 1, KTRL('y'), EC_TOP},
+       {MN_TOP, 1, KTRL('t'), EC_TOP},
        {MN_BOTTOM, 1, KTRL('u'), EC_BOTTOM},
 
        {MN_INSERT, 0, -1, -1},
index 078c9ad..e28a59a 100644 (file)
@@ -2751,9 +2751,9 @@ static void get_extra(bool roll_hitdie)
        for (i = 0; i < 5; i++)
                for (j = 0; j < 64; j++)
                        p_ptr->weapon_exp[i][j] = s_info[p_ptr->pclass].w_start[i][j];
-       if ((p_ptr->pseikaku == SEIKAKU_SEXY) && (p_ptr->weapon_exp[TV_HAFTED-TV_BOW][SV_WHIP] < WEAPON_EXP_BEGINNER))
+       if ((p_ptr->pseikaku == SEIKAKU_SEXY) && (p_ptr->weapon_exp[TV_HAFTED-TV_WEAPON_BEGIN][SV_WHIP] < WEAPON_EXP_BEGINNER))
        {
-               p_ptr->weapon_exp[TV_HAFTED-TV_BOW][SV_WHIP] = WEAPON_EXP_BEGINNER;
+               p_ptr->weapon_exp[TV_HAFTED-TV_WEAPON_BEGIN][SV_WHIP] = WEAPON_EXP_BEGINNER;
        }
 
        for (i = 0; i < 10; i++)
index f2053b4..1a94fc0 100644 (file)
@@ -2076,7 +2076,7 @@ static void py_attack_aux(int y, int x, bool *fear, bool *mdeath, s16b hand, int
        {
                if ((r_ptr->level + 10) > p_ptr->lev)
                {
-                       int tval = inventory[INVEN_RARM+hand].tval - TV_BOW;
+                       int tval = inventory[INVEN_RARM+hand].tval - TV_WEAPON_BEGIN;
                        int sval = inventory[INVEN_RARM+hand].sval;
                        int now_exp = p_ptr->weapon_exp[tval][sval];
                        if (now_exp < s_info[p_ptr->pclass].w_max[tval][sval])
index ef2e342..7d3e42a 100644 (file)
@@ -986,8 +986,6 @@ void do_cmd_destroy(void)
        /* Verify unless quantity given */
        if (!force && (confirm_destroy || (object_value(o_ptr) > 0)))
        {
-               bool okay = TRUE;
-
                /* Make a verification */
                sprintf(out_val, 
 #ifdef JP
@@ -999,9 +997,6 @@ void do_cmd_destroy(void)
 
                msg_print(NULL);
 
-               /* Prompt */
-               prt(out_val, 0, 0);
-
                /* HACK : Add the line to message buffer */
                message_add(out_val);
                p_ptr->window |= (PW_MESSAGE);
@@ -1010,18 +1005,25 @@ void do_cmd_destroy(void)
                /* Get an acceptable answer */
                while (TRUE)
                {
-                       char i = inkey();
+                       char i;
+
+                       /* Prompt */
+                       prt(out_val, 0, 0);
+
+                       i = inkey();
+
+                       /* Erase the prompt */
+                       prt("", 0, 0);
+
 
                        if (i == 'y' || i == 'Y')
                        {
-                               okay = TRUE;
                                break;
                        }
                        if (i == ESCAPE || i == 'n' || i == 'N')
                        {
                                /* Cancel */
-                               okay = FALSE;
-                               break;
+                               return;
                        }
                        if (i == 'a' || i == 'A')
                        {
@@ -1038,16 +1040,7 @@ void do_cmd_destroy(void)
                                /* The object is already destroyed. */
                                return;
                        }
-
-                       /* Loop */
-                       continue;
                }
-
-               /* Erase the prompt */
-               prt("", 0, 0);
-
-               /* Cancelled */
-               if (!okay) return;
        }
 
        /* Take a turn */
index fb371f0..361036c 100644 (file)
@@ -5741,13 +5741,13 @@ static void do_cmd_knowledge_inven_aux(FILE *fff, object_type *o_ptr, int *j, by
         * HACK:Ring of Lordly protection and Dragon equipment
         * have random resistances.
         */
-       if (((o_ptr->tval >= TV_BOW) && (o_ptr->tval<= TV_DRAG_ARMOR) && o_ptr->name2)
-           || ((o_ptr->tval == TV_AMULET) && (o_ptr->sval == SV_AMULET_RESISTANCE))
-           || ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_LORDLY))
-           || ((o_ptr->tval == TV_SHIELD) && (o_ptr->sval == SV_DRAGON_SHIELD))
-           || ((o_ptr->tval == TV_HELM) && (o_ptr->sval == SV_DRAGON_HELM))
-           || ((o_ptr->tval == TV_GLOVES) && (o_ptr->sval == SV_SET_OF_DRAGON_GLOVES))
-           || ((o_ptr->tval == TV_BOOTS) && (o_ptr->sval == SV_PAIR_OF_DRAGON_GREAVE))
+       if (((TV_EQUIP_BEGIN <= tval) && (tval <= TV_EQUIP_END) && o_ptr->name2)
+           || ((tval == TV_AMULET) && (o_ptr->sval == SV_AMULET_RESISTANCE))
+           || ((tval == TV_RING) && (o_ptr->sval == SV_RING_LORDLY))
+           || ((tval == TV_SHIELD) && (o_ptr->sval == SV_DRAGON_SHIELD))
+           || ((tval == TV_HELM) && (o_ptr->sval == SV_DRAGON_HELM))
+           || ((tval == TV_GLOVES) && (o_ptr->sval == SV_SET_OF_DRAGON_GLOVES))
+           || ((tval == TV_BOOTS) && (o_ptr->sval == SV_PAIR_OF_DRAGON_GREAVE))
            || o_ptr->art_name || o_ptr->name1)
        {
                int i = 0;
@@ -5853,7 +5853,7 @@ static void do_cmd_knowledge_inven(void)
        }
        fprintf(fff, "%s\n", inven_res_label);
 
-       for (tval = TV_BOW; tval <= TV_RING; tval++)
+       for (tval = TV_EQUIP_BEGIN; tval <= TV_EQUIP_END; tval++)
        {
                if (j != 0)
                {
index a903b1b..796831e 100644 (file)
 #define TV_HISSATSU_BOOK 106
 #define TV_GOLD         127     /* Gold can only be picked up by players */
 
+#define TV_MISSILE_BEGIN TV_SHOT
+#define TV_MISSILE_END   TV_BOLT
+#define TV_EQUIP_BEGIN   TV_BOW
+#define TV_EQUIP_END     TV_CARD
+#define TV_WEAPON_BEGIN         TV_BOW
+#define TV_WEAPON_END           TV_SWORD
+#define TV_ARMOR_BEGIN          TV_BOOTS
+#define TV_ARMOR_END            TV_DRAG_ARMOR
+
 /* Any subvalue */
 #define SV_ANY                                         255
 
index 182a785..5b76cbd 100644 (file)
@@ -6944,7 +6944,7 @@ quit("
 
        /* Sexy gal gets bonus to maximum weapon skill of whip */
        if (p_ptr->pseikaku == SEIKAKU_SEXY)
-               s_info[p_ptr->pclass].w_max[TV_HAFTED-TV_BOW][SV_WHIP] = WEAPON_EXP_MASTER;
+               s_info[p_ptr->pclass].w_max[TV_HAFTED-TV_WEAPON_BEGIN][SV_WHIP] = WEAPON_EXP_MASTER;
 
        /* Fill the arrays of floors and walls in the good proportions */
        set_floor_and_wall(dungeon_type);
index a7f93ba..0ce8597 100644 (file)
@@ -5443,7 +5443,7 @@ void calc_android_exp(void)
                        s32b total_flags = flag_cost(o_ptr, o_ptr->pval);
                        int fake_level;
 
-                       if (o_ptr->tval >= TV_BOOTS)
+                       if (o_ptr->tval >= TV_ARMOR_BEGIN)
                        {
                                /* For armors */
                                if (total_flags < 15000) fake_level = 10;
index 7056e52..7604fac 100644 (file)
@@ -558,8 +558,8 @@ u32b get_curse(int power, object_type *o_ptr)
                {
                        if (new_curse & TRC_HEAVY_MASK) continue;
                }
-               if (((o_ptr->tval < TV_BOW) || (o_ptr->tval > TV_SWORD)) && (new_curse == TRC_LOW_MELEE)) continue;
-               if (((o_ptr->tval < TV_BOOTS) || (o_ptr->tval > TV_DRAG_ARMOR)) && (new_curse == TRC_LOW_AC)) continue;
+               if (((o_ptr->tval < TV_WEAPON_BEGIN) || (o_ptr->tval > TV_WEAPON_END)) && (new_curse == TRC_LOW_MELEE)) continue;
+               if (((o_ptr->tval < TV_ARMOR_BEGIN) || (o_ptr->tval > TV_ARMOR_END)) && (new_curse == TRC_LOW_AC)) continue;
                break;
        }
        return new_curse;
index 7eec5e7..5c46d80 100644 (file)
@@ -7517,7 +7517,8 @@ static void drain_essence(void)
        {
                drain_value[TR_DEX] += 20;
        }
-       if ((o_ptr->tval >= TV_SHOT) && (o_ptr->tval <= TV_SWORD) && (o_ptr->tval != TV_BOW))
+       if ((TV_MISSILE_BEGIN <= o_ptr->tval && o_ptr->tval <= TV_MISSILE_END) ||
+           (TV_WEAPON_BEGIN <=  o_ptr->tval && o_ptr->tval <= TV_WEAPON_END))
        {
                if (old_ds > o_ptr->ds) drain_value[TR_ES_ATTACK] += (old_ds-o_ptr->ds)*10;
 
index ac6af74..3a11764 100644 (file)
@@ -5230,7 +5230,7 @@ static int minus_ac(void)
        /* Nothing to damage */
        if (!o_ptr->k_idx) return (FALSE);
 
-       if (o_ptr->tval < TV_BOOTS) return (FALSE);
+       if (o_ptr->tval <= TV_WEAPON_END) return (FALSE);
 
        /* No damage left to be done */
        if (o_ptr->ac + o_ptr->to_a <= 0) return (FALSE);
index 27daf2d..67fb12d 100644 (file)
@@ -407,7 +407,7 @@ static void do_cmd_wiz_change_aux(void)
        if (tmp_s16b < WEAPON_EXP_UNSKILLED) tmp_s16b = WEAPON_EXP_UNSKILLED;
        if (tmp_s16b > WEAPON_EXP_MASTER) tmp_s16b = WEAPON_EXP_MASTER;
 
-       for (j = 0; j <= TV_SWORD - TV_BOW; j++)
+       for (j = 0; j <= TV_WEAPON_END - TV_WEAPON_BEGIN; j++)
        {
                for (i = 0;i < 64;i++)
                {
index 2f9b621..3cf7d0f 100644 (file)
@@ -5073,7 +5073,7 @@ void calc_bonuses(void)
        {
                if (buki_motteruka(INVEN_RARM+i))
                {
-                       int tval = inventory[INVEN_RARM+i].tval - TV_BOW;
+                       int tval = inventory[INVEN_RARM+i].tval - TV_WEAPON_BEGIN;
                        int sval = inventory[INVEN_RARM+i].sval;
 
                        p_ptr->to_h[i] += (p_ptr->weapon_exp[tval][sval] - WEAPON_EXP_BEGINNER) / 200;