OSDN Git Service

#37449 (2.2.0.75) ゲームメッセージのログ拡張に伴って発生したセーブデータのトラブルを修正。 / Fix trouble of savedata...
[hengband/hengband.git] / src / rooms.c
index 76c09fd..d9ae160 100644 (file)
@@ -2390,16 +2390,7 @@ static bool build_type5(void)
                case 4: place_secret_door(yval, x2 + 1, DOOR_DEFAULT); break;
        }
 
-       /* Describe */
-       if (cheat_room)
-       {
-               /* Room type */
-#ifdef JP
-               msg_format("モンスター部屋(nest)(%s%s)", n_ptr->name, pit_subtype_string(cur_nest_type, TRUE));
-#else
-               msg_format("Monster nest (%s%s)", n_ptr->name, pit_subtype_string(cur_nest_type, TRUE));
-#endif
-       }
+       msg_format_wizard(CHEAT_DUNGEON, _("モンスター部屋(nest)(%s%s)を生成します。", "Monster nest (%s%s)"), n_ptr->name, pit_subtype_string(cur_nest_type, TRUE));
 
        /* Place some monsters */
        for (y = yval - 2; y <= yval + 2; y++)
@@ -2418,7 +2409,7 @@ static bool build_type5(void)
                }
        }
 
-       if (cheat_room && cheat_hear)
+       if (cheat_room)
        {
                ang_sort_comp = ang_sort_comp_nest_mon_info;
                ang_sort_swap = ang_sort_swap_nest_mon_info;
@@ -2433,7 +2424,7 @@ static bool build_type5(void)
                                if (nest_mon_info[i].r_idx != nest_mon_info[i + 1].r_idx) break;
                                if (!nest_mon_info[i + 1].used) break;
                        }
-                       msg_print(r_name + r_info[nest_mon_info[i].r_idx].name);
+                       msg_format_wizard(CHEAT_DUNGEON, "Nest構成モンスターNo.%d:%s", i, r_name + r_info[nest_mon_info[i].r_idx].name);
                }
        }
 
@@ -2630,28 +2621,14 @@ static bool build_type6(void)
                }
        }
 
-       /* Message */
-       if (cheat_room)
-       {
-               /* Room type */
-#ifdef JP
-               msg_format("モンスター部屋(pit)(%s%s)", n_ptr->name, pit_subtype_string(cur_pit_type, FALSE));
-#else
-               msg_format("Monster pit (%s%s)", n_ptr->name, pit_subtype_string(cur_pit_type, FALSE));
-#endif
-       }
+       msg_format_wizard(CHEAT_DUNGEON, _("モンスター部屋(pit)(%s%s)を生成します。", "Monster pit (%s%s)"), n_ptr->name, pit_subtype_string(cur_pit_type, FALSE));
 
        /* Select the entries */
        for (i = 0; i < 8; i++)
        {
                /* Every other entry */
                what[i] = what[i * 2];
-
-               if (cheat_hear)
-               {
-                       /* Message */
-                       msg_print(r_name + r_info[what[i]].name);
-               }
+               msg_format_wizard(CHEAT_DUNGEON, _("Nest構成モンスター選択No.%d:%s", "Nest Monster Select No.%d:%s"), i, r_name + r_info[what[i]].name);
        }
 
        /* Top and bottom rows */
