OSDN Git Service

[Refactor] #37353 notice_stuff() の直接呼出しを抑止。 / Forbid call of notice_stuff() except...
[hengband/hengband.git] / src / bldg.c
index 94796cd..7728016 100644 (file)
@@ -13,7 +13,7 @@
 */
 
 #include "angband.h"
-
+#include "object-hook.h"
 
 /*!
  * ループ中で / hack as in leave_store in store.c
@@ -302,19 +302,15 @@ static void arena_comm(int cmd)
 
                                p_ptr->monster_race_idx = arena_info[p_ptr->arena_number].r_idx;
                                p_ptr->window |= (PW_MONSTER);
-                               window_stuff();
+                               handle_stuff();
 
                        }
                        break;
                case BACT_ARENA_RULES:
-
-                       /* Save screen */
                        screen_save();
 
                        /* Peruse the arena help file */
                        (void)show_file(TRUE, _("arena_j.txt", "arena.txt"), NULL, 0, 0);
-
-                       /* Load screen */
                        screen_load();
 
                        break;
@@ -979,95 +975,6 @@ static int do_poker(void)
                cards[i] = deck[deck_ptr++];
                kaeruka[i] = 0; /* default:nokosu */
        }
-       
-#if 0
-       /* debug:RF */
-       cards[0] = 12;
-       cards[1] = 0;
-       cards[2] = 9;
-       cards[3] = 11;
-       cards[4] = 10;
-#endif
-#if 0
-       /* debug:SF */
-       cards[0] = 3;
-       cards[1] = 2;
-       cards[2] = 4;
-       cards[3] = 6;
-       cards[4] = 5;
-#endif
-#if 0
-       /* debug:Four Cards */
-       cards[0] = 0;
-       cards[1] = 0 + 13 * 1;
-       cards[2] = 0 + 13 * 2;
-       cards[3] = 0 + 13 * 3;
-       cards[4] = 51;
-#endif
-#if 0
-       /* debug:Straight1 */
-       cards[0] = 1;
-       cards[1] = 0 + 13;
-       cards[2] = 3;
-       cards[3] = 2 + 26;
-       cards[4] = 4;
-#endif
-#if 0
-       /* debug:Straight2 */
-       cards[0] = 12;
-       cards[1] = 0;
-       cards[2] = 9;
-       cards[3] = 11 + 13 * 2;
-       cards[4] = 10;
-#endif
-#if 0
-       /* debug:Straight3 */
-       cards[0] = 52;
-       cards[1] = 0;
-       cards[2] = 9;
-       cards[3] = 11 + 13 * 2;
-       cards[4] = 10;
-#endif
-#if 0
-       /* debug:Straight4 */
-       cards[0] = 12;
-       cards[1] = 52;
-       cards[2] = 9;
-       cards[3] = 11 + 13 * 2;
-       cards[4] = 10;
-#endif
-#if 0
-       /* debug:Straight5 */
-       cards[0] = 4;
-       cards[1] = 5 + 13;
-       cards[2] = 6;
-       cards[3] = 7 + 26;
-       cards[4] = 3;
-#endif
-#if 0
-       /* debug:Five Card1 */
-       cards[0] = 4;
-       cards[1] = 52;
-       cards[2] = 4 + 13;
-       cards[3] = 4 + 26;
-       cards[4] = 4 + 39;
-#endif
-#if 0
-       /* debug:Five Card2 */
-       cards[1] = 52;
-       cards[0] = 4;
-       cards[2] = 4 + 13;
-       cards[3] = 4 + 26;
-       cards[4] = 4 + 39;
-#endif
-#if 0
-       /* debug */
-       cards[0] = 52;
-       cards[1] = 0;
-       cards[2] = 1;
-       cards[3] = 2;
-       cards[4] = 3;
-#endif
 
        /* suteruno wo kimeru */
        prt(_("残すカードを決めて下さい(方向で移動, スペースで選択)。", "Stay witch? "), 0, 0);
