OSDN Git Service

Went back to using "staffs" as the plural of staff rather than "stave" since saw...
[hengbandforosx/hengbandosx.git] / src / wizard2.c
index 64786f2..b95b4fa 100644 (file)
@@ -11,7 +11,6 @@
  */
 
 #include "angband.h"
-#include "floor.h"
 #include "selfinfo.h"
 #include "patron.h"
 #include "mutation.h"
 #include "spells-object.h"
 #include "spells-summon.h"
 #include "spells-status.h"
+#include "spells-world.h"
+#include "spells-floor.h"
+
 #include "object-hook.h"
+#include "monster-status.h"
+
+#include "floor.h"
+#include "floor-save.h"
 
 #ifdef ALLOW_WIZARD
 
@@ -39,30 +45,6 @@ static bool wiz_dimension_door(void)
        return (TRUE);
 }
 
-
-/*!
- * @brief プレイ日数を変更する / Set gametime.
- * @return 実際に変更を行ったらTRUEを返す
- */
-static bool set_gametime(void)
-{
-       int tmp_int = 0;
-       char ppp[80], tmp_val[40];
-
-       sprintf(ppp, "Dungeon Turn (0-%ld): ", (long)dungeon_turn_limit);
-       sprintf(tmp_val, "%ld", (long)dungeon_turn);
-       if (!get_string(ppp, tmp_val, 10)) return (FALSE);
-       tmp_int = atoi(tmp_val);
-
-       /* Verify */
-       if (tmp_int >= dungeon_turn_limit) tmp_int = dungeon_turn_limit - 1;
-       else if (tmp_int < 0) tmp_int = 0;
-       dungeon_turn = turn = tmp_int;
-       return (TRUE);
-
-}
-
-
 /*!
  * @brief 指定されたIDの固定アーティファクトを生成する / Create the artifact of the specified number
  * @return なし
@@ -87,17 +69,6 @@ static void wiz_create_named_art(void)
        msg_print("Allocated.");
 }
 
-
-/*!
- * @brief ウィザードモード用モンスター調査 / Hack -- quick debugging hook
- * @return なし
- */
-static void do_cmd_wiz_hack_ben(void)
-{
-       msg_print("Oops.");
-       (void)probing();
-}
-
 /*!
  * @brief ウィザードモード用モンスターの群れ生成 / Summon a horde of monsters
  * @return なし
@@ -857,42 +828,42 @@ static void wiz_reroll_item(object_type *o_ptr)
                        case 'w': case 'W':
                        {
                                object_prep(q_ptr, o_ptr->k_idx);
-                               apply_magic(q_ptr, dun_level, AM_NO_FIXED_ART | AM_GOOD | AM_GREAT | AM_CURSED);
+                               apply_magic(q_ptr, current_floor_ptr->dun_level, AM_NO_FIXED_ART | AM_GOOD | AM_GREAT | AM_CURSED);
                                break;
                        }
                        /* Apply bad magic, but first clear object */
                        case 'c': case 'C':
                        {
                                object_prep(q_ptr, o_ptr->k_idx);
-                               apply_magic(q_ptr, dun_level, AM_NO_FIXED_ART | AM_GOOD | AM_CURSED);
+                               apply_magic(q_ptr, current_floor_ptr->dun_level, AM_NO_FIXED_ART | AM_GOOD | AM_CURSED);
                                break;
                        }
                        /* Apply normal magic, but first clear object */
                        case 'n': case 'N':
                        {
                                object_prep(q_ptr, o_ptr->k_idx);
-                               apply_magic(q_ptr, dun_level, AM_NO_FIXED_ART);
+                               apply_magic(q_ptr, current_floor_ptr->dun_level, AM_NO_FIXED_ART);
                                break;
                        }
                        /* Apply good magic, but first clear object */
                        case 'g': case 'G':
                        {
                                object_prep(q_ptr, o_ptr->k_idx);
-                               apply_magic(q_ptr, dun_level, AM_NO_FIXED_ART | AM_GOOD);
+                               apply_magic(q_ptr, current_floor_ptr->dun_level, AM_NO_FIXED_ART | AM_GOOD);
                                break;
                        }
                        /* Apply great magic, but first clear object */
                        case 'e': case 'E':
                        {
                                object_prep(q_ptr, o_ptr->k_idx);
-                               apply_magic(q_ptr, dun_level, AM_NO_FIXED_ART | AM_GOOD | AM_GREAT);
+                               apply_magic(q_ptr, current_floor_ptr->dun_level, AM_NO_FIXED_ART | AM_GOOD | AM_GREAT);
                                break;
                        }
                        /* Apply special magic, but first clear object */
                        case 's': case 'S':
                        {
                                object_prep(q_ptr, o_ptr->k_idx);
-                               apply_magic(q_ptr, dun_level, AM_GOOD | AM_GREAT | AM_SPECIAL);
+                               apply_magic(q_ptr, current_floor_ptr->dun_level, AM_GOOD | AM_GREAT | AM_SPECIAL);
 
                                /* Failed to create artifact; make a random one */
                                if (!object_is_artifact(q_ptr)) create_artifact(q_ptr, FALSE);
@@ -992,7 +963,7 @@ static void wiz_statistics(object_type *o_ptr)
 
                /* Let us know what we are doing */
                msg_format("Creating a lot of %s items. Base level = %d.",
-                                         quality, dun_level);
+                                         quality, current_floor_ptr->dun_level);
                msg_print(NULL);
 
                /* Set counters to zero */