@@ -3025,7 +3002,7 @@ static void build_vault(int yval, int xval, int ymax, int xmax, cptr data,
  */
 static bool build_type7(void)
 {
-       vault_type *v_ptr;
+       vault_type *v_ptr = NULL;
        int dummy;
        int x, y;
        int xval, yval;
@@ -3045,14 +3022,7 @@ static bool build_type7(void)
        /* No lesser vault found */
        if (dummy >= SAFE_MAX_ATTEMPTS)
        {
-               if (cheat_room)
-               {
-#ifdef JP
-                       msg_print("警告!小さな地下室を配置できません!");
-#else
-                       msg_print("Warning! Could not place lesser vault!");
-#endif
-               }
+               msg_print_wizard(CHEAT_DUNGEON, _("小型固定Vaultを配置できませんでした。", "Could not place lesser vault."));
                return FALSE;
        }
 
@@ -3098,11 +3068,7 @@ static bool build_type7(void)
 #endif
 
        /* Message */
-#ifdef JP
-       if (cheat_room) msg_format("小さな地下室(%s)", v_name + v_ptr->name);
-#else
-       if (cheat_room) msg_format("Lesser vault (%s)", v_name + v_ptr->name);
-#endif
+       msg_format_wizard(CHEAT_DUNGEON, _("小型Vault(%s)を生成しました。", "Lesser vault (%s)."), v_name + v_ptr->name);
 
        /* Hack -- Build the vault */
        build_vault(yval, xval, v_ptr->hgt, v_ptr->wid,
@@ -3137,14 +3103,7 @@ static bool build_type8(void)
        /* No greater vault found */
        if (dummy >= SAFE_MAX_ATTEMPTS)
        {
-               if (cheat_room)
-               {
-#ifdef JP
-                       msg_print("警告!巨大な地下室を配置できません!");
-#else
-                       msg_print("Warning! Could not place greater vault!");
-#endif
-               }
+               msg_print_wizard(CHEAT_DUNGEON, _("大型固定Vaultを配置できませんでした。", "Could not place greater vault."));
                return FALSE;
        }
 
@@ -3195,12 +3154,7 @@ static bool build_type8(void)
        v_ptr = &v_info[76 + randint1(3)];
 #endif
 
-       /* Message */
-#ifdef JP
-       if (cheat_room) msg_format("巨大な地下室(%s)", v_name + v_ptr->name);
-#else
-       if (cheat_room) msg_format("Greater vault (%s)", v_name + v_ptr->name);
-#endif
+       msg_format_wizard(CHEAT_DUNGEON, _("大型固定Vault(%s)を生成しました。", "Greater vault (%s)."), v_name + v_ptr->name);
 
        /* Hack -- Build the vault */
        build_vault(yval, xval, v_ptr->hgt, v_ptr->wid,
@@ -4369,8 +4323,7 @@ static void build_bubble_vault(int x0, int y0, int xsize, int ysize)
        int xhsize = xsize / 2;
        int yhsize = ysize / 2;
 
-
-       if (cheat_room) msg_print("Bubble Vault");
+       msg_print_wizard(CHEAT_DUNGEON, _("泡型ランダムVaultを生成しました。", "Room Vault."));
 
        /* Allocate center of bubbles */
        center[0].x = (byte)randint1(xsize - 3) + 1;
@@ -4403,23 +4356,23 @@ static void build_bubble_vault(int x0, int y0, int xsize, int ysize)
        /* Top and bottom boundaries */
        for (i = 0; i < xsize; i++)
        {
-               int x = x0 - xhsize + i;
+               int side_x = x0 - xhsize + i;
 
-               place_outer_noperm_bold(y0 - yhsize + 0, x);
-               cave[y0 - yhsize + 0][x].info |= (CAVE_ROOM | CAVE_ICKY);
-               place_outer_noperm_bold(y0 - yhsize + ysize - 1, x);
-               cave[y0 - yhsize + ysize - 1][x].info |= (CAVE_ROOM | CAVE_ICKY);
+               place_outer_noperm_bold(y0 - yhsize + 0, side_x);
+               cave[y0 - yhsize + 0][side_x].info |= (CAVE_ROOM | CAVE_ICKY);
+               place_outer_noperm_bold(y0 - yhsize + ysize - 1, side_x);
+               cave[y0 - yhsize + ysize - 1][side_x].info |= (CAVE_ROOM | CAVE_ICKY);
        }
 
        /* Left and right boundaries */
        for (i = 1; i < ysize - 1; i++)
        {
-               int y = y0 - yhsize + i;
+               int side_y = y0 - yhsize + i;
 
-               place_outer_noperm_bold(y, x0 - xhsize + 0);
-               cave[y][x0 - xhsize + 0].info |= (CAVE_ROOM | CAVE_ICKY);
-               place_outer_noperm_bold(y, x0 - xhsize + xsize - 1);
-               cave[y][x0 - xhsize + xsize - 1].info |= (CAVE_ROOM | CAVE_ICKY);
+               place_outer_noperm_bold(side_y, x0 - xhsize + 0);
+               cave[side_y][x0 - xhsize + 0].info |= (CAVE_ROOM | CAVE_ICKY);
+               place_outer_noperm_bold(side_y, x0 - xhsize + xsize - 1);
+               cave[side_y][x0 - xhsize + xsize - 1].info |= (CAVE_ROOM | CAVE_ICKY);
        }
 
        /* Fill in middle with bubbles */
@@ -4571,7 +4524,7 @@ static void build_room_vault(int x0, int y0, int xsize, int ysize)
        xhsize = xsize / 2;
        yhsize = ysize / 2;
 
-       if (cheat_room) msg_print("Room Vault");
+       msg_print_wizard(CHEAT_DUNGEON, _("部屋型ランダムVaultを生成しました。", "Room Vault."));
 
        /* fill area so don't get problems with arena levels */
        for (x1 = 0; x1 < xsize; x1++)
@@ -4622,7 +4575,7 @@ static void build_cave_vault(int x0, int y0, int xsiz, int ysiz)
        xsize = xhsize * 2;
        ysize = yhsize * 2;
 
-       if (cheat_room) msg_print("Cave Vault");
+       msg_print_wizard(CHEAT_DUNGEON, _("洞穴ランダムVaultを生成しました。", "Cave Vault."));
 
        light = done = FALSE;
        room = TRUE;
@@ -4770,8 +4723,7 @@ void build_maze_vault(int x0, int y0, int xsize, int ysize, bool is_vault)
        bool light;
        cave_type *c_ptr;
 
-
-       if (cheat_room && is_vault) msg_print("Maze Vault");
+       msg_print_wizard(CHEAT_DUNGEON, _("迷路ランダムVaultを生成しました。", "Maze Vault."));
 
        /* Choose lite or dark */
        light = ((dun_level <= randint1(25)) && is_vault && !(d_info[dungeon_type].flags1 & DF1_DARKNESS));
@@ -4841,7 +4793,7 @@ static void build_mini_c_vault(int x0, int y0, int xsize, int ysize)
        int m, n, num_vertices;
        int *visited;
 
-       if (cheat_room) msg_print("Mini Checker Board Vault");
+       msg_print_wizard(CHEAT_DUNGEON, _("小型チェッカーランダムVaultを生成しました。", "Mini Checker Board Vault."));
 
        /* Pick a random room size */
        dy = ysize / 2 - 1;
@@ -5180,7 +5132,7 @@ static void build_castle_vault(int x0, int y0, int xsize, int ysize)
        y2 = y0 + dy;
        x2 = x0 + dx;
 
-       if (cheat_room) msg_print("Castle Vault");
+       msg_print_wizard(CHEAT_DUNGEON, _("城型ランダムVaultを生成しました。", "Castle Vault"));
 
        /* generate the room */
        for (y = y1 - 1; y <= y2 + 1; y++)
@@ -5297,7 +5249,7 @@ static void build_target_vault(int x0, int y0, int xsize, int ysize)
        h3 = randint1(32);
        h4 = randint1(32) - 16;
 
-       if (cheat_room) msg_print("Target Vault");
+       msg_print_wizard(CHEAT_DUNGEON, _("対称形ランダムVaultを生成しました。", "Elemental Vault"));
 
        /* work out outer radius */
        if (xsize > ysize)
@@ -5418,8 +5370,7 @@ static void build_elemental_vault(int x0, int y0, int xsiz, int ysiz)
        int xsize, ysize, xhsize, yhsize, x, y, i;
        int type;
 
-
-       if (cheat_room) msg_print("Elemental Vault");
+       msg_print_wizard(CHEAT_DUNGEON, _("精霊界ランダムVaultを生成しました。", "Elemental Vault"));
 
        /* round to make sizes even */
        xhsize = xsiz / 2;
@@ -5973,16 +5924,8 @@ static bool build_type13(void)
                }
        }
 
-       /* Message */
-       if (cheat_room)
-       {
-               /* Room type */
-#ifdef JP
-               msg_format("%s%sの罠ピット", n_ptr->name, pit_subtype_string(cur_pit_type, FALSE));
-#else
-               msg_format("Trapped monster pit (%s%s)", n_ptr->name, pit_subtype_string(cur_pit_type, FALSE));
-#endif
-       }
+       msg_format_wizard(CHEAT_DUNGEON, _("%s%sの罠ピットが生成されました。", "Trapped monster pit (%s%s)"),
+               n_ptr->name, pit_subtype_string(cur_pit_type, FALSE));
 
        /* Select the entries */
        for (i = 0; i < 8; i++)
@@ -6085,15 +6028,7 @@ static bool build_type14(void)
        c_ptr->mimic = c_ptr->feat;
        c_ptr->feat = trap;
 
-       /* Message */
-       if (cheat_room)
-       {
-#ifdef JP
-               msg_format("%sの部屋", f_name + f_info[trap].name);
-#else
-               msg_format("Room of %s", f_name + f_info[trap].name);
-#endif
-       }
+       msg_format_wizard(CHEAT_DUNGEON, _("%sの部屋が生成されました。", "Room of %s was generated."), f_name + f_info[trap].name);
 
        return TRUE;
 }
@@ -6110,7 +6045,7 @@ static bool vault_aux_lite(int r_idx)
        if (!vault_monster_okay(r_idx)) return FALSE;
 
        /* Require lite attack */
-       if (!(r_ptr->flags4 & RF4_BR_LITE) && !(r_ptr->flags5 & RF5_BA_LITE)) return FALSE;
+       if (!(r_ptr->flags4 & RF4_BR_LITE) && !(r_ptr->a_ability_flags1 & RF5_BA_LITE)) return FALSE;
 
        /* No wall passing monsters */
        if (r_ptr->flags2 & (RF2_PASS_WALL | RF2_KILL_WALL)) return FALSE;
@@ -6379,15 +6314,7 @@ static bool build_type15(void)
                break;
        }
 
