OSDN Git Service

[Refactor] #37353 notice_stuff() の直接呼出しを抑止。 / Forbid call of notice_stuff() except...
[hengband/hengband.git] / src / bldg.c
index eef5b9a..7728016 100644 (file)
@@ -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);
@@ -2000,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;
@@ -2308,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();
 }
 
@@ -2358,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;
@@ -2400,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;
@@ -2479,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);
@@ -2887,8 +2787,8 @@ static PRICE compare_weapons(PRICE 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);
@@ -2899,7 +2799,8 @@ static PRICE compare_weapons(PRICE bcost)
                }
 
                /* Reset the values for the old weapon */
-               calc_bonuses();
+               p_ptr->update |= PU_BONUS;
+               handle_stuff();
 
                character_xtra = old_character_xtra;
 
@@ -2947,7 +2848,6 @@ static PRICE compare_weapons(PRICE bcost)
        /* Restore the screen */
        screen_load();
 
-       /* Done */
        return (total);
 }
 
@@ -3046,7 +2946,6 @@ static bool eval_ac(ARMOUR_CLASS iAC)
        (void)inkey();
        screen_load();
 
-       /* Done */
        return (TRUE);
 }
 
@@ -3120,7 +3019,7 @@ static PRICE repair_broken_weapon_aux(PRICE bcost)
        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;
@@ -3128,11 +3027,9 @@ static PRICE repair_broken_weapon_aux(PRICE 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.");
 
@@ -3162,7 +3059,6 @@ static PRICE repair_broken_weapon_aux(PRICE 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.");
 
@@ -3407,7 +3303,6 @@ static bool enchant_item(PRICE cost, HIT_PROB to_hit, HIT_POINT to_dam, ARMOUR_C
 
        item_tester_no_ryoute = TRUE;
 
-       /* Get an item */
        q = _("どのアイテムを改良しますか?", "Improve which item? ");
        s = _("改良できるものがありません。", "You have nothing to improve.");
 
@@ -3466,12 +3361,8 @@ static bool enchant_item(PRICE cost, HIT_PROB to_hit, HIT_POINT to_dam, ARMOUR_C
        /* Failure */
        if (!okay)
        {
-               /* Flush */
                if (flush_failure) flush();
-
-               /* Message */
                msg_print(_("改良に失敗した。", "The improvement failed."));
-
                return (FALSE);
        }
        else
@@ -3527,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;
@@ -3712,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 */
@@ -3858,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 */
@@ -4150,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 */
@@ -4224,7 +4110,7 @@ static void bldg_process_command(building_type *bldg, int i)
        bool paid = FALSE;
        int amt;
 
-       /* Flush messages XXX XXX XXX */
+       /* Flush messages */
        msg_flag = FALSE;
        msg_print(NULL);
 
@@ -4605,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);
 
@@ -4639,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);
 }
 
@@ -4759,6 +4639,5 @@ QUEST_IDX random_quest_number(DEPTH level)
                }
        }
 
-       /* Nope */
        return 0;
 }