OSDN Git Service

[feature] ソースファイルをC++に対応
[hengbandforosx/hengbandosx.git] / src / wizard / wizard-special-process.c
index 69c3d7d..0031b9a 100644 (file)
 #include "dungeon/dungeon.h"
 #include "dungeon/quest.h"
 #include "flavor/object-flavor.h"
+#include "floor/floor-leaver.h"
 #include "floor/floor-mode-changer.h"
 #include "floor/floor-object.h"
-#include "floor/floor.h"
+#include "game-option/birth-options.h"
 #include "game-option/option-types-table.h"
 #include "game-option/play-record-options.h"
 #include "game-option/special-options.h"
 #include "object/object-generator.h"
 #include "object/object-kind.h"
 #include "perception/object-perception.h"
+#include "player-info/self-info.h"
 #include "player/digestion-processor.h"
 #include "player/patron.h"
 #include "player/player-class.h"
 #include "player/player-race-types.h"
 #include "player/player-skill.h"
+#include "player/player-status-table.h"
 #include "player/player-status.h"
-#include "player/selfinfo.h"
 #include "spell-kind/spells-detection.h"
-#include "spell-kind/spells-floor.h"
-#include "spell-kind/spells-perception.h"
 #include "spell-kind/spells-sight.h"
 #include "spell-kind/spells-teleport.h"
+#include "spell-kind/spells-world.h"
 #include "spell/spells-object.h"
 #include "spell/spells-status.h"
 #include "spell/spells-summon.h"
@@ -81,7 +82,6 @@
 #include "wizard/wizard-spells.h"
 #include "wizard/wizard-spoiler.h"
 #include "world/world.h"
-
 #define NUM_O_SET 8
 #define NUM_O_BIT 32
 
@@ -130,7 +130,7 @@ KIND_OBJECT_IDX wiz_create_itemtype(void)
     if ((num < 0) || (num >= max_num))
         return 0;
 
-    tval_type tval = tvals[num].tval;
+    tval_type tval = static_cast<tval_type>(tvals[num].tval);
     concptr tval_desc = tvals[num].desc;
     term_clear();
     num = 0;
@@ -178,9 +178,9 @@ KIND_OBJECT_IDX wiz_create_itemtype(void)
  */
 void wiz_create_item(player_type *caster_ptr)
 {
-    screen_save(caster_ptr);
+    screen_save();
     OBJECT_IDX k_idx = wiz_create_itemtype();
-    screen_load(caster_ptr);
+    screen_load();
     if (!k_idx)
         return;
 
@@ -350,9 +350,9 @@ void wiz_create_feature(player_type *creature_ptr)
     feature_type *f_ptr;
     f_ptr = &f_info[get_feat_mimic(g_ptr)];
 
-    if (have_flag(f_ptr->flags, FF_GLYPH) || have_flag(f_ptr->flags, FF_MINOR_GLYPH))
+    if (has_flag(f_ptr->flags, FF_RUNE_PROTECTION) || has_flag(f_ptr->flags, FF_RUNE_EXPLOSION))
         g_ptr->info |= CAVE_OBJECT;
-    else if (have_flag(f_ptr->flags, FF_MIRROR))
+    else if (has_flag(f_ptr->flags, FF_MIRROR))
         g_ptr->info |= CAVE_GLOW | CAVE_OBJECT;
 
     note_spot(creature_ptr, y, x);
@@ -459,8 +459,8 @@ void wiz_reset_class(player_type *creature_ptr)
     if (tmp_int < 0 || tmp_int >= MAX_CLASS)
         return;
 
-    creature_ptr->pclass = (byte)tmp_int;
-    creature_ptr->window |= PW_PLAYER;
+    creature_ptr->pclass = static_cast<player_class_type>(tmp_int);
+    creature_ptr->window_flags |= PW_PLAYER;
     creature_ptr->update |= PU_BONUS | PU_HP | PU_MANA | PU_SPELLS;
     handle_stuff(creature_ptr);
 }
@@ -495,7 +495,9 @@ void wiz_dump_options(void)
             exist[ot_ptr->o_set][ot_ptr->o_bit] = i + 1;
     }
 
-    fprintf(fff, "[Option bits usage on Hengband %d.%d.%d]\n\n", FAKE_VER_MAJOR - 10, FAKE_VER_MINOR, FAKE_VER_PATCH);
+    char title[200];
+    put_version(title);
+    fprintf(fff, "[Option bits usage on %s\n]", title);
     fputs("Set - Bit (Page) Option Name\n", fff);
     fputs("------------------------------------------------\n", fff);
     for (int i = 0; i < NUM_O_SET; i++) {
@@ -582,3 +584,56 @@ void wiz_zap_floor_monsters(player_type *caster_ptr)
         delete_monster_idx(caster_ptr, i);
     }
 }
+
+void cheat_death(player_type *creature_ptr)
+{
+    if (creature_ptr->sc)
+        creature_ptr->sc = creature_ptr->age = 0;
+    creature_ptr->age++;
+
+    current_world_ptr->noscore |= 0x0001;
+    msg_print(_("ウィザードモードに念を送り、死を欺いた。", "You invoke wizard mode and cheat death."));
+    msg_print(NULL);
+
+    (void)life_stream(creature_ptr, FALSE, FALSE);
+    (void)restore_mana(creature_ptr, TRUE);
+
+    (void)recall_player(creature_ptr, 0);
+    reserve_alter_reality(creature_ptr, 0);
+
+    (void)strcpy(creature_ptr->died_from, _("死の欺き", "Cheating death"));
+    creature_ptr->is_dead = FALSE;
+    (void)set_food(creature_ptr, PY_FOOD_MAX - 1);
+
+    floor_type *floor_ptr = creature_ptr->current_floor_ptr;
+    floor_ptr->dun_level = 0;
+    floor_ptr->inside_arena = FALSE;
+    creature_ptr->phase_out = FALSE;
+    leaving_quest = 0;
+    floor_ptr->inside_quest = 0;
+    if (creature_ptr->dungeon_idx)
+        creature_ptr->recall_dungeon = creature_ptr->dungeon_idx;
+    creature_ptr->dungeon_idx = 0;
+    if (lite_town || vanilla_town) {
+        creature_ptr->wilderness_y = 1;
+        creature_ptr->wilderness_x = 1;
+        if (vanilla_town) {
+            creature_ptr->oldpy = 10;
+            creature_ptr->oldpx = 34;
+        } else {
+            creature_ptr->oldpy = 33;
+            creature_ptr->oldpx = 131;
+        }
+    } else {
+        creature_ptr->wilderness_y = 48;
+        creature_ptr->wilderness_x = 5;
+        creature_ptr->oldpy = 33;
+        creature_ptr->oldpx = 131;
+    }
+
+    creature_ptr->wild_mode = FALSE;
+    creature_ptr->leaving = TRUE;
+
+    exe_write_diary(creature_ptr, DIARY_DESCRIPTION, 1, _("                            しかし、生き返った。", "                            but revived."));
+    leave_floor(creature_ptr);
+}