OSDN Git Service

[Fix] #3453 input_value() への差し替えで0 (地上への帰還)が指定できなくなったので、ダンジョン選択時にEscキーを押すことで帰還のプロンプトを...
authorHourier <66951241+Hourier@users.noreply.github.com>
Sat, 24 Jun 2023 19:55:48 +0000 (04:55 +0900)
committerHourier <66951241+Hourier@users.noreply.github.com>
Sun, 25 Jun 2023 03:01:18 +0000 (12:01 +0900)
地上から地上へは帰還しないように抑制済

src/wizard/wizard-special-process.cpp

index 491aa4c..52e3e11 100644 (file)
@@ -531,20 +531,19 @@ static std::optional<short> select_debugging_dungeon(short initial_dungeon_id)
 }
 
 /*
- * @brief é\81¸æ\8a\9eã\81\97ã\81\9fã\83\80ã\83³ã\82¸ã\83§ã\83³ã\81®ä»»æ\84\8fã\83\95ã\83­ã\82¢を選択する
+ * @brief é\81¸æ\8a\9eã\81\97ã\81\9fã\83\80ã\83³ã\82¸ã\83§ã\83³ã\81®ä»»æ\84\8fã\83¬ã\83\99ã\83«を選択する
  * @param player_ptr プレイヤーへの参照ポインタ
  * @param dungeon_id ダンジョン番号
- * @return フロアを選択したらtrue、キャンセルならfalse
- * @details 0を指定すると地上に飛ぶが、元いた場所にしか飛ばない
- * @todo 可能ならダンジョンの入口 (例:ルルイエなら大洋の真ん中)へ飛べるようにしたい
+ * @return レベルを選択したらその値、キャンセルならnullopt
  */
 static std::optional<int> select_debugging_floor(const FloorType &floor, int dungeon_id)
 {
     const auto &dungeon = dungeons_info[dungeon_id];
     const auto max_depth = dungeon.maxdepth;
     const auto min_depth = dungeon.mindepth;
+    const auto is_current_dungeon = floor.dungeon_idx == dungeon_id;
     auto initial_depth = floor.dun_level;
-    if (floor.dungeon_idx != dungeon_id) {
+    if (!is_current_dungeon) {
         initial_depth = min_depth;
     }
 
@@ -587,25 +586,34 @@ static void wiz_jump_floor(PlayerType *player_ptr, DUNGEON_IDX dun_idx, DEPTH de
 void wiz_jump_to_dungeon(PlayerType *player_ptr)
 {
     const auto &floor = *player_ptr->current_floor_ptr;
-    const auto dungeon_id_opt = select_debugging_dungeon(floor.dungeon_idx);
+    const auto is_in_dungeon = floor.is_in_dungeon();
+    const auto dungeon_idx = is_in_dungeon ? floor.dungeon_idx : static_cast<short>(DUNGEON_ANGBAND);
+    const auto dungeon_id_opt = select_debugging_dungeon(dungeon_idx);
     if (!dungeon_id_opt.has_value()) {
+        if (!is_in_dungeon) {
+            return;
+        }
+
+        if (get_check(("Jump to the ground?"))) {
+            wiz_jump_floor(player_ptr, 0, 0);
+        }
+
         return;
     }
 
     const auto dungeon_id = dungeon_id_opt.value();
-    const auto level = select_debugging_floor(floor, dungeon_id);
-    if (!level.has_value()) {
+    const auto level_opt = select_debugging_floor(floor, dungeon_id);
+    if (!level_opt.has_value()) {
         return;
     }
 
-    const auto &dungeon = dungeons_info[dungeon_id];
-    command_arg = static_cast<short>(std::clamp(level.value(), dungeon.mindepth, dungeon.maxdepth));
-    msg_format("You jump to dungeon level %d.", command_arg);
+    const auto level = level_opt.value();
+    msg_format("You jump to dungeon level %d.", level);
     if (autosave_l) {
         do_cmd_save_game(player_ptr, true);
     }
 
-    wiz_jump_floor(player_ptr, dungeon_id, command_arg);
+    wiz_jump_floor(player_ptr, dungeon_id, level);
 }
 
 /*!