• R/O
  • SSH
  • HTTPS

xangband: コミット


コミットメタ情報

リビジョン372 (tree)
日時2002-03-29 22:22:57
作者_nothere

ログメッセージ

クエスト情報表示を変愚蛮怒と同様の情報量に増やした. この過程でセーブファイルに手が加わったため, Ver.を0.1.5に上げた上で枝とする.

変更サマリ

差分

--- XAngband/branches/branch-_nothere-questinfo/lib/file/news_j.txt (revision 371)
+++ XAngband/branches/branch-_nothere-questinfo/lib/file/news_j.txt (revision 372)
@@ -1,6 +1,6 @@
11
22 ***************************************
3- ** KantAngband 0.1.4 **
3+ ** KantAngband 0.1.5 **
44 ***************************************
55 Based on Moria: Copyright (c) 1985 Robert Alan Koeneke
66 and Umoria: Copyright (c) 1989 James E. Wilson
--- XAngband/branches/branch-_nothere-questinfo/src/birth.c (revision 371)
+++ XAngband/branches/branch-_nothere-questinfo/src/birth.c (revision 372)
@@ -2237,6 +2237,7 @@
22372237 quest[i].type = 0;
22382238 quest[i].level = 0;
22392239 quest[i].r_idx = 0;
2240+ quest[i].complev = 0;
22402241 }
22412242
22422243 /* No weight */
@@ -3400,6 +3401,8 @@
34003401 /* Accept Only Unique Monster */
34013402 if(!(r_ptr->flags1 & RF1_UNIQUE)) continue;
34023403
3404+ if (r_ptr->flags1 & RF1_QUESTOR) continue;
3405+
34033406 /*
34043407 * Accept monsters that are 2 - 6 levels
34053408 * out of depth depending on the quest level
--- XAngband/branches/branch-_nothere-questinfo/src/wizard2.c (revision 371)
+++ XAngband/branches/branch-_nothere-questinfo/src/wizard2.c (revision 372)
@@ -1459,15 +1459,8 @@
14591459 dun_level = command_arg;
14601460
14611461 p_ptr->inside_arena = 0;
1462- leaving_quest = p_ptr->inside_quest;
14631462
1464- /* Leaving an 'only once' quest marks it as failed */
1465- if (leaving_quest &&
1466- (quest[leaving_quest].flags & QUEST_FLAG_ONCE) &&
1467- (quest[leaving_quest].status == QUEST_STATUS_TAKEN))
1468- {
1469- quest[leaving_quest].status = QUEST_STATUS_FAILED;
1470- }
1463+ leave_quest_check();
14711464
14721465 p_ptr->inside_quest = 0;
14731466 p_ptr->leftbldg = FALSE;
--- XAngband/branches/branch-_nothere-questinfo/src/cmd2.c (revision 371)
+++ XAngband/branches/branch-_nothere-questinfo/src/cmd2.c (revision 372)
@@ -34,18 +34,10 @@
3434 msg_print("You enter the up staircase.");
3535 #endif
3636
37+ leave_quest_check();
3738
38- leaving_quest = p_ptr->inside_quest;
3939 p_ptr->inside_quest = c_ptr->special;
4040
41- /* Leaving an 'only once' quest marks it as failed */
42- if (leaving_quest &&
43- (quest[leaving_quest].flags & QUEST_FLAG_ONCE) &&
44- (quest[leaving_quest].status == QUEST_STATUS_TAKEN))
45- {
46- quest[leaving_quest].status = QUEST_STATUS_FAILED;
47- }
48-
4941 #ifdef USE_SCRIPT
5042 if (cmd_go_up_callback()) return;
5143 #endif /* USE_SCRIPT */
@@ -126,17 +118,9 @@
126118
127119 if (p_ptr->inside_quest)
128120 {
129- leaving_quest = p_ptr->inside_quest;
130-
131121 if(quest[leaving_quest].type != QUEST_TYPE_RANDOM) dun_level = 1;
132122
133- /* Leaving an 'only once' quest marks it as failed */
134- if (leaving_quest &&
135- (quest[leaving_quest].flags & QUEST_FLAG_ONCE) &&
136- (quest[leaving_quest].status == QUEST_STATUS_TAKEN))
137- {
138- quest[leaving_quest].status = QUEST_STATUS_FAILED;
139- }
123+ leave_quest_check();
140124
141125 p_ptr->inside_quest = c_ptr->special;
142126 }
@@ -191,17 +175,8 @@
191175 msg_print("You enter the down staircase.");
192176 #endif
193177
178+ leave_quest_check();
194179
195- leaving_quest = p_ptr->inside_quest;
196-
197- /* Leaving an 'only once' quest marks it as failed */
198- if (leaving_quest &&
199- (quest[leaving_quest].flags & QUEST_FLAG_ONCE) &&
200- (quest[leaving_quest].status == QUEST_STATUS_TAKEN))
201- {
202- quest[leaving_quest].status = QUEST_STATUS_FAILED;
203- }
204-
205180 p_ptr->inside_quest = c_ptr->special;
206181
207182 /* Activate the quest */
@@ -2777,8 +2752,9 @@
27772752 if (quest[q_index].type == QUEST_TYPE_FIND_EXIT)
27782753 {
27792754 quest[q_index].status = QUEST_STATUS_COMPLETED;
2755+ quest[q_index].complev = (byte)p_ptr->lev;
27802756 #ifdef JP
2781- msg_print("クエストを完了した!");
2757+ msg_print("クエストを達成した!");
27822758 #else
27832759 msg_print("You accomplished your quest!");
27842760 #endif
@@ -2786,16 +2762,8 @@
27862762 msg_print(NULL);
27872763 }
27882764
2789- leaving_quest = p_ptr->inside_quest;
2765+ leave_quest_check();
27902766
2791- /* Leaving an 'only once' quest marks it as failed */
2792- if (leaving_quest &&
2793- (quest[leaving_quest].flags & QUEST_FLAG_ONCE) &&
2794- (quest[leaving_quest].status == QUEST_STATUS_TAKEN))
2795- {
2796- quest[leaving_quest].status = QUEST_STATUS_FAILED;
2797- }
2798-
27992767 p_ptr->inside_quest = cave[py][px].special;
28002768 dun_level = 0;
28012769 p_ptr->oldpx = 0;
--- XAngband/branches/branch-_nothere-questinfo/src/cmd4.c (revision 371)
+++ XAngband/branches/branch-_nothere-questinfo/src/cmd4.c (revision 372)
@@ -4546,16 +4546,33 @@
45464546 char name[80];
45474547 monster_race *r_ptr;
45484548 int i;
4549+ int rand_level = 100;
4550+ int total = 0;
45494551
45504552 /* Open a new file */
45514553 fff = my_fopen_temp(file_name, 1024);
4554+ if (!fff) {
4555+#ifdef JP
4556+ msg_format("一時ファイル %s を作成できませんでした。", file_name);
4557+#else
4558+ msg_format("Failed to create temporary file %s.", file_name);
4559+#endif
4560+ msg_print(NULL);
4561+ return;
4562+ }
45524563
4564+#ifdef JP
4565+ fprintf(fff, "《遂行中のクエスト》\n");
4566+#else
4567+ fprintf(fff, "< Current Quest >\n");
4568+#endif
4569+
45534570 for (i = 1; i < max_quests; i++)
45544571 {
45554572 /* No info from "silent" quests */
45564573 if (quest[i].flags & QUEST_FLAG_SILENT) continue;
45574574
4558- if (quest[i].status == QUEST_STATUS_TAKEN)
4575+ if (quest[i].status == QUEST_STATUS_TAKEN || quest[i].status == QUEST_STATUS_COMPLETED)
45594576 {
45604577 int old_quest;
45614578 int j;
@@ -4568,6 +4585,8 @@
45684585
45694586 quest_text_line = 0;
45704587
4588+ total++;
4589+
45714590 /* Set the quest number temporary */
45724591 old_quest = p_ptr->inside_quest;
45734592 p_ptr->inside_quest = i;
@@ -4574,91 +4593,314 @@
45744593
45754594 /* Get the quest text */
45764595 init_flags = INIT_SHOW_TEXT;
4577-#ifdef JP
4596+
45784597 process_dungeon_file("q_info_j.txt", 0, 0, 0, 0);
4579-#else
4580- process_dungeon_file("q_info.txt", 0, 0, 0, 0);
4581-#endif
45824598
4583-
45844599 /* Reset the old quest number */
45854600 p_ptr->inside_quest = old_quest;
45864601
45874602 if (quest[i].type != QUEST_TYPE_RANDOM)
45884603 {
4604+ char note[80] = "\0";
4605+
4606+ if (quest[i].status == QUEST_STATUS_TAKEN)
4607+ {
4608+ if (quest[i].type == QUEST_TYPE_KILL_LEVEL || quest[i].type == QUEST_TYPE_KILL_ANY_LEVEL)
4609+ {
4610+ r_ptr = &r_info[quest[i].r_idx];
4611+ strcpy(name, r_name + r_ptr->name);
4612+ if (quest[i].max_num > 1)
4613+ {
4614+#ifdef JP
4615+ sprintf(note," - %d 体の%sを倒す。(あと %d 体)",quest[i].max_num, name, quest[i].max_num-quest[i].cur_num);
4616+#else
4617+ plural_aux(name);
4618+ sprintf(note," - kill %d %s, have killed %d.",quest[i].max_num, name, quest[i].cur_num);
4619+#endif
4620+ }
4621+ else
4622+#ifdef JP
4623+ sprintf(note," - %sを倒す。",name);
4624+#else
4625+ sprintf(note," - kill %s.",name);
4626+#endif
4627+ }
4628+ else if (quest[i].type == QUEST_TYPE_KILL_NUMBER)
4629+ {
4630+#ifdef JP
4631+ sprintf(note," - %d 体のモンスターを倒す。(あと %d 体)",quest[i].max_num, quest[i].max_num-quest[i].cur_num);
4632+#else
4633+ sprintf(note," - Kill %d monsters, have killed %d.",quest[i].max_num, quest[i].cur_num);
4634+#endif
4635+ }
4636+ else if (quest[i].type == QUEST_TYPE_FIND_ARTIFACT)
4637+ {
4638+ strcpy(name, a_name + a_info[quest[i].k_idx].name);
4639+#ifdef JP
4640+ sprintf(note," - %sを見つけ出す。", name);
4641+#else
4642+ sprintf(note," - Find out %s.", name);
4643+#endif
4644+ }
4645+ else if (quest[i].type == QUEST_TYPE_FIND_EXIT)
4646+#ifdef JP
4647+ sprintf(note," - 探索する。");
4648+#else
4649+ sprintf(note," - Search.");
4650+#endif
4651+ else if (quest[i].type == QUEST_TYPE_KILL_ALL)
4652+#ifdef JP
4653+ sprintf(note," - 全てのモンスターを倒す。");
4654+#else
4655+ sprintf(note," - Kill all monsters.");
4656+#endif
4657+ }
4658+
45894659 /* Print the quest info */
45904660 #ifdef JP
4591- sprintf(tmp_str, "%s (危険度:%d階相当)\n",
4661+ sprintf(tmp_str, "%s (危険度:%d階相当)%s\n",
45924662 #else
4593- sprintf(tmp_str, "%s (Danger level: %d)\n",
4663+ sprintf(tmp_str, "%s (Danger level: %d)%s\n",
45944664 #endif
45954665
4596- quest[i].name, quest[i].level);
4666+ quest[i].name, quest[i].level, note);
45974667
45984668 fprintf(fff, tmp_str);
45994669
4600- j = 0;
4670+ if (quest[i].status == QUEST_STATUS_COMPLETED)
4671+ {
4672+#ifdef JP
4673+ sprintf(tmp_str, " クエスト達成 - まだ報酬を受けとってない。\n");
4674+#else
4675+ sprintf(tmp_str, " Quest Completed - Unrewarded\n");
4676+#endif
46014677
4602- while (quest_text[j][0] && j<10 )
4678+
4679+ fprintf(fff, tmp_str);
4680+ }
4681+ else
46034682 {
4604- fprintf(fff, " %s\n", quest_text[j]);
4605- j++;
4683+ j = 0;
4684+
4685+ while (quest_text[j][0] && j < 10)
4686+ {
4687+ fprintf(fff, " %s\n", quest_text[j]);
4688+ j++;
4689+ }
46064690 }
46074691 }
4692+ else if ((quest[i].type == QUEST_TYPE_RANDOM) &&
4693+ (quest[i].level < rand_level))
4694+ {
4695+ /* New random */
4696+ rand_level = quest[i].level;
4697+
4698+ if (p_ptr->max_dlv >= rand_level)
4699+ {
4700+ /* Print the quest info */
4701+ r_ptr = &r_info[quest[i].r_idx];
4702+ strcpy(name, r_name + r_ptr->name);
4703+
4704+ if (quest[i].max_num > 1)
4705+ {
4706+#ifdef JP
4707+sprintf(rand_tmp_str,"%s (%d 階) - %d 体の%sを倒す。(あと %d 体)\n",
4708+ quest[i].name, quest[i].level,
4709+ quest[i].max_num, name, quest[i].max_num-quest[i].cur_num);
4710+#else
4711+ plural_aux(name);
4712+
4713+ sprintf(rand_tmp_str,"%s (Dungeon level: %d)\n Kill %d %s, have killed %d.\n",
4714+ quest[i].name, quest[i].level,
4715+ quest[i].max_num, name, quest[i].cur_num);
4716+#endif
4717+
4718+ }
4719+ else
4720+ {
4721+#ifdef JP
4722+sprintf(rand_tmp_str,"%s (%d 階) - %sを倒す。\n",
4723+#else
4724+ sprintf(rand_tmp_str,"%s (Dungeon level: %d)\n Kill %s.\n",
4725+#endif
4726+
4727+ quest[i].name, quest[i].level, name);
4728+ }
4729+ }
4730+ }
46084731 }
4609- else if (quest[i].status == QUEST_STATUS_COMPLETED)
4732+ }
4733+
4734+ /* Print the current random quest */
4735+ if (rand_tmp_str[0]) fprintf(fff, rand_tmp_str);
4736+
4737+#ifdef JP
4738+ if (!total) fprintf(fff, "なし\n");
4739+#else
4740+ if (!total) fprintf(fff, "Nothing.\n");
4741+#endif
4742+
4743+#ifdef JP
4744+ fprintf(fff, "\n《達成したクエスト》\n");
4745+#else
4746+ fprintf(fff, "\n< Completed Quest >\n");
4747+#endif
4748+ total = 0;
4749+ for (i = 1; i < max_quests; i++)
4750+ {
4751+ /* No info from "silent" quests */
4752+ if (quest[i].flags & QUEST_FLAG_SILENT) continue;
4753+
4754+ if (quest[i].status == QUEST_STATUS_FINISHED)
46104755 {
4756+ int old_quest;
4757+
4758+ total++;
4759+
4760+ if (i < MIN_RANDOM_QUEST)
4761+ {
4762+ /* Set the quest number temporary */
4763+ old_quest = p_ptr->inside_quest;
4764+ p_ptr->inside_quest = i;
4765+
4766+ /* Get the quest */
4767+ init_flags = INIT_ASSIGN;
4768+
4769+ process_dungeon_file("q_info_j.txt", 0, 0, 0, 0);
4770+
4771+ /* Reset the old quest number */
4772+ p_ptr->inside_quest = old_quest;
4773+ }
4774+
4775+ if ((i >= MIN_RANDOM_QUEST) && quest[i].r_idx)
4776+ {
4777+ /* Print the quest info */
46114778 #ifdef JP
4612- sprintf(tmp_str, "クエスト達成 - まだ報酬を受けとってない。\n");
4779+ sprintf(tmp_str, "%s (%d階) - レベル%d\n",
46134780 #else
4614- sprintf(tmp_str, "Quest Completed - Unrewarded\n");
4781+ sprintf(tmp_str, "%s (Dungeon level: %d) - level %d\n",
46154782 #endif
46164783
4784+ r_name+r_info[quest[i].r_idx].name, quest[i].level, quest[i].complev);
4785+ }
4786+ else
4787+ {
4788+ /* Print the quest info */
4789+#ifdef JP
4790+ sprintf(tmp_str, "%s (危険度:%d階相当) - レベル%d\n",
4791+#else
4792+ sprintf(tmp_str, "%s (Danger level: %d) - level %d\n",
4793+#endif
46174794
4795+ quest[i].name, quest[i].level, quest[i].complev);
4796+ }
4797+
46184798 fprintf(fff, tmp_str);
46194799 }
46204800 }
4801+#ifdef JP
4802+ if (!total) fprintf(fff, "なし\n");
4803+#else
4804+ if (!total) fprintf(fff, "Nothing.\n");
4805+#endif
46214806
4622- /* Display Random Quest Info */
4623- if(p_ptr->inside_quest &&
4624- quest[p_ptr->inside_quest].type == QUEST_TYPE_RANDOM)
4807+#ifdef JP
4808+ fprintf(fff, "\n《失敗したクエスト》\n");
4809+#else
4810+ fprintf(fff, "\n< Failed Quest >\n");
4811+#endif
4812+ total = 0;
4813+ for (i = 1; i < max_quests; i++)
46254814 {
4626- quest_type *q_ptr = &quest[p_ptr->inside_quest];
4815+ /* No info from "silent" quests */
4816+ if (quest[i].flags & QUEST_FLAG_SILENT) continue;
46274817
4628- /* Print the quest info */
4629- r_ptr = &r_info[quest[p_ptr->inside_quest].r_idx];
4630- strcpy(name, r_name + r_ptr->name);
4818+ if ((quest[i].status == QUEST_STATUS_FAILED_DONE) || (quest[i].status == QUEST_STATUS_FAILED))
4819+ {
4820+ int old_quest;
46314821
4632- if (q_ptr->max_num > 1)
4633- {
4822+ total++;
4823+
4824+ if (i < MIN_RANDOM_QUEST)
4825+ {
4826+ /* Set the quest number temporary */
4827+ old_quest = p_ptr->inside_quest;
4828+ p_ptr->inside_quest = i;
4829+
4830+ /* Get the quest text */
4831+ init_flags = INIT_ASSIGN;
4832+
4833+ process_dungeon_file("q_info_j.txt", 0, 0, 0, 0);
4834+
4835+ /* Reset the old quest number */
4836+ p_ptr->inside_quest = old_quest;
4837+ }
4838+
4839+ if ((i >= MIN_RANDOM_QUEST) && quest[i].r_idx)
4840+ {
4841+ /* Print the quest info */
46344842 #ifdef JP
4635-sprintf(rand_tmp_str,"%s (%d 階) %d 体の%sを倒す。(あと %d 体)\n",
4636- q_ptr->name, q_ptr->level,
4637- q_ptr->max_num, name, q_ptr->max_num-q_ptr->cur_num);
4843+ sprintf(tmp_str, "%s (%d階) - レベル%d\n",
46384844 #else
4639- plural_aux(name);
4845+ sprintf(tmp_str, "%s (Dungeon level: %d) - level %d\n",
4846+#endif
46404847
4641- sprintf(rand_tmp_str,"%s (Dungeon level: %d)\n Kill %d %s, have killed %d.\n",
4642- q_ptr->name, q_ptr->level,
4643- q_ptr->max_num, name, q_ptr->cur_num);
4848+ r_name+r_info[quest[i].r_idx].name, quest[i].level, quest[i].complev);
4849+ }
4850+ else
4851+ {
4852+ /* Print the quest info */
4853+#ifdef JP
4854+ sprintf(tmp_str, "%s (危険度:%d階相当) - レベル%d\n",
4855+#else
4856+ sprintf(tmp_str, "%s (Danger level: %d) - level %d\n",
46444857 #endif
46454858
4859+ quest[i].name, quest[i].level, quest[i].complev);
4860+ }
4861+ fprintf(fff, tmp_str);
46464862 }
4647- else
4863+ }
4864+#ifdef JP
4865+ if (!total) fprintf(fff, "なし\n");
4866+#else
4867+ if (!total) fprintf(fff, "Nothing.\n");
4868+#endif
4869+
4870+ if (wizard) {
4871+#ifdef JP
4872+ fprintf(fff, "\n《残りのランダムクエスト》\n");
4873+#else
4874+ fprintf(fff, "\n< Remaining Random Quest >\n");
4875+#endif
4876+ total = 0;
4877+ for (i = 1; i < max_quests; i++)
4878+ {
4879+ /* No info from "silent" quests */
4880+ if (quest[i].flags & QUEST_FLAG_SILENT) continue;
4881+
4882+ if ((quest[i].type == QUEST_TYPE_RANDOM) && (quest[i].status == QUEST_STATUS_TAKEN))
46484883 {
4884+ total++;
4885+
4886+ /* Print the quest info */
46494887 #ifdef JP
4650-sprintf(rand_tmp_str,"%s (%d 階) %sを倒す。\n",
4888+ sprintf(tmp_str, "%s (%d階, %s)\n",
46514889 #else
4652- sprintf(rand_tmp_str,"%s (Dungeon level: %d)\n Kill %s.\n",
4890+ sprintf(tmp_str, "%s (%d, %s)\n",
46534891 #endif
46544892
4655- q_ptr->name, q_ptr->level, name);
4893+ quest[i].name, quest[i].level, r_name+r_info[quest[i].r_idx].name);
4894+ fprintf(fff, tmp_str);
46564895 }
46574896 }
4897+#ifdef JP
4898+ if (!total) fprintf(fff, "なし\n");
4899+#else
4900+ if (!total) fprintf(fff, "Nothing.\n");
4901+#endif
4902+ }
46584903
4659- /* Print the current random quest */
4660- fprintf(fff, rand_tmp_str);
4661-
46624904 /* Close the file */
46634905 my_fclose(fff);
46644906
--- XAngband/branches/branch-_nothere-questinfo/src/dungeon.c (revision 371)
+++ XAngband/branches/branch-_nothere-questinfo/src/dungeon.c (revision 372)
@@ -804,6 +804,24 @@
804804 }
805805
806806
807+void leave_quest_check(void)
808+{
809+ /* Save quset number for dungeon pref file ($LEAVING_QUEST) */
810+ leaving_quest = p_ptr->inside_quest;
811+
812+ /* Leaving an 'only once' quest marks it as failed */
813+ if (leaving_quest &&
814+ ((quest[leaving_quest].flags & QUEST_FLAG_ONCE) || (quest[leaving_quest].type == QUEST_TYPE_RANDOM)) &&
815+ (quest[leaving_quest].status == QUEST_STATUS_TAKEN))
816+ {
817+ quest[leaving_quest].status = QUEST_STATUS_FAILED;
818+ quest[leaving_quest].complev = (byte)p_ptr->lev;
819+ if (quest[leaving_quest].type == QUEST_TYPE_RANDOM)
820+ r_info[quest[leaving_quest].r_idx].flags1 &= ~(RF1_QUESTOR);
821+ }
822+}
823+
824+
807825 /*
808826 * Forcibly pseudo-identify an object in the inventory
809827 * (or on the floor)
@@ -2719,19 +2737,10 @@
27192737 msg_print("You feel yourself yanked upwards!");
27202738 #endif
27212739
2722-
27232740 dun_level = 0;
27242741
2725- leaving_quest = p_ptr->inside_quest;
2742+ leave_quest_check();
27262743
2727- /* Leaving an 'only once' quest marks it as failed */
2728- if (leaving_quest &&
2729- (quest[leaving_quest].flags & QUEST_FLAG_ONCE) &&
2730- (quest[leaving_quest].status == QUEST_STATUS_TAKEN))
2731- {
2732- quest[leaving_quest].status = QUEST_STATUS_FAILED;
2733- }
2734-
27352744 p_ptr->inside_quest = 0;
27362745 p_ptr->leaving = TRUE;
27372746 }
--- XAngband/branches/branch-_nothere-questinfo/src/xtra2.c (revision 371)
+++ XAngband/branches/branch-_nothere-questinfo/src/xtra2.c (revision 372)
@@ -527,6 +527,7 @@
527527 {
528528 /* completed quest */
529529 quest[i].status = QUEST_STATUS_COMPLETED;
530+ quest[i].complev = (byte)p_ptr->lev;
530531
531532 if (!(quest[i].flags & QUEST_FLAG_SILENT))
532533 {
@@ -564,6 +565,7 @@
564565 else
565566 {
566567 quest[i].status = QUEST_STATUS_COMPLETED;
568+ quest[i].complev = (byte)p_ptr->lev;
567569 #ifdef JP
568570 msg_print("クエストを達成した!");
569571 #else
@@ -587,6 +589,7 @@
587589 {
588590 /* completed quest */
589591 quest[i].status = QUEST_STATUS_COMPLETED;
592+ quest[i].complev = (byte)p_ptr->lev;
590593 if (!(quest[i].flags & QUEST_FLAG_PRESET))
591594 {
592595 p_ptr->inside_quest = 0;
@@ -641,6 +644,7 @@
641644 {
642645 /* completed quest */
643646 quest[i].status = QUEST_STATUS_COMPLETED;
647+ quest[i].complev = (byte)p_ptr->lev;
644648
645649 if (!(quest[i].flags & QUEST_FLAG_SILENT))
646650 {
--- XAngband/branches/branch-_nothere-questinfo/src/types.h (revision 371)
+++ XAngband/branches/branch-_nothere-questinfo/src/types.h (revision 372)
@@ -762,6 +762,8 @@
762762 s16b num_mon; /* number of monsters on level */
763763
764764 byte flags; /* quest flags */
765+
766+ byte complev; /* Player level (complete) */
765767 };
766768
767769
--- XAngband/branches/branch-_nothere-questinfo/src/load.c (revision 371)
+++ XAngband/branches/branch-_nothere-questinfo/src/load.c (revision 372)
@@ -70,51 +70,8 @@
7070 /*
7171 * This function determines if the version of the savefile
7272 * currently being read is older than version "x.y.z".
73+ * Adapted for Kantangband
7374 */
74-static bool older_than(byte x, byte y, byte z)
75-{
76- /* Much older, or much more recent */
77- if (sf_major < x) return (TRUE);
78- if (sf_major > x) return (FALSE);
79-
80- /* Distinctly older, or distinctly more recent */
81- if (sf_minor < y) return (TRUE);
82- if (sf_minor > y) return (FALSE);
83-
84- /* Barely older, or barely more recent */
85- if (sf_patch < z) return (TRUE);
86- if (sf_patch > z) return (FALSE);
87-
88- /* Identical versions */
89- return (FALSE);
90-}
91-
92-
93-/*
94- * The above function, adapted for Zangband
95- */
96-static bool z_older_than(byte x, byte y, byte z)
97-{
98- /* Much older, or much more recent */
99- if (z_major < x) return (TRUE);
100- if (z_major > x) return (FALSE);
101-
102- /* Distinctly older, or distinctly more recent */
103- if (z_minor < y) return (TRUE);
104- if (z_minor > y) return (FALSE);
105-
106- /* Barely older, or barely more recent */
107- if (z_patch < z) return (TRUE);
108- if (z_patch > z) return (FALSE);
109-
110- /* Identical versions */
111- return (FALSE);
112-}
113-
114-
115-/*
116- * The above function, adapted for Kantangband
117- */
11875 static bool k_older_than(byte x, byte y, byte z)
11976 {
12077 /* Much older, or much more recent */
@@ -313,18 +270,6 @@
313270
314271
315272 /*
316- * Owner Conversion -- pre-2.7.8 to 2.7.8
317- * Shop is column, Owner is Row, see "tables.c"
318- */
319-static byte convert_owner[24] =
320-{
321- 1, 3, 1, 0, 2, 3, 2, 0,
322- 0, 1, 3, 1, 0, 1, 1, 0,
323- 3, 2, 0, 2, 1, 2, 3, 0
324-};
325-
326-
327-/*
328273 * Old pre-2.7.4 inventory slot values
329274 */
330275 #define OLD_INVEN_WIELD 22
@@ -553,81 +498,35 @@
553498 /* Special pval */
554499 rd_s16b(&o_ptr->pval);
555500
556- /* Old method */
557- if (older_than(2, 7, 8))
558- {
559- rd_byte(&o_ptr->name1);
560- rd_byte(&o_ptr->name2);
561- rd_byte(&o_ptr->ident);
562- rd_byte(&o_ptr->number);
563- rd_s16b(&o_ptr->weight);
564- rd_s16b(&o_ptr->timeout);
501+ rd_byte(&o_ptr->discount);
502+ rd_byte(&o_ptr->number);
503+ rd_s16b(&o_ptr->weight);
565504
566- rd_s16b(&o_ptr->to_h);
567- rd_s16b(&o_ptr->to_d);
568- rd_s16b(&o_ptr->to_a);
505+ rd_byte(&o_ptr->name1);
506+ rd_byte(&o_ptr->name2);
507+ rd_s16b(&o_ptr->timeout);
569508
570- rd_s16b(&o_ptr->ac);
509+ rd_s16b(&o_ptr->to_h);
510+ rd_s16b(&o_ptr->to_d);
511+ rd_s16b(&o_ptr->to_a);
571512
572- rd_byte(&old_dd);
573- rd_byte(&old_ds);
513+ rd_s16b(&o_ptr->ac);
574514
575- strip_bytes(2);
515+ rd_byte(&old_dd);
516+ rd_byte(&old_ds);
576517
577- rd_s32b(&old_cost);
518+ rd_byte(&o_ptr->ident);
578519
579- strip_bytes(4);
580- }
520+ rd_byte(&o_ptr->marked);
581521
582- /* New method */
583- else
584- {
585- rd_byte(&o_ptr->discount);
586- rd_byte(&o_ptr->number);
587- rd_s16b(&o_ptr->weight);
588-
589- rd_byte(&o_ptr->name1);
590- rd_byte(&o_ptr->name2);
591- rd_s16b(&o_ptr->timeout);
592-
593- rd_s16b(&o_ptr->to_h);
594- rd_s16b(&o_ptr->to_d);
595- rd_s16b(&o_ptr->to_a);
596-
597- rd_s16b(&o_ptr->ac);
598-
599- rd_byte(&old_dd);
600- rd_byte(&old_ds);
601-
602- rd_byte(&o_ptr->ident);
603-
604- rd_byte(&o_ptr->marked);
605- }
606-
607-#if 0
608522 /* Old flags */
609- strip_bytes(12);
610-#else
611- /* Old flags */
612523 rd_u32b(&o_ptr->art_flags1);
613524 rd_u32b(&o_ptr->art_flags2);
614525 rd_u32b(&o_ptr->art_flags3);
615-#endif
616526
617- /* Old version */
618- if (older_than(2, 8, 0))
619- {
620- /* Old something */
621- strip_bytes(2);
622- }
527+ /* Monster holding object */
528+ rd_s16b(&o_ptr->held_m_idx);
623529
624- /* New version */
625- else
626- {
627- /* Monster holding object */
628- rd_s16b(&o_ptr->held_m_idx);
629- }
630-
631530 /* Special powers */
632531 rd_byte(&o_ptr->xtra1);
633532 rd_byte(&o_ptr->xtra2);
@@ -676,22 +575,11 @@
676575 }
677576
678577 /* The Python object */
679- if (!z_older_than(2, 2, 4))
680578 {
681579 s32b tmp32s;
682580
683581 rd_s32b(&tmp32s);
684-#ifdef USE_SCRIPT
685- if (tmp32s)
686- {
687- char *python_object = (char*) malloc(tmp32s + 1);
688- rd_string(python_object, tmp32s + 1);
689- o_ptr->python = object_load_callback(python_object);
690- free(python_object);
691- }
692-#else /* USE_SCRIPT */
693582 strip_bytes(tmp32s);
694-#endif /* USE_SCRIPT */
695583 }
696584
697585 /* Mega-Hack -- handle "dungeon objects" later */
@@ -704,28 +592,9 @@
704592 o_ptr->tval = k_ptr->tval;
705593 o_ptr->sval = k_ptr->sval;
706594
707- /* For rod-stacking */
708- if (z_older_than(2, 2, 5) && (o_ptr->tval == TV_ROD))
709- {
710- o_ptr->timeout = o_ptr->pval * o_ptr->number;
711- o_ptr->pval = k_ptr->pval * o_ptr->number;
712- }
713-
714595 /* Hack -- notice "broken" items */
715596 if (k_ptr->cost <= 0) o_ptr->ident |= (IDENT_BROKEN);
716597
717-
718- /* Hack -- the "gold" values changed in 2.7.8 */
719- if (older_than(2, 7, 8) && (o_ptr->tval == TV_GOLD))
720- {
721- /* Extract the value */
722- o_ptr->pval = (s16b)old_cost;
723-
724- /* Done */
725- return;
726- }
727-
728-
729598 /* Repair non "wearable" items */
730599 if (!wearable_p(o_ptr))
731600 {
@@ -749,133 +618,9 @@
749618 return;
750619 }
751620
752-
753621 /* Extract the flags */
754622 object_flags(o_ptr, &f1, &f2, &f3);
755623
756- /* The ego item indexes changed in 2.7.9 */
757- if (older_than(2, 7, 9) && o_ptr->name2)
758- {
759- /* Convert the ego-item names */
760- o_ptr->name2 = convert_ego_item[o_ptr->name2];
761-
762- /* Hack -- fix some "Ammo" */
763- if ((o_ptr->tval == TV_BOLT) ||
764- (o_ptr->tval == TV_ARROW) ||
765- (o_ptr->tval == TV_SHOT))
766- {
767- /* Special ego-item indexes */
768- if (o_ptr->name2 == EGO_BRAND_FIRE)
769- {
770- o_ptr->name2 = EGO_FLAME;
771- }
772- else if (o_ptr->name2 == EGO_SLAYING)
773- {
774- o_ptr->name2 = EGO_FROST;
775- }
776- else if (o_ptr->name2 == EGO_SLAY_ANIMAL)
777- {
778- o_ptr->name2 = EGO_HURT_ANIMAL;
779- }
780- else if (o_ptr->name2 == EGO_SLAY_EVIL)
781- {
782- o_ptr->name2 = EGO_HURT_EVIL;
783- }
784- else if (o_ptr->name2 == EGO_SLAY_DRAGON)
785- {
786- o_ptr->name2 = EGO_HURT_DRAGON;
787- }
788- }
789-
790- /* Hack -- fix some "Bows" */
791- if (o_ptr->tval == TV_BOW)
792- {
793- /* Special ego-item indexes */
794- if (o_ptr->name2 == EGO_MIGHT)
795- {
796- o_ptr->name2 = EGO_VELOCITY;
797- }
798- }
799-
800- /* Hack -- fix some "Robes" */
801- if (o_ptr->tval == TV_SOFT_ARMOR)
802- {
803- /* Special ego-item indexes */
804- if (o_ptr->name2 == EGO_MAGI)
805- {
806- o_ptr->name2 = EGO_PERMANENCE;
807- }
808- }
809-
810- /* Hack -- fix some "Boots" */
811- if (o_ptr->tval == TV_BOOTS)
812- {
813- /* Special ego-item indexes */
814- if (o_ptr->name2 == EGO_STEALTH)
815- {
816- o_ptr->name2 = EGO_QUIET;
817- }
818- else if (o_ptr->name2 == EGO_FREE_ACTION)
819- {
820- o_ptr->name2 = EGO_MOTION;
821- }
822- }
823-
824- /* Hack -- fix some "Shields" */
825- if (o_ptr->tval == TV_SHIELD)
826- {
827- /* Special ego-item indexes */
828- if (o_ptr->name2 == EGO_RESIST_ACID)
829- {
830- o_ptr->name2 = EGO_ENDURE_ACID;
831- }
832- else if (o_ptr->name2 == EGO_RESIST_ELEC)
833- {
834- o_ptr->name2 = EGO_ENDURE_ELEC;
835- }
836- else if (o_ptr->name2 == EGO_RESIST_FIRE)
837- {
838- o_ptr->name2 = EGO_ENDURE_FIRE;
839- }
840- else if (o_ptr->name2 == EGO_RESIST_COLD)
841- {
842- o_ptr->name2 = EGO_ENDURE_COLD;
843- }
844- else if (o_ptr->name2 == EGO_RESISTANCE)
845- {
846- o_ptr->name2 = EGO_ENDURANCE;
847- }
848- else if (o_ptr->name2 == EGO_ELVENKIND)
849- {
850- o_ptr->name2 = EGO_ENDURANCE;
851- }
852- }
853- }
854-
855- /*
856- * Hack - reduce number of attacks from old objects
857- * This changed with the addition of oangband combat.
858- */
859- if (z_older_than(2, 3, 4))
860- {
861- if ((f1 & (TR1_BLOWS)) && (o_ptr->pval > 2))
862- {
863- o_ptr->pval = 2;
864- }
865- }
866-
867- /* Hack -- the "searching" bonuses changed in 2.7.6 */
868- if (older_than(2, 7, 6))
869- {
870- /* Reduce the "pval" bonus on "search" */
871- if (f1 & (TR1_SEARCH))
872- {
873- /* Paranoia -- do not lose any search bonuses */
874- o_ptr->pval = (o_ptr->pval + 4) / 5;
875- }
876- }
877-
878-
879624 /* Paranoia */
880625 if (o_ptr->name1)
881626 {
@@ -912,7 +657,6 @@
912657 /* Hack -- extract the "broken" flag */
913658 if (!o_ptr->pval < 0) o_ptr->ident |= (IDENT_BROKEN);
914659
915-
916660 /* Artifacts */
917661 if (o_ptr->name1)
918662 {
@@ -934,13 +678,6 @@
934678
935679 /* Hack -- extract the "broken" flag */
936680 if (!a_ptr->cost) o_ptr->ident |= (IDENT_BROKEN);
937-
938- /* Hack -- assume "curse" */
939- if (older_than(2, 7, 9))
940- {
941- /* Hack -- assume cursed */
942- if (a_ptr->flags3 & (TR3_CURSED)) o_ptr->ident |= (IDENT_CURSED);
943- }
944681 }
945682
946683 /* Ego items */
@@ -957,13 +694,6 @@
957694
958695 /* Hack -- extract the "broken" flag */
959696 if (!e_ptr->cost) o_ptr->ident |= (IDENT_BROKEN);
960-
961- /* Hack -- assume "curse" */
962- if (older_than(2, 7, 9))
963- {
964- /* Hack -- assume cursed */
965- if (e_ptr->flags3 & (TR3_CURSED)) o_ptr->ident |= (IDENT_CURSED);
966- }
967697 }
968698
969699 if (o_ptr->art_name) /* A random artifact */
@@ -972,21 +702,6 @@
972702 o_ptr->ds = old_ds;
973703 }
974704
975- /* Hack -- assume "cursed" items */
976- if (older_than(2, 7, 9))
977- {
978- /* Hack -- assume cursed */
979- if (k_ptr->flags3 & (TR3_CURSED)) o_ptr->ident |= (IDENT_CURSED);
980-
981- /* Hack -- apply "uncursed" incription */
982-#ifdef JP
983-if (streq(buf, "呪いなし")) o_ptr->ident &= ~(IDENT_CURSED);
984-#else
985- if (streq(buf, "uncursed")) o_ptr->ident &= ~(IDENT_CURSED);
986-#endif
987-
988- }
989-
990705 /* Change shattered weapons from 0d0 to 1d1 */
991706 if (is_weapon(o_ptr))
992707 {
@@ -1059,70 +774,50 @@
1059774
1060775 monster_race *r_ptr = &r_info[r_idx];
1061776
777+ /* Count sights/deaths/kills */
778+ rd_s16b(&r_ptr->r_sights);
779+ rd_s16b(&r_ptr->r_deaths);
780+ rd_s16b(&r_ptr->r_pkills);
781+ rd_s16b(&r_ptr->r_tkills);
1062782
1063- /* Pre-2.7.7 */
1064- if (older_than(2, 7, 7))
1065- {
1066- /* Strip old flags */
1067- strip_bytes(38);
1068- }
783+ /* Count wakes and ignores */
784+ rd_byte(&r_ptr->r_wake);
785+ rd_byte(&r_ptr->r_ignore);
1069786
1070- /* Pre-2.2.0 (old r_info.txt) */
1071- else if (z_older_than(2, 2, 0))
1072- {
1073- /* Throw away old info */
1074- strip_bytes(48);
1075- }
787+ /* Extra stuff */
788+ rd_byte(&r_ptr->r_xtra1);
789+ rd_byte(&r_ptr->r_xtra2);
1076790
1077- /* Current */
1078- else
1079- {
1080- /* Count sights/deaths/kills */
1081- rd_s16b(&r_ptr->r_sights);
1082- rd_s16b(&r_ptr->r_deaths);
1083- rd_s16b(&r_ptr->r_pkills);
1084- rd_s16b(&r_ptr->r_tkills);
791+ /* Count drops */
792+ rd_byte(&r_ptr->r_drop_gold);
793+ rd_byte(&r_ptr->r_drop_item);
1085794
1086- /* Count wakes and ignores */
1087- rd_byte(&r_ptr->r_wake);
1088- rd_byte(&r_ptr->r_ignore);
795+ /* Count spells */
796+ rd_byte(&r_ptr->r_cast_inate);
797+ rd_byte(&r_ptr->r_cast_spell);
1089798
1090- /* Extra stuff */
1091- rd_byte(&r_ptr->r_xtra1);
1092- rd_byte(&r_ptr->r_xtra2);
799+ /* Count blows of each type */
800+ rd_byte(&r_ptr->r_blows[0]);
801+ rd_byte(&r_ptr->r_blows[1]);
802+ rd_byte(&r_ptr->r_blows[2]);
803+ rd_byte(&r_ptr->r_blows[3]);
1093804
1094- /* Count drops */
1095- rd_byte(&r_ptr->r_drop_gold);
1096- rd_byte(&r_ptr->r_drop_item);
805+ /* Memorize flags */
806+ rd_u32b(&r_ptr->r_flags1);
807+ rd_u32b(&r_ptr->r_flags2);
808+ rd_u32b(&r_ptr->r_flags3);
809+ rd_u32b(&r_ptr->r_flags4);
810+ rd_u32b(&r_ptr->r_flags5);
811+ rd_u32b(&r_ptr->r_flags6);
1097812
1098- /* Count spells */
1099- rd_byte(&r_ptr->r_cast_inate);
1100- rd_byte(&r_ptr->r_cast_spell);
813+ /* Read the "Racial" monster limit per level */
814+ rd_byte(&r_ptr->max_num);
1101815
1102- /* Count blows of each type */
1103- rd_byte(&r_ptr->r_blows[0]);
1104- rd_byte(&r_ptr->r_blows[1]);
1105- rd_byte(&r_ptr->r_blows[2]);
1106- rd_byte(&r_ptr->r_blows[3]);
816+ /* Later (?) */
817+ rd_byte(&tmp8u);
818+ rd_byte(&tmp8u);
819+ rd_byte(&tmp8u);
1107820
1108- /* Memorize flags */
1109- rd_u32b(&r_ptr->r_flags1);
1110- rd_u32b(&r_ptr->r_flags2);
1111- rd_u32b(&r_ptr->r_flags3);
1112- rd_u32b(&r_ptr->r_flags4);
1113- rd_u32b(&r_ptr->r_flags5);
1114- rd_u32b(&r_ptr->r_flags6);
1115-
1116-
1117- /* Read the "Racial" monster limit per level */
1118- rd_byte(&r_ptr->max_num);
1119-
1120- /* Later (?) */
1121- rd_byte(&tmp8u);
1122- rd_byte(&tmp8u);
1123- rd_byte(&tmp8u);
1124- }
1125-
1126821 /* Repair the lore flags */
1127822 r_ptr->r_flags1 &= r_ptr->flags1;
1128823 r_ptr->r_flags2 &= r_ptr->flags2;
@@ -1144,30 +839,19 @@
1144839
1145840 int j;
1146841
1147- byte own, num;
842+ byte num;
1148843
1149844 /* Read the basic info */
1150845 rd_s32b(&st_ptr->store_open);
1151846 rd_s16b(&st_ptr->insult_cur);
1152- rd_byte(&own);
847+ rd_byte(&st_ptr->owner);
1153848 rd_byte(&num);
1154849 rd_s16b(&st_ptr->good_buy);
1155850 rd_s16b(&st_ptr->bad_buy);
1156851
1157- if (!z_older_than(2, 1, 3))
1158- {
1159- /* Read last visit */
1160- rd_s32b(&st_ptr->last_visit);
1161- }
1162- else
1163- {
1164- /* Reset last visit to the current turn */
1165- st_ptr->last_visit = turn;
1166- }
852+ /* Read last visit */
853+ rd_s32b(&st_ptr->last_visit);
1167854
1168- /* Extract the owner (see above) */
1169- st_ptr->owner = (older_than(2, 7, 8) ? convert_owner[own] : own);
1170-
1171855 /* Read the items */
1172856 for (j = 0; j < num; j++)
1173857 {
@@ -1216,9 +900,6 @@
1216900
1217901 u16b tmp16u;
1218902
1219- /* Old version */
1220- if (older_than(2, 8, 0)) return;
1221-
1222903 /* Tmp */
1223904 rd_u16b(&tmp16u);
1224905
@@ -1291,22 +972,11 @@
1291972 cheat_know = (c & 0x1000) ? TRUE : FALSE;
1292973 cheat_live = (c & 0x2000) ? TRUE : FALSE;
1293974
1294- /* Pre-2.8.0 savefiles are done */
1295- if (older_than(2, 8, 0)) return;
975+ rd_byte(&autosave_l);
976+ rd_byte(&autosave_t);
977+ rd_s16b(&autosave_freq);
1296978
1297- if (z_older_than(2, 1, 0))
1298- {
1299- autosave_t = autosave_l = 0;
1300- autosave_freq = 0;
1301- }
1302- else
1303- {
1304- rd_byte(&autosave_l);
1305- rd_byte(&autosave_t);
1306- rd_s16b(&autosave_freq);
1307- }
1308979
1309-
1310980 /*** Normal Options ***/
1311981
1312982 /* Read the option flags */
@@ -1401,19 +1071,8 @@
14011071 /* Strip name */
14021072 rd_string(buf, 64);
14031073
1404- /* Older ghosts */
1405- if (older_than(2, 7, 7))
1406- {
1407- /* Strip old data */
1408- strip_bytes(52);
1409- }
1410-
1411- /* Newer ghosts */
1412- else
1413- {
1414- /* Strip old data */
1415- strip_bytes(60);
1416- }
1074+ /* Strip old data */
1075+ strip_bytes(60);
14171076 }
14181077
14191078
@@ -1469,75 +1128,31 @@
14691128
14701129 rd_s16b(&p_ptr->lev);
14711130
1472- /* Current version */
1473- if (!z_older_than(2, 1, 3))
1474- {
1475- rd_s16b(&p_ptr->town_num);
1131+ rd_s16b(&p_ptr->town_num);
14761132
1477- /* Read arena and rewards information */
1478- rd_s16b(&p_ptr->arena_number);
1479- rd_s16b(&p_ptr->inside_arena);
1480- rd_s16b(&p_ptr->inside_quest);
1481- rd_byte(&p_ptr->exit_bldg);
1482- rd_byte(&p_ptr->leftbldg);
1133+ /* Read arena and rewards information */
1134+ rd_s16b(&p_ptr->arena_number);
1135+ rd_s16b(&p_ptr->inside_arena);
1136+ rd_s16b(&p_ptr->inside_quest);
1137+ rd_byte(&p_ptr->exit_bldg);
1138+ rd_byte(&p_ptr->leftbldg);
14831139
1484- rd_s16b(&p_ptr->oldpx);
1485- rd_s16b(&p_ptr->oldpy);
1140+ rd_s16b(&p_ptr->oldpx);
1141+ rd_s16b(&p_ptr->oldpy);
14861142
1487- rd_s16b(&tmp16s);
1143+ rd_s16b(&tmp16s);
14881144
1489- if (tmp16s > MAX_BACT)
1490- {
1145+ if (tmp16s > MAX_BACT)
1146+ {
14911147 #ifdef JP
1492-note(format("の中", tmp16s));
1148+ note(format("の中", tmp16s));
14931149 #else
1494- note(format("Too many (%d) building rewards!", tmp16s));
1150+ note(format("Too many (%d) building rewards!", tmp16s));
14951151 #endif
1496-
1497- }
1498-
1499- for (i = 0; i < tmp16s; i++) rd_s16b(&p_ptr->rewards[i]);
15001152 }
1501- /* 2.1.2 beta version */
1502- else if (z_major == 2 && z_minor == 1 && z_patch == 2)
1503- {
1504- /* Town index */
1505- rd_s16b(&tmp16s);
1506- p_ptr->town_num = 1;
1507- p_ptr->oldpx = 0;
1508- p_ptr->oldpy = 0;
15091153
1510- /* read arena information and rewards -KMW- */
1511- rd_s16b(&p_ptr->arena_number);
1154+ for (i = 0; i < tmp16s; i++) rd_s16b(&p_ptr->rewards[i]) ;
15121155
1513- rd_s16b(&p_ptr->inside_arena);
1514- rd_s16b(&p_ptr->inside_quest);
1515- rd_byte(&p_ptr->exit_bldg);
1516- rd_byte(&p_ptr->leftbldg);
1517-
1518- /* Throw away old quest informations */
1519- for (i = 0; i < 100; i++) rd_s16b(&tmp16s);
1520- for (i = 0; i < 10; i++) rd_s16b(&tmp16s);
1521- for (i = 0; i < 10; i++) rd_s16b(&tmp16s);
1522- for (i = 0; i < 5; i++) rd_s16b(&tmp16s);
1523- for (i = 0; i < 5; i++) rd_s16b(&tmp16s);
1524- }
1525- else /* 2.1.0 or older */
1526- {
1527- p_ptr->town_num = 1;
1528- p_ptr->oldpx = 0;
1529- p_ptr->oldpy = 0;
1530-
1531- /* Initialize arena information -KMW- */
1532- p_ptr->arena_number = 0;
1533- p_ptr->inside_arena = 0;
1534- p_ptr->inside_quest = 0;
1535- p_ptr->leftbldg = TRUE;
1536- p_ptr->exit_bldg = TRUE;
1537-
1538- for (i = 0; i < MAX_BACT; ++i) p_ptr->rewards[i] = 0;
1539- }
1540-
15411156 rd_s16b(&p_ptr->mhp);
15421157 rd_s16b(&p_ptr->chp);
15431158 rd_u16b(&p_ptr->chp_frac);
@@ -1560,9 +1175,6 @@
15601175 rd_s16b(&p_ptr->sc);
15611176 strip_bytes(2);
15621177
1563- /* Ignore old redundant info */
1564- if (older_than(2, 7, 7)) strip_bytes(24);
1565-
15661178 /* Read the flags */
15671179 strip_bytes(2); /* Old "rest" */
15681180 rd_s16b(&p_ptr->blind);
@@ -1660,9 +1272,6 @@
16601272 /* Calc the regeneration modifier for mutations */
16611273 mutant_regenerate_mod = calc_mutant_regenerate_mod();
16621274
1663- /* Old redundant flags */
1664- if (older_than(2, 7, 7)) strip_bytes(34);
1665-
16661275 rd_byte(&p_ptr->confusing);
16671276 rd_byte(&tmp8u); /* oops */
16681277 rd_byte(&tmp8u); /* oops */
@@ -1759,9 +1368,6 @@
17591368 /* Hack -- verify item */
17601369 if (!q_ptr->k_idx) return (53);
17611370
1762- /* Hack -- convert old slot numbers */
1763- if (older_than(2, 7, 4)) n = convert_slot(n);
1764-
17651371 /* Wield equipment */
17661372 if (n >= INVEN_WIELD)
17671373 {
@@ -1930,133 +1536,43 @@
19301536 /* Special */
19311537 c_ptr->feat = 0;
19321538
1933- /* Old method */
1934- if (older_than(2, 7, 5))
1935- {
1936- /* Extract the old "info" flags */
1937- if ((tmp8u >> 4) & 0x1) c_ptr->info |= (CAVE_ROOM);
1938- if ((tmp8u >> 5) & 0x1) c_ptr->info |= (CAVE_MARK);
1939- if ((tmp8u >> 6) & 0x1) c_ptr->info |= (CAVE_GLOW);
1539+ /* The old "vault" flag */
1540+ if (tmp8u & (OLD_GRID_ICKY)) c_ptr->info |= (CAVE_ICKY);
19401541
1941- /* Hack -- process old style "light" */
1942- if (c_ptr->info & (CAVE_GLOW))
1943- {
1944- c_ptr->info |= (CAVE_MARK);
1945- }
1542+ /* The old "room" flag */
1543+ if (tmp8u & (OLD_GRID_ROOM)) c_ptr->info |= (CAVE_ROOM);
19461544
1947- /* Mega-Hack -- light all walls */
1948- else if ((tmp8u & 0x0F) >= 12)
1949- {
1950- c_ptr->info |= (CAVE_GLOW);
1951- }
1545+ /* The old "glow" flag */
1546+ if (tmp8u & (OLD_GRID_GLOW)) c_ptr->info |= (CAVE_GLOW);
19521547
1953- /* Process the "floor type" */
1954- switch (tmp8u & 0x0F)
1955- {
1956- /* Lite Room Floor */
1957- case 2:
1958- {
1959- c_ptr->info |= (CAVE_GLOW);
1960- }
1548+ /* The old "mark" flag */
1549+ if (tmp8u & (OLD_GRID_MARK)) c_ptr->info |= (CAVE_MARK);
19611550
1962- /* Dark Room Floor */
1963- case 1:
1964- {
1965- c_ptr->info |= (CAVE_ROOM);
1966- break;
1967- }
1551+ /* The old "wall" flags -- granite wall */
1552+ if ((tmp8u & (OLD_GRID_WALL_MASK)) ==
1553+ OLD_GRID_WALL_GRANITE)
1554+ {
1555+ /* Permanent wall (assume "solid") XXX XXX XXX */
1556+ if (tmp8u & (OLD_GRID_PERM)) c_ptr->feat = FEAT_PERM_SOLID;
19681557
1969- /* Lite Vault Floor */
1970- case 4:
1971- {
1972- c_ptr->info |= (CAVE_GLOW);
1973- }
1558+ /* Normal wall (assume "basic") XXX XXX XXX */
1559+ else c_ptr->feat = FEAT_WALL_EXTRA;
1560+ }
19741561
1975- /* Dark Vault Floor */
1976- case 3:
1977- {
1978- c_ptr->info |= (CAVE_ROOM);
1979- c_ptr->info |= (CAVE_ICKY);
1980- break;
1981- }
1982-
1983- /* Corridor Floor */
1984- case 5:
1985- {
1986- break;
1987- }
1988-
1989- /* Perma-wall (assume "solid") XXX XXX XXX */
1990- case 15:
1991- {
1992- c_ptr->feat = FEAT_PERM_SOLID;
1993- break;
1994- }
1995-
1996- /* Granite wall (assume "basic") XXX XXX XXX */
1997- case 12:
1998- {
1999- c_ptr->feat = FEAT_WALL_EXTRA;
2000- break;
2001- }
2002-
2003- /* Quartz vein */
2004- case 13:
2005- {
2006- c_ptr->feat = FEAT_QUARTZ;
2007- break;
2008- }
2009-
2010- /* Magma vein */
2011- case 14:
2012- {
2013- c_ptr->feat = FEAT_MAGMA;
2014- break;
2015- }
2016- }
1562+ /* The old "wall" flags -- quartz vein */
1563+ else if ((tmp8u & (OLD_GRID_WALL_MASK)) ==
1564+ OLD_GRID_WALL_QUARTZ)
1565+ {
1566+ /* Assume no treasure */
1567+ c_ptr->feat = FEAT_QUARTZ;
20171568 }
20181569
2019- /* Newer method */
2020- else
1570+ /* The old "wall" flags -- magma vein */
1571+ else if ((tmp8u & (OLD_GRID_WALL_MASK)) ==
1572+ OLD_GRID_WALL_MAGMA)
20211573 {
2022- /* The old "vault" flag */
2023- if (tmp8u & (OLD_GRID_ICKY)) c_ptr->info |= (CAVE_ICKY);
2024-
2025- /* The old "room" flag */
2026- if (tmp8u & (OLD_GRID_ROOM)) c_ptr->info |= (CAVE_ROOM);
2027-
2028- /* The old "glow" flag */
2029- if (tmp8u & (OLD_GRID_GLOW)) c_ptr->info |= (CAVE_GLOW);
2030-
2031- /* The old "mark" flag */
2032- if (tmp8u & (OLD_GRID_MARK)) c_ptr->info |= (CAVE_MARK);
2033-
2034- /* The old "wall" flags -- granite wall */
2035- if ((tmp8u & (OLD_GRID_WALL_MASK)) ==
2036- OLD_GRID_WALL_GRANITE)
2037- {
2038- /* Permanent wall (assume "solid") XXX XXX XXX */
2039- if (tmp8u & (OLD_GRID_PERM)) c_ptr->feat = FEAT_PERM_SOLID;
2040-
2041- /* Normal wall (assume "basic") XXX XXX XXX */
2042- else c_ptr->feat = FEAT_WALL_EXTRA;
2043- }
2044-
2045- /* The old "wall" flags -- quartz vein */
2046- else if ((tmp8u & (OLD_GRID_WALL_MASK)) ==
2047- OLD_GRID_WALL_QUARTZ)
2048- {
2049- /* Assume no treasure */
2050- c_ptr->feat = FEAT_QUARTZ;
2051- }
2052-
2053- /* The old "wall" flags -- magma vein */
2054- else if ((tmp8u & (OLD_GRID_WALL_MASK)) ==
2055- OLD_GRID_WALL_MAGMA)
2056- {
2057- /* Assume no treasure */
2058- c_ptr->feat = FEAT_MAGMA;
2059- }
1574+ /* Assume no treasure */
1575+ c_ptr->feat = FEAT_MAGMA;
20601576 }
20611577
20621578 /* Advance the cave pointers */
@@ -2452,10 +1968,6 @@
24521968 c_ptr->o_idx = o_idx;
24531969 }
24541970
2455-
2456- /* Extract index of first monster */
2457- start = (older_than(2, 7, 7) ? 2 : 1);
2458-
24591971 /* Read the monster count */
24601972 rd_u16b(&limit);
24611973
@@ -2472,7 +1984,7 @@
24721984 }
24731985
24741986 /* Read the monsters */
2475- for (i = start; i < limit; i++)
1987+ for (i = 1; i < limit; i++)
24761988 {
24771989 int m_idx;
24781990
@@ -2584,10 +2096,7 @@
25842096 base_level = dun_level;
25852097
25862098 /* Read the base level */
2587- if (!z_older_than(2, 2, 2))
2588- {
2589- rd_s16b(&base_level);
2590- }
2099+ rd_s16b(&base_level);
25912100
25922101 rd_s16b(&num_repro);
25932102 rd_s16b(&py);
@@ -2597,18 +2106,10 @@
25972106 rd_s16b(&tmp16s); /* max_panel_rows */
25982107 rd_s16b(&tmp16s); /* max_panel_cols */
25992108
2600- /* Old method */
2601- if (older_than(2, 8, 0))
2602- {
2603- return (rd_dungeon_aux());
2604- }
2605-
2606-
26072109 /* Maximal size */
26082110 ymax = cur_hgt;
26092111 xmax = cur_wid;
26102112
2611-
26122113 /*** Run length decoding ***/
26132114
26142115 /* Load the dungeon data */
@@ -2670,66 +2171,62 @@
26702171 }
26712172 }
26722173
2174+ /*** Run length decoding ***/
26732175
2674- if (!z_older_than(2, 1, 3))
2176+ /* Load the dungeon data */
2177+ for (x = y = 0; y < ymax; )
26752178 {
2676- /*** Run length decoding ***/
2179+ /* Grab RLE info */
2180+ rd_byte(&count);
2181+ rd_byte(&tmp8u);
26772182
2678- /* Load the dungeon data */
2679- for (x = y = 0; y < ymax; )
2183+ /* Apply the RLE info */
2184+ for (i = count; i > 0; i--)
26802185 {
2681- /* Grab RLE info */
2682- rd_byte(&count);
2683- rd_byte(&tmp8u);
2186+ /* Access the cave */
2187+ c_ptr = &cave[y][x];
26842188
2685- /* Apply the RLE info */
2686- for (i = count; i > 0; i--)
2189+ /* Extract "feat" */
2190+ c_ptr->mimic = tmp8u;
2191+
2192+ /* Advance/Wrap */
2193+ if (++x >= xmax)
26872194 {
2688- /* Access the cave */
2689- c_ptr = &cave[y][x];
2195+ /* Wrap */
2196+ x = 0;
26902197
2691- /* Extract "feat" */
2692- c_ptr->mimic = tmp8u;
2693-
26942198 /* Advance/Wrap */
2695- if (++x >= xmax)
2696- {
2697- /* Wrap */
2698- x = 0;
2699-
2700- /* Advance/Wrap */
2701- if (++y >= ymax) break;
2702- }
2199+ if (++y >= ymax) break;
27032200 }
27042201 }
2202+ }
27052203
2706- /*** Run length decoding ***/
2204+ /*** Run length decoding ***/
27072205
2708- /* Load the dungeon data */
2709- for (x = y = 0; y < ymax; )
2206+ /* Load the dungeon data */
2207+ for (x = y = 0; y < ymax; )
2208+ {
2209+ /* Grab RLE info */
2210+ rd_byte(&count);
2211+ rd_s16b(&tmp16s);
2212+
2213+ /* Apply the RLE info */
2214+ for (i = count; i > 0; i--)
27102215 {
2711- /* Grab RLE info */
2712- rd_byte(&count);
2713- rd_s16b(&tmp16s);
2216+ /* Access the cave */
2217+ c_ptr = &cave[y][x];
27142218
2715- /* Apply the RLE info */
2716- for (i = count; i > 0; i--)
2219+ /* Extract "feat" */
2220+ c_ptr->special = tmp16s;
2221+
2222+ /* Advance/Wrap */
2223+ if (++x >= xmax)
27172224 {
2718- /* Access the cave */
2719- c_ptr = &cave[y][x];
2225+ /* Wrap */
2226+ x = 0;
27202227
2721- /* Extract "feat" */
2722- c_ptr->special = tmp16s;
2723-
27242228 /* Advance/Wrap */
2725- if (++x >= xmax)
2726- {
2727- /* Wrap */
2728- x = 0;
2729-
2730- /* Advance/Wrap */
2731- if (++y >= ymax) break;
2732- }
2229+ if (++y >= ymax) break;
27332230 }
27342231 }
27352232 }
@@ -2880,8 +2377,8 @@
28802377
28812378 /*** Success ***/
28822379
2883- /* Regenerate the dungeon for old savefiles and corrupted panic-saves */
2884- if (z_older_than(2, 1, 3) || (py == 0) || (px == 0))
2380+ /* Regenerate the dungeon for corrupted panic-saves */
2381+ if ((py == 0) || (px == 0))
28852382 {
28862383 character_dungeon = FALSE;
28872384 }
@@ -2927,19 +2424,6 @@
29272424
29282425 k_major, k_minor, k_patch));
29292426
2930-
2931- /* Hack -- Warn about "obsolete" versions */
2932- if (older_than(2, 7, 4))
2933- {
2934-#ifdef JP
2935-note("警告 -- 旧式のセーブ・ファイルを変換しています。");
2936-#else
2937- note("Warning -- converting obsolete save file.");
2938-#endif
2939-
2940- }
2941-
2942-
29432427 /* Strip the version bytes */
29442428 strip_bytes(4);
29452429
@@ -2953,9 +2437,7 @@
29532437
29542438 #if SAVEFILE_VERSION
29552439 /* Read the version number of the savefile */
2956- if (!z_older_than(2, 2, 8) &&
2957- !(z_major == 2 && z_minor == 3 && z_patch == 0))
2958- rd_u32b(&sf_version);
2440+ rd_u32b(&sf_version);
29592441 #endif /* SAVEFILE_VERSION */
29602442
29612443 /* Operating system info */
@@ -2996,11 +2478,6 @@
29962478 if (arg_fiddle) note("Loaded Option Flags");
29972479 #endif
29982480
2999-
3000- /* Switch streams on for old savefiles */
3001- if (z_older_than(2, 2, 7))
3002- terrain_streams = TRUE;
3003-
30042481 /*
30052482 * Munchkin players are marked
30062483 *
@@ -3047,49 +2524,8 @@
30472524
30482525 /* Access that monster */
30492526 r_ptr = &r_info[i];
3050-
3051- /* XXX XXX Hack -- repair old savefiles */
3052- if (older_than(2, 7, 6))
3053- {
3054- /* Assume no kills */
3055- r_ptr->r_pkills = 0;
3056-
3057- /* Hack -- no previous lives */
3058- if (sf_lives == 0)
3059- {
3060- /* All kills by this life */
3061- r_ptr->r_pkills = r_ptr->r_tkills;
3062- }
3063-
3064- /* Hack -- handle uniques */
3065- if (r_ptr->flags1 & (RF1_UNIQUE))
3066- {
3067- /* Assume no kills */
3068- r_ptr->r_pkills = 0;
3069-
3070- /* Handle dead uniques */
3071- if (r_ptr->max_num == 0) r_ptr->r_pkills = 1;
3072- }
3073- }
30742527 }
30752528
3076- /* Pre 2.2.0 version (old r_info.txt) */
3077- if (z_older_than(2, 2, 0))
3078- {
3079- monster_race *r_ptr;
3080-
3081- for (i = 0; i < max_r_idx; i++)
3082- {
3083- /* Access that monster */
3084- r_ptr = &r_info[i];
3085-
3086- /* Hack -- Reset the death counter */
3087- r_ptr->max_num = 100;
3088- if (r_ptr->flags1 & RF1_UNIQUE) r_ptr->max_num = 1;
3089- if (r_ptr->flags3 & RF3_UNIQUE_7) r_ptr->max_num = 7;
3090- }
3091- }
3092-
30932529 #ifdef JP
30942530 if (arg_fiddle) note("モンスターの思い出をロードしました");
30952531 #else
@@ -3156,22 +2592,14 @@
31562592 }
31572593
31582594 /* 2.1.3 or newer version */
3159- if (!z_older_than(2, 1, 3))
31602595 {
31612596 u16b max_towns_load;
31622597 u16b max_quests_load;
2598+ byte max_rquests_load;
31632599
31642600 /* Number of towns */
31652601 rd_u16b(&max_towns_load);
31662602
3167- /* 2.2.2 or older version */
3168- if (z_older_than(2, 2, 3))
3169- {
3170- /* Ignore higher numbers of towns */
3171- if (max_towns_load > max_towns)
3172- max_towns_load = max_towns;
3173- }
3174-
31752603 /* Incompatible save files */
31762604 if (max_towns_load > max_towns)
31772605 {
@@ -3187,20 +2615,25 @@
31872615 /* Number of quests */
31882616 rd_u16b(&max_quests_load);
31892617
3190- /* 2.2.3 or newer version */
3191- if (!z_older_than(2, 2, 3))
2618+ if (k_older_than(0, 1, 5))
31922619 {
3193- /* Incompatible save files */
3194- if (max_quests_load > max_quests)
3195- {
2620+ max_rquests_load = 10;
2621+ }
2622+ else
2623+ {
2624+ rd_byte(&max_rquests_load);
2625+ }
2626+
2627+ /* Incompatible save files */
2628+ if (max_quests_load > max_quests)
2629+ {
31962630 #ifdef JP
3197-note(format("クエストが多すぎる(%u)!", max_quests_load));
2631+ note(format("クエストが多すぎる(%u)!", max_quests_load));
31982632 #else
3199- note(format("Too many (%u) quests!", max_quests_load));
2633+ note(format("Too many (%u) quests!", max_quests_load));
32002634 #endif
32012635
3202- return (23);
3203- }
2636+ return (23);
32042637 }
32052638
32062639 for (i = 0; i < max_quests_load; i++)
@@ -3208,49 +2641,69 @@
32082641 if (i < max_quests)
32092642 {
32102643 rd_s16b(&quest[i].status);
2644+ rd_s16b(&quest[i].level);
32112645
3212- if (!z_older_than(2, 2, 0))
2646+ if (k_older_than(0, 1, 5))
32132647 {
3214- rd_s16b(&quest[i].level);
2648+ quest[i].complev = 0;
32152649 }
2650+ else
2651+ {
2652+ rd_byte(&quest[i].complev);
2653+ }
32162654
32172655 /* Load quest status if quest is running */
3218- if (quest[i].status == QUEST_STATUS_TAKEN)
2656+ if (quest[i].status == QUEST_STATUS_TAKEN
2657+ || (quest[i].status == QUEST_STATUS_COMPLETED)
2658+ || (!k_older_than(0, 1, 5) && (i >= MIN_RANDOM_QUEST) && (i <= (MIN_RANDOM_QUEST + max_rquests_load))))
32192659 {
32202660 rd_s16b(&quest[i].cur_num);
32212661 rd_s16b(&quest[i].max_num);
32222662 rd_s16b(&quest[i].type);
32232663
3224- if (z_older_than(2, 2, 0))
3225- {
3226- strip_bytes(2);
3227- }
3228-
32292664 /* Load quest monster index */
32302665 rd_s16b(&quest[i].r_idx);
32312666
3232- /* Load quest item index */
3233- if (!z_older_than(2, 2, 1))
2667+ if ((quest[i].type == QUEST_TYPE_RANDOM) && (!quest[i].r_idx))
32342668 {
3235- rd_s16b(&quest[i].k_idx);
2669+ int r_idx;
2670+ while (1)
2671+ {
2672+ monster_race *r_ptr;
32362673
3237- if (quest[i].k_idx)
3238- a_info[quest[i].k_idx].flags3 |= TR3_QUESTITEM;
2674+ /*
2675+ * Random monster 5 - 10 levels out of depth
2676+ * (depending on level)
2677+ */
2678+ r_idx = get_mon_num(quest[i].level + 5 + randint1(quest[i].level / 10));
2679+ r_ptr = &r_info[r_idx];
2680+
2681+ if(!(r_ptr->flags1 & RF1_UNIQUE)) continue;
2682+
2683+ if (r_ptr->flags1 & RF1_QUESTOR) continue;
2684+
2685+ /*
2686+ * Accept monsters that are 2 - 6 levels
2687+ * out of depth depending on the quest level
2688+ */
2689+ if (r_ptr->level > (quest[i].level + (quest[i].level / 20))) break;
2690+ }
2691+
2692+ quest[i].r_idx = r_idx;
32392693 }
32402694
2695+ /* Load quest item index */
2696+ rd_s16b(&quest[i].k_idx);
2697+
2698+ if (quest[i].k_idx)
2699+ a_info[quest[i].k_idx].flags3 |= TR3_QUESTITEM;
2700+
32412701 /* Load quest flags */
3242- if (!z_older_than(2, 2, 3))
3243- {
3244- rd_byte(&quest[i].flags);
3245- }
2702+ rd_byte(&quest[i].flags);
32462703
3247- if (z_older_than(2, 2, 0))
3248- {
3249- strip_bytes(40);
3250- }
3251-
32522704 /* Mark uniques */
3253- if (r_info[quest[i].r_idx].flags1 & RF1_UNIQUE)
2705+ if (quest[i].status == QUEST_STATUS_TAKEN || quest[i].status == QUEST_STATUS_UNTAKEN)
2706+ if (r_info[quest[i].r_idx].flags1 & RF1_UNIQUE)
32542707 r_info[quest[i].r_idx].flags1 |= RF1_QUESTOR;
32552708 }
32562709 }
@@ -3261,10 +2714,7 @@
32612714 strip_bytes(2);
32622715
32632716 /* Ignore quest level */
3264- if (!z_older_than(2, 2, 0))
3265- {
3266- strip_bytes(2);
3267- }
2717+ strip_bytes(2);
32682718
32692719 /*
32702720 * We don't have to care about the other info,
@@ -3273,33 +2723,6 @@
32732723 }
32742724 }
32752725
3276-#if 0
3277- /* Only in 2.2.1 and 2.2.2 */
3278- if (!z_older_than(2, 2, 1) && z_older_than(2, 2, 3))
3279- {
3280- /* "Hard quests" flag */
3281- rd_byte(&ironman_hard_quests);
3282-
3283- /****** HACK ******/
3284- if (ironman_hard_quests)
3285- {
3286- /* Set the option by hand */
3287- option_flag[6] |= (1L << 6);
3288- }
3289-
3290- /* Inverted "Wilderness" flag */
3291- rd_byte(&lite_town);
3292- lite_town = !lite_town;
3293-
3294- /****** HACK ******/
3295- if (lite_town)
3296- {
3297- /* Set the option by hand */
3298- option_flag[6] |= (1L << 1);
3299- }
3300- }
3301-#endif
3302-
33032726 /* Position in the wilderness */
33042727 rd_s32b(&p_ptr->wilderness_x);
33052728 rd_s32b(&p_ptr->wilderness_y);
@@ -3329,373 +2752,13 @@
33292752 }
33302753 }
33312754 }
3332- /* rr9: Load old savegame without the quest infos */
3333- else if (z_older_than(2, 1, 1))
3334- {
3335- /* Load the number of quests */
3336- rd_u16b(&tmp16u);
33372755
3338- /* Ignore all infos */
3339- for (i = 0; i < tmp16u; i++)
3340- {
3341- strip_bytes(4);
3342- }
3343- }
3344- /* rr9: Load 2.1.1 savegame quest infos */
3345- else if (z_older_than(2, 1, 2))
3346- {
3347- /* Load the number of quests */
3348- rd_u16b(&tmp16u);
3349-
3350- j = tmp16u;
3351-
3352- /* Ignore the quests */
3353- for (i = 0; i < j; i++)
3354- {
3355- strip_bytes(5);
3356- }
3357- }
3358- /* 2.1.2 beta version */
3359- else if (z_older_than(2, 1, 3))
3360- {
3361- /* Load the number of quests */
3362- rd_u16b(&tmp16u);
3363-
3364- /* Incompatible save files */
3365- if (tmp16u > 20)
3366- {
33672756 #ifdef JP
3368-note(format("クエストが多すぎる(%u)!", tmp16u));
3369-#else
3370- note(format("Too many (%u) quests!", tmp16u));
3371-#endif
3372-
3373- return (23);
3374- }
3375-
3376- /* Load the quest information */
3377- for (i = 0; i < tmp16u; i++)
3378- {
3379- /* Throw it away */
3380- strip_bytes(14);
3381- }
3382- }
3383-
3384- /*
3385- * Select the number of random quests
3386- * when importing old savefiles.
3387- */
3388- if (z_older_than(2, 2, 0))
3389- {
3390- char inp[80];
3391- int i, v;
3392-
3393- /* Wipe the quests */
3394- for (i = 0; i < max_quests; i++)
3395- {
3396- quest[i].status = QUEST_STATUS_UNTAKEN;
3397-
3398- quest[i].cur_num = 0;
3399- quest[i].max_num = 0;
3400- quest[i].type = 0;
3401- quest[i].level = 0;
3402- quest[i].r_idx = 0;
3403- }
3404-
3405- /* Clean up */
3406- clear_from(10);
3407-
3408- /*** User enters number of quests ***/
3409- /* Heino Vander Sanden and Jimmy De Laet */
3410-
3411- /* Extra info */
3412- Term_putstr(5, 15, -1, TERM_WHITE,
3413-#ifdef JP
3414-"必須のクエスト(オベロン及び混沌の邪龍)に加えて、追加のクエストの");
3415-#else
3416- "You can input yourself the number of quest you'd like to");
3417-#endif
3418-
3419- Term_putstr(5, 16, -1, TERM_WHITE,
3420-#ifdef JP
3421-"数を設定することが出来ます。");
3422-#else
3423- "perform next to two obligatory ones ( Oberon and the Serpent of Chaos )");
3424-#endif
3425-
3426- Term_putstr(5, 17, -1, TERM_WHITE,
3427-#ifdef JP
3428-"追加クエストを行ないたくない場合は '0'を入力して下さい。");
3429-#else
3430- "In case you do not want any additional quest, just enter 0");
3431-#endif
3432-
3433-
3434- /* Ask the number of additional quests */
3435- while (TRUE)
3436- {
3437-#ifdef JP
3438-put_str(format("追加クエストの数 (%u以下) ", MAX_RANDOM_QUEST - MIN_RANDOM_QUEST + 2), 20, 2);
3439-#else
3440- put_str(format("Number of additional quest? (<%u) ", MAX_RANDOM_QUEST - MIN_RANDOM_QUEST + 2), 20, 2);
3441-#endif
3442-
3443-
3444- /* Get a the number of additional quest */
3445- while (TRUE)
3446- {
3447- /* Move the cursor */
3448- put_str("", 20, 37);
3449-
3450- /* Default */
3451- strcpy(inp, "20");
3452-
3453- /* Get a response (or escape) */
3454- if (!askfor_aux(inp, 2)) inp[0] = '\0';
3455- v = atoi(inp);
3456-
3457- /* Break on valid input */
3458- if ((v <= MAX_RANDOM_QUEST - MIN_RANDOM_QUEST + 1) && (v >= 0)) break;
3459- }
3460- break;
3461- }
3462-
3463- /* Clear */
3464- clear_from(15);
3465-
3466- /* Init the random quests */
3467- init_flags = INIT_ASSIGN;
3468- p_ptr->inside_quest = MIN_RANDOM_QUEST;
3469-#ifdef JP
3470- process_dungeon_file("q_info_j.txt", 0, 0, 0, 0);
3471-#else
3472- process_dungeon_file("q_info.txt", 0, 0, 0, 0);
3473-#endif
3474-
3475- p_ptr->inside_quest = 0;
3476-
3477- /* Prepare allocation table */
3478- get_mon_num_prep(monster_quest, NULL);
3479-
3480- /* Generate quests */
3481- for (i = MIN_RANDOM_QUEST + v - 1; i >= MIN_RANDOM_QUEST; i--)
3482- {
3483- quest_type *q_ptr = &quest[i];
3484- monster_race *r_ptr = NULL;
3485-
3486- q_ptr->status = QUEST_STATUS_TAKEN;
3487-
3488- for (j = 0; j < MAX_TRIES; j++)
3489- {
3490- /* Random monster 5 - 10 levels out of depth */
3491- q_ptr->r_idx = get_mon_num(q_ptr->level + 4 + randint(6));
3492-
3493- r_ptr = &r_info[q_ptr->r_idx];
3494-
3495- /* Accept only monsters that are out of depth */
3496- if (r_ptr->level > q_ptr->level) break;
3497- }
3498-
3499- /* Get the number of monsters */
3500- if (r_ptr->flags1 & RF1_UNIQUE)
3501- {
3502- /* Mark uniques */
3503- r_ptr->flags1 |= RF1_QUESTOR;
3504-
3505- q_ptr->max_num = 1;
3506- }
3507- else
3508- {
3509- q_ptr->max_num = 5 + (s16b)rand_int(q_ptr->level/3 + 5);
3510- }
3511- }
3512-
3513- /* Init the two main quests (Oberon + Serpent) */
3514- init_flags = INIT_ASSIGN;
3515- p_ptr->inside_quest = QUEST_OBERON;
3516-#ifdef JP
3517- process_dungeon_file("q_info_j.txt", 0, 0, 0, 0);
3518-#else
3519- process_dungeon_file("q_info.txt", 0, 0, 0, 0);
3520-#endif
3521-
3522- quest[QUEST_OBERON].status = QUEST_STATUS_TAKEN;
3523-
3524- p_ptr->inside_quest = QUEST_SERPENT;
3525-#ifdef JP
3526- process_dungeon_file("q_info_j.txt", 0, 0, 0, 0);
3527-#else
3528- process_dungeon_file("q_info.txt", 0, 0, 0, 0);
3529-#endif
3530-
3531- quest[QUEST_SERPENT].status = QUEST_STATUS_TAKEN;
3532- p_ptr->inside_quest = 0;
3533- }
3534-
3535-#if 0
3536- /*
3537- * Select 'hard random quests mode'
3538- * when importing old savefiles.
3539- */
3540- if (z_older_than(2, 2, 1))
3541- {
3542- char c;
3543-
3544- /* Clear */
3545- clear_from(15);
3546-
3547- /*** Hard quests mode ***/
3548-
3549- /* Extra info */
3550- Term_putstr(5, 14, -1, TERM_WHITE,
3551-#ifdef JP
3552-"「ハード・クエスト」をオンにすると、追加クエストは難易度が");
3553-#else
3554- "Using 'hard quests' mode makes the random quests harder, because");
3555-#endif
3556-
3557- Term_putstr(5, 15, -1, TERM_WHITE,
3558-#ifdef JP
3559-"上がります。全てのモンスターを他の階に行くことなく一度に倒さねば");
3560-#else
3561- "you have to kill all monsters at the same visit to the quest level.");
3562-#endif
3563-
3564- Term_putstr(5, 16, -1, TERM_WHITE,
3565-#ifdef JP
3566-"ならないからです。全てのモンスターを倒さずにその階を一度離れて");
3567-#else
3568- "If you leave the level while some quest monsters are still alive,");
3569-#endif
3570-
3571- Term_putstr(5, 17, -1, TERM_WHITE,
3572-#ifdef JP
3573-"から戻ってくると、倒したモンスターはすべて復活します。");
3574-#else
3575- "then all killed quest monsters are revived on your next visit");
3576-#endif
3577-
3578- Term_putstr(5, 18, -1, TERM_WHITE,
3579-#ifdef JP
3580-"");
3581-#else
3582- "to this level.");
3583-#endif
3584-
3585-
3586- /* Ask about "hard quests" mode */
3587- while (1)
3588- {
3589-#ifdef JP
3590-put_str("「ハード・クエスト」をオンにしますか?(y/n/*)", 20, 2);
3591-#else
3592- put_str("Use 'Hard quests'? (y/n/*) ", 20, 2);
3593-#endif
3594-
3595- c = inkey();
3596- if (c == 'Q') quit(NULL);
3597- if (c == 'S') return (FALSE);
3598- if (c == '*')
3599- {
3600- c = 'y';
3601- if (randint(2) == 1)
3602- c = 'n';
3603- break;
3604- }
3605- if (c == ESCAPE) break;
3606- if ((c == 'y') || (c == 'n')) break;
3607- if (c == '?') do_cmd_help();
3608- else bell();
3609- }
3610-
3611- /* Set "hard quests" mode */
3612- ironman_hard_quests = (c == 'y');
3613-
3614- /* Clear */
3615- clear_from(15);
3616- }
3617-#endif
3618-
3619-#ifdef JP
36202757 if (arg_fiddle) note("クエスト情報をロードしました");
36212758 #else
36222759 if (arg_fiddle) note("Loaded Quests");
36232760 #endif
36242761
3625-
3626- /* A version without the wilderness */
3627- if (z_older_than(2, 1, 2))
3628- {
3629- char c;
3630-
3631- /* Clear */
3632- clear_from(14);
3633-
3634- /*** Wilderness mode ***/
3635-
3636- /* Extra info */
3637- Term_putstr(5, 14, -1, TERM_WHITE,
3638-#ifdef JP
3639-"「荒野」モードでは、Zangband で追加された街の外の荒野といくつかの");
3640-#else
3641- "'Wilderness' mode enables the extended wilderness of ZAngband");
3642-#endif
3643-
3644- Term_putstr(5, 15, -1, TERM_WHITE,
3645-#ifdef JP
3646-"新しい街を探索することができます。「荒野」モードは若干重いので、");
3647-#else
3648- "giving you a wilderness and several new towns to explore.");
3649-#endif
3650-
3651- Term_putstr(5, 16, -1, TERM_WHITE,
3652-#ifdef JP
3653-"コンピューターのパワーがない場合は使用しないことを");
3654-#else
3655- "Switching off 'wilderness' mode is recommended for slower computers,");
3656-#endif
3657-
3658- Term_putstr(5, 17, -1, TERM_WHITE,
3659-#ifdef JP
3660-"お勧めします。");
3661-#else
3662- "because the wilderness slows down the system a bit.");
3663-#endif
3664-
3665-
3666- /* Ask about "wilderness" mode */
3667- while (1)
3668- {
3669-#ifdef JP
3670-put_str("「荒野」を使用しますか?(y/n/*)", 20, 2);
3671-#else
3672- put_str("Use 'wilderness'? (y/n/*) ", 20, 2);
3673-#endif
3674-
3675- c = inkey();
3676- if (c == 'Q') quit(NULL);
3677- if (c == 'S') return (FALSE);
3678- if (c == '*')
3679- {
3680- c = 'y';
3681- if (randint(2) == 1)
3682- c = 'n';
3683- break;
3684- }
3685- if (c == ESCAPE) break;
3686- if ((c == 'y') || (c == 'n')) break;
3687- if (c == '?') do_cmd_help();
3688- else bell();
3689- }
3690-
3691- /* Set "wilderness" mode */
3692- lite_town = (c == 'y');
3693-
3694- /* Clear */
3695- clear_from(14);
3696- }
3697-
3698-
36992762 /* Load the Artifacts */
37002763 rd_u16b(&tmp16u);
37012764
@@ -3798,52 +2861,19 @@
37982861 }
37992862
38002863 /* Read number of towns */
3801- if (!z_older_than(2, 1, 3))
3802- {
3803- rd_u16b(&tmp16u);
3804- town_count = tmp16u;
3805- }
3806- else
3807- {
3808- /* Only one town */
3809- town_count = 2;
3810- }
2864+ rd_u16b(&tmp16u);
2865+ town_count = tmp16u;
38112866
38122867 /* Read the stores */
38132868 rd_u16b(&tmp16u);
38142869 for (i = 1; i < town_count; i++)
38152870 {
3816- /* HACK - ignore the empty towns */
3817- if (z_older_than(2, 2, 3) && (i >= 6))
2871+ for (j = 0; j < tmp16u; j++)
38182872 {
3819- for (j = 0; j < tmp16u; j++)
3820- {
3821- /* Read the info into the empty town 5 (R'Lyeh) */
3822- if (rd_store(5, j)) return (22);
3823- }
2873+ if (rd_store(i, j)) return (22);
38242874 }
3825- else
3826- {
3827- for (j = 0; j < tmp16u; j++)
3828- {
3829- if (rd_store(i, j)) return (22);
3830- }
3831- }
38322875 }
38332876
3834-#if 0
3835- if (z_older_than(2, 1, 0))
3836- {
3837-#ifdef JP
3838-msg_print("フレーバー再配置中...");
3839-#else
3840- msg_print("Reallocating flavours...");
3841-#endif
3842-
3843- flavor_init();
3844- }
3845-#endif
3846-
38472877 /* Read the pet command settings */
38482878 if (sf_version > 2)
38492879 {
@@ -3851,7 +2881,7 @@
38512881 rd_byte(&p_ptr->pet_open_doors);
38522882 rd_byte(&p_ptr->pet_pickup_items);
38532883 }
3854- else if (!z_older_than(2, 2, 3))
2884+ else
38552885 {
38562886 rd_byte(&tmp8u);
38572887
@@ -3860,13 +2890,6 @@
38602890 rd_byte(&p_ptr->pet_open_doors);
38612891 rd_byte(&p_ptr->pet_pickup_items);
38622892 }
3863- else
3864- {
3865- /* Default pet command settings */
3866- p_ptr->pet_follow_distance = PET_FOLLOW_DIST;
3867- p_ptr->pet_open_doors = FALSE;
3868- p_ptr->pet_pickup_items = FALSE;
3869- }
38702893
38712894 /* I'm not dead yet... */
38722895 if (!death)
@@ -3892,22 +2915,11 @@
38922915 /* Read the ghost info */
38932916 rd_ghost();
38942917
3895- if (!z_older_than(2, 2, 4))
38962918 {
38972919 s32b tmp32s;
38982920
38992921 rd_s32b(&tmp32s);
3900-#ifdef USE_SCRIPT
3901- if (tmp32s)
3902- {
3903- char *callbacks = (char*) malloc(tmp32s + 1);
3904- rd_string(callbacks, tmp32s + 1);
3905- callbacks_load_callback(callbacks);
3906- free(callbacks);
3907- }
3908-#else /* USE_SCRIPT */
39092922 strip_bytes(tmp32s);
3910-#endif /* USE_SCRIPT */
39112923 }
39122924 }
39132925
--- XAngband/branches/branch-_nothere-questinfo/src/defines.h (revision 371)
+++ XAngband/branches/branch-_nothere-questinfo/src/defines.h (revision 372)
@@ -57,7 +57,7 @@
5757 #define FAKE_VERSION 0
5858 #define FAKE_VER_MAJOR 0
5959 #define FAKE_VER_MINOR 1
60-#define FAKE_VER_PATCH 4
60+#define FAKE_VER_PATCH 5
6161 #endif /* USE_SCRIPT */
6262
6363 #define ANGBAND_2_8_1
--- XAngband/branches/branch-_nothere-questinfo/src/cmd1.c (revision 371)
+++ XAngband/branches/branch-_nothere-questinfo/src/cmd1.c (revision 372)
@@ -808,8 +808,9 @@
808808 (quest[i].k_idx == o_ptr->name1))
809809 {
810810 quest[i].status = QUEST_STATUS_COMPLETED;
811+ quest[i].complev = (byte)p_ptr->lev;
811812 #ifdef JP
812- msg_print("クエストを達成した!");
813+ msg_print("クエストを達成した!");
813814 #else
814815 msg_print("You completed your quest!");
815816 #endif
@@ -4299,6 +4300,7 @@
42994300 if (quest[p_ptr->inside_quest].type == QUEST_TYPE_FIND_EXIT)
43004301 {
43014302 quest[p_ptr->inside_quest].status = QUEST_STATUS_COMPLETED;
4303+ quest[p_ptr->inside_quest].complev = (byte)p_ptr->lev;
43024304 #ifdef JP
43034305 msg_print("クエストを達成した!");
43044306 #else
@@ -4308,16 +4310,8 @@
43084310 msg_print(NULL);
43094311 }
43104312
4311- leaving_quest = p_ptr->inside_quest;
4313+ leave_quest_check();
43124314
4313- /* Leaving an 'only once' quest marks it as failed */
4314- if (leaving_quest &&
4315- (quest[leaving_quest].flags & QUEST_FLAG_ONCE) &&
4316- (quest[leaving_quest].status == QUEST_STATUS_TAKEN))
4317- {
4318- quest[leaving_quest].status = QUEST_STATUS_FAILED;
4319- }
4320-
43214315 p_ptr->inside_quest = cave[y][x].special;
43224316 dun_level = 0;
43234317 p_ptr->oldpx = 0;
--- XAngband/branches/branch-_nothere-questinfo/src/cmd3.c (revision 371)
+++ XAngband/branches/branch-_nothere-questinfo/src/cmd3.c (revision 372)
@@ -302,6 +302,7 @@
302302 (quest[i].k_idx == o_ptr->name1))
303303 {
304304 quest[i].status = QUEST_STATUS_COMPLETED;
305+ quest[i].complev = (byte)p_ptr->lev;
305306 #ifdef JP
306307 msg_print("クエストを達成した!");
307308 #else
--- XAngband/branches/branch-_nothere-questinfo/src/save.c (revision 371)
+++ XAngband/branches/branch-_nothere-questinfo/src/save.c (revision 372)
@@ -1447,6 +1447,10 @@
14471447 tmp16u = max_quests;
14481448 wr_u16b(tmp16u);
14491449
1450+ /* Dump the quests */
1451+ tmp8u = MAX_RANDOM_QUEST - MIN_RANDOM_QUEST;
1452+ wr_byte(tmp8u);
1453+
14501454 for (i = 0; i < max_quests; i++)
14511455 {
14521456 /* Save status for every quest */
@@ -1456,8 +1460,10 @@
14561460 /* (prevents problems with multi-level quests) */
14571461 wr_s16b(quest[i].level);
14581462
1463+ wr_byte(quest[i].complev);
1464+
14591465 /* Save quest status if quest is running */
1460- if (quest[i].status == QUEST_STATUS_TAKEN)
1466+ if (quest[i].status == QUEST_STATUS_TAKEN || quest[i].status == QUEST_STATUS_COMPLETED || ((i >= MIN_RANDOM_QUEST) && (i <= MAX_RANDOM_QUEST)))
14611467 {
14621468 wr_s16b(quest[i].cur_num);
14631469 wr_s16b(quest[i].max_num);
--- XAngband/branches/branch-_nothere-questinfo/src/bldg.c (revision 371)
+++ XAngband/branches/branch-_nothere-questinfo/src/bldg.c (revision 372)
@@ -2998,18 +2998,10 @@
29982998 p_ptr->oldpy = 0;
29992999 p_ptr->oldpx = 0;
30003000
3001- leaving_quest = p_ptr->inside_quest;
3001+ leave_quest_check();
30023002
3003- /* Leaving an 'only once' quest marks it as failed */
3004- if (leaving_quest &&
3005- (quest[leaving_quest].flags & QUEST_FLAG_ONCE) &&
3006- (quest[leaving_quest].status == QUEST_STATUS_TAKEN))
3007- {
3008- quest[leaving_quest].status = QUEST_STATUS_FAILED;
3009- }
3010-
30113003 p_ptr->inside_quest = cave[py][px].special;
3012- dun_level = 1;
3004+ if(quest[leaving_quest].type != QUEST_TYPE_RANDOM) dun_level = 1;
30133005 p_ptr->leftbldg = TRUE;
30143006 p_ptr->leaving = TRUE;
30153007 }
--- XAngband/branches/branch-_nothere-questinfo/src/externs.h (revision 371)
+++ XAngband/branches/branch-_nothere-questinfo/src/externs.h (revision 372)
@@ -696,6 +696,7 @@
696696 extern void do_cmd_use(void);
697697
698698 /* dungeon.c */
699+extern void leave_quest_check(void);
699700 extern void play_game(bool new_game);
700701 extern bool psychometry(void);
701702 extern void leave_level(int level);
旧リポジトリブラウザで表示