OSDN Git Service

[Refactor] #37353 leave_quest_check() to quest.c.
authordeskull <deskull@users.sourceforge.jp>
Wed, 6 Mar 2019 14:28:07 +0000 (23:28 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Wed, 6 Mar 2019 14:28:07 +0000 (23:28 +0900)
src/dungeon.c
src/externs.h
src/quest.c
src/quest.h

index 05b2414..dd15605 100644 (file)
@@ -1043,59 +1043,6 @@ static void notice_lite_change(object_type *o_ptr)
 }
 
 /*!
- * @brief クエスト階層から離脱する際の処理
- * @return なし
- */
-void leave_quest_check(void)
-{
-       /* Save quest number for dungeon pref file ($LEAVING_QUEST) */
-       leaving_quest = p_ptr->inside_quest;
-
-       /* Leaving an 'only once' quest marks it as failed */
-       if (leaving_quest)
-       {       
-               quest_type* const q_ptr = &quest[leaving_quest];
-               
-           if(((q_ptr->flags & QUEST_FLAG_ONCE)  || (q_ptr->type == QUEST_TYPE_RANDOM)) &&
-              (q_ptr->status == QUEST_STATUS_TAKEN))
-               {
-                       q_ptr->status = QUEST_STATUS_FAILED;
-                       q_ptr->complev = p_ptr->lev;
-                       update_playtime();
-                       q_ptr->comptime = current_world_ptr->play_time;
-
-                       /* Additional settings */
-                       switch (q_ptr->type)
-                       {
-                         case QUEST_TYPE_TOWER:
-                               quest[QUEST_TOWER1].status = QUEST_STATUS_FAILED;
-                               quest[QUEST_TOWER1].complev = p_ptr->lev;
-                               break;
-                         case QUEST_TYPE_FIND_ARTIFACT:
-                               a_info[q_ptr->k_idx].gen_flags &= ~(TRG_QUESTITEM);
-                               break;
-                         case QUEST_TYPE_RANDOM:
-                               r_info[q_ptr->r_idx].flags1 &= ~(RF1_QUESTOR);
-
-                               /* Floor of random quest will be blocked */
-                               prepare_change_floor_mode(CFM_NO_RETURN);
-                               break;
-                       }
-
-                       /* Record finishing a quest */
-                       if (q_ptr->type == QUEST_TYPE_RANDOM)
-                       {
-                               if (record_rand_quest) do_cmd_write_nikki(NIKKI_RAND_QUEST_F, leaving_quest, NULL);
-                       }
-                       else
-                       {
-                               if (record_fix_quest) do_cmd_write_nikki(NIKKI_FIX_QUEST_F, leaving_quest, NULL);
-                       }
-               }
-       }
-}
-
-/*!
  * @brief 「塔」クエストの各階層から離脱する際の処理
  * @return なし
  */
index 3e46c8d..e8f8f23 100644 (file)
@@ -553,7 +553,6 @@ extern concptr do_spell(REALM_IDX realm, SPELL_IDX spell, BIT_FLAGS mode);
 extern bool trump_summoning(int num, bool pet, POSITION y, POSITION x, DEPTH lev, int type, BIT_FLAGS mode);
 
 /* dungeon.c */
-extern void leave_quest_check(void);
 extern void leave_tower_check(void);
 extern void extract_option_vars(void);
 extern void determine_bounty_uniques(void);
index 26069c0..ea82629 100644 (file)
@@ -1,4 +1,5 @@
 #include "angband.h"
+#include "floor.h"
 #include "floor-events.h"
 #include "quest.h"
 #include "monsterrace-hook.h"
@@ -426,3 +427,56 @@ QUEST_IDX random_quest_number(DEPTH level)
 
        return 0;
 }
+
+/*!
+ * @brief クエスト階層から離脱する際の処理
+ * @return なし
+ */
+void leave_quest_check(void)
+{
+       /* Save quest number for dungeon pref file ($LEAVING_QUEST) */
+       leaving_quest = p_ptr->inside_quest;
+
+       /* Leaving an 'only once' quest marks it as failed */
+       if (leaving_quest)
+       {
+               quest_type* const q_ptr = &quest[leaving_quest];
+
+               if (((q_ptr->flags & QUEST_FLAG_ONCE) || (q_ptr->type == QUEST_TYPE_RANDOM)) &&
+                       (q_ptr->status == QUEST_STATUS_TAKEN))
+               {
+                       q_ptr->status = QUEST_STATUS_FAILED;
+                       q_ptr->complev = p_ptr->lev;
+                       update_playtime();
+                       q_ptr->comptime = current_world_ptr->play_time;
+
+                       /* Additional settings */
+                       switch (q_ptr->type)
+                       {
+                       case QUEST_TYPE_TOWER:
+                               quest[QUEST_TOWER1].status = QUEST_STATUS_FAILED;
+                               quest[QUEST_TOWER1].complev = p_ptr->lev;
+                               break;
+                       case QUEST_TYPE_FIND_ARTIFACT:
+                               a_info[q_ptr->k_idx].gen_flags &= ~(TRG_QUESTITEM);
+                               break;
+                       case QUEST_TYPE_RANDOM:
+                               r_info[q_ptr->r_idx].flags1 &= ~(RF1_QUESTOR);
+
+                               /* Floor of random quest will be blocked */
+                               prepare_change_floor_mode(CFM_NO_RETURN);
+                               break;
+                       }
+
+                       /* Record finishing a quest */
+                       if (q_ptr->type == QUEST_TYPE_RANDOM)
+                       {
+                               if (record_rand_quest) do_cmd_write_nikki(NIKKI_RAND_QUEST_F, leaving_quest, NULL);
+                       }
+                       else
+                       {
+                               if (record_fix_quest) do_cmd_write_nikki(NIKKI_FIX_QUEST_F, leaving_quest, NULL);
+                       }
+               }
+       }
+}
index 0b62f05..8217105 100644 (file)
@@ -25,3 +25,4 @@ extern void check_find_art_quest_completion(object_type *o_ptr);
 void quest_discovery(QUEST_IDX q_idx);
 extern QUEST_IDX quest_number(DEPTH level);
 extern QUEST_IDX random_quest_number(DEPTH level);
+extern void leave_quest_check(void);