@@ -1465,7 +1372,6 @@ static bool vault_aux_battle(MONRACE_IDX r_idx)
        }
        if (!dam && !(r_ptr->flags4 & (RF4_BOLT_MASK | RF4_BEAM_MASK | RF4_BALL_MASK | RF4_BREATH_MASK)) && !(r_ptr->a_ability_flags1 & (RF5_BOLT_MASK | RF5_BEAM_MASK | RF5_BALL_MASK | RF5_BREATH_MASK)) && !(r_ptr->a_ability_flags2 & (RF6_BOLT_MASK | RF6_BEAM_MASK | RF6_BALL_MASK | RF6_BREATH_MASK))) return (FALSE);
 
-       /* Okay */
        return (TRUE);
 }
 
@@ -1744,7 +1650,7 @@ static void tsuchinoko(void)
 static void shoukinkubi(void)
 {
        int i;
-       int y = 0;
+       TERM_LEN y = 0;
 
        clear_bldg(4,18);
        prt(_("死体を持ち帰れば報酬を差し上げます。", "Offer a prize when you bring a wanted monster's corpse"),4 ,10);
@@ -1821,7 +1727,8 @@ static struct {
  */
 static bool kankin(void)
 {
-       int i, j;
+       INVENTORY_IDX i;
+       int j;
        bool change = FALSE;
        char o_name[MAX_NLEN];
        object_type *o_ptr;
@@ -1948,7 +1855,8 @@ static bool kankin(void)
                        if ((o_ptr->tval == TV_CORPSE) && (o_ptr->pval == kubi_r_idx[j]))
                        {
                                char buf[MAX_NLEN+20];
-                               int num, k, item_new;
+                               int num, k;
+                               INVENTORY_IDX item_new;
                                object_type forge;
 
                                object_desc(o_name, o_ptr, 0);
@@ -1998,14 +1906,11 @@ static bool kankin(void)
                                 */
                                item_new = inven_carry(&forge);
 
-                               /* Describe the object */
                                object_desc(o_name, &forge, 0);
                                msg_format(_("%s(%c)を貰った。", "You get %s (%c). "), o_name, index_to_label(item_new));
 
                                /* Auto-inscription */
                                autopick_alter_item(item_new, FALSE);
-
-                               /* Handle stuff */
                                handle_stuff();
 
                                change = TRUE;
@@ -2306,13 +2211,10 @@ static void castle_quest(void)
  */
 static void town_history(void)
 {
-       /* Save screen */
        screen_save();
 
        /* Peruse the building help file */
        (void)show_file(TRUE, _("jbldg.txt", "bldg.txt"), NULL, 0, 0);
-
-       /* Load screen */
        screen_load();
 }
 
@@ -2356,7 +2258,7 @@ HIT_POINT calc_crit_ratio_shot(HIT_POINT plus_ammo, HIT_POINT plus_bow)
  * @param dam 基本ダメージ量
  * @return ダメージ期待値
  */
-HIT_POINT calc_expect_crit_shot(int weight, int plus_ammo, int plus_bow,  HIT_POINT dam)
+HIT_POINT calc_expect_crit_shot(WEIGHT weight, int plus_ammo, int plus_bow,  HIT_POINT dam)
 {
        u32b num;
        int i, k, crit;
@@ -2398,7 +2300,7 @@ HIT_POINT calc_expect_crit_shot(int weight, int plus_ammo, int plus_bow,  HIT_PO
  * @param dokubari 毒針処理か否か
  * @return ダメージ期待値
  */
-HIT_POINT calc_expect_crit(int weight, int plus, HIT_POINT dam, s16b meichuu, bool dokubari)
+HIT_POINT calc_expect_crit(WEIGHT weight, int plus, HIT_POINT dam, s16b meichuu, bool dokubari)
 {
        u32b k, num;
        int i;
@@ -2477,7 +2379,7 @@ static HIT_POINT calc_slaydam(HIT_POINT dam, int mult, int div, bool force)
  * @param vorpal_div 切れ味倍率(割り算部分)
  * @return ダメージ期待値
  */
-static u32b calc_expect_dice(u32b dam, int mult, int div, bool force, int weight, int plus, s16b meichuu, bool dokubari, int vorpal_mult, int vorpal_div)
+static u32b calc_expect_dice(u32b dam, int mult, int div, bool force, WEIGHT weight, int plus, s16b meichuu, bool dokubari, int vorpal_mult, int vorpal_div)
 {
        dam = calc_slaydam(dam, mult, div, force);
        dam = calc_expect_crit(weight, plus, dam, meichuu, dokubari);
@@ -2537,7 +2439,7 @@ static void show_weapon_dmg(int r, int c, int mindice, int maxdice, int blows, i
  */
 static void compare_weapon_aux(object_type *o_ptr, int col, int r)
 {
-       u32b flgs[TR_FLAG_SIZE];
+       BIT_FLAGS flgs[TR_FLAG_SIZE];
        int blow = p_ptr->num_blow[0];
        bool force = FALSE;
        bool dokubari = FALSE;
@@ -2741,11 +2643,11 @@ static void compare_weapon_aux(object_type *o_ptr, int col, int r)
  * @brief モンスターへの命中率の計算
  * @param to_h 命中値
  * @param ac 敵AC
- * @return なし
+ * @return 命中確率
  */
-static int hit_chance(int to_h, int ac)
+static PERCENTAGE hit_chance(HIT_PROB to_h, ARMOUR_CLASS ac)
 {
-       int chance = 0;
+       PERCENTAGE chance = 0;
        int meichuu = p_ptr->skill_thn + (p_ptr->to_h[0] + to_h) * BTH_PLUS_ADJ;
 
        if (meichuu <= 0) return 5;
@@ -2771,14 +2673,14 @@ static int hit_chance(int to_h, int ac)
  * various info about the player's +to_dam and number of blows.
  * @return なし
  */
-static void list_weapon(object_type *o_ptr, int row, int col)
+static void list_weapon(object_type *o_ptr, TERM_LEN row, TERM_LEN col)
 {
        char o_name[MAX_NLEN];
        char tmp_str[80];
 
        /* Effective dices */
-       int eff_dd = o_ptr->dd + p_ptr->to_dd[0];
-       int eff_ds = o_ptr->ds + p_ptr->to_ds[0];
+       DICE_NUMBER eff_dd = o_ptr->dd + p_ptr->to_dd[0];
+       DICE_SID eff_ds = o_ptr->ds + p_ptr->to_ds[0];
 
        /* Print the weapon name */
        object_desc(o_name, o_ptr, OD_NAME_ONLY);
@@ -2812,53 +2714,6 @@ static void list_weapon(object_type *o_ptr, int row, int col)
        put_str(tmp_str, row+7, col+1);
 }
 
-
-/*!
- * @brief 武器匠の「武器」鑑定対象になるかを判定する。/ Hook to specify "weapon"
- * @param o_ptr オブジェクトの構造体の参照ポインタ。
- * @return 対象になるならTRUEを返す。
- */
-static bool item_tester_hook_melee_weapon(object_type *o_ptr)
-{
-       switch (o_ptr->tval)
-       {
-               case TV_HAFTED:
-               case TV_POLEARM:
-               case TV_DIGGING:
-               {
-                       return (TRUE);
-               }
-               case TV_SWORD:
-               {
-                       if (o_ptr->sval != SV_DOKUBARI) return (TRUE);
-               }
-       }
-
-       return (FALSE);
-}
-
-
-/*!
- * @brief 武器匠の「矢弾」鑑定対象になるかを判定する。/ Hook to specify "weapon"
- * @param o_ptr オブジェクトの構造体の参照ポインタ。
- * @return 対象になるならTRUEを返す。
- */
-static bool item_tester_hook_ammo(object_type *o_ptr)
-{
-       switch (o_ptr->tval)
-       {
-               case TV_SHOT:
-               case TV_ARROW:
-               case TV_BOLT:
-               {
-                       return (TRUE);
-               }
-       }
-
-       return (FALSE);
-}
-
-
 /*!
  * @brief 武器匠鑑定1回分(オブジェクト2種)の処理。/ Compare weapons
  * @details 
@@ -2868,7 +2723,7 @@ static bool item_tester_hook_ammo(object_type *o_ptr)
  * @param bcost 基本鑑定費用
  * @return 最終的にかかった費用
  */
-static int compare_weapons(int bcost)
+static PRICE compare_weapons(PRICE bcost)
 {
        int i, n;
        OBJECT_IDX item, item2;
@@ -2876,12 +2731,12 @@ static int compare_weapons(int bcost)
        object_type orig_weapon;
        object_type *i_ptr;
        cptr q, s;
-       int row = 2;
-       int wid = 38, mgn = 2;
+       TERM_LEN row = 2;
+       TERM_LEN wid = 38, mgn = 2;
        bool old_character_xtra = character_xtra;
        char ch;
-       int total = 0;
-       int cost = 0; /* First time no price */
+       PRICE total = 0;
+       PRICE cost = 0; /* First time no price */
 
        /* Save the screen */
        screen_save();
@@ -2895,7 +2750,7 @@ static int compare_weapons(int bcost)
 
        /* Only compare melee weapons */
        item_tester_no_ryoute = TRUE;
-       item_tester_hook = item_tester_hook_melee_weapon;
+       item_tester_hook = item_tester_hook_orthodox_melee_weapons;
 
        /* Get the first weapon */
        q = _("第一の武器は?", "What is your first weapon? ");
@@ -2919,7 +2774,7 @@ static int compare_weapons(int bcost)
 
                /* Only compare melee weapons */
                item_tester_no_ryoute = TRUE;
-               item_tester_hook = item_tester_hook_melee_weapon;
+               item_tester_hook = item_tester_hook_orthodox_melee_weapons;
 
                /* Hack -- prevent "icky" message */
                character_xtra = TRUE;
@@ -2932,8 +2787,8 @@ static int compare_weapons(int bcost)
                        /* Copy i-th weapon into the weapon slot (if it's not already there) */
                        if (o_ptr[i] != i_ptr) object_copy(i_ptr, o_ptr[i]);
 
-                       /* Get the new values */
-                       calc_bonuses();
+                       p_ptr->update |= PU_BONUS;
+                       handle_stuff();
 
                        /* List the new values */
                        list_weapon(o_ptr[i], row, col);
@@ -2944,7 +2799,8 @@ static int compare_weapons(int bcost)
                }
 
                /* Reset the values for the old weapon */
-               calc_bonuses();
+               p_ptr->update |= PU_BONUS;
+               handle_stuff();
 
                character_xtra = old_character_xtra;
 
@@ -2992,7 +2848,6 @@ static int compare_weapons(int bcost)
        /* Restore the screen */
        screen_load();
 
-       /* Done */
        return (total);
 }
 
@@ -3005,7 +2860,7 @@ static int compare_weapons(int bcost)
  * @param iAC プレイヤーのAC。
  * @return 常にTRUEを返す。
  */
-static bool eval_ac(int iAC)
+static bool eval_ac(ARMOUR_CLASS iAC)
 {
 #ifdef JP
        const char memo[] =
@@ -3032,8 +2887,8 @@ static bool eval_ac(int iAC)
 #endif
 
        int protection;
-       int col, row = 2;
-       int lvl;
+       TERM_LEN col, row = 2;
+       DEPTH lvl;
        char buf[80*20], *t;
 
        /* AC lower than zero has no effect */
@@ -3085,40 +2940,16 @@ static bool eval_ac(int iAC)
        for (t = buf; t[0]; t += strlen(t) + 1)
                put_str(t, (row++) + 4, 4);
 
-#ifdef JP
-       prt("現在のあなたの装備からすると、あなたの防御力は"
-                  "これくらいです:", 0, 0);
-#else
-       prt("Defense abilities from your current Armor Class are evaluated below.", 0, 0);
-#endif
+       prt(_("現在のあなたの装備からすると、あなたの防御力はこれくらいです:", "Defense abilities from your current Armor Class are evaluated below."), 0, 0);
   
        flush();
        (void)inkey();
        screen_load();
 
-       /* Done */
        return (TRUE);
 }
 
 
-/*!
- * @brief 修復対象となる壊れた武器かを判定する。 / Hook to specify "broken weapon"
- * @param o_ptr オブジェクトの構造体の参照ポインタ。
- * @return 修復対象になるならTRUEを返す。
- */
-static bool item_tester_hook_broken_weapon(object_type *o_ptr)
-{
-       if (o_ptr->tval != TV_SWORD) return FALSE;
-
-       switch (o_ptr->sval)
-       {
-       case SV_BROKEN_DAGGER:
-       case SV_BROKEN_SWORD:
-               return TRUE;
-       }
-
-       return FALSE;
-}
 
 /*!
  * @brief 修復材料のオブジェクトから修復対象に特性を移植する。
@@ -3130,8 +2961,8 @@ static void give_one_ability_of_object(object_type *to_ptr, object_type *from_pt
 {
        int i, n = 0;
        int cand[TR_FLAG_MAX];
-       u32b to_flgs[TR_FLAG_SIZE];
-       u32b from_flgs[TR_FLAG_SIZE];
+       BIT_FLAGS to_flgs[TR_FLAG_SIZE];
+       BIT_FLAGS from_flgs[TR_FLAG_SIZE];
 
        object_flags(to_ptr, to_flgs);
        object_flags(from_ptr, from_flgs);
@@ -3178,17 +3009,17 @@ static void give_one_ability_of_object(object_type *to_ptr, object_type *from_pt
 
 /*!
  * @brief アイテム修復処理のメインルーチン / Repair broken weapon
- * @param bcost 基本鑑定費用
+ * @param bcost 基本修復費用
  * @return 実際にかかった費用
  */
-static int repair_broken_weapon_aux(int bcost)
+static PRICE repair_broken_weapon_aux(PRICE bcost)
 {
-       s32b cost;
+       PRICE cost;
        OBJECT_IDX item, mater;
        object_type *o_ptr, *mo_ptr; /* broken weapon and material weapon */
        object_kind *k_ptr;
        int i, dd_bonus, ds_bonus;
-       IDX k_idx;
+       KIND_OBJECT_IDX k_idx;
        char basenm[MAX_NLEN];
        cptr q, s; /* For get_item prompt */
        int row = 7;
@@ -3196,11 +3027,9 @@ static int repair_broken_weapon_aux(int bcost)
        /* Clear screen */
        clear_bldg(0, 22);
 
-       /* Notice */
        prt(_("修復には材料となるもう1つの武器が必要です。", "Hand one material weapon to repair a broken weapon."), row, 2);
        prt(_("材料に使用した武器はなくなります!", "The material weapon will disappear after repairing!!"), row+1, 2);
 
-       /* Get an item */
        q = _("どの折れた武器を修復しますか?", "Repair which broken weapon? ");
        s = _("修復できる折れた武器がありません。", "You have no broken weapon to repair.");
 
@@ -3230,12 +3059,11 @@ static int repair_broken_weapon_aux(int bcost)
        object_desc(basenm, o_ptr, OD_NAME_ONLY);
        prt(format(_("修復する武器 : %s", "Repairing: %s"), basenm), row+3, 2);
 
-       /* Get an item */
        q = _("材料となる武器は?", "Which weapon for material? ");
        s = _("材料となる武器がありません。", "You have no material to repair.");
 
        /* Only forge broken weapons */
-       item_tester_hook = item_tester_hook_melee_weapon;
+       item_tester_hook = item_tester_hook_orthodox_melee_weapons;
 
        if (!get_item(&mater, q, s, (USE_INVEN | USE_EQUIP))) return (0);
        if (mater == item)
@@ -3260,8 +3088,7 @@ static int repair_broken_weapon_aux(int bcost)
        if (p_ptr->au < cost)
        {
                object_desc(basenm, o_ptr, OD_NAME_ONLY);
-               msg_format(_("%sを修復するだけのゴールドがありません!",
-                       "You do not have the gold to repair %s!"), basenm);
+               msg_format(_("%sを修復するだけのゴールドがありません!", "You do not have the gold to repair %s!"), basenm);
                msg_print(NULL);
                return (0);
        }
@@ -3437,10 +3264,9 @@ static int repair_broken_weapon_aux(int bcost)
  * @param bcost 基本鑑定費用
  * @return 実際にかかった費用
  */
-static int repair_broken_weapon(int bcost)
+static int repair_broken_weapon(PRICE bcost)
 {
-       int cost;
-
+       PRICE cost;
        screen_save();
        cost = repair_broken_weapon_aux(bcost);
        screen_load();
@@ -3454,9 +3280,9 @@ static int repair_broken_weapon(int bcost)
  * @param to_hit 命中をアップさせる量
  * @param to_dam ダメージをアップさせる量
  * @param to_ac ACをアップさせる量
- * @return 実際にかかった費用
+ * @return 実際に行ったらTRUE
  */
-static bool enchant_item(int cost, int to_hit, int to_dam, int to_ac)
+static bool enchant_item(PRICE cost, HIT_PROB to_hit, HIT_POINT to_dam, ARMOUR_CLASS to_ac)
 {
        int         i;
        OBJECT_IDX  item;
@@ -3477,7 +3303,6 @@ static bool enchant_item(int cost, int to_hit, int to_dam, int to_ac)
 
        item_tester_no_ryoute = TRUE;
 
-       /* Get an item */
        q = _("どのアイテムを改良しますか?", "Improve which item? ");
        s = _("改良できるものがありません。", "You have nothing to improve.");
 
@@ -3536,12 +3361,8 @@ static bool enchant_item(int cost, int to_hit, int to_dam, int to_ac)
        /* Failure */
        if (!okay)
        {
-               /* Flush */
                if (flush_failure) flush();
-
-               /* Message */
                msg_print(_("改良に失敗した。", "The improvement failed."));
-
                return (FALSE);
        }
        else
@@ -3578,11 +3399,11 @@ static bool enchant_item(int cost, int to_hit, int to_dam, int to_ac)
 static void building_recharge(void)
 {
        OBJECT_IDX  item;
-       int         lev;
+       DEPTH       lev;
        object_type *o_ptr;
        object_kind *k_ptr;
        cptr        q, s;
-       int         price;
+       PRICE       price;
        PARAMETER_VALUE charges;
        int         max_charges;
        char        tmp_str[MAX_NLEN];
@@ -3597,7 +3418,6 @@ static void building_recharge(void)
        /* Only accept legal items */
        item_tester_hook = item_tester_hook_recharge;
 
-       /* Get an item */
        q = _("どのアイテムに魔力を充填しますか? ", "Recharge which item? ");
        s = _("魔力を充填すべきアイテムがない。", "You have nothing to recharge.");
        if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
@@ -3755,7 +3575,7 @@ if (get_check(format("そのロッドを$%d で再充填しますか?",
                        max_charges = o_ptr->number * k_ptr->pval - o_ptr->pval;
 
                /* Get the quantity for staves and wands */
-               charges = get_quantity(format(_("一回分$%d で何回分充填しますか?", "Add how many charges for %d gold? "), price), 
+               charges = (PARAMETER_VALUE)get_quantity(format(_("一回分$%d で何回分充填しますか?", "Add how many charges for %d gold? "), price), 
                                        MIN(p_ptr->au / price, max_charges));
 
                /* Do nothing */
@@ -3782,7 +3602,6 @@ if (get_check(format("そのロッドを$%d で再充填しますか?",
        /* Combine / Reorder the pack (later) */
        p_ptr->notice |= (PN_COMBINE | PN_REORDER);
 
-       /* Window stuff */
        p_ptr->window |= (PW_INVEN);
 
        /* Pay the price */
@@ -3806,12 +3625,12 @@ if (get_check(format("そのロッドを$%d で再充填しますか?",
  */
 static void building_recharge_all(void)
 {
-       int         i;
-       int         lev;
+       INVENTORY_IDX i;
+       DEPTH lev;
        object_type *o_ptr;
        object_kind *k_ptr;
-       int         price = 0;
-       int         total_cost = 0;
+       PRICE price = 0;
+       PRICE total_cost = 0;
 
 
        /* Display some info */
@@ -3928,7 +3747,6 @@ static void building_recharge_all(void)
        /* Combine / Reorder the pack (later) */
        p_ptr->notice |= (PN_COMBINE | PN_REORDER);
 
-       /* Window stuff */
        p_ptr->window |= (PW_INVEN);
 
        /* Pay the price */
@@ -3962,14 +3780,14 @@ bool tele_town(void)
        screen_save();
        clear_bldg(4, 10);
 
-       for (i=1;i<max_towns;i++)
+       for (i = 1; i < max_towns; i++)
        {
                char buf[80];
 
-               if ((i == NO_TOWN) || (i == SECRET_TOWN) || (i == p_ptr->town_num) || !(p_ptr->visit & (1L << (i-1)))) continue;
+               if ((i == NO_TOWN) || (i == SECRET_TOWN) || (i == p_ptr->town_num) || !(p_ptr->visit & (1L << (i - 1)))) continue;
 
-               sprintf(buf,"%c) %-20s", I2A(i-1), town[i].name);
-               prt(buf, 5+i, 5);
+               sprintf(buf, "%c) %-20s", I2A(i - 1), town[i].name);
+               prt(buf, 5 + i, 5);
                num++;
        }
 
@@ -4027,14 +3845,10 @@ static bool research_mon(void)
        MONRACE_IDX r_idx;
        char sym, query;
        char buf[128];
-
        bool notpicked;
-
        bool recall = FALSE;
-
        u16b why = 0;
-
-       IDX *who;
+       MONSTER_IDX *who;
 
        /* XTRA HACK WHATSEARCH */
        bool    all = FALSE;
@@ -4224,8 +4038,6 @@ static bool research_mon(void)
 
                                /* Save this monster ID */
                                monster_race_track(r_idx);
-
-                               /* Hack -- Handle stuff */
                                handle_stuff();
 
                                /* know every thing mode */
@@ -4293,12 +4105,12 @@ static bool research_mon(void)
  */
 static void bldg_process_command(building_type *bldg, int i)
 {
-       int bact = bldg->actions[i];
-       int bcost;
+       BACT_IDX bact = bldg->actions[i];
+       PRICE bcost;
        bool paid = FALSE;
        int amt;
 
-       /* Flush messages XXX XXX XXX */
+       /* Flush messages */
        msg_flag = FALSE;
        msg_print(NULL);
 
@@ -4386,16 +4198,9 @@ static void bldg_process_command(building_type *bldg, int i)
                building_recharge_all();
                break;
        case BACT_IDENTS: /* needs work */
-#ifdef JP
-               if (!get_check("持ち物を全て鑑定してよろしいですか?")) break;
+               if (!get_check(_("持ち物を全て鑑定してよろしいですか?", "Do you pay for identify all your possession? "))) break;
                identify_pack();
-               msg_print(" 持ち物全てが鑑定されました。");
-#else
-               if (!get_check("Do you pay for identify all your possession? ")) break;
-               identify_pack();
-               msg_print("Your possessions have been identified.");
-#endif
-
+               msg_print(_(" 持ち物全てが鑑定されました。", "Your possessions have been identified."));
                paid = TRUE;
                break;
        case BACT_IDENT_ONE: /* needs work */
@@ -4405,21 +4210,10 @@ static void bldg_process_command(building_type *bldg, int i)
                do_cmd_study();
                break;
        case BACT_HEALING: /* needs work */
-               hp_player(200);
-               set_poisoned(0);
-               set_blind(0);
-               set_confused(0);
-               set_cut(0);
-               set_stun(0);
-               paid = TRUE;
+               paid = cure_critical_wounds(200);
                break;
        case BACT_RESTORE: /* needs work */
-               if (do_res_stat(A_STR)) paid = TRUE;
-               if (do_res_stat(A_INT)) paid = TRUE;
-               if (do_res_stat(A_WIS)) paid = TRUE;
-               if (do_res_stat(A_DEX)) paid = TRUE;
-               if (do_res_stat(A_CON)) paid = TRUE;
-               if (do_res_stat(A_CHR)) paid = TRUE;
+               paid = restore_all_status();
                break;
        case BACT_ENCHANT_ARROWS:
                item_tester_hook = item_tester_hook_ammo;
@@ -4697,19 +4491,14 @@ void do_cmd_bldg(void)
                        }
                }
 
-               if (validcmd)
-                       bldg_process_command(bldg, i);
-
-               /* Notice stuff */
-               notice_stuff();
+               if(validcmd) bldg_process_command(bldg, i);
 
-               /* Handle stuff */
                handle_stuff();
        }
 
        select_floor_music();
 
-       /* Flush messages XXX XXX XXX */
+       /* Flush messages */
        msg_flag = FALSE;
        msg_print(NULL);
 
@@ -4731,7 +4520,6 @@ void do_cmd_bldg(void)
        /* Redraw entire screen */
        p_ptr->redraw |= (PR_BASIC | PR_EXTRA | PR_EQUIPPY | PR_MAP);
 
-       /* Window stuff */
        p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
 }
 
@@ -4753,7 +4541,7 @@ static cptr find_quest[] =
  * @brief クエストの導入メッセージを表示する / Discover quest
  * @param q_idx 開始されたクエストのID
  */
-void quest_discovery(int q_idx)
+void quest_discovery(QUEST_IDX q_idx)
 {
        quest_type      *q_ptr = &quest[q_idx];
        monster_race    *r_ptr = &r_info[q_ptr->r_idx];
@@ -4806,15 +4594,15 @@ void quest_discovery(int q_idx)
  * @param level 検索対象になる階
  * @return クエストIDを返す。該当がない場合0を返す。
  */
-IDX quest_number(DEPTH level)
+QUEST_IDX quest_number(DEPTH level)
 {
-       IDX i;
+       QUEST_IDX i;
 
        /* Check quests */
        if (p_ptr->inside_quest)
                return (p_ptr->inside_quest);
 
-       for (i = 0; i < max_quests; i++)
+       for (i = 0; i < max_q_idx; i++)
        {
                if (quest[i].status != QUEST_STATUS_TAKEN) continue;
 
@@ -4834,9 +4622,9 @@ IDX quest_number(DEPTH level)
  * @param level 検索対象になる階
  * @return クエストIDを返す。該当がない場合0を返す。
  */
-IDX random_quest_number(DEPTH level)
+QUEST_IDX random_quest_number(DEPTH level)
 {
-       IDX i;
+       QUEST_IDX i;
 
        if (dungeon_type != DUNGEON_ANGBAND) return 0;
 
@@ -4851,6 +4639,5 @@ IDX random_quest_number(DEPTH level)
                }
        }
 
-       /* Nope */
        return 0;
 }