-       /* Message */
-       if (cheat_room)
-       {
-#ifdef JP
-               msg_print("ガラスの部屋");
-#else
-               msg_print("Glass room");
-#endif
-       }
+       msg_print_wizard(CHEAT_DUNGEON, _("ガラスの部屋が生成されました。", "Glass room was generated."));
 
        return TRUE;
 }
@@ -6523,8 +6450,14 @@ static bool precalc_ugarcade(int town_hgt, int town_wid, int n)
        return i == n;
 }
 
-/*
- * Actually create buildings
+/*!
+ * @brief タイプ16の部屋…地下都市生成のサブルーチン / Actually create buildings
+ * @return なし
+ * @param ltcy 生成基準Y座標
+ * @param ltcx 生成基準X座標
+ * @param stotes[] 生成する店舗のリスト
+ * @param n 生成する店舗の数
+ * @note
  * Note: ltcy and ltcx indicate "left top corner".
  */
 static void build_stores(int ltcy, int ltcx, int stores[], int n)
@@ -6676,11 +6609,7 @@ static bool build_type16(void)
        /* Build stores */
        build_stores(y1, x1, stores, n);
 
-#ifdef JP
-       if (cheat_room) msg_print("地下街");
-#else
-       if (cheat_room) msg_print("Underground Arcade");
-#endif
+       msg_print_wizard(CHEAT_DUNGEON, _("地下街を生成しました", "Underground arcade was generated."));
 
        /* Free buildings array */
        C_KILL(ugbldg, n, ugbldg_type);