@@ -1109,8 +1080,6 @@ static void wiz_quantity_item(object_type *o_ptr)
        {
                /* Extract */
                tmp_int = atoi(tmp_val);
-
-               /* Paranoia */
                if (tmp_int < 1) tmp_int = 1;
                if (tmp_int > 99) tmp_int = 99;
 
@@ -1316,7 +1285,7 @@ static void wiz_create_item(void)
        q_ptr = &forge;
        object_prep(q_ptr, k_idx);
 
-       apply_magic(q_ptr, dun_level, AM_NO_FIXED_ART);
+       apply_magic(q_ptr, current_floor_ptr->dun_level, AM_NO_FIXED_ART);
 
        /* Drop the object from heaven */
        (void)drop_near(q_ptr, -1, p_ptr->y, p_ptr->x);
@@ -1370,7 +1339,7 @@ static void do_cmd_wiz_jump(void)
                        (int)d_info[tmp_dungeon_type].mindepth, (int)d_info[tmp_dungeon_type].maxdepth);
 
                /* Default */
-               sprintf(tmp_val, "%d", (int)dun_level);
+               sprintf(tmp_val, "%d", (int)current_floor_ptr->dun_level);
 
                /* Ask for a level */
                if (!get_string(ppp, tmp_val, 10)) return;
@@ -1380,8 +1349,6 @@ static void do_cmd_wiz_jump(void)
 
                p_ptr->dungeon_idx = tmp_dungeon_type;
        }
-
-       /* Paranoia */
        if (command_arg < d_info[p_ptr->dungeon_idx].mindepth) command_arg = 0;
        if (command_arg > d_info[p_ptr->dungeon_idx].maxdepth) command_arg = (COMMAND_ARG)d_info[p_ptr->dungeon_idx].maxdepth;
 
@@ -1391,11 +1358,11 @@ static void do_cmd_wiz_jump(void)
        if (autosave_l) do_cmd_save_game(TRUE);
 
        /* Change level */
-       dun_level = command_arg;
+       current_floor_ptr->dun_level = command_arg;
 
        prepare_change_floor_mode(CFM_RAND_PLACE);
 
-       if (!dun_level) p_ptr->dungeon_idx = 0;
+       if (!current_floor_ptr->dun_level) p_ptr->dungeon_idx = 0;
        p_ptr->inside_arena = FALSE;
        p_ptr->wild_mode = FALSE;
 
@@ -1414,8 +1381,6 @@ static void do_cmd_wiz_jump(void)
         * and create a first saved floor
         */
        prepare_change_floor_mode(CFM_FIRST_FLOOR);
-
-       /* Leaving */
        p_ptr->leaving = TRUE;
 }
 
@@ -1459,7 +1424,7 @@ static void do_cmd_wiz_summon(int num)
        int i;
        for (i = 0; i < num; i++)
        {
-               (void)summon_specific(0, p_ptr->y, p_ptr->x, dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE), '\0');
+               (void)summon_specific(0, p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE), '\0');
        }
 }
 
