From d8e70ed365eb912422a9085b7d7046a630599243 Mon Sep 17 00:00:00 2001 From: nothere Date: Thu, 5 Jun 2003 07:28:35 +0000 Subject: [PATCH] =?utf8?q?=E3=82=AF=E3=82=A8=E3=82=B9=E3=83=88ID=E3=81=8C?= =?utf8?q?=E3=83=A9=E3=83=B3=E3=83=80=E3=83=A0=E3=82=AF=E3=82=A8=E3=82=B9?= =?utf8?q?=E3=83=88=E3=81=AE=E7=89=A9=E3=81=8B=E3=81=A9=E3=81=86=E3=81=8B?= =?utf8?q?=E5=88=A4=E5=AE=9A=E3=81=99=E3=82=8B=E9=83=A8=E5=88=86=E3=82=92?= =?utf8?q?=E3=83=9E=E3=82=AF=E3=83=AD=E3=81=AB=E3=81=BE=E3=81=A8=E3=82=81?= =?utf8?q?=20=E3=81=9F.=20=E5=B0=86=E6=9D=A5=E7=9A=84=E3=81=AB=E3=83=A9?= =?utf8?q?=E3=83=B3=E3=83=80=E3=83=A0=E3=82=AF=E3=82=A8=E3=82=B9=E3=83=88?= =?utf8?q?=E9=A0=98=E5=9F=9F=E3=81=AE=E5=BE=8C=E3=82=8D=E3=81=AB=E5=9B=BA?= =?utf8?q?=E5=AE=9A=E3=82=AF=E3=82=A8=E3=82=B9=E3=83=88=E3=82=92=E9=85=8D?= =?utf8?q?=E7=BD=AE=E3=81=99=E3=82=8B=E3=81=93=E3=81=A8=E3=82=92=20?= =?utf8?q?=E8=80=83=E3=81=88=E3=81=9F=E4=B8=8A=E3=81=A7=E3=81=AE=E5=A4=89?= =?utf8?q?=E6=9B=B4.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/cmd4.c | 17 +++++++++++------ src/defines.h | 3 +++ src/dungeon.c | 23 ++++++++++++++--------- src/effects.c | 5 ++++- src/files.c | 18 +++++++++--------- src/floors.c | 2 +- src/monster2.c | 2 +- src/mspells1.c | 2 +- src/mspells2.c | 2 +- src/save.c | 2 +- src/spells2.c | 4 ++-- src/xtra1.c | 2 +- 12 files changed, 49 insertions(+), 33 deletions(-) diff --git a/src/cmd4.c b/src/cmd4.c index 043e7b182..eec411ea5 100644 --- a/src/cmd4.c +++ b/src/cmd4.c @@ -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 diff --git a/src/defines.h b/src/defines.h index 9863dffd9..7896bcdac 100644 --- a/src/defines.h +++ b/src/defines.h @@ -118,6 +118,9 @@ #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 diff --git a/src/dungeon.c b/src/dungeon.c index b5af455ef..5ec9ad4e7 100644 --- a/src/dungeon.c +++ b/src/dungeon.c @@ -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 } diff --git a/src/effects.c b/src/effects.c index 5e660da6b..934150fa6 100644 --- a/src/effects.c +++ b/src/effects.c @@ -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 diff --git a/src/files.c b/src/files.c index e821c69e1..178c51dd7 100644 --- a/src/files.c +++ b/src/files.c @@ -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 diff --git a/src/floors.c b/src/floors.c index 32e51ed5a..ebb65d67e 100644 --- a/src/floors.c +++ b/src/floors.c @@ -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 */ diff --git a/src/monster2.c b/src/monster2.c index 6b859c458..ded7b4048 100644 --- a/src/monster2.c +++ b/src/monster2.c @@ -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; diff --git a/src/mspells1.c b/src/mspells1.c index 667bfe387..05ef506bf 100644 --- a/src/mspells1.c +++ b/src/mspells1.c @@ -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); diff --git a/src/mspells2.c b/src/mspells2.c index 52ebef375..05d077c22 100644 --- a/src/mspells2.c +++ b/src/mspells2.c @@ -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); diff --git a/src/save.c b/src/save.c index 68918b4ed..4680e65bf 100644 --- a/src/save.c +++ b/src/save.c @@ -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); diff --git a/src/spells2.c b/src/spells2.c index ec0ac5de3..a25cc52ad 100644 --- a/src/spells2.c +++ b/src/spells2.c @@ -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); } diff --git a/src/xtra1.c b/src/xtra1.c index e85fcd1fb..d02e6030a 100644 --- a/src/xtra1.c +++ b/src/xtra1.c @@ -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 "¥¯¥¨¥¹¥È"; -- 2.11.0