@@ -6689,11 +6618,11 @@ static bool build_type16(void)
 }
 
 
-/*
- * Attempt to build a room of the given type at the given block
- *
- * Note that we restrict the number of "crowded" rooms to reduce
- * the chance of overflowing the monster list during level creation.
+/*!
+ * @brief 与えられた部屋型IDに応じて部屋の生成処理分岐を行い結果を返す / Attempt to build a room of the given type at the given block
+ * @param type 部屋型ID
+ * @note that we restrict the number of "crowded" rooms to reduce the chance of overflowing the monster list during level creation.
+ * @return 部屋の精製に成功した場合 TRUE を返す。
  */
 static bool room_build(int typ)
 {
@@ -6723,13 +6652,16 @@ static bool room_build(int typ)
        return FALSE;
 }
 
+/*!
+ * @brief 指定した部屋の生成確率を別の部屋に加算し、指定した部屋の生成率を0にする
+ * @param dst 確率を移す先の部屋種ID
+ * @param src 確率を与える元の部屋種ID
+ */
+#define MOVE_PLIST(dst, src) (prob_list[dst] += prob_list[src], prob_list[src] = 0) 
 
-#define MOVE_PLIST(dst, src) (prob_list[dst] += prob_list[src], prob_list[src] = 0)
-
-/*
- * [from SAngband (originally from OAngband)]
- * 
- * Generate rooms in dungeon.  Build bigger rooms at first.
+/*!
+ * @brief 部屋生成処理のメインルーチン(Sangbandを経由してOangbandからの実装を引用) / Generate rooms in dungeon.  Build bigger rooms at first. [from SAngband (originally from OAngband)]
+ * @return 部屋生成に成功した場合 TRUE を返す。
  */
 bool generate_rooms(void)
 {
@@ -6771,7 +6703,7 @@ bool generate_rooms(void)
         * XXX -- Various dungeon types and options.
         */
 
-       /* Ironman sees only Greater Vaults */
+       /*! @details ダンジョンにBEGINNER、CHAMELEON、SMALLESTいずれのフラグもなく、かつ「常に通常でない部屋を生成する」フラグがONならば、GRATER_VAULTのみを生成対象とする。 / Ironman sees only Greater Vaults */
        if (ironman_rooms && !((d_info[dungeon_type].flags1 & (DF1_BEGINNER | DF1_CHAMELEON | DF1_SMALLEST))))
        {
                for (i = 0; i < ROOM_T_MAX; i++)
@@ -6781,7 +6713,7 @@ bool generate_rooms(void)
                }
        }
 
