3 * @brief ¥²¡¼¥à¥Ç¡¼¥¿½é´ü²½2 / Initialization (part 2) -BEN-
7 * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
8 * This software may be copied and distributed for educational, research,
9 * and not for profit purposes provided that this copyright and statement
10 * are included in all such copies. Other copyrights may also apply.
11 * 2014 Deskull rearranged comment for Doxygen.\n
15 * This file is used to initialize various variables and arrays for the
16 * Angband game. Note the use of "fd_read()" and "fd_write()" to bypass
17 * the common limitation of "read()" and "write()" to only 32767 bytes
19 * Several of the arrays for Angband are built from "template" files in
20 * the "lib/file" directory, from which quick-load binary "image" files
21 * are constructed whenever they are not present in the "lib/data"
22 * directory, or if those files become obsolete, if we are allowed.
23 * Warning -- the "ascii" file parsers use a minor hack to collect the
24 * name and text information in a single pass. Thus, the game will not
25 * be able to load any template file with more than 20K of names or 60K
26 * of text, even though technically, up to 64K should be legal.
27 * The "init1.c" file is used only to parse the ascii template files,
28 * to create the binary image files. If you include the binary image
29 * files instead of the ascii template files, then you can undefine
30 * "ALLOW_TEMPLATES", saving about 20K by removing "init1.c". Note
31 * that the binary image files are extremely system dependant.
40 #ifdef CHECK_MODIFICATION_TIME
41 #include <sys/types.h>
43 #endif /* CHECK_MODIFICATION_TIME */
50 * @brief ³Æ¥Ç¡¼¥¿¥Õ¥¡¥¤¥ë¤òÆɤ߼è¤ë¤¿¤á¤Î¥Ñ¥¹¤ò¼èÆÀ¤¹¤ë
51 * Find the default paths to all of our important sub-directories.
52 * @param path ¥Ñ¥¹ÊÝ´ÉÀè¤Îʸ»úÎó
56 * The purpose of each sub-directory is described in "variable.c".
57 * All of the sub-directories should, by default, be located inside
58 * the main "lib" directory, whose location is very system dependant.
59 * This function takes a writable buffer, initially containing the
60 * "path" to the "lib" directory, for example, "/pkg/lib/angband/",
61 * or a system dependant string, for example, ":lib:". The buffer
62 * must be large enough to contain at least 32 more characters.
63 * Various command line options may allow some of the important
64 * directories to be changed to user-specified directories, most
65 * importantly, the "info" and "user" and "save" directories,
66 * but this is done after this function, see "main.c".
67 * In general, the initial path should end in the appropriate "PATH_SEP"
68 * string. All of the "sub-directory" paths (created below or supplied
69 * by the user) will NOT end in the "PATH_SEP" string, see the special
70 * "path_build()" function in "util.c" for more information.
71 * Mega-Hack -- support fat raw files under NEXTSTEP, using special
72 * "suffixed" directories for the "ANGBAND_DIR_DATA" directory, but
73 * requiring the directories to be created by hand by the user.
74 * Hack -- first we free all the strings, since this is known
75 * to succeed even if the strings have not been allocated yet,
76 * as long as the variables start out as "NULL". This allows
77 * this function to be called multiple times, for example, to
78 * try several base "path" values until a good one is found.
81 void init_file_paths(char *path)
85 #ifdef PRIVATE_USER_PATH
87 #endif /* PRIVATE_USER_PATH */
89 /*** Free everything ***/
91 /* Free the main path */
92 string_free(ANGBAND_DIR);
94 /* Free the sub-paths */
95 string_free(ANGBAND_DIR_APEX);
96 string_free(ANGBAND_DIR_BONE);
97 string_free(ANGBAND_DIR_DATA);
98 string_free(ANGBAND_DIR_EDIT);
99 string_free(ANGBAND_DIR_SCRIPT);
100 string_free(ANGBAND_DIR_FILE);
101 string_free(ANGBAND_DIR_HELP);
102 string_free(ANGBAND_DIR_INFO);
103 string_free(ANGBAND_DIR_SAVE);
104 string_free(ANGBAND_DIR_USER);
105 string_free(ANGBAND_DIR_XTRA);
108 /*** Prepare the "path" ***/
110 /* Hack -- save the main directory */
111 ANGBAND_DIR = string_make(path);
113 /* Prepare to append to the Base Path */
114 tail = path + strlen(path);
119 /*** Use "flat" paths with VM/ESA ***/
121 /* Use "blank" path names */
122 ANGBAND_DIR_APEX = string_make("");
123 ANGBAND_DIR_BONE = string_make("");
124 ANGBAND_DIR_DATA = string_make("");
125 ANGBAND_DIR_EDIT = string_make("");
126 ANGBAND_DIR_SCRIPT = string_make("");
127 ANGBAND_DIR_FILE = string_make("");
128 ANGBAND_DIR_HELP = string_make("");
129 ANGBAND_DIR_INFO = string_make("");
130 ANGBAND_DIR_SAVE = string_make("");
131 ANGBAND_DIR_USER = string_make("");
132 ANGBAND_DIR_XTRA = string_make("");
138 /*** Build the sub-directory names ***/
140 /* Build a path name */
141 strcpy(tail, "apex");
142 ANGBAND_DIR_APEX = string_make(path);
144 /* Build a path name */
145 strcpy(tail, "bone");
146 ANGBAND_DIR_BONE = string_make(path);
148 /* Build a path name */
149 strcpy(tail, "data");
150 ANGBAND_DIR_DATA = string_make(path);
152 /* Build a path name */
153 strcpy(tail, "edit");
154 ANGBAND_DIR_EDIT = string_make(path);
156 /* Build a path name */
157 strcpy(tail, "script");
158 ANGBAND_DIR_SCRIPT = string_make(path);
160 /* Build a path name */
161 strcpy(tail, "file");
162 ANGBAND_DIR_FILE = string_make(path);
164 /* Build a path name */
165 strcpy(tail, "help");
166 ANGBAND_DIR_HELP = string_make(path);
168 /* Build a path name */
169 strcpy(tail, "info");
170 ANGBAND_DIR_INFO = string_make(path);
172 /* Build a path name */
173 strcpy(tail, "pref");
174 ANGBAND_DIR_PREF = string_make(path);
176 /* Build a path name */
177 strcpy(tail, "save");
178 ANGBAND_DIR_SAVE = string_make(path);
180 #ifdef PRIVATE_USER_PATH
182 /* Build the path to the user specific directory */
183 path_build(buf, sizeof(buf), PRIVATE_USER_PATH, VERSION_NAME);
185 /* Build a relative path name */
186 ANGBAND_DIR_USER = string_make(buf);
188 #else /* PRIVATE_USER_PATH */
190 /* Build a path name */
191 strcpy(tail, "user");
192 ANGBAND_DIR_USER = string_make(path);
194 #endif /* PRIVATE_USER_PATH */
196 /* Build a path name */
197 strcpy(tail, "xtra");
198 ANGBAND_DIR_XTRA = string_make(path);
205 /* Allow "fat binary" usage with NeXT */
226 /* Use special directory */
229 /* Forget the old path name */
230 string_free(ANGBAND_DIR_DATA);
232 /* Build a new path name */
233 sprintf(tail, "data-%s", next);
234 ANGBAND_DIR_DATA = string_make(path);
244 #ifdef ALLOW_TEMPLATES
248 * Hack -- help give useful error messages
255 * Standard error message text
257 cptr err_str[PARSE_ERROR_MAX] =
265 "¤ª¤«¤·¤Ê¥Õ¥é¥°Â¸ºß",
274 "missing record header",
275 "non-sequential records",
276 "invalid flag specification",
277 "undefined directive",
279 "coordinates out of bounds",
281 "undefined terrain tag",
287 #endif /* ALLOW_TEMPLATES */
303 #ifdef CHECK_MODIFICATION_TIME
306 * @brief ¥Æ¥¥¹¥È¥Õ¥¡¥¤¥ë¤Èraw¥Õ¥¡¥¤¥ë¤Î¹¹¿·»þ¹ï¤òÈæ³Ó¤¹¤ë
307 * Find the default paths to all of our important sub-directories.
308 * @param fd ¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿
309 * @param template_file ¥Õ¥¡¥¤¥ë̾
310 * @return ¥Æ¥¥¹¥È¤ÎÊý¤¬¿·¤·¤¤¤«¡¢raw¥Õ¥¡¥¤¥ë¤¬¤Ê¤¯¹¹¿·¤ÎɬÍפ¬¤¢¤ë¾ì¹ç-1¡¢¹¹¿·¤ÎɬÍפ¬¤Ê¤¤¾ì¹ç0¡£
312 static errr check_modification_date(int fd, cptr template_file)
316 struct stat txt_stat, raw_stat;
318 /* Build the filename */
319 path_build(buf, sizeof(buf), ANGBAND_DIR_EDIT, template_file);
321 /* Access stats on text file */
322 if (stat(buf, &txt_stat))
324 /* No text file - continue */
327 /* Access stats on raw file */
328 else if (fstat(fd, &raw_stat))
334 /* Ensure text file is not newer than raw file */
335 else if (txt_stat.st_mtime > raw_stat.st_mtime)
337 /* Reprocess text file */
344 #endif /* CHECK_MODIFICATION_TIME */
348 /*** Initialize from binary image files ***/
352 * Initialize the "*_info" array, by parsing a binary "image" file
354 static errr init_info_raw(int fd, header *head)
358 /* Read and Verify the header */
359 if (fd_read(fd, (char*)(&test), sizeof(header)) ||
360 (test.v_major != head->v_major) ||
361 (test.v_minor != head->v_minor) ||
362 (test.v_patch != head->v_patch) ||
363 (test.info_num != head->info_num) ||
364 (test.info_len != head->info_len) ||
365 (test.head_size != head->head_size) ||
366 (test.info_size != head->info_size))
373 /* Accept the header */
377 /* Allocate the "*_info" array */
378 C_MAKE(head->info_ptr, head->info_size, char);
380 /* Read the "*_info" array */
381 fd_read(fd, head->info_ptr, head->info_size);
386 /* Allocate the "*_name" array */
387 C_MAKE(head->name_ptr, head->name_size, char);
389 /* Read the "*_name" array */
390 fd_read(fd, head->name_ptr, head->name_size);
396 /* Allocate the "*_text" array */
397 C_MAKE(head->text_ptr, head->text_size, char);
399 /* Read the "*_text" array */
400 fd_read(fd, head->text_ptr, head->text_size);
406 /* Allocate the "*_tag" array */
407 C_MAKE(head->tag_ptr, head->tag_size, char);
409 /* Read the "*_tag" array */
410 fd_read(fd, head->tag_ptr, head->tag_size);
421 * Initialize the header of an *_info.raw file.
423 static void init_header(header *head, int num, int len)
425 /* Save the "version" */
426 head->v_major = FAKE_VER_MAJOR;
427 head->v_minor = FAKE_VER_MINOR;
428 head->v_patch = FAKE_VER_PATCH;
431 /* Save the "record" information */
432 head->info_num = num;
433 head->info_len = len;
435 /* Save the size of "*_head" and "*_info" */
436 head->head_size = sizeof(header);
437 head->info_size = head->info_num * head->info_len;
442 * Initialize the "*_info" array
444 * Note that we let each entry have a unique "name" and "text" string,
445 * even if the string happens to be empty (everyone has a unique '\0').
447 static errr init_info(cptr filename, header *head,
448 void **info, char **name, char **text, char **tag)
462 #ifdef ALLOW_TEMPLATES
464 /*** Load the binary image file ***/
466 /* Build the filename */
468 path_build(buf, sizeof(buf), ANGBAND_DIR_DATA, format("%s_j.raw", filename));
470 path_build(buf, sizeof(buf), ANGBAND_DIR_DATA, format("%s.raw", filename));
474 /* Attempt to open the "raw" file */
475 fd = fd_open(buf, O_RDONLY);
477 /* Process existing "raw" file */
480 #ifdef CHECK_MODIFICATION_TIME
482 err = check_modification_date(fd, format("%s.txt", filename));
484 #endif /* CHECK_MODIFICATION_TIME */
486 /* Attempt to parse the "raw" file */
488 err = init_info_raw(fd, head);
495 /* Do we have to parse the *.txt file? */
498 /*** Make the fake arrays ***/
500 /* Allocate the "*_info" array */
501 C_MAKE(head->info_ptr, head->info_size, char);
503 /* Hack -- make "fake" arrays */
504 if (name) C_MAKE(head->name_ptr, FAKE_NAME_SIZE, char);
505 if (text) C_MAKE(head->text_ptr, FAKE_TEXT_SIZE, char);
506 if (tag) C_MAKE(head->tag_ptr, FAKE_TAG_SIZE, char);
508 if (info) (*info) = head->info_ptr;
509 if (name) (*name) = head->name_ptr;
510 if (text) (*text) = head->text_ptr;
511 if (tag) (*tag) = head->tag_ptr;
513 /*** Load the ascii template file ***/
515 /* Build the filename */
517 path_build(buf, sizeof(buf), ANGBAND_DIR_EDIT, format("%s.txt", filename));
520 fp = my_fopen(buf, "r");
524 if (!fp) quit(format("'%s.txt'¥Õ¥¡¥¤¥ë¤ò¥ª¡¼¥×¥ó¤Ç¤¤Þ¤»¤ó¡£", filename));
526 if (!fp) quit(format("Cannot open '%s.txt' file.", filename));
531 err = init_info_txt(fp, buf, head, head->parse_info_txt);
543 oops = (((err > 0) && (err < PARSE_ERROR_MAX)) ? err_str[err] : "̤ÃΤÎ");
546 msg_format("'%s.txt'¥Õ¥¡¥¤¥ë¤Î %d ¹ÔÌܤ˥¨¥é¡¼¡£", filename, error_line);
547 msg_format("¥ì¥³¡¼¥É %d ¤Ï '%s' ¥¨¥é¡¼¤¬¤¢¤ê¤Þ¤¹¡£", error_idx, oops);
548 msg_format("¹½Ê¸ '%s'¡£", buf);
552 quit(format("'%s.txt'¥Õ¥¡¥¤¥ë¤Ë¥¨¥é¡¼", filename));
555 oops = (((err > 0) && (err < PARSE_ERROR_MAX)) ? err_str[err] : "unknown");
558 msg_format("Error %d at line %d of '%s.txt'.", err, error_line, filename);
559 msg_format("Record %d contains a '%s' error.", error_idx, oops);
560 msg_format("Parsing '%s'.", buf);
564 quit(format("Error in '%s.txt' file.", filename));
570 /*** Make final retouch on fake tags ***/
574 (*head->retouch)(head);
578 /*** Dump the binary image file ***/
580 /* File type is "DATA" */
581 FILE_TYPE(FILE_TYPE_DATA);
583 /* Build the filename */
585 path_build(buf, sizeof(buf), ANGBAND_DIR_DATA, format("%s_j.raw", filename));
587 path_build(buf, sizeof(buf), ANGBAND_DIR_DATA, format("%s.raw", filename));
591 /* Grab permissions */
594 /* Kill the old file */
597 /* Attempt to create the raw file */
598 fd = fd_make(buf, mode);
600 /* Drop permissions */
603 /* Dump to the file */
607 fd_write(fd, (cptr)(head), head->head_size);
609 /* Dump the "*_info" array */
610 fd_write(fd, head->info_ptr, head->info_size);
612 /* Dump the "*_name" array */
613 fd_write(fd, head->name_ptr, head->name_size);
615 /* Dump the "*_text" array */
616 fd_write(fd, head->text_ptr, head->text_size);
618 /* Dump the "*_tag" array */
619 fd_write(fd, head->tag_ptr, head->tag_size);
626 /*** Kill the fake arrays ***/
628 /* Free the "*_info" array */
629 C_KILL(head->info_ptr, head->info_size, char);
631 /* Hack -- Free the "fake" arrays */
632 if (name) C_KILL(head->name_ptr, FAKE_NAME_SIZE, char);
633 if (text) C_KILL(head->text_ptr, FAKE_TEXT_SIZE, char);
634 if (tag) C_KILL(head->tag_ptr, FAKE_TAG_SIZE, char);
636 #endif /* ALLOW_TEMPLATES */
639 /*** Load the binary image file ***/
641 /* Build the filename */
643 path_build(buf, sizeof(buf), ANGBAND_DIR_DATA, format("%s_j.raw", filename));
645 path_build(buf, sizeof(buf), ANGBAND_DIR_DATA, format("%s.raw", filename));
649 /* Attempt to open the "raw" file */
650 fd = fd_open(buf, O_RDONLY);
652 /* Process existing "raw" file */
654 if (fd < 0) quit(format("'%s_j.raw'¥Õ¥¡¥¤¥ë¤ò¥í¡¼¥É¤Ç¤¤Þ¤»¤ó¡£", filename));
656 if (fd < 0) quit(format("Cannot load '%s.raw' file.", filename));
660 /* Attempt to parse the "raw" file */
661 err = init_info_raw(fd, head);
668 if (err) quit(format("'%s_j.raw'¥Õ¥¡¥¤¥ë¤ò²òÀϤǤ¤Þ¤»¤ó¡£", filename));
670 if (err) quit(format("Cannot parse '%s.raw' file.", filename));
673 #ifdef ALLOW_TEMPLATES
677 if (info) (*info) = head->info_ptr;
678 if (name) (*name) = head->name_ptr;
679 if (text) (*text) = head->text_ptr;
680 if (tag) (*tag) = head->tag_ptr;
688 * Initialize the "f_info" array
690 static errr init_f_info(void)
692 /* Init the header */
693 init_header(&f_head, max_f_idx, sizeof(feature_type));
695 #ifdef ALLOW_TEMPLATES
697 /* Save a pointer to the parsing function */
698 f_head.parse_info_txt = parse_f_info;
700 /* Save a pointer to the retouch fake tags */
701 f_head.retouch = retouch_f_info;
703 #endif /* ALLOW_TEMPLATES */
705 return init_info("f_info", &f_head,
706 (void*)&f_info, &f_name, NULL, &f_tag);
711 * Initialize the "k_info" array
713 static errr init_k_info(void)
715 /* Init the header */
716 init_header(&k_head, max_k_idx, sizeof(object_kind));
718 #ifdef ALLOW_TEMPLATES
720 /* Save a pointer to the parsing function */
721 k_head.parse_info_txt = parse_k_info;
723 #endif /* ALLOW_TEMPLATES */
725 return init_info("k_info", &k_head,
726 (void*)&k_info, &k_name, &k_text, NULL);
732 * Initialize the "a_info" array
734 static errr init_a_info(void)
736 /* Init the header */
737 init_header(&a_head, max_a_idx, sizeof(artifact_type));
739 #ifdef ALLOW_TEMPLATES
741 /* Save a pointer to the parsing function */
742 a_head.parse_info_txt = parse_a_info;
744 #endif /* ALLOW_TEMPLATES */
746 return init_info("a_info", &a_head,
747 (void*)&a_info, &a_name, &a_text, NULL);
753 * Initialize the "e_info" array
755 static errr init_e_info(void)
757 /* Init the header */
758 init_header(&e_head, max_e_idx, sizeof(ego_item_type));
760 #ifdef ALLOW_TEMPLATES
762 /* Save a pointer to the parsing function */
763 e_head.parse_info_txt = parse_e_info;
765 #endif /* ALLOW_TEMPLATES */
767 return init_info("e_info", &e_head,
768 (void*)&e_info, &e_name, &e_text, NULL);
774 * Initialize the "r_info" array
776 static errr init_r_info(void)
778 /* Init the header */
779 init_header(&r_head, max_r_idx, sizeof(monster_race));
781 #ifdef ALLOW_TEMPLATES
783 /* Save a pointer to the parsing function */
784 r_head.parse_info_txt = parse_r_info;
786 #endif /* ALLOW_TEMPLATES */
788 return init_info("r_info", &r_head,
789 (void*)&r_info, &r_name, &r_text, NULL);
795 * Initialize the "d_info" array
797 static errr init_d_info(void)
799 /* Init the header */
800 init_header(&d_head, max_d_idx, sizeof(dungeon_info_type));
802 #ifdef ALLOW_TEMPLATES
804 /* Save a pointer to the parsing function */
805 d_head.parse_info_txt = parse_d_info;
807 #endif /* ALLOW_TEMPLATES */
809 return init_info("d_info", &d_head,
810 (void*)&d_info, &d_name, &d_text, NULL);
815 * Initialize the "v_info" array
817 * Note that we let each entry have a unique "name" and "text" string,
818 * even if the string happens to be empty (everyone has a unique '\0').
820 errr init_v_info(void)
822 /* Init the header */
823 init_header(&v_head, max_v_idx, sizeof(vault_type));
825 #ifdef ALLOW_TEMPLATES
827 /* Save a pointer to the parsing function */
828 v_head.parse_info_txt = parse_v_info;
830 #endif /* ALLOW_TEMPLATES */
832 return init_info("v_info", &v_head,
833 (void*)&v_info, &v_name, &v_text, NULL);
838 * Initialize the "s_info" array
840 static errr init_s_info(void)
842 /* Init the header */
843 init_header(&s_head, MAX_CLASS, sizeof(skill_table));
845 #ifdef ALLOW_TEMPLATES
847 /* Save a pointer to the parsing function */
848 s_head.parse_info_txt = parse_s_info;
850 #endif /* ALLOW_TEMPLATES */
852 return init_info("s_info", &s_head,
853 (void*)&s_info, NULL, NULL, NULL);
858 * Initialize the "m_info" array
860 static errr init_m_info(void)
862 /* Init the header */
863 init_header(&m_head, MAX_CLASS, sizeof(player_magic));
865 #ifdef ALLOW_TEMPLATES
867 /* Save a pointer to the parsing function */
868 m_head.parse_info_txt = parse_m_info;
870 #endif /* ALLOW_TEMPLATES */
872 return init_info("m_info", &m_head,
873 (void*)&m_info, NULL, NULL, NULL);
878 /*** Initialize others ***/
881 * Hack -- Objects sold in the stores -- by tval/sval pair.
883 static byte store_table[MAX_STORES][STORE_CHOICES][2] =
888 { TV_FOOD, SV_FOOD_RATION },
889 { TV_FOOD, SV_FOOD_RATION },
890 { TV_FOOD, SV_FOOD_RATION },
891 { TV_FOOD, SV_FOOD_RATION },
893 { TV_FOOD, SV_FOOD_RATION },
894 { TV_FOOD, SV_FOOD_BISCUIT },
895 { TV_FOOD, SV_FOOD_JERKY },
896 { TV_FOOD, SV_FOOD_JERKY },
898 { TV_FOOD, SV_FOOD_PINT_OF_WINE },
899 { TV_FOOD, SV_FOOD_PINT_OF_ALE },
900 { TV_LITE, SV_LITE_TORCH },
901 { TV_LITE, SV_LITE_TORCH },
903 { TV_LITE, SV_LITE_TORCH },
904 { TV_LITE, SV_LITE_TORCH },
905 { TV_LITE, SV_LITE_LANTERN },
906 { TV_LITE, SV_LITE_LANTERN },
918 { TV_SHOT, SV_AMMO_NORMAL },
919 { TV_ARROW, SV_AMMO_NORMAL },
920 { TV_BOLT, SV_AMMO_NORMAL },
921 { TV_DIGGING, SV_SHOVEL },
923 { TV_DIGGING, SV_PICK },
924 { TV_CLOAK, SV_CLOAK },
925 { TV_CLOAK, SV_CLOAK },
926 { TV_CLOAK, SV_FUR_CLOAK },
928 { TV_FOOD, SV_FOOD_RATION },
929 { TV_FOOD, SV_FOOD_RATION },
930 { TV_FOOD, SV_FOOD_RATION },
931 { TV_FOOD, SV_FOOD_RATION },
933 { TV_POTION, SV_POTION_WATER },
934 { TV_POTION, SV_POTION_WATER },
935 { TV_LITE, SV_LITE_LANTERN },
936 { TV_LITE, SV_LITE_LANTERN },
938 { TV_FOOD, SV_FOOD_WAYBREAD },
939 { TV_FOOD, SV_FOOD_WAYBREAD },
943 { TV_SHOT, SV_AMMO_NORMAL },
944 { TV_ARROW, SV_AMMO_NORMAL },
945 { TV_BOLT, SV_AMMO_NORMAL },
946 { TV_DIGGING, SV_SHOVEL }
952 { TV_BOOTS, SV_PAIR_OF_SOFT_LEATHER_BOOTS },
953 { TV_BOOTS, SV_PAIR_OF_SOFT_LEATHER_BOOTS },
954 { TV_BOOTS, SV_PAIR_OF_HARD_LEATHER_BOOTS },
955 { TV_BOOTS, SV_PAIR_OF_HARD_LEATHER_BOOTS },
957 { TV_HELM, SV_HARD_LEATHER_CAP },
958 { TV_HELM, SV_HARD_LEATHER_CAP },
959 { TV_HELM, SV_METAL_CAP },
960 { TV_HELM, SV_IRON_HELM },
962 { TV_SOFT_ARMOR, SV_ROBE },
963 { TV_SOFT_ARMOR, SV_ROBE },
964 { TV_SOFT_ARMOR, SV_SOFT_LEATHER_ARMOR },
965 { TV_SOFT_ARMOR, SV_SOFT_LEATHER_ARMOR },
967 { TV_SOFT_ARMOR, SV_HARD_LEATHER_ARMOR },
968 { TV_SOFT_ARMOR, SV_HARD_LEATHER_ARMOR },
969 { TV_SOFT_ARMOR, SV_HARD_STUDDED_LEATHER },
970 { TV_SOFT_ARMOR, SV_HARD_STUDDED_LEATHER },
972 { TV_SOFT_ARMOR, SV_RHINO_HIDE_ARMOR },
973 { TV_SOFT_ARMOR, SV_LEATHER_SCALE_MAIL },
974 { TV_HARD_ARMOR, SV_METAL_SCALE_MAIL },
975 { TV_HARD_ARMOR, SV_CHAIN_MAIL },
977 { TV_HARD_ARMOR, SV_DOUBLE_RING_MAIL },
978 { TV_HARD_ARMOR, SV_AUGMENTED_CHAIN_MAIL },
979 { TV_HARD_ARMOR, SV_BAR_CHAIN_MAIL },
980 { TV_HARD_ARMOR, SV_DOUBLE_CHAIN_MAIL },
982 { TV_HARD_ARMOR, SV_METAL_BRIGANDINE_ARMOUR },
983 { TV_HARD_ARMOR, SV_SPLINT_MAIL },
984 { TV_GLOVES, SV_SET_OF_LEATHER_GLOVES },
985 { TV_GLOVES, SV_SET_OF_LEATHER_GLOVES },
987 { TV_GLOVES, SV_SET_OF_GAUNTLETS },
988 { TV_SHIELD, SV_SMALL_LEATHER_SHIELD },
989 { TV_SHIELD, SV_LARGE_LEATHER_SHIELD },
990 { TV_SHIELD, SV_SMALL_METAL_SHIELD },
992 { TV_BOOTS, SV_PAIR_OF_HARD_LEATHER_BOOTS },
993 { TV_BOOTS, SV_PAIR_OF_HARD_LEATHER_BOOTS },
994 { TV_HELM, SV_HARD_LEATHER_CAP },
995 { TV_HELM, SV_HARD_LEATHER_CAP },
997 { TV_SOFT_ARMOR, SV_ROBE },
998 { TV_SOFT_ARMOR, SV_SOFT_LEATHER_ARMOR },
999 { TV_SOFT_ARMOR, SV_SOFT_LEATHER_ARMOR },
1000 { TV_SOFT_ARMOR, SV_HARD_LEATHER_ARMOR },
1002 { TV_SOFT_ARMOR, SV_LEATHER_JACK },
1003 { TV_HARD_ARMOR, SV_METAL_SCALE_MAIL },
1004 { TV_HARD_ARMOR, SV_CHAIN_MAIL },
1005 { TV_HARD_ARMOR, SV_CHAIN_MAIL },
1007 { TV_GLOVES, SV_SET_OF_LEATHER_GLOVES },
1008 { TV_GLOVES, SV_SET_OF_GAUNTLETS },
1009 { TV_SHIELD, SV_SMALL_LEATHER_SHIELD },
1010 { TV_SHIELD, SV_SMALL_LEATHER_SHIELD }
1016 { TV_SWORD, SV_DAGGER },
1017 { TV_SWORD, SV_MAIN_GAUCHE },
1018 { TV_SWORD, SV_RAPIER },
1019 { TV_SWORD, SV_SMALL_SWORD },
1021 { TV_SWORD, SV_SHORT_SWORD },
1022 { TV_SWORD, SV_SABRE },
1023 { TV_SWORD, SV_CUTLASS },
1024 { TV_SWORD, SV_TULWAR },
1026 { TV_SWORD, SV_BROAD_SWORD },
1027 { TV_SWORD, SV_LONG_SWORD },
1028 { TV_SWORD, SV_SCIMITAR },
1029 { TV_SWORD, SV_KATANA },
1031 { TV_SWORD, SV_BASTARD_SWORD },
1032 { TV_POLEARM, SV_SPEAR },
1033 { TV_POLEARM, SV_AWL_PIKE },
1034 { TV_POLEARM, SV_TRIDENT },
1036 { TV_POLEARM, SV_PIKE },
1037 { TV_POLEARM, SV_BEAKED_AXE },
1038 { TV_POLEARM, SV_BROAD_AXE },
1039 { TV_POLEARM, SV_LANCE },
1041 { TV_POLEARM, SV_BATTLE_AXE },
1042 { TV_POLEARM, SV_HATCHET },
1043 { TV_BOW, SV_SLING },
1044 { TV_BOW, SV_SHORT_BOW },
1046 { TV_BOW, SV_LIGHT_XBOW },
1047 { TV_SHOT, SV_AMMO_NORMAL },
1048 { TV_SHOT, SV_AMMO_NORMAL },
1049 { TV_ARROW, SV_AMMO_NORMAL },
1051 { TV_ARROW, SV_AMMO_NORMAL },
1052 { TV_BOLT, SV_AMMO_NORMAL },
1053 { TV_BOLT, SV_AMMO_NORMAL },
1054 { TV_BOW, SV_LIGHT_XBOW },
1056 { TV_ARROW, SV_AMMO_NORMAL },
1057 { TV_BOLT, SV_AMMO_NORMAL },
1058 { TV_BOW, SV_SHORT_BOW },
1059 { TV_BOW, SV_LIGHT_XBOW },
1061 { TV_SWORD, SV_DAGGER },
1062 { TV_SWORD, SV_TANTO },
1063 { TV_SWORD, SV_RAPIER },
1064 { TV_SWORD, SV_SMALL_SWORD },
1066 { TV_SWORD, SV_SHORT_SWORD },
1067 { TV_SWORD, SV_LONG_SWORD },
1068 { TV_SWORD, SV_SCIMITAR },
1069 { TV_SWORD, SV_BROAD_SWORD },
1071 { TV_HISSATSU_BOOK, 0 },
1072 { TV_HISSATSU_BOOK, 0 },
1073 { TV_HISSATSU_BOOK, 1 },
1074 { TV_HISSATSU_BOOK, 1 },
1080 { TV_HAFTED, SV_NUNCHAKU },
1081 { TV_HAFTED, SV_QUARTERSTAFF },
1082 { TV_HAFTED, SV_MACE },
1083 { TV_HAFTED, SV_BO_STAFF },
1085 { TV_HAFTED, SV_WAR_HAMMER },
1086 { TV_HAFTED, SV_WAR_HAMMER },
1087 { TV_HAFTED, SV_MORNING_STAR },
1088 { TV_HAFTED, SV_FLAIL },
1090 { TV_HAFTED, SV_LEAD_FILLED_MACE },
1091 { TV_SCROLL, SV_SCROLL_REMOVE_CURSE },
1092 { TV_SCROLL, SV_SCROLL_BLESSING },
1093 { TV_SCROLL, SV_SCROLL_HOLY_CHANT },
1095 { TV_POTION, SV_POTION_HEROISM },
1096 { TV_SCROLL, SV_SCROLL_WORD_OF_RECALL },
1097 { TV_SCROLL, SV_SCROLL_WORD_OF_RECALL },
1098 { TV_SCROLL, SV_SCROLL_WORD_OF_RECALL },
1100 { TV_POTION, SV_POTION_CURE_LIGHT },
1101 { TV_POTION, SV_POTION_CURE_SERIOUS },
1102 { TV_POTION, SV_POTION_CURE_SERIOUS },
1103 { TV_POTION, SV_POTION_CURE_CRITICAL },
1105 { TV_POTION, SV_POTION_CURE_CRITICAL },
1106 { TV_POTION, SV_POTION_RESTORE_EXP },
1107 { TV_POTION, SV_POTION_RESTORE_EXP },
1108 { TV_POTION, SV_POTION_RESTORE_EXP },
1110 { TV_LIFE_BOOK, 0 },
1111 { TV_LIFE_BOOK, 0 },
1112 { TV_LIFE_BOOK, 1 },
1113 { TV_LIFE_BOOK, 1 },
1115 { TV_CRUSADE_BOOK, 0 },
1116 { TV_CRUSADE_BOOK, 0 },
1117 { TV_CRUSADE_BOOK, 1 },
1118 { TV_CRUSADE_BOOK, 1 },
1120 { TV_HAFTED, SV_WHIP },
1121 { TV_HAFTED, SV_MACE },
1122 { TV_HAFTED, SV_BALL_AND_CHAIN },
1123 { TV_HAFTED, SV_WAR_HAMMER },
1125 { TV_SCROLL, SV_SCROLL_WORD_OF_RECALL },
1126 { TV_SCROLL, SV_SCROLL_WORD_OF_RECALL },
1127 { TV_SCROLL, SV_SCROLL_WORD_OF_RECALL },
1128 { TV_POTION, SV_POTION_CURE_CRITICAL },
1130 { TV_POTION, SV_POTION_CURE_CRITICAL },
1131 { TV_POTION, SV_POTION_RESTORE_EXP },
1134 { TV_STATUE, SV_ANY },
1136 { TV_SCROLL, SV_SCROLL_REMOVE_CURSE },
1137 { TV_SCROLL, SV_SCROLL_REMOVE_CURSE },
1138 { TV_SCROLL, SV_SCROLL_STAR_REMOVE_CURSE },
1139 { TV_SCROLL, SV_SCROLL_STAR_REMOVE_CURSE }
1145 { TV_SCROLL, SV_SCROLL_ENCHANT_WEAPON_TO_HIT },
1146 { TV_SCROLL, SV_SCROLL_ENCHANT_WEAPON_TO_DAM },
1147 { TV_SCROLL, SV_SCROLL_ENCHANT_ARMOR },
1148 { TV_SCROLL, SV_SCROLL_IDENTIFY },
1150 { TV_SCROLL, SV_SCROLL_IDENTIFY },
1151 { TV_SCROLL, SV_SCROLL_IDENTIFY },
1152 { TV_SCROLL, SV_SCROLL_IDENTIFY },
1153 { TV_SCROLL, SV_SCROLL_LIGHT },
1155 { TV_SCROLL, SV_SCROLL_PHASE_DOOR },
1156 { TV_SCROLL, SV_SCROLL_PHASE_DOOR },
1157 { TV_SCROLL, SV_SCROLL_TELEPORT },
1158 { TV_SCROLL, SV_SCROLL_MONSTER_CONFUSION },
1160 { TV_SCROLL, SV_SCROLL_MAPPING },
1161 { TV_SCROLL, SV_SCROLL_DETECT_GOLD },
1162 { TV_SCROLL, SV_SCROLL_DETECT_ITEM },
1163 { TV_SCROLL, SV_SCROLL_DETECT_TRAP },
1165 { TV_SCROLL, SV_SCROLL_DETECT_INVIS },
1166 { TV_SCROLL, SV_SCROLL_RECHARGING },
1167 { TV_SCROLL, SV_SCROLL_TELEPORT },
1168 { TV_SCROLL, SV_SCROLL_WORD_OF_RECALL },
1170 { TV_SCROLL, SV_SCROLL_WORD_OF_RECALL },
1171 { TV_SCROLL, SV_SCROLL_WORD_OF_RECALL },
1172 { TV_SCROLL, SV_SCROLL_WORD_OF_RECALL },
1173 { TV_SCROLL, SV_SCROLL_TELEPORT },
1175 { TV_SCROLL, SV_SCROLL_TELEPORT },
1176 { TV_POTION, SV_POTION_RES_STR },
1177 { TV_POTION, SV_POTION_RES_INT },
1178 { TV_POTION, SV_POTION_RES_WIS },
1180 { TV_POTION, SV_POTION_RES_DEX },
1181 { TV_POTION, SV_POTION_RES_CON },
1182 { TV_POTION, SV_POTION_RES_CHR },
1183 { TV_SCROLL, SV_SCROLL_IDENTIFY },
1185 { TV_SCROLL, SV_SCROLL_IDENTIFY },
1186 { TV_SCROLL, SV_SCROLL_STAR_IDENTIFY }, /* Yep, occasionally! */
1187 { TV_SCROLL, SV_SCROLL_STAR_IDENTIFY },
1188 { TV_SCROLL, SV_SCROLL_LIGHT },
1190 { TV_POTION, SV_POTION_RES_STR },
1191 { TV_POTION, SV_POTION_RES_INT },
1192 { TV_POTION, SV_POTION_RES_WIS },
1193 { TV_POTION, SV_POTION_RES_DEX },
1195 { TV_POTION, SV_POTION_RES_CON },
1196 { TV_POTION, SV_POTION_RES_CHR },
1197 { TV_SCROLL, SV_SCROLL_ENCHANT_ARMOR },
1198 { TV_SCROLL, SV_SCROLL_ENCHANT_ARMOR },
1200 { TV_SCROLL, SV_SCROLL_RECHARGING },
1201 { TV_SCROLL, SV_SCROLL_PHASE_DOOR },
1202 { TV_SCROLL, SV_SCROLL_ENCHANT_WEAPON_TO_HIT },
1203 { TV_SCROLL, SV_SCROLL_ENCHANT_WEAPON_TO_DAM },
1208 /* Magic-User store */
1210 { TV_RING, SV_RING_PROTECTION },
1211 { TV_RING, SV_RING_LEVITATION_FALL },
1212 { TV_RING, SV_RING_PROTECTION },
1213 { TV_RING, SV_RING_RESIST_FIRE },
1215 { TV_RING, SV_RING_RESIST_COLD },
1216 { TV_AMULET, SV_AMULET_CHARISMA },
1217 { TV_RING, SV_RING_WARNING },
1218 { TV_AMULET, SV_AMULET_RESIST_ACID },
1220 { TV_AMULET, SV_AMULET_SEARCHING },
1221 { TV_WAND, SV_WAND_SLOW_MONSTER },
1222 { TV_WAND, SV_WAND_CONFUSE_MONSTER },
1223 { TV_WAND, SV_WAND_SLEEP_MONSTER },
1225 { TV_WAND, SV_WAND_MAGIC_MISSILE },
1226 { TV_WAND, SV_WAND_STINKING_CLOUD },
1227 { TV_WAND, SV_WAND_WONDER },
1228 { TV_WAND, SV_WAND_DISARMING },
1230 { TV_STAFF, SV_STAFF_LITE },
1231 { TV_STAFF, SV_STAFF_MAPPING },
1232 { TV_STAFF, SV_STAFF_DETECT_TRAP },
1233 { TV_STAFF, SV_STAFF_DETECT_DOOR },
1235 { TV_STAFF, SV_STAFF_DETECT_GOLD },
1236 { TV_STAFF, SV_STAFF_DETECT_ITEM },
1237 { TV_STAFF, SV_STAFF_DETECT_INVIS },
1238 { TV_STAFF, SV_STAFF_DETECT_EVIL },
1240 { TV_STAFF, SV_STAFF_TELEPORTATION },
1241 { TV_STAFF, SV_STAFF_TELEPORTATION },
1242 { TV_STAFF, SV_STAFF_TELEPORTATION },
1243 { TV_STAFF, SV_STAFF_TELEPORTATION },
1245 { TV_STAFF, SV_STAFF_IDENTIFY },
1246 { TV_STAFF, SV_STAFF_IDENTIFY },
1247 { TV_STAFF, SV_STAFF_IDENTIFY },
1249 { TV_STAFF, SV_STAFF_IDENTIFY },
1250 { TV_STAFF, SV_STAFF_REMOVE_CURSE },
1251 { TV_STAFF, SV_STAFF_CURE_LIGHT },
1252 { TV_STAFF, SV_STAFF_PROBING },
1256 { TV_SORCERY_BOOK, 0 },
1257 { TV_SORCERY_BOOK, 0 },
1258 { TV_SORCERY_BOOK, 1 },
1259 { TV_SORCERY_BOOK, 1 },
1261 { TV_ARCANE_BOOK, 0 },
1262 { TV_ARCANE_BOOK, 0 },
1263 { TV_ARCANE_BOOK, 1 },
1264 { TV_ARCANE_BOOK, 1 },
1266 { TV_ARCANE_BOOK, 2 },
1267 { TV_ARCANE_BOOK, 2 },
1268 { TV_ARCANE_BOOK, 3 },
1269 { TV_ARCANE_BOOK, 3 },
1274 /* Black Market (unused) */
1347 { TV_SORCERY_BOOK, 0 },
1348 { TV_SORCERY_BOOK, 0 },
1349 { TV_SORCERY_BOOK, 1 },
1350 { TV_SORCERY_BOOK, 1 },
1352 { TV_NATURE_BOOK, 0 },
1353 { TV_NATURE_BOOK, 0 },
1354 { TV_NATURE_BOOK, 1 },
1355 { TV_NATURE_BOOK, 1 },
1357 { TV_CHAOS_BOOK, 0 },
1358 { TV_CHAOS_BOOK, 0 },
1359 { TV_CHAOS_BOOK, 1 },
1360 { TV_CHAOS_BOOK, 1 },
1362 { TV_DEATH_BOOK, 0 },
1363 { TV_DEATH_BOOK, 0 },
1364 { TV_DEATH_BOOK, 1 },
1365 { TV_DEATH_BOOK, 1 },
1367 { TV_TRUMP_BOOK, 0 }, /* +16 */
1368 { TV_TRUMP_BOOK, 0 },
1369 { TV_TRUMP_BOOK, 1 },
1370 { TV_TRUMP_BOOK, 1 },
1372 { TV_ARCANE_BOOK, 0 },
1373 { TV_ARCANE_BOOK, 1 },
1374 { TV_ARCANE_BOOK, 2 },
1375 { TV_ARCANE_BOOK, 3 },
1377 { TV_CRAFT_BOOK, 0 },
1378 { TV_CRAFT_BOOK, 0 },
1379 { TV_CRAFT_BOOK, 1 },
1380 { TV_CRAFT_BOOK, 1 },
1382 { TV_DAEMON_BOOK, 0 },
1383 { TV_DAEMON_BOOK, 0 },
1384 { TV_DAEMON_BOOK, 1 },
1385 { TV_DAEMON_BOOK, 1 },
1387 { TV_MUSIC_BOOK, 0 },
1388 { TV_MUSIC_BOOK, 0 },
1389 { TV_MUSIC_BOOK, 1 },
1390 { TV_MUSIC_BOOK, 1 },
1399 /* Museum (unused) */
1437 * Initialize misc. values
1439 static errr init_misc(void)
1441 /* Initialize the values */
1442 process_dungeon_file("misc.txt", 0, 0, 0, 0);
1449 * Initialize town array
1451 static errr init_towns(void)
1455 /*** Prepare the Towns ***/
1457 /* Allocate the towns */
1458 C_MAKE(town, max_towns, town_type);
1460 for (i = 1; i < max_towns; i++)
1462 /*** Prepare the Stores ***/
1464 /* Allocate the stores */
1465 C_MAKE(town[i].store, MAX_STORES, store_type);
1467 /* Fill in each store */
1468 for (j = 0; j < MAX_STORES; j++)
1470 /* Access the store */
1471 store_type *st_ptr = &town[i].store[j];
1473 if ((i > 1) && (j == STORE_MUSEUM || j == STORE_HOME)) continue;
1475 /* Assume full stock */
1478 * ²æ¤¬²È¤¬ 20 ¥Ú¡¼¥¸¤Þ¤Ç»È¤¨¤ë±£¤·µ¡Ç½¤Î¤¿¤á¤Î½àÈ÷¡£
1479 * ¥ª¥×¥·¥ç¥ó¤¬Í¸ú¤Ç¤â¤½¤¦¤Ç¤Ê¤¯¤Æ¤â°ì±þ¥¹¥Ú¡¼¥¹
1482 if (j == STORE_HOME)
1484 st_ptr->stock_size = (STORE_INVEN_MAX * 10);
1486 else if (j == STORE_MUSEUM)
1488 st_ptr->stock_size = (STORE_INVEN_MAX * 50);
1492 st_ptr->stock_size = STORE_INVEN_MAX;
1496 /* Allocate the stock */
1497 C_MAKE(st_ptr->stock, st_ptr->stock_size, object_type);
1499 /* No table for the black market or home */
1500 if ((j == STORE_BLACK) || (j == STORE_HOME) || (j == STORE_MUSEUM)) continue;
1502 /* Assume full table */
1503 st_ptr->table_size = STORE_CHOICES;
1505 /* Allocate the stock */
1506 C_MAKE(st_ptr->table, st_ptr->table_size, s16b);
1508 /* Scan the choices */
1509 for (k = 0; k < STORE_CHOICES; k++)
1513 /* Extract the tval/sval codes */
1514 int tv = store_table[j][k][0];
1515 int sv = store_table[j][k][1];
1518 for (k_idx = 1; k_idx < max_k_idx; k_idx++)
1520 object_kind *k_ptr = &k_info[k_idx];
1523 if ((k_ptr->tval == tv) && (k_ptr->sval == sv)) break;
1527 if (k_idx == max_k_idx) continue;
1529 /* Add that item index to the table */
1530 st_ptr->table[st_ptr->table_num++] = k_idx;
1539 * Initialize buildings
1541 errr init_buildings(void)
1545 for (i = 0; i < MAX_BLDG; i++)
1547 building[i].name[0] = '\0';
1548 building[i].owner_name[0] = '\0';
1549 building[i].owner_race[0] = '\0';
1551 for (j = 0; j < 8; j++)
1553 building[i].act_names[j][0] = '\0';
1554 building[i].member_costs[j] = 0;
1555 building[i].other_costs[j] = 0;
1556 building[i].letters[j] = 0;
1557 building[i].actions[j] = 0;
1558 building[i].action_restr[j] = 0;
1561 for (j = 0; j < MAX_CLASS; j++)
1563 building[i].member_class[j] = 0;
1566 for (j = 0; j < MAX_RACES; j++)
1568 building[i].member_race[j] = 0;
1571 for (j = 0; j < MAX_MAGIC+1; j++)
1573 building[i].member_realm[j] = 0;
1582 * Initialize quest array
1584 static errr init_quests(void)
1588 /*** Prepare the quests ***/
1590 /* Allocate the quests */
1591 C_MAKE(quest, max_quests, quest_type);
1593 /* Set all quest to "untaken" */
1594 for (i = 0; i < max_quests; i++)
1596 quest[i].status = QUEST_STATUS_UNTAKEN;
1603 static bool feat_tag_is_not_found = FALSE;
1606 s16b f_tag_to_index_in_init(cptr str)
1608 s16b feat = f_tag_to_index(str);
1610 if (feat < 0) feat_tag_is_not_found = TRUE;
1617 * Initialize feature variables
1619 static errr init_feat_variables(void)
1624 feat_none = f_tag_to_index_in_init("NONE");
1627 feat_floor = f_tag_to_index_in_init("FLOOR");
1630 feat_glyph = f_tag_to_index_in_init("GLYPH");
1631 feat_explosive_rune = f_tag_to_index_in_init("EXPLOSIVE_RUNE");
1632 feat_mirror = f_tag_to_index_in_init("MIRROR");
1635 feat_door[DOOR_DOOR].open = f_tag_to_index_in_init("OPEN_DOOR");
1636 feat_door[DOOR_DOOR].broken = f_tag_to_index_in_init("BROKEN_DOOR");
1637 feat_door[DOOR_DOOR].closed = f_tag_to_index_in_init("CLOSED_DOOR");
1640 for (i = 1; i < MAX_LJ_DOORS; i++)
1642 s16b door = f_tag_to_index(format("LOCKED_DOOR_%d", i));
1643 if (door < 0) break;
1644 feat_door[DOOR_DOOR].locked[i - 1] = door;
1646 if (i == 1) return PARSE_ERROR_UNDEFINED_TERRAIN_TAG;
1647 feat_door[DOOR_DOOR].num_locked = i - 1;
1650 for (i = 0; i < MAX_LJ_DOORS; i++)
1652 s16b door = f_tag_to_index(format("JAMMED_DOOR_%d", i));
1653 if (door < 0) break;
1654 feat_door[DOOR_DOOR].jammed[i] = door;
1656 if (!i) return PARSE_ERROR_UNDEFINED_TERRAIN_TAG;
1657 feat_door[DOOR_DOOR].num_jammed = i;
1660 feat_door[DOOR_GLASS_DOOR].open = f_tag_to_index_in_init("OPEN_GLASS_DOOR");
1661 feat_door[DOOR_GLASS_DOOR].broken = f_tag_to_index_in_init("BROKEN_GLASS_DOOR");
1662 feat_door[DOOR_GLASS_DOOR].closed = f_tag_to_index_in_init("CLOSED_GLASS_DOOR");
1664 /* Locked glass doors */
1665 for (i = 1; i < MAX_LJ_DOORS; i++)
1667 s16b door = f_tag_to_index(format("LOCKED_GLASS_DOOR_%d", i));
1668 if (door < 0) break;
1669 feat_door[DOOR_GLASS_DOOR].locked[i - 1] = door;
1671 if (i == 1) return PARSE_ERROR_UNDEFINED_TERRAIN_TAG;
1672 feat_door[DOOR_GLASS_DOOR].num_locked = i - 1;
1674 /* Jammed glass doors */
1675 for (i = 0; i < MAX_LJ_DOORS; i++)
1677 s16b door = f_tag_to_index(format("JAMMED_GLASS_DOOR_%d", i));
1678 if (door < 0) break;
1679 feat_door[DOOR_GLASS_DOOR].jammed[i] = door;
1681 if (!i) return PARSE_ERROR_UNDEFINED_TERRAIN_TAG;
1682 feat_door[DOOR_GLASS_DOOR].num_jammed = i;
1685 feat_door[DOOR_CURTAIN].open = f_tag_to_index_in_init("OPEN_CURTAIN");
1686 feat_door[DOOR_CURTAIN].broken = feat_door[DOOR_CURTAIN].open;
1687 feat_door[DOOR_CURTAIN].closed = f_tag_to_index_in_init("CLOSED_CURTAIN");
1688 feat_door[DOOR_CURTAIN].locked[0] = feat_door[DOOR_CURTAIN].closed;
1689 feat_door[DOOR_CURTAIN].num_locked = 1;
1690 feat_door[DOOR_CURTAIN].jammed[0] = feat_door[DOOR_CURTAIN].closed;
1691 feat_door[DOOR_CURTAIN].num_jammed = 1;
1694 feat_up_stair = f_tag_to_index_in_init("UP_STAIR");
1695 feat_down_stair = f_tag_to_index_in_init("DOWN_STAIR");
1696 feat_entrance = f_tag_to_index_in_init("ENTRANCE");
1699 init_normal_traps();
1702 feat_trap_open = f_tag_to_index_in_init("TRAP_OPEN");
1703 feat_trap_armageddon = f_tag_to_index_in_init("TRAP_ARMAGEDDON");
1704 feat_trap_piranha = f_tag_to_index_in_init("TRAP_PIRANHA");
1707 feat_rubble = f_tag_to_index_in_init("RUBBLE");
1710 feat_magma_vein = f_tag_to_index_in_init("MAGMA_VEIN");
1711 feat_quartz_vein = f_tag_to_index_in_init("QUARTZ_VEIN");
1714 feat_granite = f_tag_to_index_in_init("GRANITE");
1715 feat_permanent = f_tag_to_index_in_init("PERMANENT");
1718 feat_glass_floor = f_tag_to_index_in_init("GLASS_FLOOR");
1721 feat_glass_wall = f_tag_to_index_in_init("GLASS_WALL");
1722 feat_permanent_glass_wall = f_tag_to_index_in_init("PERMANENT_GLASS_WALL");
1725 feat_pattern_start = f_tag_to_index_in_init("PATTERN_START");
1726 feat_pattern_1 = f_tag_to_index_in_init("PATTERN_1");
1727 feat_pattern_2 = f_tag_to_index_in_init("PATTERN_2");
1728 feat_pattern_3 = f_tag_to_index_in_init("PATTERN_3");
1729 feat_pattern_4 = f_tag_to_index_in_init("PATTERN_4");
1730 feat_pattern_end = f_tag_to_index_in_init("PATTERN_END");
1731 feat_pattern_old = f_tag_to_index_in_init("PATTERN_OLD");
1732 feat_pattern_exit = f_tag_to_index_in_init("PATTERN_EXIT");
1733 feat_pattern_corrupted = f_tag_to_index_in_init("PATTERN_CORRUPTED");
1736 feat_black_market = f_tag_to_index_in_init("BLACK_MARKET");
1737 feat_town = f_tag_to_index_in_init("TOWN");
1740 feat_deep_water = f_tag_to_index_in_init("DEEP_WATER");
1741 feat_shallow_water = f_tag_to_index_in_init("SHALLOW_WATER");
1742 feat_deep_lava = f_tag_to_index_in_init("DEEP_LAVA");
1743 feat_shallow_lava = f_tag_to_index_in_init("SHALLOW_LAVA");
1744 feat_dirt = f_tag_to_index_in_init("DIRT");
1745 feat_grass = f_tag_to_index_in_init("GRASS");
1746 feat_flower = f_tag_to_index_in_init("FLOWER");
1747 feat_brake = f_tag_to_index_in_init("BRAKE");
1748 feat_tree = f_tag_to_index_in_init("TREE");
1749 feat_mountain = f_tag_to_index_in_init("MOUNTAIN");
1750 feat_swamp = f_tag_to_index_in_init("SWAMP");
1752 /* Unknown grid (not detected) */
1753 feat_undetected = f_tag_to_index_in_init("UNDETECTED");
1755 /* Wilderness terrains */
1756 init_wilderness_terrains();
1758 return feat_tag_is_not_found ? PARSE_ERROR_UNDEFINED_TERRAIN_TAG : 0;
1763 * Initialize some other arrays
1765 static errr init_other(void)
1770 /*** Prepare the "dungeon" information ***/
1772 /* Allocate and Wipe the object list */
1773 C_MAKE(o_list, max_o_idx, object_type);
1775 /* Allocate and Wipe the monster list */
1776 C_MAKE(m_list, max_m_idx, monster_type);
1778 /* Allocate and Wipe the monster process list */
1779 for (i = 0; i < MAX_MTIMED; i++)
1781 C_MAKE(mproc_list[i], max_m_idx, s16b);
1784 /* Allocate and Wipe the max dungeon level */
1785 C_MAKE(max_dlv, max_d_idx, s16b);
1787 /* Allocate and wipe each line of the cave */
1788 for (i = 0; i < MAX_HGT; i++)
1790 /* Allocate one row of the cave */
1791 C_MAKE(cave[i], MAX_WID, cave_type);
1795 /*** Prepare the various "bizarre" arrays ***/
1797 /* Macro variables */
1798 C_MAKE(macro__pat, MACRO_MAX, cptr);
1799 C_MAKE(macro__act, MACRO_MAX, cptr);
1800 C_MAKE(macro__cmd, MACRO_MAX, bool);
1802 /* Macro action buffer */
1803 C_MAKE(macro__buf, 1024, char);
1805 /* Quark variables */
1808 /* Message variables */
1809 C_MAKE(message__ptr, MESSAGE_MAX, u16b);
1810 C_MAKE(message__buf, MESSAGE_BUF, char);
1812 /* Hack -- No messages yet */
1813 message__tail = MESSAGE_BUF;
1816 /*** Prepare the Player inventory ***/
1819 C_MAKE(inventory, INVEN_TOTAL, object_type);
1822 /*** Prepare the options ***/
1824 /* Scan the options */
1825 for (i = 0; option_info[i].o_desc; i++)
1827 int os = option_info[i].o_set;
1828 int ob = option_info[i].o_bit;
1830 /* Set the "default" options */
1831 if (option_info[i].o_var)
1834 option_mask[os] |= (1L << ob);
1837 if (option_info[i].o_norm)
1840 option_flag[os] |= (1L << ob);
1847 option_flag[os] &= ~(1L << ob);
1852 /* Analyze the windows */
1853 for (n = 0; n < 8; n++)
1855 /* Analyze the options */
1856 for (i = 0; i < 32; i++)
1859 if (window_flag_desc[i])
1862 window_mask[n] |= (1L << i);
1868 * Set the "default" window flags
1869 * Window 1 : Display messages
1870 * Window 2 : Display inven/equip
1872 window_flag[1] = 1L << 6;
1873 window_flag[2] = 1L << 0;
1876 /*** Pre-allocate space for the "format()" buffer ***/
1878 /* Hack -- Just call the "format()" function */
1879 (void)format("%s (%s).", "Mr.Hoge", MAINTAINER);
1888 * Initialize some other arrays
1890 static errr init_object_alloc(void)
1895 s16b num[MAX_DEPTH];
1896 s16b aux[MAX_DEPTH];
1899 /*** Analyze object allocation info ***/
1901 /* Clear the "aux" array */
1902 (void)C_WIPE(&aux, MAX_DEPTH, s16b);
1904 /* Clear the "num" array */
1905 (void)C_WIPE(&num, MAX_DEPTH, s16b);
1907 /* Free the old "alloc_kind_table" (if it exists) */
1908 if (alloc_kind_table)
1910 C_KILL(alloc_kind_table, alloc_kind_size, alloc_entry);
1913 /* Size of "alloc_kind_table" */
1914 alloc_kind_size = 0;
1916 /* Scan the objects */
1917 for (i = 1; i < max_k_idx; i++)
1921 /* Scan allocation pairs */
1922 for (j = 0; j < 4; j++)
1924 /* Count the "legal" entries */
1925 if (k_ptr->chance[j])
1927 /* Count the entries */
1930 /* Group by level */
1931 num[k_ptr->locale[j]]++;
1936 /* Collect the level indexes */
1937 for (i = 1; i < MAX_DEPTH; i++)
1939 /* Group by level */
1945 if (!num[0]) quit("Ä®¤Î¥¢¥¤¥Æ¥à¤¬¤Ê¤¤¡ª");
1947 if (!num[0]) quit("No town objects!");
1952 /*** Initialize object allocation info ***/
1954 /* Allocate the alloc_kind_table */
1955 C_MAKE(alloc_kind_table, alloc_kind_size, alloc_entry);
1957 /* Access the table entry */
1958 table = alloc_kind_table;
1960 /* Scan the objects */
1961 for (i = 1; i < max_k_idx; i++)
1965 /* Scan allocation pairs */
1966 for (j = 0; j < 4; j++)
1968 /* Count the "legal" entries */
1969 if (k_ptr->chance[j])
1973 /* Extract the base level */
1974 x = k_ptr->locale[j];
1976 /* Extract the base probability */
1977 p = (100 / k_ptr->chance[j]);
1979 /* Skip entries preceding our locale */
1980 y = (x > 0) ? num[x-1] : 0;
1982 /* Skip previous entries at this locale */
1985 /* Load the entry */
1992 /* Another entry complete for this locale */
2004 * Initialize some other arrays
2006 static errr init_alloc(void)
2009 monster_race *r_ptr;
2015 /* Allocate the "r_info" array */
2016 C_MAKE(elements, max_r_idx, tag_type);
2018 /* Scan the monsters */
2019 for (i = 1; i < max_r_idx; i++)
2021 elements[i].tag = r_info[i].level;
2022 elements[i].index = i;
2025 tag_sort(elements, max_r_idx);
2027 /*** Initialize monster allocation info ***/
2029 /* Size of "alloc_race_table" */
2030 alloc_race_size = max_r_idx;
2032 /* Allocate the alloc_race_table */
2033 C_MAKE(alloc_race_table, alloc_race_size, alloc_entry);
2035 /* Scan the monsters */
2036 for (i = 1; i < max_r_idx; i++)
2038 /* Get the i'th race */
2039 r_ptr = &r_info[elements[i].index];
2041 /* Count valid pairs */
2046 /* Extract the base level */
2049 /* Extract the base probability */
2050 p = (100 / r_ptr->rarity);
2052 /* Load the entry */
2053 alloc_race_table[i].index = elements[i].index;
2054 alloc_race_table[i].level = x;
2055 alloc_race_table[i].prob1 = p;
2056 alloc_race_table[i].prob2 = p;
2057 alloc_race_table[i].prob3 = p;
2061 /* Free the "r_info" array */
2062 C_KILL(elements, max_r_idx, tag_type);
2064 #else /* SORT_R_INFO */
2068 s16b num[MAX_DEPTH];
2069 s16b aux[MAX_DEPTH];
2071 /*** Analyze monster allocation info ***/
2073 /* Clear the "aux" array */
2074 C_WIPE(&aux, MAX_DEPTH, s16b);
2076 /* Clear the "num" array */
2077 C_WIPE(&num, MAX_DEPTH, s16b);
2079 /* Size of "alloc_race_table" */
2080 alloc_race_size = 0;
2082 /* Scan the monsters */
2083 for (i = 1; i < max_r_idx; i++)
2085 /* Get the i'th race */
2088 /* Legal monsters */
2091 /* Count the entries */
2094 /* Group by level */
2095 num[r_ptr->level]++;
2099 /* Collect the level indexes */
2100 for (i = 1; i < MAX_DEPTH; i++)
2102 /* Group by level */
2108 if (!num[0]) quit("Ä®¤Î¥â¥ó¥¹¥¿¡¼¤¬¤Ê¤¤¡ª");
2110 if (!num[0]) quit("No town monsters!");
2115 /*** Initialize monster allocation info ***/
2117 /* Allocate the alloc_race_table */
2118 C_MAKE(alloc_race_table, alloc_race_size, alloc_entry);
2120 /* Access the table entry */
2121 table = alloc_race_table;
2123 /* Scan the monsters */
2124 for (i = 1; i < max_r_idx; i++)
2126 /* Get the i'th race */
2129 /* Count valid pairs */
2134 /* Extract the base level */
2137 /* Extract the base probability */
2138 p = (100 / r_ptr->rarity);
2140 /* Skip entries preceding our locale */
2141 y = (x > 0) ? num[x-1] : 0;
2143 /* Skip previous entries at this locale */
2146 /* Load the entry */
2153 /* Another entry complete for this locale */
2158 #endif /* SORT_R_INFO */
2160 /* Init the "alloc_kind_table" */
2161 (void)init_object_alloc();
2170 * Hack -- take notes on line 23
2172 static void note(cptr str)
2174 Term_erase(0, 23, 255);
2175 Term_putstr(20, 23, -1, TERM_WHITE, str);
2182 * Hack -- Explain a broken "lib" folder and quit (see below).
2184 * XXX XXX XXX This function is "messy" because various things
2185 * may or may not be initialized, but the "plog()" and "quit()"
2186 * functions are "supposed" to work under any conditions.
2188 static void init_angband_aux(cptr why)
2195 plog("'lib'¥Ç¥£¥ì¥¯¥È¥ê¤¬Â¸ºß¤·¤Ê¤¤¤«²õ¤ì¤Æ¤¤¤ë¤è¤¦¤Ç¤¹¡£");
2198 plog("¤Ò¤ç¤Ã¤È¤¹¤ë¤È¥¢¡¼¥«¥¤¥Ö¤¬Àµ¤·¤¯²òÅव¤ì¤Æ¤¤¤Ê¤¤¤Î¤«¤â¤·¤ì¤Þ¤»¤ó¡£");
2201 plog("³ºÅö¤¹¤ë'README'¥Õ¥¡¥¤¥ë¤òÆɤó¤Ç³Îǧ¤·¤Æ¤ß¤Æ²¼¤µ¤¤¡£");
2203 /* Quit with error */
2204 quit("Ã×̿Ū¤Ê¥¨¥é¡¼¡£");
2207 plog("The 'lib' directory is probably missing or broken.");
2210 plog("Perhaps the archive was not extracted correctly.");
2213 plog("See the 'README' file for more information.");
2215 /* Quit with error */
2216 quit("Fatal Error.");
2223 * Hack -- main Angband initialization entry point
2225 * Verify some files, display the "news.txt" file, create
2226 * the high score file, initialize all internal arrays, and
2227 * load the basic "user pref files".
2229 * Be very careful to keep track of the order in which things
2230 * are initialized, in particular, the only thing *known* to
2231 * be available when this function is called is the "z-term.c"
2232 * package, and that may not be fully initialized until the
2233 * end of this function, when the default "user pref files"
2234 * are loaded and "Term_xtra(TERM_XTRA_REACT,0)" is called.
2236 * Note that this function attempts to verify the "news" file,
2237 * and the game aborts (cleanly) on failure, since without the
2238 * "news" file, it is likely that the "lib" folder has not been
2239 * correctly located. Otherwise, the news file is displayed for
2242 * Note that this function attempts to verify (or create) the
2243 * "high score" file, and the game aborts (cleanly) on failure,
2244 * since one of the most common "extraction" failures involves
2245 * failing to extract all sub-directories (even empty ones), such
2246 * as by failing to use the "-d" option of "pkunzip", or failing
2247 * to use the "save empty directories" option with "Compact Pro".
2248 * This error will often be caught by the "high score" creation
2249 * code below, since the "lib/apex" directory, being empty in the
2250 * standard distributions, is most likely to be "lost", making it
2251 * impossible to create the high score file.
2253 * Note that various things are initialized by this function,
2254 * including everything that was once done by "init_some_arrays".
2256 * This initialization involves the parsing of special files
2257 * in the "lib/data" and sometimes the "lib/edit" directories.
2259 * Note that the "template" files are initialized first, since they
2260 * often contain errors. This means that macros and message recall
2261 * and things like that are not available until after they are done.
2263 * We load the default "user pref files" here in case any "color"
2264 * changes are needed before character creation.
2266 * Note that the "graf-xxx.prf" file must be loaded separately,
2267 * if needed, in the first (?) pass through "TERM_XTRA_REACT".
2269 void init_angband(void)
2280 /*** Verify the "news" file ***/
2282 /* Build the filename */
2284 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, "news_j.txt");
2286 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, "news.txt");
2290 /* Attempt to open the file */
2291 fd = fd_open(buf, O_RDONLY);
2300 sprintf(why, "'%s'¥Õ¥¡¥¤¥ë¤Ë¥¢¥¯¥»¥¹¤Ç¤¤Þ¤»¤ó!", buf);
2302 sprintf(why, "Cannot access the '%s' file!", buf);
2306 /* Crash and burn */
2307 init_angband_aux(why);
2314 /*** Display the "news" file ***/
2319 /* Build the filename */
2321 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, "news_j.txt");
2323 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, "news.txt");
2327 /* Open the News file */
2328 fp = my_fopen(buf, "r");
2335 /* Dump the file to the screen */
2336 while (0 == my_fgets(fp, buf, sizeof(buf)))
2338 /* Display and advance */
2339 Term_putstr(0, i++, -1, TERM_WHITE, buf);
2350 /*** Verify (or create) the "high score" file ***/
2352 /* Build the filename */
2353 path_build(buf, sizeof(buf), ANGBAND_DIR_APEX, "scores.raw");
2355 /* Attempt to open the high score file */
2356 fd = fd_open(buf, O_RDONLY);
2361 /* File type is "DATA" */
2362 FILE_TYPE(FILE_TYPE_DATA);
2364 /* Grab permissions */
2367 /* Create a new high score file */
2368 fd = fd_make(buf, mode);
2370 /* Drop permissions */
2380 sprintf(why, "'%s'¥Õ¥¡¥¤¥ë¤òºîÀ®¤Ç¤¤Þ¤»¤ó!", buf);
2382 sprintf(why, "Cannot create the '%s' file!", buf);
2386 /* Crash and burn */
2387 init_angband_aux(why);
2395 /*** Initialize some arrays ***/
2397 /* Initialize misc. values */
2399 note("[ÊÑ¿ô¤ò½é´ü²½¤·¤Æ¤¤¤Þ¤¹...(¤½¤Î¾)");
2401 note("[Initializing values... (misc)]");
2405 if (init_misc()) quit("¤½¤Î¾¤ÎÊÑ¿ô¤ò½é´ü²½¤Ç¤¤Þ¤»¤ó");
2407 if (init_misc()) quit("Cannot initialize misc. values");
2411 /* Initialize feature info */
2413 note("[¥Ç¡¼¥¿¤Î½é´ü²½Ãæ... (ÃÏ·Á)]");
2414 if (init_f_info()) quit("ÃÏ·Á½é´ü²½ÉÔǽ");
2415 if (init_feat_variables()) quit("ÃÏ·Á½é´ü²½ÉÔǽ");
2417 note("[Initializing arrays... (features)]");
2418 if (init_f_info()) quit("Cannot initialize features");
2419 if (init_feat_variables()) quit("Cannot initialize features");
2423 /* Initialize object info */
2425 note("[¥Ç¡¼¥¿¤Î½é´ü²½Ãæ... (¥¢¥¤¥Æ¥à)]");
2426 if (init_k_info()) quit("¥¢¥¤¥Æ¥à½é´ü²½ÉÔǽ");
2428 note("[Initializing arrays... (objects)]");
2429 if (init_k_info()) quit("Cannot initialize objects");
2433 /* Initialize artifact info */
2435 note("[¥Ç¡¼¥¿¤Î½é´ü²½Ãæ... (ÅÁÀâ¤Î¥¢¥¤¥Æ¥à)]");
2436 if (init_a_info()) quit("ÅÁÀâ¤Î¥¢¥¤¥Æ¥à½é´ü²½ÉÔǽ");
2438 note("[Initializing arrays... (artifacts)]");
2439 if (init_a_info()) quit("Cannot initialize artifacts");
2443 /* Initialize ego-item info */
2445 note("[¥Ç¡¼¥¿¤Î½é´ü²½Ãæ... (̾¤Î¤¢¤ë¥¢¥¤¥Æ¥à)]");
2446 if (init_e_info()) quit("̾¤Î¤¢¤ë¥¢¥¤¥Æ¥à½é´ü²½ÉÔǽ");
2448 note("[Initializing arrays... (ego-items)]");
2449 if (init_e_info()) quit("Cannot initialize ego-items");
2453 /* Initialize monster info */
2455 note("[¥Ç¡¼¥¿¤Î½é´ü²½Ãæ... (¥â¥ó¥¹¥¿¡¼)]");
2456 if (init_r_info()) quit("¥â¥ó¥¹¥¿¡¼½é´ü²½ÉÔǽ");
2458 note("[Initializing arrays... (monsters)]");
2459 if (init_r_info()) quit("Cannot initialize monsters");
2463 /* Initialize dungeon info */
2465 note("[¥Ç¡¼¥¿¤Î½é´ü²½Ãæ... (¥À¥ó¥¸¥ç¥ó)]");
2466 if (init_d_info()) quit("¥À¥ó¥¸¥ç¥ó½é´ü²½ÉÔǽ");
2468 note("[Initializing arrays... (dungeon)]");
2469 if (init_d_info()) quit("Cannot initialize dungeon");
2473 for (i = 1; i < max_d_idx; i++)
2474 if (d_info[i].final_guardian)
2475 r_info[d_info[i].final_guardian].flags7 |= RF7_GUARDIAN;
2478 /* Initialize magic info */
2480 note("[¥Ç¡¼¥¿¤Î½é´ü²½Ãæ... (ËâË¡)]");
2481 if (init_m_info()) quit("ËâË¡½é´ü²½ÉÔǽ");
2483 note("[Initializing arrays... (magic)]");
2484 if (init_m_info()) quit("Cannot initialize magic");
2487 /* Initialize weapon_exp info */
2489 note("[¥Ç¡¼¥¿¤Î½é´ü²½Ãæ... (½ÏÎýÅÙ)]");
2490 if (init_s_info()) quit("½ÏÎýÅÙ½é´ü²½ÉÔǽ");
2492 note("[Initializing arrays... (skill)]");
2493 if (init_s_info()) quit("Cannot initialize skill");
2496 /* Initialize wilderness array */
2498 note("[ÇÛÎó¤ò½é´ü²½¤·¤Æ¤¤¤Þ¤¹... (¹ÓÌî)]");
2500 note("[Initializing arrays... (wilderness)]");
2504 if (init_wilderness()) quit("¹ÓÌî¤ò½é´ü²½¤Ç¤¤Þ¤»¤ó");
2506 if (init_wilderness()) quit("Cannot initialize wilderness");
2510 /* Initialize town array */
2512 note("[ÇÛÎó¤ò½é´ü²½¤·¤Æ¤¤¤Þ¤¹... (³¹)]");
2514 note("[Initializing arrays... (towns)]");
2518 if (init_towns()) quit("³¹¤ò½é´ü²½¤Ç¤¤Þ¤»¤ó");
2520 if (init_towns()) quit("Cannot initialize towns");
2524 /* Initialize building array */
2526 note("[ÇÛÎó¤ò½é´ü²½¤·¤Æ¤¤¤Þ¤¹... (·úʪ)]");
2528 note("[Initializing arrays... (buildings)]");
2532 if (init_buildings()) quit("·úʪ¤ò½é´ü²½¤Ç¤¤Þ¤»¤ó");
2534 if (init_buildings()) quit("Cannot initialize buildings");
2538 /* Initialize quest array */
2540 note("[ÇÛÎó¤ò½é´ü²½¤·¤Æ¤¤¤Þ¤¹... (¥¯¥¨¥¹¥È)]");
2542 note("[Initializing arrays... (quests)]");
2546 if (init_quests()) quit("¥¯¥¨¥¹¥È¤ò½é´ü²½¤Ç¤¤Þ¤»¤ó");
2548 if (init_quests()) quit("Cannot initialize quests");
2552 /* Initialize vault info */
2554 if (init_v_info()) quit("vault ½é´ü²½ÉÔǽ");
2556 if (init_v_info()) quit("Cannot initialize vaults");
2560 /* Initialize some other arrays */
2562 note("[¥Ç¡¼¥¿¤Î½é´ü²½Ãæ... (¤½¤Î¾)]");
2563 if (init_other()) quit("¤½¤Î¾¤Î¥Ç¡¼¥¿½é´ü²½ÉÔǽ");
2565 note("[Initializing arrays... (other)]");
2566 if (init_other()) quit("Cannot initialize other stuff");
2570 /* Initialize some other arrays */
2573 note("[¥Ç¡¼¥¿¤Î½é´ü²½Ãæ... (¥¢¥í¥±¡¼¥·¥ç¥ó)]");
2574 if (init_alloc()) quit("¥¢¥í¥±¡¼¥·¥ç¥ó¡¦¥¹¥¿¥Ã¥Õ½é´ü²½ÉÔǽ");
2576 note("[Initializing arrays... (alloc)]");
2577 if (init_alloc()) quit("Cannot initialize alloc stuff");
2582 /*** Load default user pref files ***/
2584 /* Initialize feature info */
2586 note("[¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤ò½é´ü²½¤·¤Æ¤¤¤Þ¤¹...]");
2588 note("[Initializing user pref files...]");
2592 /* Access the "basic" pref file */
2593 strcpy(buf, "pref.prf");
2595 /* Process that file */
2596 process_pref_file(buf);
2598 /* Access the "basic" system pref file */
2599 sprintf(buf, "pref-%s.prf", ANGBAND_SYS);
2601 /* Process that file */
2602 process_pref_file(buf);
2606 note("[½é´ü²½½ªÎ»]");
2608 note("[Initialization complete]");
2614 * Get check sum in string form
2616 cptr get_check_sum(void)
2618 return format("%02x%02x%02x%02x%02x%02x%02x%02x%02x",