• R/O
  • HTTP
  • SSH
  • HTTPS

hengband: Commit

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


Commit MetaInfo

Revision8620c39af3503155b45750511c88d1a4569e7c1f (tree)
Time2019-01-12 22:16:48
AuthorDeskull <deskull@user...>
CommiterDeskull

Log Message

[Refactor] #37917 word_of_recall() と recall_player() を整理。 / Refactor word_of_recall() and recall_player().

Change Summary

Incremental Difference

--- a/src/bldg.c
+++ b/src/bldg.c
@@ -4110,7 +4110,7 @@ static void bldg_process_command(building_type *bldg, int i)
41104110 break;
41114111
41124112 case BACT_RECALL:
4113- if (recall_player(1)) paid = TRUE;
4113+ if (recall_player(p_ptr, 1)) paid = TRUE;
41144114 break;
41154115
41164116 case BACT_TELEPORT_LEVEL:
--- a/src/cmd-activate.c
+++ b/src/cmd-activate.c
@@ -1361,7 +1361,7 @@ bool activate_artifact(object_type *o_ptr)
13611361 case ACT_RECALL:
13621362 {
13631363 msg_print(_("やわらかな白色に輝いている...", "It glows soft white..."));
1364- if (!word_of_recall()) return FALSE;
1364+ if (!recall_player(p_ptr, randint0(21) + 15)) return FALSE;
13651365 break;
13661366 }
13671367
@@ -1381,7 +1381,7 @@ bool activate_artifact(object_type *o_ptr)
13811381
13821382 if (get_check(_("帰還の力を使いますか?", "Activate recall? ")))
13831383 {
1384- (void)word_of_recall();
1384+ (void)recall_player(p_ptr, randint0(21) + 15);
13851385 }
13861386
13871387 break;
--- a/src/cmd-read.c
+++ b/src/cmd-read.c
@@ -185,7 +185,7 @@ void do_cmd_read_scroll_aux(INVENTORY_IDX item, bool known)
185185
186186 case SV_SCROLL_WORD_OF_RECALL:
187187 {
188- if (!word_of_recall()) used_up = FALSE;
188+ if (!recall_player(p_ptr, randint0(21) + 15)) used_up = FALSE;
189189 ident = TRUE;
190190 break;
191191 }
--- a/src/cmd-zaprod.c
+++ b/src/cmd-zaprod.c
@@ -49,7 +49,7 @@ int rod_effect(OBJECT_SUBTYPE_VALUE sval, DIRECTION dir, bool *use_charge, bool
4949
5050 case SV_ROD_RECALL:
5151 {
52- if (!word_of_recall()) *use_charge = FALSE;
52+ if (!recall_player(p_ptr, randint0(21) + 15)) *use_charge = FALSE;
5353 ident = TRUE;
5454 break;
5555 }
--- a/src/dungeon.c
+++ b/src/dungeon.c
@@ -523,8 +523,8 @@ static void pattern_teleport(void)
523523 /* Ask for level */
524524 if (get_check(_("他の階にテレポートしますか?", "Teleport level? ")))
525525 {
526- char ppp[80];
527- char tmp_val[160];
526+ char ppp[80];
527+ char tmp_val[160];
528528
529529 /* Only downward in ironman mode */
530530 if (ironman_downward)
@@ -582,7 +582,7 @@ static void pattern_teleport(void)
582582
583583 leave_quest_check();
584584
585- if (record_stair) do_cmd_write_nikki(NIKKI_PAT_TELE,0,NULL);
585+ if (record_stair) do_cmd_write_nikki(NIKKI_PAT_TELE, 0, NULL);
586586
587587 p_ptr->inside_quest = 0;
588588 p_ptr->energy_use = 0;
@@ -616,9 +616,7 @@ static void wreck_the_pattern(void)
616616 msg_print(_("パターンを血で汚してしまった!", "You bleed on the Pattern!"));
617617 msg_print(_("何か恐ろしい事が起こった!", "Something terrible happens!"));
618618
619- if (!IS_INVULN())
620- take_hit(DAMAGE_NOESCAPE, damroll(10, 8), _("パターン損壊", "corrupting the Pattern"), -1);
621-
619+ if (!IS_INVULN()) take_hit(DAMAGE_NOESCAPE, damroll(10, 8), _("パターン損壊", "corrupting the Pattern"), -1);
622620 to_ruin = randint1(45) + 35;
623621
624622 while (to_ruin--)
--- a/src/externs.h
+++ b/src/externs.h
@@ -1019,9 +1019,8 @@ extern void teleport_player_to(POSITION ny, POSITION nx, BIT_FLAGS mode);
10191019 extern void teleport_away_followable(MONSTER_IDX m_idx);
10201020 extern void teleport_level(MONSTER_IDX m_idx);
10211021 extern DUNGEON_IDX choose_dungeon(cptr note, POSITION y, POSITION x);
1022-extern bool recall_player(TIME_EFFECT turns);
1022+extern bool recall_player(player_type *creature_ptr, TIME_EFFECT turns);
10231023 extern bool free_level_recall(player_type *creature_ptr);
1024-extern bool word_of_recall(void);
10251024 extern bool reset_recall(void);
10261025 extern bool apply_disenchant(BIT_FLAGS mode);
10271026 extern void mutate_player(void);
--- a/src/mind.c
+++ b/src/mind.c
@@ -1441,7 +1441,7 @@ static bool cast_mirror_spell(int spell)
14411441
14421442 /* mirror of recall */
14431443 case 17:
1444- return word_of_recall();
1444+ return recall_player(p_ptr, randint0(21) + 15);
14451445 /* multi-shadow */
14461446 case 18:
14471447 set_multishadow(6 + randint1(6), FALSE);
--- a/src/mutation.c
+++ b/src/mutation.c
@@ -2269,7 +2269,7 @@ bool mutation_power_aux(int power)
22692269 break;
22702270
22712271 case MUT1_RECALL:
2272- if (!word_of_recall()) return FALSE;
2272+ if (!recall_player(p_ptr, randint0(21) + 15)) return FALSE;
22732273 break;
22742274
22752275 case MUT1_BANISH:
--- a/src/racial.c
+++ b/src/racial.c
@@ -1054,7 +1054,7 @@ static bool cmd_racial_power_aux(s32b command)
10541054 }
10551055 case CLASS_BERSERKER:
10561056 {
1057- if (!word_of_recall()) return FALSE;
1057+ if (!recall_player(p_ptr, randint0(21) + 15)) return FALSE;
10581058 break;
10591059 }
10601060 case CLASS_SMITH:
--- a/src/realm-arcane.c
+++ b/src/realm-arcane.c
@@ -517,7 +517,7 @@ cptr do_arcane_spell(SPELL_IDX spell, BIT_FLAGS mode)
517517
518518 if (cast)
519519 {
520- if (!word_of_recall()) return NULL;
520+ if (!recall_player(p_ptr, randint0(21) + 15)) return NULL;
521521 }
522522 }
523523 break;
--- a/src/realm-life.c
+++ b/src/realm-life.c
@@ -320,7 +320,7 @@ cptr do_life_spell(SPELL_IDX spell, BIT_FLAGS mode)
320320
321321 if (cast)
322322 {
323- if (!word_of_recall()) return NULL;
323+ if (!recall_player(p_ptr, randint0(21) + 15)) return NULL;
324324 }
325325 }
326326 break;
--- a/src/realm-sorcery.c
+++ b/src/realm-sorcery.c
@@ -386,7 +386,7 @@ cptr do_sorcery_spell(SPELL_IDX spell, BIT_FLAGS mode)
386386
387387 if (cast)
388388 {
389- if (!word_of_recall()) return NULL;
389+ if (!recall_player(p_ptr, randint0(21) + 15)) return NULL;
390390 }
391391 }
392392 break;
--- a/src/realm-trump.c
+++ b/src/realm-trump.c
@@ -298,7 +298,7 @@ cptr do_trump_spell(SPELL_IDX spell, BIT_FLAGS mode)
298298
299299 if (cast)
300300 {
301- if (!word_of_recall()) return NULL;
301+ if (!recall_player(p_ptr, randint0(21) + 15)) return NULL;
302302 }
303303 }
304304 break;
--- a/src/spells3.c
+++ b/src/spells3.c
@@ -823,7 +823,7 @@ DUNGEON_IDX choose_dungeon(cptr note, POSITION y, POSITION x)
823823 * @param turns 発動までのターン数
824824 * @return 常にTRUEを返す
825825 */
826-bool recall_player(TIME_EFFECT turns)
826+bool recall_player(player_type *creature_ptr, TIME_EFFECT turns)
827827 {
828828 /*
829829 * TODO: Recall the player to the last
@@ -831,13 +831,13 @@ bool recall_player(TIME_EFFECT turns)
831831 */
832832
833833 /* Ironman option */
834- if (p_ptr->inside_arena || ironman_downward)
834+ if (creature_ptr->inside_arena || ironman_downward)
835835 {
836836 msg_print(_("何も起こらなかった。", "Nothing happens."));
837837 return TRUE;
838838 }
839839
840- if (dun_level && (max_dlv[dungeon_type] > dun_level) && !p_ptr->inside_quest && !p_ptr->word_recall)
840+ if (dun_level && (max_dlv[dungeon_type] > dun_level) && !creature_ptr->inside_quest && !creature_ptr->word_recall)
841841 {
842842 if (get_check(_("ここは最深到達階より浅い階です。この階に戻って来ますか? ", "Reset recall depth? ")))
843843 {
@@ -847,24 +847,24 @@ bool recall_player(TIME_EFFECT turns)
847847 }
848848
849849 }
850- if (!p_ptr->word_recall)
850+ if (!creature_ptr->word_recall)
851851 {
852852 if (!dun_level)
853853 {
854854 DUNGEON_IDX select_dungeon;
855855 select_dungeon = choose_dungeon(_("に帰還", "recall"), 2, 14);
856856 if (!select_dungeon) return FALSE;
857- p_ptr->recall_dungeon = select_dungeon;
857+ creature_ptr->recall_dungeon = select_dungeon;
858858 }
859- p_ptr->word_recall = turns;
859+ creature_ptr->word_recall = turns;
860860 msg_print(_("回りの大気が張りつめてきた...", "The air about you becomes charged..."));
861- p_ptr->redraw |= (PR_STATUS);
861+ creature_ptr->redraw |= (PR_STATUS);
862862 }
863863 else
864864 {
865- p_ptr->word_recall = 0;
865+ creature_ptr->word_recall = 0;
866866 msg_print(_("張りつめた大気が流れ去った...", "A tension leaves the air around you..."));
867- p_ptr->redraw |= (PR_STATUS);
867+ creature_ptr->redraw |= (PR_STATUS);
868868 }
869869 return TRUE;
870870 }
@@ -908,15 +908,6 @@ bool free_level_recall(player_type *creature_ptr)
908908
909909
910910 /*!
911- * @brief 帰還用メインルーチン
912- * @return 常にTRUEを返す
913- */
914-bool word_of_recall(void)
915-{
916- return(recall_player(randint0(21) + 15));
917-}
918-
919-/*!
920911 * @brief フロア・リセット処理
921912 * @return リセット処理が実際に行われたらTRUEを返す
922913 */
Show on old repository browser