• R/O
  • HTTP
  • SSH
  • HTTPS

hengband: Commit

変愚蛮怒のメインリポジトリです


Commit MetaInfo

Revision21cc26073ffc77c6dbf98b56d6dc9bc98a774d9d (tree)
Time2019-01-12 22:31:29
AuthorDeskull <deskull@user...>
CommiterDeskull

Log Message

[Refactor] #37353 「死を欺く処理」を dungeon.c から cheat_death() に分離。 / Separate cheat_death() from dungeon.c.

Change Summary

Incremental Difference

--- a/src/dungeon.c
+++ b/src/dungeon.c
@@ -6111,7 +6111,6 @@ void play_game(bool new_game)
61116111 /* Process the level */
61126112 dungeon(load_game);
61136113
6114-
61156114 /* Hack -- prevent "icky" message */
61166115 character_xtra = TRUE;
61176116
@@ -6168,106 +6167,7 @@ void play_game(bool new_game)
61686167 /* Mega-Hack -- Allow player to cheat death */
61696168 if ((p_ptr->wizard || cheat_live) && !get_check(_("死にますか? ", "Die? ")))
61706169 {
6171- /* Mark social class, reset age, if needed */
6172- if (p_ptr->sc) p_ptr->sc = p_ptr->age = 0;
6173-
6174- /* Increase age */
6175- p_ptr->age++;
6176-
6177- /* Mark savefile */
6178- p_ptr->noscore |= 0x0001;
6179-
6180- msg_print(_("ウィザードモードに念を送り、死を欺いた。", "You invoke wizard mode and cheat death."));
6181- msg_print(NULL);
6182-
6183- (void)life_stream(FALSE, FALSE);
6184-
6185- if (p_ptr->pclass == CLASS_MAGIC_EATER)
6186- {
6187- int magic_idx;
6188- for (magic_idx = 0; magic_idx < EATER_EXT*2; magic_idx++)
6189- {
6190- p_ptr->magic_num1[magic_idx] = p_ptr->magic_num2[magic_idx]*EATER_CHARGE;
6191- }
6192- for (; magic_idx < EATER_EXT*3; magic_idx++)
6193- {
6194- p_ptr->magic_num1[magic_idx] = 0;
6195- }
6196- }
6197-
6198- /* Restore spell points */
6199- p_ptr->csp = p_ptr->msp;
6200- p_ptr->csp_frac = 0;
6201-
6202- /* Hack -- cancel recall */
6203- if (p_ptr->word_recall)
6204- {
6205- msg_print(_("張りつめた大気が流れ去った...", "A tension leaves the air around you..."));
6206- msg_print(NULL);
6207-
6208- /* Hack -- Prevent recall */
6209- p_ptr->word_recall = 0;
6210- p_ptr->redraw |= (PR_STATUS);
6211- }
6212-
6213- /* Hack -- cancel alter */
6214- if (p_ptr->alter_reality)
6215- {
6216- /* Hack -- Prevent alter */
6217- p_ptr->alter_reality = 0;
6218- p_ptr->redraw |= (PR_STATUS);
6219- }
6220-
6221- /* Note cause of death */
6222- (void)strcpy(p_ptr->died_from, _("死の欺き", "Cheating death"));
6223-
6224- /* Do not die */
6225- p_ptr->is_dead = FALSE;
6226-
6227- /* Hack -- Prevent starvation */
6228- (void)set_food(PY_FOOD_MAX - 1);
6229-
6230- dun_level = 0;
6231- p_ptr->inside_arena = FALSE;
6232- p_ptr->inside_battle = FALSE;
6233- leaving_quest = 0;
6234- p_ptr->inside_quest = 0;
6235- if (dungeon_type) p_ptr->recall_dungeon = dungeon_type;
6236- dungeon_type = 0;
6237- if (lite_town || vanilla_town)
6238- {
6239- p_ptr->wilderness_y = 1;
6240- p_ptr->wilderness_x = 1;
6241- if (vanilla_town)
6242- {
6243- p_ptr->oldpy = 10;
6244- p_ptr->oldpx = 34;
6245- }
6246- else
6247- {
6248- p_ptr->oldpy = 33;
6249- p_ptr->oldpx = 131;
6250- }
6251- }
6252- else
6253- {
6254- p_ptr->wilderness_y = 48;
6255- p_ptr->wilderness_x = 5;
6256- p_ptr->oldpy = 33;
6257- p_ptr->oldpx = 131;
6258- }
6259-
6260- /* Leaving */
6261- p_ptr->wild_mode = FALSE;
6262- p_ptr->leaving = TRUE;
6263-
6264- do_cmd_write_nikki(NIKKI_BUNSHOU, 1,
6265- _(" しかし、生き返った。",
6266- " but revived."));
6267-
6268- /* Prepare next floor */
6269- leave_floor();
6270- wipe_m_list();
6170+ cheat_death(p_ptr);
62716171 }
62726172 }
62736173 }
--- a/src/externs.h
+++ b/src/externs.h
@@ -1476,6 +1476,7 @@ extern void spoil_random_artifact(cptr fname);
14761476 extern void strip_name(char *buf, KIND_OBJECT_IDX k_idx);
14771477 extern void do_cmd_rerate_aux(void);
14781478 extern void do_cmd_rerate(bool display);
1479+extern void cheat_death(player_type *creature_ptr);
14791480
14801481 /* avatar.c */
14811482 extern bool compare_virtue(int type, int num, int tekitou);
--- a/src/wizard2.c
+++ b/src/wizard2.c
@@ -2104,6 +2104,111 @@ void do_cmd_debug(void)
21042104 }
21052105 }
21062106
2107+void cheat_death(player_type *creature_ptr)
2108+{
2109+ /* Mark social class, reset age, if needed */
2110+ if (creature_ptr->sc) creature_ptr->sc = creature_ptr->age = 0;
2111+
2112+ /* Increase age */
2113+ creature_ptr->age++;
2114+
2115+ /* Mark savefile */
2116+ creature_ptr->noscore |= 0x0001;
2117+
2118+ msg_print(_("ウィザードモードに念を送り、死を欺いた。", "You invoke wizard mode and cheat death."));
2119+ msg_print(NULL);
2120+
2121+ (void)life_stream(FALSE, FALSE);
2122+
2123+ if (creature_ptr->pclass == CLASS_MAGIC_EATER)
2124+ {
2125+ int magic_idx;
2126+ for (magic_idx = 0; magic_idx < EATER_EXT * 2; magic_idx++)
2127+ {
2128+ creature_ptr->magic_num1[magic_idx] = creature_ptr->magic_num2[magic_idx] * EATER_CHARGE;
2129+ }
2130+ for (; magic_idx < EATER_EXT * 3; magic_idx++)
2131+ {
2132+ creature_ptr->magic_num1[magic_idx] = 0;
2133+ }
2134+ }
2135+
2136+ /* Restore spell points */
2137+ creature_ptr->csp = creature_ptr->msp;
2138+ creature_ptr->csp_frac = 0;
2139+
2140+ /* Hack -- cancel recall */
2141+ if (creature_ptr->word_recall)
2142+ {
2143+ msg_print(_("張りつめた大気が流れ去った...", "A tension leaves the air around you..."));
2144+ msg_print(NULL);
2145+
2146+ /* Hack -- Prevent recall */
2147+ creature_ptr->word_recall = 0;
2148+ creature_ptr->redraw |= (PR_STATUS);
2149+ }
2150+
2151+ /* Hack -- cancel alter */
2152+ if (creature_ptr->alter_reality)
2153+ {
2154+ /* Hack -- Prevent alter */
2155+ creature_ptr->alter_reality = 0;
2156+ creature_ptr->redraw |= (PR_STATUS);
2157+ }
2158+
2159+ /* Note cause of death */
2160+ (void)strcpy(creature_ptr->died_from, _("死の欺き", "Cheating death"));
2161+
2162+ /* Do not die */
2163+ creature_ptr->is_dead = FALSE;
2164+
2165+ /* Hack -- Prevent starvation */
2166+ (void)set_food(PY_FOOD_MAX - 1);
2167+
2168+ dun_level = 0;
2169+ creature_ptr->inside_arena = FALSE;
2170+ creature_ptr->inside_battle = FALSE;
2171+ leaving_quest = 0;
2172+ creature_ptr->inside_quest = 0;
2173+ if (dungeon_type) creature_ptr->recall_dungeon = dungeon_type;
2174+ dungeon_type = 0;
2175+ if (lite_town || vanilla_town)
2176+ {
2177+ creature_ptr->wilderness_y = 1;
2178+ creature_ptr->wilderness_x = 1;
2179+ if (vanilla_town)
2180+ {
2181+ creature_ptr->oldpy = 10;
2182+ creature_ptr->oldpx = 34;
2183+ }
2184+ else
2185+ {
2186+ creature_ptr->oldpy = 33;
2187+ creature_ptr->oldpx = 131;
2188+ }
2189+ }
2190+ else
2191+ {
2192+ creature_ptr->wilderness_y = 48;
2193+ creature_ptr->wilderness_x = 5;
2194+ creature_ptr->oldpy = 33;
2195+ creature_ptr->oldpx = 131;
2196+ }
2197+
2198+ /* Leaving */
2199+ creature_ptr->wild_mode = FALSE;
2200+ creature_ptr->leaving = TRUE;
2201+
2202+ do_cmd_write_nikki(NIKKI_BUNSHOU, 1,
2203+ _(" しかし、生き返った。",
2204+ " but revived."));
2205+
2206+ /* Prepare next floor */
2207+ leave_floor();
2208+ wipe_m_list();
2209+
2210+}
2211+
21072212
21082213 #else
21092214
Show on old repository browser