-       /* Forbidden vaults */
+       /*! @details ダンジョンにNO_VAULTフラグがあるならば、LESSER_VAULT / GREATER_VAULT/ RANDOM_VAULTを除外 / Forbidden vaults */
        else if (d_info[dungeon_type].flags1 & DF1_NO_VAULT)
        {
                prob_list[ROOM_T_LESSER_VAULT] = 0;
@@ -6789,8 +6721,7 @@ bool generate_rooms(void)
                prob_list[ROOM_T_RANDOM_VAULT] = 0;
        }
 
-
-       /* NO_CAVE dungeon (Castle)*/
+       /*! @details ダンジョンにNO_CAVEフラグがある場合、FRACAVEの生成枠がNORMALに与えられる。CRIPT、OVALの生成枠がINNER_Fに与えられる。/ NO_CAVE dungeon (Castle)*/
        if (d_info[dungeon_type].flags1 & DF1_NO_CAVE)
        {
                MOVE_PLIST(ROOM_T_NORMAL, ROOM_T_FRACAVE);
@@ -6798,24 +6729,25 @@ bool generate_rooms(void)
                MOVE_PLIST(ROOM_T_INNER_FEAT, ROOM_T_OVAL);
        }
 
-       /* CAVE dungeon (Orc cave etc.) */
+       /*! @details ダンジョンにCAVEフラグがある場合、NORMALの生成枠がFRACAVEに与えられる。/ CAVE dungeon (Orc cave etc.) */
        else if (d_info[dungeon_type].flags1 & DF1_CAVE)
        {
                MOVE_PLIST(ROOM_T_FRACAVE, ROOM_T_NORMAL);
        }
 
-       /* No caves when a (random) cavern exists: they look bad */
+       /*! @details ダンジョンの基本地形が最初から渓谷かアリーナ型の場合 FRACAVE は生成から除外。 /  No caves when a (random) cavern exists: they look bad */
        else if (dun->cavern || dun->empty_level)
        {
                prob_list[ROOM_T_FRACAVE] = 0;
        }
 
-       /* Forbidden glass rooms */
+       /*! @details ダンジョンに最初からGLASS_ROOMフラグがある場合、GLASS を生成から除外。/ Forbidden glass rooms */
        if (!(d_info[dungeon_type].flags1 & DF1_GLASS_ROOM))
        {
                prob_list[ROOM_T_GLASS] = 0;
        }
 
+       /*! @details ARCADEは同フラグがダンジョンにないと生成されない。 / Forbidden glass rooms */
        if (!(d_info[dungeon_type].flags1 & DF1_ARCADE))
        {
                prob_list[ROOM_T_ARCADE] = 0;
@@ -6932,16 +6864,14 @@ bool generate_rooms(void)
                if (!remain) break;
        }
 
-       if (rooms_built < 2) return FALSE;
-
-       if (cheat_room)
+       /*! @details 部屋生成数が2未満の場合生成失敗を返す */
+       if (rooms_built < 2)
        {
-#ifdef JP
-               msg_format("部屋数: %d", rooms_built);
-#else
-               msg_format("Number of Rooms: %d", rooms_built);
-#endif
+               msg_format_wizard(CHEAT_DUNGEON, _("部屋数が2未満でした。生成を再試行します。", "Number of rooms was under 2. Retry."), rooms_built);
+               return FALSE;
        }
 
+       msg_format_wizard(CHEAT_DUNGEON, _("このダンジョンの部屋数は %d です。", "Number of Rooms: %d"), rooms_built);
+
        return TRUE;
 }