@@ -1506,10 +1471,8 @@ static void do_cmd_wiz_zap(void)
        /* Genocide everyone nearby */
        for (i = 1; i < m_max; i++)
        {
-               monster_type *m_ptr = &m_list[i];
-
-               /* Paranoia -- Skip dead monsters */
-               if (!m_ptr->r_idx) continue;
+               monster_type *m_ptr = &current_floor_ptr->m_list[i];
+               if (!monster_is_valid(m_ptr)) continue;
 
                /* Skip the mount */
                if (i == p_ptr->riding) continue;
@@ -1543,10 +1506,8 @@ static void do_cmd_wiz_zap_all(void)
        /* Genocide everyone */
        for (i = 1; i < m_max; i++)
        {
-               monster_type *m_ptr = &m_list[i];
-
-               /* Paranoia -- Skip dead monsters */
-               if (!m_ptr->r_idx) continue;
+               monster_type *m_ptr = &current_floor_ptr->m_list[i];
+               if (!monster_is_valid(m_ptr)) continue;
 
                /* Skip the mount */
                if (i == p_ptr->riding) continue;
@@ -1582,7 +1543,7 @@ static void do_cmd_wiz_create_feature(void)
 
        if (!tgt_pt(&x, &y)) return;
 
-       g_ptr = &grid_array[y][x];
+       g_ptr = &current_floor_ptr->grid_array[y][x];
 
        /* Default */
        sprintf(tmp_val, "%d", prev_feat);
@@ -1619,8 +1580,6 @@ static void do_cmd_wiz_create_feature(void)
 
        note_spot(y, x);
        lite_spot(y, x);
-
-       /* Update some things */
        p_ptr->update |= (PU_FLOW);
 
        prev_feat = tmp_feat;
@@ -1698,8 +1657,6 @@ static void do_cmd_dump_options(void)
        /* Free the "exist" array (2-dimension) */
        C_KILL(*exist, NUM_O_BIT * NUM_O_SET, int);
        C_KILL(exist, NUM_O_SET, int *);
-
-       /* Close it */
        my_fclose(fff);
 
        msg_format(_("オプションbit使用状況をファイル %s に書き出しました。", "Option bits usage dump saved to file %s."), buf);
@@ -1832,7 +1789,7 @@ void do_cmd_debug(void)
 
        /* Hitpoint rerating */
        case 'h':
-               roll_hitdice(SPOP_DISPLAY_MES | SPOP_DEBUG);
+               roll_hitdice(p_ptr, SPOP_DISPLAY_MES | SPOP_DEBUG);
                break;
 
        case 'H':
@@ -1866,7 +1823,7 @@ void do_cmd_debug(void)
 
        /* Mutation */
        case 'M':
-               (void)gain_random_mutation(command_arg);
+               (void)gain_mutation(p_ptr, command_arg);
                break;
 
        /* Reset Class */
@@ -1945,11 +1902,11 @@ void do_cmd_debug(void)
 
        /* Make every dungeon square "known" to test streamers -KMW- */
        case 'u':
-               for (y = 0; y < cur_hgt; y++)
+               for (y = 0; y < current_floor_ptr->height; y++)
                {
-                       for (x = 0; x < cur_wid; x++)
+                       for (x = 0; x < current_floor_ptr->width; x++)
                        {
-                               grid_array[y][x].info |= (CAVE_GLOW | CAVE_MARK);
+                               current_floor_ptr->grid_array[y][x].info |= (CAVE_GLOW | CAVE_MARK);
                        }
                }
                wiz_lite(FALSE);
@@ -2006,7 +1963,7 @@ void do_cmd_debug(void)
 
        /* Hack -- whatever I desire */
        case '_':
-               do_cmd_wiz_hack_ben();
+               probing();
                break;
 
        /* For temporary test. */
@@ -2093,7 +2050,7 @@ void cheat_death(player_type *creature_ptr)
        /* Hack -- Prevent starvation */
        (void)set_food(PY_FOOD_MAX - 1);
 
-       dun_level = 0;
+       current_floor_ptr->dun_level = 0;
        creature_ptr->inside_arena = FALSE;
        creature_ptr->inside_battle = FALSE;
        leaving_quest = 0;
@@ -2122,8 +2079,6 @@ void cheat_death(player_type *creature_ptr)
                creature_ptr->oldpy = 33;
                creature_ptr->oldpx = 131;
        }
-
-       /* Leaving */
        creature_ptr->wild_mode = FALSE;
        creature_ptr->leaving = TRUE;