OSDN Git Service

クエストIDがランダムクエストの物かどうか判定する部分をマクロにまとめ
authornothere <nothere@0568b783-4c39-0410-ac80-bf13821ea2a2>
Thu, 5 Jun 2003 07:28:35 +0000 (07:28 +0000)
committernothere <nothere@0568b783-4c39-0410-ac80-bf13821ea2a2>
Thu, 5 Jun 2003 07:28:35 +0000 (07:28 +0000)
た. 将来的にランダムクエスト領域の後ろに固定クエストを配置することを
考えた上での変更.

12 files changed:
src/cmd4.c
src/defines.h
src/dungeon.c
src/effects.c
src/files.c
src/floors.c
src/monster2.c
src/mspells1.c
src/mspells2.c
src/save.c
src/spells2.c
src/xtra1.c

index 043e7b1..eec411e 100644 (file)
@@ -344,6 +344,7 @@ errr do_cmd_write_nikki(int type, int num, cptr note)
        cptr note_level = "";
        bool do_level = TRUE;
        char note_level_buf[40];
+       int q_idx;
 
        static bool disable_nikki = FALSE;
 
@@ -399,6 +400,8 @@ errr do_cmd_write_nikki(int type, int num, cptr note)
                return (-1);
        }
 
+       q_idx = quest_number(dun_level);
+
        if (write_level)
        {
                if (p_ptr->inside_arena)
@@ -413,7 +416,8 @@ errr do_cmd_write_nikki(int type, int num, cptr note)
 #else
                        note_level = "Surface:";
 #endif
-               else if (quest_number(dun_level) && ((quest_number(dun_level) < MIN_RANDOM_QUEST) && !(quest_number(dun_level) == QUEST_OBERON || quest_number(dun_level) == QUEST_SERPENT)))
+               else if (q_idx && (is_fixed_quest_idx(q_idx)
+                        && !((q_idx == QUEST_OBERON) || (q_idx == QUEST_SERPENT))))
 #ifdef JP
                        note_level = "¥¯¥¨¥¹¥È:";
 #else
@@ -534,7 +538,8 @@ errr do_cmd_write_nikki(int type, int num, cptr note)
                case NIKKI_STAIR:
                {
                        cptr to;
-                       if (quest_number(dun_level) && ((quest_number(dun_level) < MIN_RANDOM_QUEST) && !(quest_number(dun_level) == QUEST_OBERON || quest_number(dun_level) == QUEST_SERPENT)))
+                       if (q_idx && (is_fixed_quest_idx(q_idx)
+                            && !((q_idx == QUEST_OBERON) || (q_idx == QUEST_SERPENT))))
                        {
 #ifdef JP
                                to = "ÃϾå";
@@ -8823,7 +8828,7 @@ static void do_cmd_knowledge_quests(void)
        {
                if (quest[i].status == QUEST_STATUS_FINISHED)
                {
-                       if (i < MIN_RANDOM_QUEST)
+                       if (is_fixed_quest_idx(i))
                        {
                                int old_quest;
 
@@ -8845,7 +8850,7 @@ static void do_cmd_knowledge_quests(void)
 
                        total++;
 
-                       if ((i >= MIN_RANDOM_QUEST) && quest[i].r_idx)
+                       if (!is_fixed_quest_idx(i) && quest[i].r_idx)
                        {
                                /* Print the quest info */
 
@@ -8904,7 +8909,7 @@ static void do_cmd_knowledge_quests(void)
        {
                if ((quest[i].status == QUEST_STATUS_FAILED_DONE) || (quest[i].status == QUEST_STATUS_FAILED))
                {
-                       if (i < MIN_RANDOM_QUEST)
+                       if (is_fixed_quest_idx(i))
                        {
                                int old_quest;
 
@@ -8926,7 +8931,7 @@ static void do_cmd_knowledge_quests(void)
 
                        total++;
 
-                       if ((i >= MIN_RANDOM_QUEST) && quest[i].r_idx)
+                       if (!is_fixed_quest_idx(i) && quest[i].r_idx)
                        {
                                /* Print the quest info */
 #ifdef JP
index 9863dff..7896bcd 100644 (file)
 #define MIN_RANDOM_QUEST    40
 #define MAX_RANDOM_QUEST    49
 
+/* Check is the quest index is "fixed" */
+#define is_fixed_quest_idx(Q_IDX) (((Q_IDX) < MIN_RANDOM_QUEST) || ((Q_IDX) > MAX_RANDOM_QUEST))
+
 #define QUEST_OBERON         8
 #define QUEST_SERPENT        9
 
index b5af455..5ec9ad4 100644 (file)
@@ -1492,7 +1492,7 @@ msg_print("
 
 void leave_quest_check(void)
 {
-       /* Save quset number for dungeon pref file ($LEAVING_QUEST) */
+       /* Save quest number for dungeon pref file ($LEAVING_QUEST) */
        leaving_quest = p_ptr->inside_quest;
 
        /* Leaving an 'only once' quest marks it as failed */
@@ -1916,13 +1916,17 @@ static void process_world(void)
        s32b len = TURNS_PER_TICK * TOWN_DAWN;
        s32b tick = turn % len + len / 4;
 
+       int quest_num = quest_number(dun_level);
+
        extract_day_hour_min(&day, &hour, &min);
        prev_min = (1440 * (tick - TURNS_PER_TICK) / len) % 60;
 
        if ((turn - old_turn == (150 - dun_level) * TURNS_PER_TICK)
-           && (dun_level) &&
-           !(quest_number(dun_level) && ((quest_number(dun_level) < MIN_RANDOM_QUEST) && !(quest_number(dun_level) == QUEST_OBERON || quest_number(dun_level) == QUEST_SERPENT || !(quest[quest_number(dun_level)].flags & QUEST_FLAG_PRESET)))) &&
-           !(p_ptr->inside_battle))
+           && dun_level &&
+           !(quest_num && (is_fixed_quest_idx(quest_num) &&
+           !((quest_num == QUEST_OBERON) || (quest_num == QUEST_SERPENT) ||
+             !(quest[quest_num].flags & QUEST_FLAG_PRESET)))) &&
+           !p_ptr->inside_battle)
                do_cmd_feeling();
 
        if (p_ptr->inside_battle && !p_ptr->leaving)
@@ -6265,7 +6269,9 @@ static void dungeon(bool load_game)
        /* Refresh */
        Term_fresh();
 
-       if (quest_number(dun_level) && ((quest_number(dun_level) < MIN_RANDOM_QUEST) && !(quest_number(dun_level) == QUEST_OBERON || quest_number(dun_level) == QUEST_SERPENT || !(quest[quest_number(dun_level)].flags & QUEST_FLAG_PRESET)))) do_cmd_feeling();
+       if (quest_num && (is_fixed_quest_idx(quest_num) &&
+           !((quest_num == QUEST_OBERON) || (quest_num == QUEST_SERPENT) ||
+           !(quest[quest_num].flags & QUEST_FLAG_PRESET)))) do_cmd_feeling();
 
        if (p_ptr->inside_battle)
        {
@@ -6276,7 +6282,6 @@ static void dungeon(bool load_game)
                }
                else
                {
-                       
 #ifdef JP
 msg_print("»î¹ç³«»Ï¡ª");
 #else
@@ -6306,9 +6311,9 @@ msg_print("
                                   d_name+d_info[dungeon_type].name, 
                                   r_name+r_info[d_info[dungeon_type].final_guardian].name);
 #else
-               msg_format("%^s lives in this level as the keeper of %s.",
-                                  r_name+r_info[d_info[dungeon_type].final_guardian].name, 
-                                  d_name+d_info[dungeon_type].name);
+                       msg_format("%^s lives in this level as the keeper of %s.",
+                                          r_name+r_info[d_info[dungeon_type].final_guardian].name, 
+                                          d_name+d_info[dungeon_type].name);
 #endif
        }
 
index 5e660da..934150f 100644 (file)
@@ -5151,6 +5151,8 @@ int take_hit(int damage_type, int damage, cptr hit_from, int monspell)
                }
                else
                {
+                       int q_idx = quest_number(dun_level);
+
 #ifdef WORLD_SCORE
                        /* Make screen dump */
                        screen_dump = make_screen_dump();
@@ -5178,7 +5180,8 @@ int take_hit(int damage_type, int damage, cptr hit_from, int monspell)
 #else
                                strcpy(buf,"on the surface");
 #endif
-                       else if (quest_number(dun_level) && ((quest_number(dun_level) < MIN_RANDOM_QUEST) && !(quest_number(dun_level) == QUEST_OBERON || quest_number(dun_level) == QUEST_SERPENT)))
+                       else if (q_idx && (is_fixed_quest_idx(q_idx) &&
+                                !((q_idx == QUEST_OBERON) || (q_idx == QUEST_SERPENT))))
 #ifdef JP
                                strcpy(buf,"¥¯¥¨¥¹¥È");
 #else
index e821c69..178c51d 100644 (file)
@@ -3808,7 +3808,7 @@ void display_player(int mode)
                                        sprintf(statmsg, "...You were killed by %s in %s.", p_ptr->died_from, map_name());
 #endif
                                }
-                               else if (p_ptr->inside_quest && (p_ptr->inside_quest < MIN_RANDOM_QUEST))
+                               else if (p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest))
                                {
                                        /* Get the quest text */
                                        /* Bewere that INIT_ASSIGN resets the cur_num. */
@@ -3823,7 +3823,7 @@ void display_player(int mode)
 #endif
                                }
                                else
-                               {                                       
+                               {
 #ifdef JP
                                        sprintf(statmsg, "¡Ä¤¢¤Ê¤¿¤Ï¡¢%s¤Î%d³¬¤Ç%s¤Ë»¦¤µ¤ì¤¿¡£", map_name(), dun_level, p_ptr->died_from);
 #else
@@ -3841,7 +3841,7 @@ void display_player(int mode)
                                        sprintf(statmsg, "...Now, you are in %s.", map_name());
 #endif
                                }
-                               else if (p_ptr->inside_quest && (p_ptr->inside_quest < MIN_RANDOM_QUEST))
+                               else if (p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest))
                                {
                                        /* Clear the text */
                                        /* Must be done before doing INIT_SHOW_TEXT */
@@ -3861,7 +3861,7 @@ void display_player(int mode)
 #else
                                        sprintf(statmsg, "...Now, you are in the quest '%s'.", quest[p_ptr->inside_quest].name);
 #endif
-                               }                                                       
+                               }
                                else
                                {
 #ifdef JP
@@ -4156,10 +4156,10 @@ errr make_character_dump(FILE *fff)
 
                if (quest[num].status == QUEST_STATUS_FINISHED)
                {
-                       if (num < MIN_RANDOM_QUEST)
+                       if (is_fixed_quest_idx(num))
                        {
                                int old_quest;
-                       
+
                                /* Set the quest number temporary */
                                old_quest = p_ptr->inside_quest;
                                p_ptr->inside_quest = num;
@@ -4178,7 +4178,7 @@ errr make_character_dump(FILE *fff)
 
                        total++;
 
-                       if ((num >= MIN_RANDOM_QUEST) && quest[num].r_idx)
+                       if (!is_fixed_quest_idx(num) && quest[num].r_idx)
                        {
                                /* Print the quest info */
 
@@ -4237,7 +4237,7 @@ errr make_character_dump(FILE *fff)
 
                if ((quest[num].status == QUEST_STATUS_FAILED_DONE) || (quest[num].status == QUEST_STATUS_FAILED))
                {
-                       if (num < MIN_RANDOM_QUEST)
+                       if (is_fixed_quest_idx(num))
                        {
                                int old_quest;
 
@@ -4259,7 +4259,7 @@ errr make_character_dump(FILE *fff)
 
                        total++;
 
-                       if ((num >= MIN_RANDOM_QUEST) && quest[num].r_idx)
+                       if (!is_fixed_quest_idx(num) && quest[num].r_idx)
                        {
                                /* Print the quest info */
 #ifdef JP
index 32e51ed..ebb65d6 100644 (file)
@@ -1314,7 +1314,7 @@ void stair_creation(void)
 
        /* No effect out of standard dungeon floor */
        if (!dun_level || (!up && !down) ||
-           (p_ptr->inside_quest && (p_ptr->inside_quest < MIN_RANDOM_QUEST)) ||
+           (p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)) ||
            p_ptr->inside_arena || p_ptr->inside_battle)
        {
                /* arena or quest */
index 6b859c4..ded7b40 100644 (file)
@@ -1221,7 +1221,7 @@ errr get_mon_num_prep(monster_hook_type monster_hook,
                /* Accept this monster */
                entry->prob2 = entry->prob1;
 
-               if (dun_level && (!p_ptr->inside_quest || p_ptr->inside_quest < MIN_RANDOM_QUEST) && !restrict_monster_to_dungeon(entry->index) && !p_ptr->inside_battle)
+               if (dun_level && (!p_ptr->inside_quest || is_fixed_quest_idx(p_ptr->inside_quest)) && !restrict_monster_to_dungeon(entry->index) && !p_ptr->inside_battle)
                {
                        int hoge = entry->prob2 * d_info[dungeon_type].special_div;
                        entry->prob2 = hoge / 64;
index 667bfe3..05ef506 100644 (file)
@@ -1378,7 +1378,7 @@ bool make_attack_spell(int m_idx)
                f6 &= ~(RF6_DARKNESS);
        }
 
-       if (dun_level && (!p_ptr->inside_quest || (p_ptr->inside_quest < MIN_RANDOM_QUEST)) && (d_info[dungeon_type].flags1 & DF1_NO_MAGIC))
+       if (dun_level && (!p_ptr->inside_quest || is_fixed_quest_idx(p_ptr->inside_quest)) && (d_info[dungeon_type].flags1 & DF1_NO_MAGIC))
        {
                f4 &= (RF4_NOMAGIC_MASK);
                f5 &= (RF5_NOMAGIC_MASK);
index 52ebef3..05d077c 100644 (file)
@@ -310,7 +310,7 @@ bool monst_spell_monst(int m_idx)
        /* Extract the monster level */
        rlev = ((r_ptr->level >= 1) ? r_ptr->level : 1);
 
-       if (dun_level && (!p_ptr->inside_quest || (p_ptr->inside_quest < MIN_RANDOM_QUEST)) && (d_info[dungeon_type].flags1 & DF1_NO_MAGIC))
+       if (dun_level && (!p_ptr->inside_quest || is_fixed_quest_idx(p_ptr->inside_quest)) && (d_info[dungeon_type].flags1 & DF1_NO_MAGIC))
        {
                f4 &= (RF4_NOMAGIC_MASK);
                f5 &= (RF5_NOMAGIC_MASK);
index 68918b4..4680e65 100644 (file)
@@ -1289,7 +1289,7 @@ static bool wr_savefile_new(void)
                wr_byte(quest[i].complev);
 
                /* Save quest status if quest is running */
-               if (quest[i].status == QUEST_STATUS_TAKEN || quest[i].status == QUEST_STATUS_COMPLETED || ((i >= MIN_RANDOM_QUEST) && (i <= MAX_RANDOM_QUEST)))
+               if (quest[i].status == QUEST_STATUS_TAKEN || quest[i].status == QUEST_STATUS_COMPLETED || !is_fixed_quest_idx(i))
                {
                        wr_s16b(quest[i].cur_num);
                        wr_s16b(quest[i].max_num);
index ec0ac5d..a25cc52 100644 (file)
@@ -5331,7 +5331,7 @@ bool destroy_area(int y1, int x1, int r)
 
 
        /* Prevent destruction of quest levels and town */
-       if ((p_ptr->inside_quest && (p_ptr->inside_quest < MIN_RANDOM_QUEST)) || !dun_level)
+       if ((p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)) || !dun_level)
        {
                return (FALSE);
        }
@@ -5534,7 +5534,7 @@ bool earthquake(int cy, int cx, int r)
 
 
        /* Prevent destruction of quest levels and town */
-       if ((p_ptr->inside_quest && (p_ptr->inside_quest < MIN_RANDOM_QUEST)) || !dun_level)
+       if ((p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)) || !dun_level)
        {
                return (FALSE);
        }
index e85fcd1..d02e603 100644 (file)
@@ -175,7 +175,7 @@ void prt_time(void)
 
 cptr map_name(void)
 {
-       if (p_ptr->inside_quest && (p_ptr->inside_quest < MIN_RANDOM_QUEST)
+       if (p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)
            && (quest[p_ptr->inside_quest].flags & QUEST_FLAG_PRESET))
 #ifdef JP
                return "¥¯¥¨¥¹¥È";