3 /* Purpose: Initialization (part 2) -BEN- */
8 #ifdef CHECK_MODIFICATION_TIME
11 #endif /* CHECK_MODIFICATION_TIME */
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
20 * Several of the arrays for Angband are built from "template" files in
21 * the "lib/file" directory, from which quick-load binary "image" files
22 * are constructed whenever they are not present in the "lib/data"
23 * directory, or if those files become obsolete, if we are allowed.
25 * Warning -- the "ascii" file parsers use a minor hack to collect the
26 * name and text information in a single pass. Thus, the game will not
27 * be able to load any template file with more than 20K of names or 60K
28 * of text, even though technically, up to 64K should be legal.
30 * The "init1.c" file is used only to parse the ascii template files,
31 * to create the binary image files. If you include the binary image
32 * files instead of the ascii template files, then you can undefine
33 * "ALLOW_TEMPLATES", saving about 20K by removing "init1.c". Note
34 * that the binary image files are extremely system dependant.
40 * Find the default paths to all of our important sub-directories.
42 * The purpose of each sub-directory is described in "variable.c".
44 * All of the sub-directories should, by default, be located inside
45 * the main "lib" directory, whose location is very system dependant.
47 * This function takes a writable buffer, initially containing the
48 * "path" to the "lib" directory, for example, "/pkg/lib/angband/",
49 * or a system dependant string, for example, ":lib:". The buffer
50 * must be large enough to contain at least 32 more characters.
52 * Various command line options may allow some of the important
53 * directories to be changed to user-specified directories, most
54 * importantly, the "info" and "user" and "save" directories,
55 * but this is done after this function, see "main.c".
57 * In general, the initial path should end in the appropriate "PATH_SEP"
58 * string. All of the "sub-directory" paths (created below or supplied
59 * by the user) will NOT end in the "PATH_SEP" string, see the special
60 * "path_build()" function in "util.c" for more information.
62 * Mega-Hack -- support fat raw files under NEXTSTEP, using special
63 * "suffixed" directories for the "ANGBAND_DIR_DATA" directory, but
64 * requiring the directories to be created by hand by the user.
66 * Hack -- first we free all the strings, since this is known
67 * to succeed even if the strings have not been allocated yet,
68 * as long as the variables start out as "NULL". This allows
69 * this function to be called multiple times, for example, to
70 * try several base "path" values until a good one is found.
72 void init_file_paths(char *path)
76 #ifdef PRIVATE_USER_PATH
78 #endif /* PRIVATE_USER_PATH */
80 /*** Free everything ***/
82 /* Free the main path */
83 string_free(ANGBAND_DIR);
85 /* Free the sub-paths */
86 string_free(ANGBAND_DIR_APEX);
87 string_free(ANGBAND_DIR_BONE);
88 string_free(ANGBAND_DIR_DATA);
89 string_free(ANGBAND_DIR_EDIT);
90 string_free(ANGBAND_DIR_SCRIPT);
91 string_free(ANGBAND_DIR_FILE);
92 string_free(ANGBAND_DIR_HELP);
93 string_free(ANGBAND_DIR_INFO);
94 string_free(ANGBAND_DIR_SAVE);
95 string_free(ANGBAND_DIR_USER);
96 string_free(ANGBAND_DIR_XTRA);
99 /*** Prepare the "path" ***/
101 /* Hack -- save the main directory */
102 ANGBAND_DIR = string_make(path);
104 /* Prepare to append to the Base Path */
105 tail = path + strlen(path);
110 /*** Use "flat" paths with VM/ESA ***/
112 /* Use "blank" path names */
113 ANGBAND_DIR_APEX = string_make("");
114 ANGBAND_DIR_BONE = string_make("");
115 ANGBAND_DIR_DATA = string_make("");
116 ANGBAND_DIR_EDIT = string_make("");
117 ANGBAND_DIR_SCRIPT = string_make("");
118 ANGBAND_DIR_FILE = string_make("");
119 ANGBAND_DIR_HELP = string_make("");
120 ANGBAND_DIR_INFO = string_make("");
121 ANGBAND_DIR_SAVE = string_make("");
122 ANGBAND_DIR_USER = string_make("");
123 ANGBAND_DIR_XTRA = string_make("");
129 /*** Build the sub-directory names ***/
131 /* Build a path name */
132 strcpy(tail, "apex");
133 ANGBAND_DIR_APEX = string_make(path);
135 /* Build a path name */
136 strcpy(tail, "bone");
137 ANGBAND_DIR_BONE = string_make(path);
139 /* Build a path name */
140 strcpy(tail, "data");
141 ANGBAND_DIR_DATA = string_make(path);
143 /* Build a path name */
144 strcpy(tail, "edit");
145 ANGBAND_DIR_EDIT = string_make(path);
147 /* Build a path name */
148 strcpy(tail, "script");
149 ANGBAND_DIR_SCRIPT = string_make(path);
151 /* Build a path name */
152 strcpy(tail, "file");
153 ANGBAND_DIR_FILE = string_make(path);
155 /* Build a path name */
156 strcpy(tail, "help");
157 ANGBAND_DIR_HELP = string_make(path);
159 /* Build a path name */
160 strcpy(tail, "info");
161 ANGBAND_DIR_INFO = string_make(path);
163 /* Build a path name */
164 strcpy(tail, "pref");
165 ANGBAND_DIR_PREF = string_make(path);
167 /* Build a path name */
168 strcpy(tail, "save");
169 ANGBAND_DIR_SAVE = string_make(path);
171 #ifdef PRIVATE_USER_PATH
173 /* Build the path to the user specific directory */
174 path_build(buf, 1024, PRIVATE_USER_PATH, VERSION_NAME);
176 /* Build a relative path name */
177 ANGBAND_DIR_USER = string_make(buf);
179 #else /* PRIVATE_USER_PATH */
181 /* Build a path name */
182 strcpy(tail, "user");
183 ANGBAND_DIR_USER = string_make(path);
185 #endif /* PRIVATE_USER_PATH */
187 /* Build a path name */
188 strcpy(tail, "xtra");
189 ANGBAND_DIR_XTRA = string_make(path);
196 /* Allow "fat binary" usage with NeXT */
217 /* Use special directory */
220 /* Forget the old path name */
221 string_free(ANGBAND_DIR_DATA);
223 /* Build a new path name */
224 sprintf(tail, "data-%s", next);
225 ANGBAND_DIR_DATA = string_make(path);
235 #ifdef ALLOW_TEMPLATES
239 * Hack -- help give useful error messages
246 * Hack -- help initialize the fake "name" and "text" arrays when
247 * parsing an "ascii" template file.
251 u32b E_fake_name_size;
257 * Standard error message text
259 cptr err_str[PARSE_ERROR_MAX] =
267 "¤ª¤«¤·¤Ê¥Õ¥é¥°Â¸ºß",
275 "missing record header",
276 "non-sequential records",
277 "invalid flag specification",
278 "undefined directive",
280 "coordinates out of bounds",
287 #endif /* ALLOW_TEMPLATES */
290 #ifdef CHECK_MODIFICATION_TIME
292 static errr check_modification_date(int fd, cptr template_file)
296 struct stat txt_stat, raw_stat;
298 /* Build the filename */
299 path_build(buf, 1024, ANGBAND_DIR_EDIT, template_file);
301 /* Access stats on text file */
302 if (stat(buf, &txt_stat))
304 /* No text file - continue */
307 /* Access stats on raw file */
308 else if (fstat(fd, &raw_stat))
314 /* Ensure text file is not newer than raw file */
315 else if (txt_stat.st_mtime > raw_stat.st_mtime)
317 /* Reprocess text file */
324 #endif /* CHECK_MODIFICATION_TIME */
328 /*** Initialize from binary image files ***/
332 * Initialize the "f_info" array, by parsing a binary "image" file
334 static errr init_f_info_raw(int fd)
338 /* Read and Verify the header */
339 if (fd_read(fd, (char*)(&test), sizeof(header)) ||
340 (test.v_major != f_head->v_major) ||
341 (test.v_minor != f_head->v_minor) ||
342 (test.v_patch != f_head->v_patch) ||
343 (test.v_extra != f_head->v_extra) ||
344 (test.info_num != f_head->info_num) ||
345 (test.info_len != f_head->info_len) ||
346 (test.head_size != f_head->head_size) ||
347 (test.info_size != f_head->info_size))
354 /* Accept the header */
358 /* Allocate the "f_info" array */
359 C_MAKE(f_info, f_head->info_num, feature_type);
361 /* Read the "f_info" array */
362 fd_read(fd, (char*)(f_info), f_head->info_size);
365 /* Allocate the "f_name" array */
366 C_MAKE(f_name, f_head->name_size, char);
368 /* Read the "f_name" array */
369 fd_read(fd, (char*)(f_name), f_head->name_size);
373 /* Allocate the "E_f_name" array */
374 C_MAKE(E_f_name, f_head->E_name_size, char);
376 /* Read the "E_f_name" array */
377 fd_read(fd, (char*)(E_f_name), f_head->E_name_size);
380 #ifndef DELAY_LOAD_F_TEXT
382 /* Allocate the "f_text" array */
383 C_MAKE(f_text, f_head->text_size, char);
385 /* Read the "f_text" array */
386 fd_read(fd, (char*)(f_text), f_head->text_size);
388 #endif /* DELAY_LOAD_F_TEXT */
398 * Initialize the "f_info" array
400 * Note that we let each entry have a unique "name" and "text" string,
401 * even if the string happens to be empty (everyone has a unique '\0').
403 static errr init_f_info(void)
417 /*** Make the header ***/
419 /* Allocate the "header" */
420 MAKE(f_head, header);
422 /* Save the "version" */
423 f_head->v_major = FAKE_VER_MAJOR;
424 f_head->v_minor = FAKE_VER_MINOR;
425 f_head->v_patch = FAKE_VER_PATCH;
428 /* Save the "record" information */
429 f_head->info_num = max_f_idx;
430 f_head->info_len = sizeof(feature_type);
432 /* Save the size of "f_head" and "f_info" */
433 f_head->head_size = sizeof(header);
434 f_head->info_size = f_head->info_num * f_head->info_len;
437 #ifdef ALLOW_TEMPLATES
439 /*** Load the binary image file ***/
441 /* Build the filename */
443 path_build(buf, 1024, ANGBAND_DIR_DATA, "f_info_j.raw");
445 path_build(buf, 1024, ANGBAND_DIR_DATA, "f_info.raw");
449 /* Attempt to open the "raw" file */
450 fd = fd_open(buf, O_RDONLY);
452 /* Process existing "raw" file */
455 #ifdef CHECK_MODIFICATION_TIME
457 err = check_modification_date(fd, "f_info_j.txt");
459 #endif /* CHECK_MODIFICATION_TIME */
461 /* Attempt to parse the "raw" file */
463 err = init_f_info_raw(fd);
469 if (!err) return (0);
473 /*** Make the fake arrays ***/
475 /* Fake the size of "f_name" and "f_text" */
476 fake_name_size = FAKE_NAME_SIZE;
479 E_fake_name_size = FAKE_NAME_SIZE;
481 fake_text_size = FAKE_TEXT_SIZE;
483 /* Allocate the "f_info" array */
484 C_MAKE(f_info, f_head->info_num, feature_type);
486 /* Hack -- make "fake" arrays */
487 C_MAKE(f_name, fake_name_size, char);
490 C_MAKE(E_f_name, E_fake_name_size, char);
492 C_MAKE(f_text, fake_text_size, char);
495 /*** Load the ascii template file ***/
497 /* Build the filename */
499 path_build(buf, 1024, ANGBAND_DIR_EDIT, "f_info_j.txt");
502 fp = my_fopen(buf, "r");
506 if (!fp) quit("'f_info_j.txt'¥Õ¥¡¥¤¥ë¤ò¥ª¡¼¥×¥ó¤Ç¤¤Þ¤»¤ó¡£");
508 if (!fp) quit("Cannot open 'f_info.txt' file.");
513 err = init_f_info_txt(fp, buf);
525 oops = ((err > 0) ? err_str[err] : "̤ÃΤÎ");
528 msg_format("'f_info_j.txt'¥Õ¥¡¥¤¥ë¤Î %d ¹ÔÌܤ˥¨¥é¡¼¡£", error_line);
529 msg_format("¥ì¥³¡¼¥É %d ¤Ï '%s' ¥¨¥é¡¼¤¬¤¢¤ê¤Þ¤¹¡£", error_idx, oops);
530 msg_format("¹½Ê¸ '%s'¡£", buf);
534 quit("'f_info_j.txt'¥Õ¥¡¥¤¥ë¤Ë¥¨¥é¡¼");
537 oops = (((err > 0) && (err < PARSE_ERROR_MAX)) ? err_str[err] : "unknown");
540 msg_format("Error %d at line %d of 'f_info.txt'.", err, error_line);
541 msg_format("Record %d contains a '%s' error.", error_idx, oops);
542 msg_format("Parsing '%s'.", buf);
546 quit("Error in 'f_info.txt' file.");
552 /*** Dump the binary image file ***/
554 /* File type is "DATA" */
555 FILE_TYPE(FILE_TYPE_DATA);
557 /* Build the filename */
559 path_build(buf, 1024, ANGBAND_DIR_DATA, "f_info_j.raw");
561 path_build(buf, 1024, ANGBAND_DIR_DATA, "f_info.raw");
565 /* Kill the old file */
568 /* Attempt to create the raw file */
569 fd = fd_make(buf, mode);
571 /* Dump to the file */
575 fd_write(fd, (char*)(f_head), f_head->head_size);
577 /* Dump the "f_info" array */
578 fd_write(fd, (char*)(f_info), f_head->info_size);
580 /* Dump the "f_name" array */
581 fd_write(fd, (char*)(f_name), f_head->name_size);
584 /* Dump the "E_f_name" array */
585 fd_write(fd, (char*)(E_f_name), f_head->E_name_size);
588 /* Dump the "f_text" array */
589 fd_write(fd, (char*)(f_text), f_head->text_size);
596 /*** Kill the fake arrays ***/
598 /* Free the "f_info" array */
599 C_KILL(f_info, f_head->info_num, feature_type);
601 /* Hack -- Free the "fake" arrays */
602 C_KILL(f_name, fake_name_size, char);
605 C_KILL(E_f_name, E_fake_name_size, char);
607 C_KILL(f_text, fake_text_size, char);
609 /* Forget the array sizes */
613 E_fake_name_size = 0;
617 #endif /* ALLOW_TEMPLATES */
620 /*** Load the binary image file ***/
622 /* Build the filename */
624 path_build(buf, 1024, ANGBAND_DIR_DATA, "f_info_j.raw");
626 path_build(buf, 1024, ANGBAND_DIR_DATA, "f_info.raw");
630 /* Attempt to open the "raw" file */
631 fd = fd_open(buf, O_RDONLY);
633 /* Process existing "raw" file */
635 if (fd < 0) quit("'f_info_j.raw'¥Õ¥¡¥¤¥ë¤ò¥í¡¼¥É¤Ç¤¤Þ¤»¤ó¡£");
637 if (fd < 0) quit("Cannot load 'f_info.raw' file.");
641 /* Attempt to parse the "raw" file */
642 err = init_f_info_raw(fd);
649 if (err) quit("'f_info_j.raw'¥Õ¥¡¥¤¥ë¤ò²òÀϤǤ¤Þ¤»¤ó¡£");
651 if (err) quit("Cannot parse 'f_info.raw' file.");
661 * Initialize the "k_info" array, by parsing a binary "image" file
663 static errr init_k_info_raw(int fd)
667 /* Read and Verify the header */
668 if (fd_read(fd, (char*)(&test), sizeof(header)) ||
669 (test.v_major != k_head->v_major) ||
670 (test.v_minor != k_head->v_minor) ||
671 (test.v_patch != k_head->v_patch) ||
672 (test.v_extra != k_head->v_extra) ||
673 (test.info_num != k_head->info_num) ||
674 (test.info_len != k_head->info_len) ||
675 (test.head_size != k_head->head_size) ||
676 (test.info_size != k_head->info_size))
683 /* Accept the header */
686 /* Allocate the "k_info" array */
687 C_MAKE(k_info, k_head->info_num, object_kind);
689 /* Read the "k_info" array */
690 fd_read(fd, (char*)(k_info), k_head->info_size);
693 /* Allocate the "k_name" array */
694 C_MAKE(k_name, k_head->name_size, char);
696 /* Read the "k_name" array */
697 fd_read(fd, (char*)(k_name), k_head->name_size);
702 /* Allocate the "E_k_name" array */
703 C_MAKE(E_k_name, k_head->E_name_size, char);
705 /* Read the "E_k_name" array */
706 fd_read(fd, (char*)(E_k_name), k_head->E_name_size);
708 #ifndef DELAY_LOAD_K_TEXT
710 /* Allocate the "k_text" array */
711 C_MAKE(k_text, k_head->text_size, char);
713 /* Read the "k_text" array */
714 fd_read(fd, (char*)(k_text), k_head->text_size);
716 #endif /* DELAY_LOAD_K_TEXT */
724 * Initialize the "k_info" array
726 * Note that we let each entry have a unique "name" and "text" string,
727 * even if the string happens to be empty (everyone has a unique '\0').
729 static errr init_k_info(void)
743 /*** Make the header ***/
745 /* Allocate the "header" */
746 MAKE(k_head, header);
748 /* Save the "version" */
749 k_head->v_major = FAKE_VER_MAJOR;
750 k_head->v_minor = FAKE_VER_MINOR;
751 k_head->v_patch = FAKE_VER_PATCH;
754 /* Save the "record" information */
755 k_head->info_num = max_k_idx;
756 k_head->info_len = sizeof(object_kind);
758 /* Save the size of "k_head" and "k_info" */
759 k_head->head_size = sizeof(header);
760 k_head->info_size = k_head->info_num * k_head->info_len;
763 #ifdef ALLOW_TEMPLATES
765 /*** Load the binary image file ***/
767 /* Build the filename */
769 path_build(buf, 1024, ANGBAND_DIR_DATA, "k_info_j.raw");
771 path_build(buf, 1024, ANGBAND_DIR_DATA, "k_info.raw");
775 /* Attempt to open the "raw" file */
776 fd = fd_open(buf, O_RDONLY);
778 /* Process existing "raw" file */
781 #ifdef CHECK_MODIFICATION_TIME
783 err = check_modification_date(fd, "k_info_j.txt");
785 #endif /* CHECK_MODIFICATION_TIME */
787 /* Attempt to parse the "raw" file */
789 err = init_k_info_raw(fd);
798 if (init_object_kind_list_callback()) return (0);
799 #endif /* USE_SCRIPT */
806 /*** Make the fake arrays ***/
808 /* Fake the size of "k_name" and "k_text" */
809 fake_name_size = FAKE_NAME_SIZE;
812 E_fake_name_size = FAKE_NAME_SIZE;
814 fake_text_size = FAKE_TEXT_SIZE;
816 /* Allocate the "k_info" array */
817 C_MAKE(k_info, k_head->info_num, object_kind);
819 /* Hack -- make "fake" arrays */
820 C_MAKE(k_name, fake_name_size, char);
823 C_MAKE(E_k_name, E_fake_name_size, char);
825 C_MAKE(k_text, fake_text_size, char);
828 /*** Load the ascii template file ***/
830 /* Build the filename */
832 path_build(buf, 1024, ANGBAND_DIR_EDIT, "k_info_j.txt");
835 fp = my_fopen(buf, "r");
839 if (!fp) quit("'k_info_j.txt'¥Õ¥¡¥¤¥ë¤ò¥ª¡¼¥×¥ó¤Ç¤¤Þ¤»¤ó¡£");
841 if (!fp) quit("Cannot open 'k_info.txt' file.");
846 err = init_k_info_txt(fp, buf);
858 oops = ((err > 0) ? err_str[err] : "̤ÃΤÎ");
861 msg_format("'k_info_j.txt'¥Õ¥¡¥¤¥ë¤Î %d ¹ÔÌܤ˥¨¥é¡¼¡£", error_line);
862 msg_format("¥ì¥³¡¼¥É %d ¤Ï '%s' ¥¨¥é¡¼¤¬¤¢¤ê¤Þ¤¹¡£", error_idx, oops);
863 msg_format("¹½Ê¸ '%s'¡£", buf);
867 quit("'k_info_j.txt'¥Õ¥¡¥¤¥ë¤Ë¥¨¥é¡¼");
870 oops = (((err > 0) && (err < PARSE_ERROR_MAX)) ? err_str[err] : "unknown");
873 msg_format("Error %d at line %d of 'k_info.txt'.", err, error_line);
874 msg_format("Record %d contains a '%s' error.", error_idx, oops);
875 msg_format("Parsing '%s'.", buf);
879 quit("Error in 'k_info.txt' file.");
885 /*** Dump the binary image file ***/
887 /* File type is "DATA" */
888 FILE_TYPE(FILE_TYPE_DATA);
890 /* Build the filename */
892 path_build(buf, 1024, ANGBAND_DIR_DATA, "k_info_j.raw");
894 path_build(buf, 1024, ANGBAND_DIR_DATA, "k_info.raw");
898 /* Kill the old file */
901 /* Attempt to create the raw file */
902 fd = fd_make(buf, mode);
904 /* Dump to the file */
908 fd_write(fd, (char*)(k_head), k_head->head_size);
910 /* Dump the "k_info" array */
911 fd_write(fd, (char*)(k_info), k_head->info_size);
913 /* Dump the "k_name" array */
914 fd_write(fd, (char*)(k_name), k_head->name_size);
918 /* Dump the "E_k_name" array */
919 fd_write(fd, (char*)(E_k_name), k_head->E_name_size);
921 /* Dump the "k_text" array */
922 fd_write(fd, (char*)(k_text), k_head->text_size);
929 /*** Kill the fake arrays ***/
931 /* Free the "k_info" array */
932 C_KILL(k_info, k_head->info_num, object_kind);
934 /* Hack -- Free the "fake" arrays */
935 C_KILL(k_name, fake_name_size, char);
938 C_KILL(E_k_name, E_fake_name_size, char);
940 C_KILL(k_text, fake_text_size, char);
942 /* Forget the array sizes */
946 E_fake_name_size = 0;
950 #endif /* ALLOW_TEMPLATES */
953 /*** Load the binary image file ***/
955 /* Build the filename */
957 path_build(buf, 1024, ANGBAND_DIR_DATA, "k_info_j.raw");
959 path_build(buf, 1024, ANGBAND_DIR_DATA, "k_info.raw");
963 /* Attempt to open the "raw" file */
964 fd = fd_open(buf, O_RDONLY);
966 /* Process existing "raw" file */
968 if (fd < 0) quit("'k_info_j.raw'¥Õ¥¡¥¤¥ë¤ò¥í¡¼¥É¤Ç¤¤Þ¤»¤ó¡£");
970 if (fd < 0) quit("Cannot load 'k_info.raw' file.");
974 /* Attempt to parse the "raw" file */
975 err = init_k_info_raw(fd);
982 if (err) quit("'k_info_j.raw'¥Õ¥¡¥¤¥ë¤ò²òÀϤǤ¤Þ¤»¤ó¡£");
984 if (err) quit("Cannot parse 'k_info.raw' file.");
990 if (init_object_kind_list_callback()) return (0);
991 #endif /* USE_SCRIPT */
1000 * Initialize the "a_info" array, by parsing a binary "image" file
1002 static errr init_a_info_raw(int fd)
1006 /* Read and Verify the header */
1007 if (fd_read(fd, (char*)(&test), sizeof(header)) ||
1008 (test.v_major != a_head->v_major) ||
1009 (test.v_minor != a_head->v_minor) ||
1010 (test.v_patch != a_head->v_patch) ||
1011 (test.v_extra != a_head->v_extra) ||
1012 (test.info_num != a_head->info_num) ||
1013 (test.info_len != a_head->info_len) ||
1014 (test.head_size != a_head->head_size) ||
1015 (test.info_size != a_head->info_size))
1022 /* Accept the header */
1026 /* Allocate the "a_info" array */
1027 C_MAKE(a_info, a_head->info_num, artifact_type);
1029 /* Read the "a_info" array */
1030 fd_read(fd, (char*)(a_info), a_head->info_size);
1033 /* Allocate the "a_name" array */
1034 C_MAKE(a_name, a_head->name_size, char);
1036 /* Read the "a_name" array */
1037 fd_read(fd, (char*)(a_name), a_head->name_size);
1042 /* Allocate the "E_a_name" array */
1043 C_MAKE(E_a_name, a_head->E_name_size, char);
1045 /* Read the "E_a_name" array */
1046 fd_read(fd, (char*)(E_a_name), a_head->E_name_size);
1049 /* Allocate the "a_text" array */
1050 C_MAKE(a_text, a_head->text_size, char);
1052 /* Read the "a_text" array */
1053 fd_read(fd, (char*)(a_text), a_head->text_size);
1062 * Initialize the "a_info" array
1064 * Note that we let each entry have a unique "name" and "text" string,
1065 * even if the string happens to be empty (everyone has a unique '\0').
1067 static errr init_a_info(void)
1077 /* General buffer */
1081 /*** Make the "header" ***/
1083 /* Allocate the "header" */
1084 MAKE(a_head, header);
1086 /* Save the "version" */
1087 a_head->v_major = FAKE_VER_MAJOR;
1088 a_head->v_minor = FAKE_VER_MINOR;
1089 a_head->v_patch = FAKE_VER_PATCH;
1090 a_head->v_extra = 0;
1092 /* Save the "record" information */
1093 a_head->info_num = max_a_idx;
1094 a_head->info_len = sizeof(artifact_type);
1096 /* Save the size of "a_head" and "a_info" */
1097 a_head->head_size = sizeof(header);
1098 a_head->info_size = a_head->info_num * a_head->info_len;
1101 #ifdef ALLOW_TEMPLATES
1103 /*** Load the binary image file ***/
1105 /* Build the filename */
1107 path_build(buf, 1024, ANGBAND_DIR_DATA, "a_info_j.raw");
1109 path_build(buf, 1024, ANGBAND_DIR_DATA, "a_info.raw");
1113 /* Attempt to open the "raw" file */
1114 fd = fd_open(buf, O_RDONLY);
1116 /* Process existing "raw" file */
1119 #ifdef CHECK_MODIFICATION_TIME
1121 err = check_modification_date(fd, "a_info_j.txt");
1123 #endif /* CHECK_MODIFICATION_TIME */
1125 /* Attempt to parse the "raw" file */
1127 err = init_a_info_raw(fd);
1133 if (!err) return (0);
1137 /*** Make the fake arrays ***/
1139 /* Fake the size of "a_name" and "a_text" */
1140 fake_name_size = FAKE_NAME_SIZE;
1143 E_fake_name_size = FAKE_NAME_SIZE;
1145 fake_text_size = FAKE_TEXT_SIZE;
1147 /* Allocate the "a_info" array */
1148 C_MAKE(a_info, a_head->info_num, artifact_type);
1150 /* Hack -- make "fake" arrays */
1151 C_MAKE(a_name, fake_name_size, char);
1154 C_MAKE(E_a_name, E_fake_name_size, char);
1156 C_MAKE(a_text, fake_text_size, char);
1159 /*** Load the ascii template file ***/
1161 /* Build the filename */
1163 path_build(buf, 1024, ANGBAND_DIR_EDIT, "a_info_j.txt");
1166 fp = my_fopen(buf, "r");
1170 if (!fp) quit("'a_info_j.txt'¥Õ¥¡¥¤¥ë¤ò¥ª¡¼¥×¥ó¤Ç¤¤Þ¤»¤ó¡£");
1172 if (!fp) quit("Cannot open 'a_info.txt' file.");
1176 /* Parse the file */
1177 err = init_a_info_txt(fp, buf);
1189 oops = ((err > 0) ? err_str[err] : "̤ÃΤÎ");
1192 msg_format("'a_info_j.txt'¥Õ¥¡¥¤¥ë¤Î %d ¹ÔÌܤ˥¨¥é¡¼¡£", error_line);
1193 msg_format("¥ì¥³¡¼¥É %d ¤Ï '%s' ¥¨¥é¡¼¤¬¤¢¤ê¤Þ¤¹¡£", error_idx, oops);
1194 msg_format("¹½Ê¸ '%s'¡£", buf);
1198 quit("'a_info_j.txt'¥Õ¥¡¥¤¥ë¤Ë¥¨¥é¡¼");
1201 oops = (((err > 0) && (err < PARSE_ERROR_MAX)) ? err_str[err] : "unknown");
1204 msg_format("Error %d at line %d of 'a_info.txt'.", err, error_line);
1205 msg_format("Record %d contains a '%s' error.", error_idx, oops);
1206 msg_format("Parsing '%s'.", buf);
1210 quit("Error in 'a_info.txt' file.");
1216 /*** Dump the binary image file ***/
1218 /* File type is "DATA" */
1219 FILE_TYPE(FILE_TYPE_DATA);
1221 /* Build the filename */
1223 path_build(buf, 1024, ANGBAND_DIR_DATA, "a_info_j.raw");
1225 path_build(buf, 1024, ANGBAND_DIR_DATA, "a_info.raw");
1229 /* Kill the old file */
1232 /* Attempt to create the raw file */
1233 fd = fd_make(buf, mode);
1235 /* Dump to the file */
1239 fd_write(fd, (char*)(a_head), a_head->head_size);
1241 /* Dump the "a_info" array */
1242 fd_write(fd, (char*)(a_info), a_head->info_size);
1244 /* Dump the "a_name" array */
1245 fd_write(fd, (char*)(a_name), a_head->name_size);
1249 /* Dump the "E_a_name" array */
1250 fd_write(fd, (char*)(E_a_name), a_head->E_name_size);
1252 /* Dump the "a_text" array */
1253 fd_write(fd, (char*)(a_text), a_head->text_size);
1260 /*** Kill the fake arrays ***/
1262 /* Free the "a_info" array */
1263 C_KILL(a_info, a_head->info_num, artifact_type);
1265 /* Hack -- Free the "fake" arrays */
1266 C_KILL(a_name, fake_name_size, char);
1269 C_KILL(E_a_name, E_fake_name_size, char);
1271 C_KILL(a_text, fake_text_size, char);
1273 /* Forget the array sizes */
1277 E_fake_name_size = 0;
1281 #endif /* ALLOW_TEMPLATES */
1284 /*** Load the binary image file ***/
1286 /* Build the filename */
1288 path_build(buf, 1024, ANGBAND_DIR_DATA, "a_info_j.raw");
1290 path_build(buf, 1024, ANGBAND_DIR_DATA, "a_info.raw");
1294 /* Attempt to open the "raw" file */
1295 fd = fd_open(buf, O_RDONLY);
1297 /* Process existing "raw" file */
1299 if (fd < 0) quit("'a_info_j.raw'¥Õ¥¡¥¤¥ë¤ò¥í¡¼¥É¤Ç¤¤Þ¤»¤ó¡£");
1301 if (fd < 0) quit("Cannot open 'a_info.raw' file.");
1305 /* Attempt to parse the "raw" file */
1306 err = init_a_info_raw(fd);
1313 if (err) quit("'a_info_j.raw'¥Õ¥¡¥¤¥ë¤ò²òÀϤǤ¤Þ¤»¤ó¡£");
1315 if (err) quit("Cannot parse 'a_info.raw' file.");
1326 * Initialize the "e_info" array, by parsing a binary "image" file
1328 static errr init_e_info_raw(int fd)
1332 /* Read and Verify the header */
1333 if (fd_read(fd, (char*)(&test), sizeof(header)) ||
1334 (test.v_major != e_head->v_major) ||
1335 (test.v_minor != e_head->v_minor) ||
1336 (test.v_patch != e_head->v_patch) ||
1337 (test.v_extra != e_head->v_extra) ||
1338 (test.info_num != e_head->info_num) ||
1339 (test.info_len != e_head->info_len) ||
1340 (test.head_size != e_head->head_size) ||
1341 (test.info_size != e_head->info_size))
1348 /* Accept the header */
1352 /* Allocate the "e_info" array */
1353 C_MAKE(e_info, e_head->info_num, ego_item_type);
1355 /* Read the "e_info" array */
1356 fd_read(fd, (char*)(e_info), e_head->info_size);
1359 /* Allocate the "e_name" array */
1360 C_MAKE(e_name, e_head->name_size, char);
1362 /* Read the "e_name" array */
1363 fd_read(fd, (char*)(e_name), e_head->name_size);
1368 /* Allocate the "E_e_name" array */
1369 C_MAKE(E_e_name, e_head->E_name_size, char);
1371 /* Read the "E_e_name" array */
1372 fd_read(fd, (char*)(E_e_name), e_head->E_name_size);
1374 #ifndef DELAY_LOAD_E_TEXT
1376 /* Allocate the "e_text" array */
1377 C_MAKE(e_text, e_head->text_size, char);
1379 /* Read the "e_text" array */
1380 fd_read(fd, (char*)(e_text), e_head->text_size);
1382 #endif /* DELAY_LOAD_E_TEXT */
1392 * Initialize the "e_info" array
1394 * Note that we let each entry have a unique "name" and "text" string,
1395 * even if the string happens to be empty (everyone has a unique '\0').
1397 static errr init_e_info(void)
1407 /* General buffer */
1411 /*** Make the "header" ***/
1413 /* Allocate the "header" */
1414 MAKE(e_head, header);
1416 /* Save the "version" */
1417 e_head->v_major = FAKE_VER_MAJOR;
1418 e_head->v_minor = FAKE_VER_MINOR;
1419 e_head->v_patch = FAKE_VER_PATCH;
1420 e_head->v_extra = 0;
1422 /* Save the "record" information */
1423 e_head->info_num = max_e_idx;
1424 e_head->info_len = sizeof(ego_item_type);
1426 /* Save the size of "e_head" and "e_info" */
1427 e_head->head_size = sizeof(header);
1428 e_head->info_size = e_head->info_num * e_head->info_len;
1431 #ifdef ALLOW_TEMPLATES
1433 /*** Load the binary image file ***/
1435 /* Build the filename */
1437 path_build(buf, 1024, ANGBAND_DIR_DATA, "e_info_j.raw");
1439 path_build(buf, 1024, ANGBAND_DIR_DATA, "e_info.raw");
1443 /* Attempt to open the "raw" file */
1444 fd = fd_open(buf, O_RDONLY);
1446 /* Process existing "raw" file */
1450 #ifdef CHECK_MODIFICATION_TIME
1452 err = check_modification_date(fd, "e_info_j.txt");
1454 #endif /* CHECK_MODIFICATION_TIME */
1457 /* Attempt to parse the "raw" file */
1459 err = init_e_info_raw(fd);
1465 if (!err) return (0);
1469 /*** Make the fake arrays ***/
1471 /* Fake the size of "e_name" and "e_text" */
1472 fake_name_size = FAKE_NAME_SIZE;
1475 E_fake_name_size = FAKE_NAME_SIZE;
1477 fake_text_size = FAKE_TEXT_SIZE;
1479 /* Allocate the "e_info" array */
1480 C_MAKE(e_info, e_head->info_num, ego_item_type);
1482 /* Hack -- make "fake" arrays */
1483 C_MAKE(e_name, fake_name_size, char);
1486 C_MAKE(E_e_name, E_fake_name_size, char);
1488 C_MAKE(e_text, fake_text_size, char);
1491 /*** Load the ascii template file ***/
1493 /* Build the filename */
1495 path_build(buf, 1024, ANGBAND_DIR_EDIT, "e_info_j.txt");
1498 fp = my_fopen(buf, "r");
1502 if (!fp) quit("'e_info_j.txt'¥Õ¥¡¥¤¥ë¤ò¥ª¡¼¥×¥ó¤Ç¤¤Þ¤»¤ó¡£");
1504 if (!fp) quit("Cannot open 'e_info.txt' file.");
1508 /* Parse the file */
1509 err = init_e_info_txt(fp, buf);
1521 oops = ((err > 0) ? err_str[err] : "̤ÃΤÎ");
1524 msg_format("'e_info_j.txt'¥Õ¥¡¥¤¥ë¤Î %d ¹ÔÌܤ˥¨¥é¡¼¡£", error_line);
1525 msg_format("¥ì¥³¡¼¥É %d ¤Ï '%s' ¥¨¥é¡¼¤¬¤¢¤ê¤Þ¤¹¡£", error_idx, oops);
1526 msg_format("¹½Ê¸ '%s'¡£", buf);
1530 quit("'e_info_j.txt'¥Õ¥¡¥¤¥ë¤Ë¥¨¥é¡¼");
1533 oops = (((err > 0) && (err < PARSE_ERROR_MAX)) ? err_str[err] : "unknown");
1536 msg_format("Error %d at line %d of 'e_info.txt'.", err, error_line);
1537 msg_format("Record %d contains a '%s' error.", error_idx, oops);
1538 msg_format("Parsing '%s'.", buf);
1542 quit("Error in 'e_info.txt' file.");
1548 /*** Dump the binary image file ***/
1550 /* File type is "DATA" */
1551 FILE_TYPE(FILE_TYPE_DATA);
1553 /* Build the filename */
1555 path_build(buf, 1024, ANGBAND_DIR_DATA, "e_info_j.raw");
1557 path_build(buf, 1024, ANGBAND_DIR_DATA, "e_info.raw");
1561 /* Kill the old file */
1564 /* Attempt to create the raw file */
1565 fd = fd_make(buf, mode);
1567 /* Dump to the file */
1571 fd_write(fd, (char*)(e_head), e_head->head_size);
1573 /* Dump the "e_info" array */
1574 fd_write(fd, (char*)(e_info), e_head->info_size);
1576 /* Dump the "e_name" array */
1577 fd_write(fd, (char*)(e_name), e_head->name_size);
1581 /* Dump the "E_e_name" array */
1582 fd_write(fd, (char*)(E_e_name), e_head->E_name_size);
1584 /* Dump the "e_text" array */
1585 fd_write(fd, (char*)(e_text), e_head->text_size);
1592 /*** Kill the fake arrays ***/
1594 /* Free the "e_info" array */
1595 C_KILL(e_info, e_head->info_num, ego_item_type);
1597 /* Hack -- Free the "fake" arrays */
1598 C_KILL(e_name, fake_name_size, char);
1601 C_KILL(E_e_name, E_fake_name_size, char);
1603 C_KILL(e_text, fake_text_size, char);
1605 /* Forget the array sizes */
1609 E_fake_name_size = 0;
1613 #endif /* ALLOW_TEMPLATES */
1616 /*** Load the binary image file ***/
1618 /* Build the filename */
1620 path_build(buf, 1024, ANGBAND_DIR_DATA, "e_info_j.raw");
1622 path_build(buf, 1024, ANGBAND_DIR_DATA, "e_info.raw");
1626 /* Attempt to open the "raw" file */
1627 fd = fd_open(buf, O_RDONLY);
1629 /* Process existing "raw" file */
1631 if (fd < 0) quit("'e_info_j.raw'¥Õ¥¡¥¤¥ë¤ò¥í¡¼¥É¤Ç¤¤Þ¤»¤ó¡£");
1633 if (fd < 0) quit("Cannot load 'e_info.raw' file.");
1637 /* Attempt to parse the "raw" file */
1638 err = init_e_info_raw(fd);
1645 if (err) quit("'e_info_j.raw'¥Õ¥¡¥¤¥ë¤ò²òÀϤǤ¤Þ¤»¤ó¡£");
1647 if (err) quit("Cannot parse 'e_info.raw' file.");
1658 * Initialize the "r_info" array, by parsing a binary "image" file
1660 static errr init_r_info_raw(int fd)
1664 /* Read and Verify the header */
1665 if (fd_read(fd, (char*)(&test), sizeof(header)) ||
1666 (test.v_major != r_head->v_major) ||
1667 (test.v_minor != r_head->v_minor) ||
1668 (test.v_patch != r_head->v_patch) ||
1669 (test.v_extra != r_head->v_extra) ||
1670 (test.info_num != r_head->info_num) ||
1671 (test.info_len != r_head->info_len) ||
1672 (test.head_size != r_head->head_size) ||
1673 (test.info_size != r_head->info_size))
1680 /* Accept the header */
1684 /* Allocate the "r_info" array */
1685 C_MAKE(r_info, r_head->info_num, monster_race);
1687 /* Read the "r_info" array */
1688 fd_read(fd, (char*)(r_info), r_head->info_size);
1691 /* Allocate the "r_name" array */
1692 C_MAKE(r_name, r_head->name_size, char);
1694 /* Read the "r_name" array */
1695 fd_read(fd, (char*)(r_name), r_head->name_size);
1700 /* Allocate the "E_r_name" array */
1701 C_MAKE(E_r_name, r_head->E_name_size, char);
1703 /* Read the "E_r_name" array */
1704 fd_read(fd, (char*)(E_r_name), r_head->E_name_size);
1706 #ifndef DELAY_LOAD_R_TEXT
1708 /* Allocate the "r_text" array */
1709 C_MAKE(r_text, r_head->text_size, char);
1711 /* Read the "r_text" array */
1712 fd_read(fd, (char*)(r_text), r_head->text_size);
1714 #endif /* DELAY_LOAD_R_TEXT */
1723 * Initialize the "r_info" array
1725 * Note that we let each entry have a unique "name" and "text" string,
1726 * even if the string happens to be empty (everyone has a unique '\0').
1728 static errr init_r_info(void)
1738 /* General buffer */
1742 /*** Make the header ***/
1744 /* Allocate the "header" */
1745 MAKE(r_head, header);
1747 /* Save the "version" */
1748 r_head->v_major = FAKE_VER_MAJOR;
1749 r_head->v_minor = FAKE_VER_MINOR;
1750 r_head->v_patch = FAKE_VER_PATCH;
1751 r_head->v_extra = 0;
1753 /* Save the "record" information */
1754 r_head->info_num = max_r_idx;
1755 r_head->info_len = sizeof(monster_race);
1757 /* Save the size of "r_head" and "r_info" */
1758 r_head->head_size = sizeof(header);
1759 r_head->info_size = r_head->info_num * r_head->info_len;
1762 #ifdef ALLOW_TEMPLATES
1764 /*** Load the binary image file ***/
1766 /* Build the filename */
1768 path_build(buf, 1024, ANGBAND_DIR_DATA, "r_info_j.raw");
1770 path_build(buf, 1024, ANGBAND_DIR_DATA, "r_info.raw");
1774 /* Attempt to open the "raw" file */
1775 fd = fd_open(buf, O_RDONLY);
1777 /* Process existing "raw" file */
1780 #ifdef CHECK_MODIFICATION_TIME
1782 err = check_modification_date(fd, "r_info_j.txt");
1784 #endif /* CHECK_MODIFICATION_TIME */
1786 /* Attempt to parse the "raw" file */
1788 err = init_r_info_raw(fd);
1794 if (!err) return (0);
1798 /*** Make the fake arrays ***/
1800 /* Assume the size of "r_name" and "r_text" */
1801 fake_name_size = FAKE_NAME_SIZE;
1804 E_fake_name_size = FAKE_NAME_SIZE;
1806 fake_text_size = FAKE_TEXT_SIZE;
1808 /* Allocate the "r_info" array */
1809 C_MAKE(r_info, r_head->info_num, monster_race);
1811 /* Hack -- make "fake" arrays */
1812 C_MAKE(r_name, fake_name_size, char);
1815 C_MAKE(E_r_name, E_fake_name_size, char);
1817 C_MAKE(r_text, fake_text_size, char);
1820 /*** Load the ascii template file ***/
1822 /* Build the filename */
1824 path_build(buf, 1024, ANGBAND_DIR_EDIT, "r_info_j.txt");
1827 fp = my_fopen(buf, "r");
1831 if (!fp) quit("'r_info_j.txt'¥Õ¥¡¥¤¥ë¤ò¥ª¡¼¥×¥ó¤Ç¤¤Þ¤»¤ó¡£");
1833 if (!fp) quit("Cannot open 'r_info.txt' file.");
1837 /* Parse the file */
1838 err = init_r_info_txt(fp, buf);
1850 oops = ((err > 0) ? err_str[err] : "̤ÃΤÎ");
1853 msg_format("'r_info_j.txt'¥Õ¥¡¥¤¥ë¤Î %d ¹ÔÌܤ˥¨¥é¡¼¡£", error_line);
1854 msg_format("¥ì¥³¡¼¥É %d ¤Ï '%s' ¥¨¥é¡¼¤¬¤¢¤ê¤Þ¤¹¡£", error_idx, oops);
1855 msg_format("¹½Ê¸ '%s'¡£", buf);
1859 quit("'r_info_j.txt'¥Õ¥¡¥¤¥ë¤Ë¥¨¥é¡¼");
1862 oops = (((err > 0) && (err < PARSE_ERROR_MAX)) ? err_str[err] : "unknown");
1865 msg_format("Error %d at line %d of 'r_info.txt'.", err, error_line);
1866 msg_format("Record %d contains a '%s' error.", error_idx, oops);
1867 msg_format("Parsing '%s'.", buf);
1871 quit("Error in 'r_info.txt' file.");
1877 /*** Dump the binary image file ***/
1879 /* File type is "DATA" */
1880 FILE_TYPE(FILE_TYPE_DATA);
1882 /* Build the filename */
1884 path_build(buf, 1024, ANGBAND_DIR_DATA, "r_info_j.raw");
1886 path_build(buf, 1024, ANGBAND_DIR_DATA, "r_info.raw");
1890 /* Kill the old file */
1893 /* Attempt to create the raw file */
1894 fd = fd_make(buf, mode);
1896 /* Dump to the file */
1900 fd_write(fd, (char*)(r_head), r_head->head_size);
1902 /* Dump the "r_info" array */
1903 fd_write(fd, (char*)(r_info), r_head->info_size);
1905 /* Dump the "r_name" array */
1906 fd_write(fd, (char*)(r_name), r_head->name_size);
1910 /* Dump the "E_r_name" array */
1911 fd_write(fd, (char*)(E_r_name), r_head->E_name_size);
1913 /* Dump the "r_text" array */
1914 fd_write(fd, (char*)(r_text), r_head->text_size);
1921 /*** Kill the fake arrays ***/
1923 /* Free the "r_info" array */
1924 C_KILL(r_info, r_head->info_num, monster_race);
1926 /* Hack -- Free the "fake" arrays */
1927 C_KILL(r_name, fake_name_size, char);
1930 C_KILL(E_r_name, E_fake_name_size, char);
1932 C_KILL(r_text, fake_text_size, char);
1934 /* Forget the array sizes */
1938 E_fake_name_size = 0;
1942 #endif /* ALLOW_TEMPLATES */
1945 /*** Load the binary image file ***/
1947 /* Build the filename */
1949 path_build(buf, 1024, ANGBAND_DIR_DATA, "r_info_j.raw");
1951 path_build(buf, 1024, ANGBAND_DIR_DATA, "r_info.raw");
1955 /* Attempt to open the "raw" file */
1956 fd = fd_open(buf, O_RDONLY);
1958 /* Process existing "raw" file */
1960 if (fd < 0) quit("'r_info_j.raw'¥Õ¥¡¥¤¥ë¤ò¥í¡¼¥É¤Ç¤¤Þ¤»¤ó¡£");
1962 if (fd < 0) quit("Cannot load 'r_info.raw' file.");
1966 /* Attempt to parse the "raw" file */
1967 err = init_r_info_raw(fd);
1974 if (err) quit("'r_info_j.raw'¥Õ¥¡¥¤¥ë¤ò²òÀϤǤ¤Þ¤»¤ó¡£");
1976 if (err) quit("Cannot parse 'r_info.raw' file.");
1987 * Initialize the "d_info" array, by parsing a binary "image" file
1989 static errr init_d_info_raw(int fd)
1993 /* Read and Verify the header */
1994 if (fd_read(fd, (char*)(&test), sizeof(header)) ||
1995 (test.v_major != d_head->v_major) ||
1996 (test.v_minor != d_head->v_minor) ||
1997 (test.v_patch != d_head->v_patch) ||
1998 (test.v_extra != d_head->v_extra) ||
1999 (test.info_num != d_head->info_num) ||
2000 (test.info_len != d_head->info_len) ||
2001 (test.head_size != d_head->head_size) ||
2002 (test.info_size != d_head->info_size))
2009 /* Accept the header */
2013 /* Allocate the "d_info" array */
2014 C_MAKE(d_info, d_head->info_num, dungeon_info_type);
2016 /* Read the "d_info" array */
2017 fd_read(fd, (char*)(d_info), d_head->info_size);
2020 /* Allocate the "d_name" array */
2021 C_MAKE(d_name, d_head->name_size, char);
2023 /* Read the "d_name" array */
2024 fd_read(fd, (char*)(d_name), d_head->name_size);
2027 #ifndef DELAY_LOAD_D_TEXT
2029 /* Allocate the "d_text" array */
2030 C_MAKE(d_text, d_head->text_size, char);
2032 /* Read the "d_text" array */
2033 fd_read(fd, (char*)(d_text), d_head->text_size);
2035 #endif /* DELAY_LOAD_D_TEXT */
2045 * Initialize the "d_info" array
2047 * Note that we let each entry have a unique "name" and "text" string,
2048 * even if the string happens to be empty (everyone has a unique '\0').
2050 static errr init_d_info(void)
2060 /* General buffer */
2064 /*** Make the "header" ***/
2066 /* Allocate the "header" */
2067 MAKE(d_head, header);
2069 /* Save the "version" */
2070 d_head->v_major = FAKE_VER_MAJOR;
2071 d_head->v_minor = FAKE_VER_MINOR;
2072 d_head->v_patch = FAKE_VER_PATCH;
2073 d_head->v_extra = 0;
2075 /* Save the "record" information */
2076 d_head->info_num = max_d_idx;
2077 d_head->info_len = sizeof(dungeon_info_type);
2079 /* Save the size of "d_head" and "d_info" */
2080 d_head->head_size = sizeof(header);
2081 d_head->info_size = d_head->info_num * d_head->info_len;
2084 #ifdef ALLOW_TEMPLATES
2086 /*** Load the binary image file ***/
2088 /* Build the filename */
2090 path_build(buf, 1024, ANGBAND_DIR_DATA, "d_info_j.raw");
2092 path_build(buf, 1024, ANGBAND_DIR_DATA, "d_info.raw");
2096 /* Attempt to open the "raw" file */
2097 fd = fd_open(buf, O_RDONLY);
2099 /* Process existing "raw" file */
2103 #ifdef CHECK_MODIFICATION_TIME
2105 err = check_modification_date(fd, "d_info_j.txt");
2107 #endif /* CHECK_MODIFICATION_TIME */
2110 /* Attempt to parse the "raw" file */
2112 err = init_d_info_raw(fd);
2118 if (!err) return (0);
2122 /*** Make the fake arrays ***/
2124 /* Fake the size of "d_name" and "d_text" */
2125 fake_name_size = FAKE_NAME_SIZE;
2126 fake_text_size = FAKE_TEXT_SIZE;
2128 /* Allocate the "d_info" array */
2129 C_MAKE(d_info, d_head->info_num, dungeon_info_type);
2131 /* Hack -- make "fake" arrays */
2132 C_MAKE(d_name, fake_name_size, char);
2133 C_MAKE(d_text, fake_text_size, char);
2136 /*** Load the ascii template file ***/
2138 /* Build the filename */
2140 path_build(buf, 1024, ANGBAND_DIR_EDIT, "d_info_j.txt");
2143 fp = my_fopen(buf, "r");
2147 if (!fp) quit("'d_info_j.txt'¥Õ¥¡¥¤¥ë¤ò¥ª¡¼¥×¥ó¤Ç¤¤Þ¤»¤ó¡£");
2149 if (!fp) quit("Cannot open 'd_info.txt' file.");
2153 /* Parse the file */
2154 err = init_d_info_txt(fp, buf);
2166 oops = ((err > 0) ? err_str[err] : "̤ÃΤÎ");
2169 msg_format("'d_info_j.txt'¥Õ¥¡¥¤¥ë¤Î %d ¹ÔÌܤ˥¨¥é¡¼¡£", error_line);
2170 msg_format("¥ì¥³¡¼¥É %d ¤Ï '%s' ¥¨¥é¡¼¤¬¤¢¤ê¤Þ¤¹¡£", error_idx, oops);
2171 msg_format("¹½Ê¸ '%s'¡£", buf);
2175 quit("'d_info_j.txt'¥Õ¥¡¥¤¥ë¤Ë¥¨¥é¡¼");
2178 oops = (((err > 0) && (err < PARSE_ERROR_MAX)) ? err_str[err] : "unknown");
2181 msg_format("Error %d at line %d of 'd_info.txt'.", err, error_line);
2182 msg_format("Record %d contains a '%s' error.", error_idx, oops);
2183 msg_format("Parsing '%s'.", buf);
2187 quit("Error in 'd_info.txt' file.");
2193 /*** Dump the binary image file ***/
2195 /* File type is "DATA" */
2196 FILE_TYPE(FILE_TYPE_DATA);
2198 /* Build the filename */
2200 path_build(buf, 1024, ANGBAND_DIR_DATA, "d_info_j.raw");
2202 path_build(buf, 1024, ANGBAND_DIR_DATA, "d_info.raw");
2206 /* Kill the old file */
2209 /* Attempt to create the raw file */
2210 fd = fd_make(buf, mode);
2212 /* Dump to the file */
2216 fd_write(fd, (char*)(d_head), d_head->head_size);
2218 /* Dump the "d_info" array */
2219 fd_write(fd, (char*)(d_info), d_head->info_size);
2221 /* Dump the "d_name" array */
2222 fd_write(fd, (char*)(d_name), d_head->name_size);
2224 /* Dump the "d_text" array */
2225 fd_write(fd, (char*)(d_text), d_head->text_size);
2232 /*** Kill the fake arrays ***/
2234 /* Free the "d_info" array */
2235 C_KILL(d_info, d_head->info_num, dungeon_info_type);
2237 /* Hack -- Free the "fake" arrays */
2238 C_KILL(d_name, fake_name_size, char);
2239 C_KILL(d_text, fake_text_size, char);
2241 /* Forget the array sizes */
2245 #endif /* ALLOW_TEMPLATES */
2248 /*** Load the binary image file ***/
2250 /* Build the filename */
2252 path_build(buf, 1024, ANGBAND_DIR_DATA, "d_info_j.raw");
2254 path_build(buf, 1024, ANGBAND_DIR_DATA, "d_info.raw");
2258 /* Attempt to open the "raw" file */
2259 fd = fd_open(buf, O_RDONLY);
2261 /* Process existing "raw" file */
2263 if (fd < 0) quit("'d_info_j.raw'¥Õ¥¡¥¤¥ë¤ò¥í¡¼¥É¤Ç¤¤Þ¤»¤ó¡£");
2265 if (fd < 0) quit("Cannot load 'd_info.raw' file.");
2269 /* Attempt to parse the "raw" file */
2270 err = init_d_info_raw(fd);
2277 if (err) quit("'d_info_j.raw'¥Õ¥¡¥¤¥ë¤ò²òÀϤǤ¤Þ¤»¤ó¡£");
2279 if (err) quit("Cannot parse 'd_info.raw' file.");
2290 * Initialize the "v_info" array, by parsing a binary "image" file
2292 static errr init_v_info_raw(int fd)
2296 /* Read and Verify the header */
2297 if (fd_read(fd, (char*)(&test), sizeof(header)) ||
2298 (test.v_major != v_head->v_major) ||
2299 (test.v_minor != v_head->v_minor) ||
2300 (test.v_patch != v_head->v_patch) ||
2301 (test.v_extra != v_head->v_extra) ||
2302 (test.info_num != v_head->info_num) ||
2303 (test.info_len != v_head->info_len) ||
2304 (test.head_size != v_head->head_size) ||
2305 (test.info_size != v_head->info_size))
2312 /* Accept the header */
2316 /* Allocate the "v_info" array */
2317 C_MAKE(v_info, v_head->info_num, vault_type);
2319 /* Read the "v_info" array */
2320 fd_read(fd, (char*)(v_info), v_head->info_size);
2323 /* Allocate the "v_name" array */
2324 C_MAKE(v_name, v_head->name_size, char);
2326 /* Read the "v_name" array */
2327 fd_read(fd, (char*)(v_name), v_head->name_size);
2330 #ifndef DELAY_LOAD_V_TEXT
2332 /* Allocate the "v_text" array */
2333 C_MAKE(v_text, v_head->text_size, char);
2335 /* Read the "v_text" array */
2336 fd_read(fd, (char*)(v_text), v_head->text_size);
2338 #endif /* DELAY_LOAD_V_TEXT */
2346 * Initialize the "v_info" array
2348 * Note that we let each entry have a unique "name" and "text" string,
2349 * even if the string happens to be empty (everyone has a unique '\0').
2351 errr init_v_info(void)
2361 /* General buffer */
2365 /*** Make the header ***/
2367 /* Allocate the "header" */
2368 MAKE(v_head, header);
2370 /* Save the "version" */
2371 v_head->v_major = FAKE_VER_MAJOR;
2372 v_head->v_minor = FAKE_VER_MINOR;
2373 v_head->v_patch = FAKE_VER_PATCH;
2374 v_head->v_extra = 0;
2376 /* Save the "record" information */
2377 v_head->info_num = max_v_idx;
2378 v_head->info_len = sizeof(vault_type);
2380 /* Save the size of "v_head" and "v_info" */
2381 v_head->head_size = sizeof(header);
2382 v_head->info_size = v_head->info_num * v_head->info_len;
2385 #ifdef ALLOW_TEMPLATES
2387 /*** Load the binary image file ***/
2389 /* Build the filename */
2391 path_build(buf, 1024, ANGBAND_DIR_DATA, "v_info_j.raw");
2393 path_build(buf, 1024, ANGBAND_DIR_DATA, "v_info.raw");
2397 /* Attempt to open the "raw" file */
2398 fd = fd_open(buf, O_RDONLY);
2400 /* Process existing "raw" file */
2403 #ifdef CHECK_MODIFICATION_TIME
2405 err = check_modification_date(fd, "v_info_j.txt");
2407 #endif /* CHECK_MODIFICATION_TIME */
2409 /* Attempt to parse the "raw" file */
2411 err = init_v_info_raw(fd);
2417 if (!err) return (0);
2421 /*** Make the fake arrays ***/
2423 /* Fake the size of "v_name" and "v_text" */
2424 fake_name_size = FAKE_NAME_SIZE;
2425 fake_text_size = FAKE_TEXT_SIZE;
2427 /* Allocate the "k_info" array */
2428 C_MAKE(v_info, v_head->info_num, vault_type);
2430 /* Hack -- make "fake" arrays */
2431 C_MAKE(v_name, fake_name_size, char);
2432 C_MAKE(v_text, fake_text_size, char);
2435 /*** Load the ascii template file ***/
2437 /* Build the filename */
2439 path_build(buf, 1024, ANGBAND_DIR_EDIT, "v_info_j.txt");
2442 fp = my_fopen(buf, "r");
2446 if (!fp) quit("'v_info_j.txt'¥Õ¥¡¥¤¥ë¤ò¥ª¡¼¥×¥ó¤Ç¤¤Þ¤»¤ó¡£");
2448 if (!fp) quit("Cannot open 'v_info.txt' file.");
2452 /* Parse the file */
2453 err = init_v_info_txt(fp, buf, TRUE);
2465 oops = (((err > 0) && (err < PARSE_ERROR_MAX)) ? err_str[err] : "̤ÃΤÎ");
2468 msg_format("'v_info_j.txt'¥Õ¥¡¥¤¥ë¤Î %d ¹ÔÌܤ˥¨¥é¡¼¡£", error_line);
2469 msg_format("¥ì¥³¡¼¥É %d ¤Ï '%s' ¥¨¥é¡¼¤¬¤¢¤ê¤Þ¤¹¡£", error_idx, oops);
2470 msg_format("¹½Ê¸ '%s'¡£", buf);
2474 quit("'v_info_j.txt'¥Õ¥¡¥¤¥ë¤Ë¥¨¥é¡¼");
2477 oops = (((err > 0) && (err < PARSE_ERROR_MAX)) ? err_str[err] : "unknown");
2480 msg_format("Error %d at line %d of 'v_info.txt'.", err, error_line);
2481 msg_format("Record %d contains a '%s' error.", error_idx, oops);
2482 msg_format("Parsing '%s'.", buf);
2486 quit("Error in 'v_info.txt' file.");
2492 /*** Dump the binary image file ***/
2494 /* File type is "DATA" */
2495 FILE_TYPE(FILE_TYPE_DATA);
2497 /* Build the filename */
2499 path_build(buf, 1024, ANGBAND_DIR_DATA, "v_info_j.raw");
2501 path_build(buf, 1024, ANGBAND_DIR_DATA, "v_info.raw");
2505 /* Kill the old file */
2508 /* Attempt to create the raw file */
2509 fd = fd_make(buf, mode);
2511 /* Dump to the file */
2515 fd_write(fd, (char*)(v_head), v_head->head_size);
2517 /* Dump the "v_info" array */
2518 fd_write(fd, (char*)(v_info), v_head->info_size);
2520 /* Dump the "v_name" array */
2521 fd_write(fd, (char*)(v_name), v_head->name_size);
2523 /* Dump the "v_text" array */
2524 fd_write(fd, (char*)(v_text), v_head->text_size);
2531 /*** Kill the fake arrays ***/
2533 /* Free the "v_info" array */
2534 C_KILL(v_info, v_head->info_num, vault_type);
2536 /* Hack -- Free the "fake" arrays */
2537 C_KILL(v_name, fake_name_size, char);
2538 C_KILL(v_text, fake_text_size, char);
2540 /* Forget the array sizes */
2544 #endif /* ALLOW_TEMPLATES */
2547 /*** Load the binary image file ***/
2549 /* Build the filename */
2551 path_build(buf, 1024, ANGBAND_DIR_DATA, "v_info_j.raw");
2553 path_build(buf, 1024, ANGBAND_DIR_DATA, "v_info.raw");
2556 /* Attempt to open the "raw" file */
2557 fd = fd_open(buf, O_RDONLY);
2559 /* Process existing "raw" file */
2561 if (fd < 0) quit("'v_info_j.raw'¥Õ¥¡¥¤¥ë¤ò¥í¡¼¥É¤Ç¤¤Þ¤»¤ó¡£");
2563 if (fd < 0) quit("Cannot load 'v_info.raw' file.");
2567 /* Attempt to parse the "raw" file */
2568 err = init_v_info_raw(fd);
2575 if (err) quit("'v_info_j.raw'¥Õ¥¡¥¤¥ë¤ò²òÀϤǤ¤Þ¤»¤ó¡£");
2577 if (err) quit("Cannot parse 'v_info.raw' file.");
2587 * Initialize the "we_info" array, by parsing a binary "image" file
2589 static errr init_we_info_raw(int fd)
2593 /* Read and Verify the header */
2594 if (fd_read(fd, (char*)(&test), sizeof(header)) ||
2595 (test.v_major != we_head->v_major) ||
2596 (test.v_minor != we_head->v_minor) ||
2597 (test.v_patch != we_head->v_patch) ||
2598 (test.v_extra != we_head->v_extra) ||
2599 (test.info_num != we_head->info_num) ||
2600 (test.info_len != we_head->info_len) ||
2601 (test.head_size != we_head->head_size) ||
2602 (test.info_size != we_head->info_size))
2609 /* Accept the header */
2613 /* Allocate the "we_info" array */
2614 C_MAKE(we_info, we_head->info_num, weapon_exp_table);
2616 /* Read the "we_info" array */
2617 fd_read(fd, (char*)(we_info), we_head->info_size);
2620 /* Allocate the "we_name" array */
2621 C_MAKE(we_name, we_head->name_size, char);
2623 /* Read the "we_name" array */
2624 fd_read(fd, (char*)(we_name), we_head->name_size);
2627 /* Allocate the "we_text" array */
2628 C_MAKE(we_text, we_head->text_size, char);
2630 /* Read the "we_text" array */
2631 fd_read(fd, (char*)(we_text), we_head->text_size);
2639 * Initialize the "we_info" array
2641 * Note that we let each entry have a unique "name" and "text" string,
2642 * even if the string happens to be empty (everyone has a unique '\0').
2644 static errr init_we_info(void)
2654 /* General buffer */
2658 /*** Make the header ***/
2660 /* Allocate the "header" */
2661 MAKE(we_head, header);
2663 /* Save the "version" */
2664 we_head->v_major = FAKE_VER_MAJOR;
2665 we_head->v_minor = FAKE_VER_MINOR;
2666 we_head->v_patch = FAKE_VER_PATCH;
2667 we_head->v_extra = 0;
2669 /* Save the "record" information */
2670 we_head->info_num = MAX_CLASS;
2671 we_head->info_len = sizeof(weapon_exp_table);
2673 /* Save the size of "we_head" and "we_info" */
2674 we_head->head_size = sizeof(header);
2675 we_head->info_size = we_head->info_num * we_head->info_len;
2678 #ifdef ALLOW_TEMPLATES
2680 /*** Load the binary image file ***/
2682 /* Build the filename */
2684 path_build(buf, 1024, ANGBAND_DIR_DATA, "we_info_j.raw");
2686 path_build(buf, 1024, ANGBAND_DIR_DATA, "we_info.raw");
2690 /* Attempt to open the "raw" file */
2691 fd = fd_open(buf, O_RDONLY);
2693 /* Process existing "raw" file */
2696 #ifdef CHECK_MODIFICATION_TIME
2698 err = check_modification_date(fd, "we_info_j.txt");
2700 #endif /* CHECK_MODIFICATION_TIME */
2702 /* Attempt to parse the "raw" file */
2704 err = init_we_info_raw(fd);
2710 if (!err) return (0);
2714 /*** Make the fake arrays ***/
2716 /* Fake the size of "we_name" and "we_text" */
2717 fake_name_size = FAKE_NAME_SIZE;
2718 fake_text_size = FAKE_TEXT_SIZE;
2720 /* Allocate the "we_info" array */
2721 C_MAKE(we_info, we_head->info_num, weapon_exp_table);
2723 /* Hack -- make "fake" arrays */
2724 C_MAKE(we_name, fake_name_size, char);
2725 C_MAKE(we_text, fake_text_size, char);
2728 /*** Load the ascii template file ***/
2730 /* Build the filename */
2732 path_build(buf, 1024, ANGBAND_DIR_EDIT, "we_info_j.txt");
2735 fp = my_fopen(buf, "r");
2739 if (!fp) quit("'we_info_j.txt'¥Õ¥¡¥¤¥ë¤ò¥ª¡¼¥×¥ó¤Ç¤¤Þ¤»¤ó¡£");
2741 if (!fp) quit("Cannot open 'we_info.txt' file.");
2745 /* Parse the file */
2746 err = init_we_info_txt(fp, buf);
2758 oops = (((err > 0) && (err < PARSE_ERROR_MAX)) ? err_str[err] : "̤ÃΤÎ");
2761 msg_format("'we_info_j.txt'¥Õ¥¡¥¤¥ë¤Î %d ¹ÔÌܤ˥¨¥é¡¼¡£", error_line);
2762 msg_format("¥ì¥³¡¼¥É %d ¤Ï '%s' ¥¨¥é¡¼¤¬¤¢¤ê¤Þ¤¹¡£", error_idx, oops);
2763 msg_format("¹½Ê¸ '%s'¡£", buf);
2767 quit("'we_info_j.txt'¥Õ¥¡¥¤¥ë¤Ë¥¨¥é¡¼");
2770 oops = (((err > 0) && (err < PARSE_ERROR_MAX)) ? err_str[err] : "unknown");
2773 msg_format("Error %d at line %d of 'we_info.txt'.", err, error_line);
2774 msg_format("Record %d contains a '%s' error.", error_idx, oops);
2775 msg_format("Parsing '%s'.", buf);
2779 quit("Error in 'we_info.txt' file.");
2785 /*** Dump the binary image file ***/
2787 /* File type is "DATA" */
2788 FILE_TYPE(FILE_TYPE_DATA);
2790 /* Build the filename */
2792 path_build(buf, 1024, ANGBAND_DIR_DATA, "we_info_j.raw");
2794 path_build(buf, 1024, ANGBAND_DIR_DATA, "we_info.raw");
2798 /* Kill the old file */
2801 /* Attempt to create the raw file */
2802 fd = fd_make(buf, mode);
2804 /* Dump to the file */
2808 fd_write(fd, (char*)(we_head), we_head->head_size);
2810 /* Dump the "we_info" array */
2811 fd_write(fd, (char*)(we_info), we_head->info_size);
2813 /* Dump the "we_name" array */
2814 fd_write(fd, (char*)(we_name), we_head->name_size);
2816 /* Dump the "we_text" array */
2817 fd_write(fd, (char*)(we_text), we_head->text_size);
2824 /*** Kill the fake arrays ***/
2826 /* Free the "we_info" array */
2827 C_KILL(we_info, we_head->info_num, weapon_exp_table);
2829 /* Hack -- Free the "fake" arrays */
2830 C_KILL(we_name, fake_name_size, char);
2831 C_KILL(we_text, fake_text_size, char);
2833 /* Forget the array sizes */
2837 #endif /* ALLOW_TEMPLATES */
2840 /*** Load the binary image file ***/
2842 /* Build the filename */
2844 path_build(buf, 1024, ANGBAND_DIR_DATA, "we_info_j.raw");
2846 path_build(buf, 1024, ANGBAND_DIR_DATA, "we_info.raw");
2849 /* Attempt to open the "raw" file */
2850 fd = fd_open(buf, O_RDONLY);
2852 /* Process existing "raw" file */
2854 if (fd < 0) quit("'we_info_j.raw'¥Õ¥¡¥¤¥ë¤ò¥í¡¼¥É¤Ç¤¤Þ¤»¤ó¡£");
2856 if (fd < 0) quit("Cannot load 'we_info.raw' file.");
2860 /* Attempt to parse the "raw" file */
2861 err = init_we_info_raw(fd);
2868 if (err) quit("'we_info_j.raw'¥Õ¥¡¥¤¥ë¤ò²òÀϤǤ¤Þ¤»¤ó¡£");
2870 if (err) quit("Cannot parse 'we_info.raw' file.");
2880 * Initialize the "se_info" array, by parsing a binary "image" file
2882 static errr init_se_info_raw(int fd)
2886 /* Read and Verify the header */
2887 if (fd_read(fd, (char*)(&test), sizeof(header)) ||
2888 (test.v_major != se_head->v_major) ||
2889 (test.v_minor != se_head->v_minor) ||
2890 (test.v_patch != se_head->v_patch) ||
2891 (test.v_extra != se_head->v_extra) ||
2892 (test.info_num != se_head->info_num) ||
2893 (test.info_len != se_head->info_len) ||
2894 (test.head_size != se_head->head_size) ||
2895 (test.info_size != se_head->info_size))
2902 /* Accept the header */
2906 /* Allocate the "se_info" array */
2907 C_MAKE(se_info, se_head->info_num, skill_exp_table);
2909 /* Read the "se_info" array */
2910 fd_read(fd, (char*)(se_info), se_head->info_size);
2913 /* Allocate the "se_name" array */
2914 C_MAKE(se_name, se_head->name_size, char);
2916 /* Read the "se_name" array */
2917 fd_read(fd, (char*)(se_name), se_head->name_size);
2920 /* Allocate the "se_text" array */
2921 C_MAKE(se_text, se_head->text_size, char);
2923 /* Read the "se_text" array */
2924 fd_read(fd, (char*)(se_text), se_head->text_size);
2932 * Initialize the "se_info" array
2934 * Note that we let each entry have a unique "name" and "text" string,
2935 * even if the string happens to be empty (everyone has a unique '\0').
2937 static errr init_se_info(void)
2947 /* General buffer */
2951 /*** Make the header ***/
2953 /* Allocate the "header" */
2954 MAKE(se_head, header);
2956 /* Save the "version" */
2957 se_head->v_major = FAKE_VER_MAJOR;
2958 se_head->v_minor = FAKE_VER_MINOR;
2959 se_head->v_patch = FAKE_VER_PATCH;
2960 se_head->v_extra = 0;
2962 /* Save the "record" information */
2963 se_head->info_num = MAX_CLASS;
2964 se_head->info_len = sizeof(skill_exp_table);
2966 /* Save the size of "se_head" and "se_info" */
2967 se_head->head_size = sizeof(header);
2968 se_head->info_size = se_head->info_num * se_head->info_len;
2971 #ifdef ALLOW_TEMPLATES
2973 /*** Load the binary image file ***/
2975 /* Build the filename */
2977 path_build(buf, 1024, ANGBAND_DIR_DATA, "se_info_j.raw");
2979 path_build(buf, 1024, ANGBAND_DIR_DATA, "se_info.raw");
2983 /* Attempt to open the "raw" file */
2984 fd = fd_open(buf, O_RDONLY);
2986 /* Process existing "raw" file */
2989 #ifdef CHECK_MODIFICATION_TIME
2991 err = check_modification_date(fd, "se_info_j.txt");
2993 #endif /* CHECK_MODIFICATION_TIME */
2995 /* Attempt to parse the "raw" file */
2997 err = init_se_info_raw(fd);
3003 if (!err) return (0);
3007 /*** Make the fake arrays ***/
3009 /* Fake the size of "se_name" and "se_text" */
3010 fake_name_size = FAKE_NAME_SIZE;
3011 fake_text_size = FAKE_TEXT_SIZE;
3013 /* Allocate the "se_info" array */
3014 C_MAKE(se_info, se_head->info_num, skill_exp_table);
3016 /* Hack -- make "fake" arrays */
3017 C_MAKE(se_name, fake_name_size, char);
3018 C_MAKE(se_text, fake_text_size, char);
3021 /*** Load the ascii template file ***/
3023 /* Build the filename */
3025 path_build(buf, 1024, ANGBAND_DIR_EDIT, "se_info_j.txt");
3028 fp = my_fopen(buf, "r");
3032 if (!fp) quit("'se_info_j.txt'¥Õ¥¡¥¤¥ë¤ò¥ª¡¼¥×¥ó¤Ç¤¤Þ¤»¤ó¡£");
3034 if (!fp) quit("Cannot open 'se_info.txt' file.");
3038 /* Parse the file */
3039 err = init_se_info_txt(fp, buf);
3051 oops = (((err > 0) && (err < PARSE_ERROR_MAX)) ? err_str[err] : "̤ÃΤÎ");
3054 msg_format("'se_info_j.txt'¥Õ¥¡¥¤¥ë¤Î %d ¹ÔÌܤ˥¨¥é¡¼¡£", error_line);
3055 msg_format("¥ì¥³¡¼¥É %d ¤Ï '%s' ¥¨¥é¡¼¤¬¤¢¤ê¤Þ¤¹¡£", error_idx, oops);
3056 msg_format("¹½Ê¸ '%s'¡£", buf);
3060 quit("'se_info_j.txt'¥Õ¥¡¥¤¥ë¤Ë¥¨¥é¡¼");
3063 oops = (((err > 0) && (err < PARSE_ERROR_MAX)) ? err_str[err] : "unknown");
3066 msg_format("Error %d at line %d of 'se_info.txt'.", err, error_line);
3067 msg_format("Record %d contains a '%s' error.", error_idx, oops);
3068 msg_format("Parsing '%s'.", buf);
3072 quit("Error in 'se_info.txt' file.");
3078 /*** Dump the binary image file ***/
3080 /* File type is "DATA" */
3081 FILE_TYPE(FILE_TYPE_DATA);
3083 /* Build the filename */
3085 path_build(buf, 1024, ANGBAND_DIR_DATA, "se_info_j.raw");
3087 path_build(buf, 1024, ANGBAND_DIR_DATA, "se_info.raw");
3091 /* Kill the old file */
3094 /* Attempt to create the raw file */
3095 fd = fd_make(buf, mode);
3097 /* Dump to the file */
3101 fd_write(fd, (char*)(se_head), se_head->head_size);
3103 /* Dump the "se_info" array */
3104 fd_write(fd, (char*)(se_info), se_head->info_size);
3106 /* Dump the "se_name" array */
3107 fd_write(fd, (char*)(se_name), se_head->name_size);
3109 /* Dump the "se_text" array */
3110 fd_write(fd, (char*)(se_text), se_head->text_size);
3117 /*** Kill the fake arrays ***/
3119 /* Free the "se_info" array */
3120 C_KILL(se_info, se_head->info_num, skill_exp_table);
3122 /* Hack -- Free the "fake" arrays */
3123 C_KILL(se_name, fake_name_size, char);
3124 C_KILL(se_text, fake_text_size, char);
3126 /* Forget the array sizes */
3130 #endif /* ALLOW_TEMPLATES */
3133 /*** Load the binary image file ***/
3135 /* Build the filename */
3137 path_build(buf, 1024, ANGBAND_DIR_DATA, "se_info_j.raw");
3139 path_build(buf, 1024, ANGBAND_DIR_DATA, "se_info.raw");
3142 /* Attempt to open the "raw" file */
3143 fd = fd_open(buf, O_RDONLY);
3145 /* Process existing "raw" file */
3147 if (fd < 0) quit("'se_info_j.raw'¥Õ¥¡¥¤¥ë¤ò¥í¡¼¥É¤Ç¤¤Þ¤»¤ó¡£");
3149 if (fd < 0) quit("Cannot load 'se_info.raw' file.");
3153 /* Attempt to parse the "raw" file */
3154 err = init_se_info_raw(fd);
3161 if (err) quit("'se_info_j.raw'¥Õ¥¡¥¤¥ë¤ò²òÀϤǤ¤Þ¤»¤ó¡£");
3163 if (err) quit("Cannot parse 'se_info.raw' file.");
3173 * Initialize the "m_info" array, by parsing a binary "image" file
3175 static errr init_m_info_raw(int fd)
3179 /* Read and Verify the header */
3180 if (fd_read(fd, (char*)(&test), sizeof(header)) ||
3181 (test.v_major != m_head->v_major) ||
3182 (test.v_minor != m_head->v_minor) ||
3183 (test.v_patch != m_head->v_patch) ||
3184 (test.v_extra != m_head->v_extra) ||
3185 (test.info_num != m_head->info_num) ||
3186 (test.info_len != m_head->info_len) ||
3187 (test.head_size != m_head->head_size) ||
3188 (test.info_size != m_head->info_size))
3195 /* Accept the header */
3199 /* Allocate the "m_info" array */
3200 C_MAKE(m_info, m_head->info_num, player_magic);
3202 /* Read the "m_info" array */
3203 fd_read(fd, (char*)(m_info), m_head->info_size);
3206 /* Allocate the "m_name" array */
3207 C_MAKE(m_name, m_head->name_size, char);
3209 /* Read the "m_name" array */
3210 fd_read(fd, (char*)(m_name), m_head->name_size);
3213 /* Allocate the "m_text" array */
3214 C_MAKE(m_text, m_head->text_size, char);
3216 /* Read the "m_text" array */
3217 fd_read(fd, (char*)(m_text), m_head->text_size);
3225 * Initialize the "m_info" array
3227 * Note that we let each entry have a unique "name" and "text" string,
3228 * even if the string happens to be empty (everyone has a unique '\0').
3230 static errr init_m_info(void)
3240 /* General buffer */
3244 /*** Make the header ***/
3246 /* Allocate the "header" */
3247 MAKE(m_head, header);
3249 /* Save the "version" */
3250 m_head->v_major = FAKE_VER_MAJOR;
3251 m_head->v_minor = FAKE_VER_MINOR;
3252 m_head->v_patch = FAKE_VER_PATCH;
3253 m_head->v_extra = 0;
3255 /* Save the "record" information */
3256 m_head->info_num = MAX_CLASS;
3257 m_head->info_len = sizeof(player_magic);
3259 /* Save the size of "m_head" and "m_info" */
3260 m_head->head_size = sizeof(header);
3261 m_head->info_size = m_head->info_num * m_head->info_len;
3264 #ifdef ALLOW_TEMPLATES
3266 /*** Load the binary image file ***/
3268 /* Build the filename */
3270 path_build(buf, 1024, ANGBAND_DIR_DATA, "m_info_j.raw");
3272 path_build(buf, 1024, ANGBAND_DIR_DATA, "m_info.raw");
3276 /* Attempt to open the "raw" file */
3277 fd = fd_open(buf, O_RDONLY);
3279 /* Process existing "raw" file */
3282 #ifdef CHECK_MODIFICATION_TIME
3284 err = check_modification_date(fd, "m_info_j.txt");
3286 #endif /* CHECK_MODIFICATION_TIME */
3288 /* Attempt to parse the "raw" file */
3290 err = init_m_info_raw(fd);
3296 if (!err) return (0);
3300 /*** Make the fake arrays ***/
3302 /* Fake the size of "m_name" and "m_text" */
3303 fake_name_size = FAKE_NAME_SIZE;
3304 fake_text_size = FAKE_TEXT_SIZE;
3306 /* Allocate the "m_info" array */
3307 C_MAKE(m_info, m_head->info_num, player_magic);
3309 /* Hack -- make "fake" arrays */
3310 C_MAKE(m_name, fake_name_size, char);
3311 C_MAKE(m_text, fake_text_size, char);
3314 /*** Load the ascii template file ***/
3316 /* Build the filename */
3318 path_build(buf, 1024, ANGBAND_DIR_EDIT, "m_info_j.txt");
3321 fp = my_fopen(buf, "r");
3325 if (!fp) quit("'m_info_j.txt'¥Õ¥¡¥¤¥ë¤ò¥ª¡¼¥×¥ó¤Ç¤¤Þ¤»¤ó¡£");
3327 if (!fp) quit("Cannot open 'm_info.txt' file.");
3331 /* Parse the file */
3332 err = init_m_info_txt(fp, buf);
3344 oops = (((err > 0) && (err < PARSE_ERROR_MAX)) ? err_str[err] : "̤ÃΤÎ");
3347 msg_format("'m_info_j.txt'¥Õ¥¡¥¤¥ë¤Î %d ¹ÔÌܤ˥¨¥é¡¼¡£", error_line);
3348 msg_format("¥ì¥³¡¼¥É %d ¤Ï '%s' ¥¨¥é¡¼¤¬¤¢¤ê¤Þ¤¹¡£", error_idx, oops);
3349 msg_format("¹½Ê¸ '%s'¡£", buf);
3353 quit("'m_info_j.txt'¥Õ¥¡¥¤¥ë¤Ë¥¨¥é¡¼");
3356 oops = (((err > 0) && (err < PARSE_ERROR_MAX)) ? err_str[err] : "unknown");
3359 msg_format("Error %d at line %d of 'm_info.txt'.", err, error_line);
3360 msg_format("Record %d contains a '%s' error.", error_idx, oops);
3361 msg_format("Parsing '%s'.", buf);
3365 quit("Error in 'm_info.txt' file.");
3371 /*** Dump the binary image file ***/
3373 /* File type is "DATA" */
3374 FILE_TYPE(FILE_TYPE_DATA);
3376 /* Build the filename */
3378 path_build(buf, 1024, ANGBAND_DIR_DATA, "m_info_j.raw");
3380 path_build(buf, 1024, ANGBAND_DIR_DATA, "m_info.raw");
3384 /* Kill the old file */
3387 /* Attempt to create the raw file */
3388 fd = fd_make(buf, mode);
3390 /* Dump to the file */
3394 fd_write(fd, (char*)(m_head), m_head->head_size);
3396 /* Dump the "m_info" array */
3397 fd_write(fd, (char*)(m_info), m_head->info_size);
3399 /* Dump the "m_name" array */
3400 fd_write(fd, (char*)(m_name), m_head->name_size);
3402 /* Dump the "m_text" array */
3403 fd_write(fd, (char*)(m_text), m_head->text_size);
3410 /*** Kill the fake arrays ***/
3412 /* Free the "m_info" array */
3413 C_KILL(m_info, m_head->info_num, player_magic);
3415 /* Hack -- Free the "fake" arrays */
3416 C_KILL(m_name, fake_name_size, char);
3417 C_KILL(m_text, fake_text_size, char);
3419 /* Forget the array sizes */
3423 #endif /* ALLOW_TEMPLATES */
3426 /*** Load the binary image file ***/
3428 /* Build the filename */
3430 path_build(buf, 1024, ANGBAND_DIR_DATA, "m_info_j.raw");
3432 path_build(buf, 1024, ANGBAND_DIR_DATA, "m_info.raw");
3435 /* Attempt to open the "raw" file */
3436 fd = fd_open(buf, O_RDONLY);
3438 /* Process existing "raw" file */
3440 if (fd < 0) quit("'m_info_j.raw'¥Õ¥¡¥¤¥ë¤ò¥í¡¼¥É¤Ç¤¤Þ¤»¤ó¡£");
3442 if (fd < 0) quit("Cannot load 'm_info.raw' file.");
3446 /* Attempt to parse the "raw" file */
3447 err = init_m_info_raw(fd);
3454 if (err) quit("'m_info_j.raw'¥Õ¥¡¥¤¥ë¤ò²òÀϤǤ¤Þ¤»¤ó¡£");
3456 if (err) quit("Cannot parse 'm_info.raw' file.");
3466 /*** Initialize others ***/
3469 * Hack -- Objects sold in the stores -- by tval/sval pair.
3471 static byte store_table[MAX_STORES][STORE_CHOICES][2] =
3476 { TV_FOOD, SV_FOOD_RATION },
3477 { TV_FOOD, SV_FOOD_RATION },
3478 { TV_FOOD, SV_FOOD_RATION },
3479 { TV_FOOD, SV_FOOD_RATION },
3481 { TV_FOOD, SV_FOOD_RATION },
3482 { TV_FOOD, SV_FOOD_BISCUIT },
3483 { TV_FOOD, SV_FOOD_JERKY },
3484 { TV_FOOD, SV_FOOD_JERKY },
3486 { TV_FOOD, SV_FOOD_PINT_OF_WINE },
3487 { TV_FOOD, SV_FOOD_PINT_OF_ALE },
3488 { TV_LITE, SV_LITE_TORCH },
3489 { TV_LITE, SV_LITE_TORCH },
3491 { TV_LITE, SV_LITE_TORCH },
3492 { TV_LITE, SV_LITE_TORCH },
3493 { TV_LITE, SV_LITE_LANTERN },
3494 { TV_LITE, SV_LITE_LANTERN },
3506 { TV_SHOT, SV_AMMO_NORMAL },
3507 { TV_ARROW, SV_AMMO_NORMAL },
3508 { TV_BOLT, SV_AMMO_NORMAL },
3509 { TV_DIGGING, SV_SHOVEL },
3511 { TV_DIGGING, SV_PICK },
3512 { TV_CLOAK, SV_CLOAK },
3513 { TV_CLOAK, SV_CLOAK },
3514 { TV_CLOAK, SV_FUR_CLOAK },
3516 { TV_FOOD, SV_FOOD_RATION },
3517 { TV_FOOD, SV_FOOD_RATION },
3518 { TV_FOOD, SV_FOOD_RATION },
3519 { TV_FOOD, SV_FOOD_RATION },
3521 { TV_LITE, SV_LITE_TORCH },
3522 { TV_LITE, SV_LITE_TORCH },
3523 { TV_LITE, SV_LITE_LANTERN },
3524 { TV_LITE, SV_LITE_LANTERN },
3533 { TV_SHOT, SV_AMMO_NORMAL },
3534 { TV_ARROW, SV_AMMO_NORMAL },
3535 { TV_BOLT, SV_AMMO_NORMAL },
3536 { TV_DIGGING, SV_SHOVEL }
3542 { TV_BOOTS, SV_PAIR_OF_SOFT_LEATHER_BOOTS },
3543 { TV_BOOTS, SV_PAIR_OF_SOFT_LEATHER_BOOTS },
3544 { TV_BOOTS, SV_PAIR_OF_HARD_LEATHER_BOOTS },
3545 { TV_BOOTS, SV_PAIR_OF_HARD_LEATHER_BOOTS },
3547 { TV_HELM, SV_HARD_LEATHER_CAP },
3548 { TV_HELM, SV_HARD_LEATHER_CAP },
3549 { TV_HELM, SV_METAL_CAP },
3550 { TV_HELM, SV_IRON_HELM },
3552 { TV_SOFT_ARMOR, SV_ROBE },
3553 { TV_SOFT_ARMOR, SV_ROBE },
3554 { TV_SOFT_ARMOR, SV_SOFT_LEATHER_ARMOR },
3555 { TV_SOFT_ARMOR, SV_SOFT_LEATHER_ARMOR },
3557 { TV_SOFT_ARMOR, SV_HARD_LEATHER_ARMOR },
3558 { TV_SOFT_ARMOR, SV_HARD_LEATHER_ARMOR },
3559 { TV_SOFT_ARMOR, SV_HARD_STUDDED_LEATHER },
3560 { TV_SOFT_ARMOR, SV_HARD_STUDDED_LEATHER },
3562 { TV_SOFT_ARMOR, SV_RHINO_HIDE_ARMOR },
3563 { TV_SOFT_ARMOR, SV_LEATHER_SCALE_MAIL },
3564 { TV_HARD_ARMOR, SV_METAL_SCALE_MAIL },
3565 { TV_HARD_ARMOR, SV_CHAIN_MAIL },
3567 { TV_HARD_ARMOR, SV_DOUBLE_RING_MAIL },
3568 { TV_HARD_ARMOR, SV_AUGMENTED_CHAIN_MAIL },
3569 { TV_HARD_ARMOR, SV_BAR_CHAIN_MAIL },
3570 { TV_HARD_ARMOR, SV_DOUBLE_CHAIN_MAIL },
3572 { TV_HARD_ARMOR, SV_METAL_BRIGANDINE_ARMOUR },
3573 { TV_HARD_ARMOR, SV_SPLINT_MAIL },
3574 { TV_GLOVES, SV_SET_OF_LEATHER_GLOVES },
3575 { TV_GLOVES, SV_SET_OF_LEATHER_GLOVES },
3577 { TV_GLOVES, SV_SET_OF_GAUNTLETS },
3578 { TV_SHIELD, SV_SMALL_LEATHER_SHIELD },
3579 { TV_SHIELD, SV_LARGE_LEATHER_SHIELD },
3580 { TV_SHIELD, SV_SMALL_METAL_SHIELD },
3582 { TV_BOOTS, SV_PAIR_OF_HARD_LEATHER_BOOTS },
3583 { TV_BOOTS, SV_PAIR_OF_HARD_LEATHER_BOOTS },
3584 { TV_HELM, SV_HARD_LEATHER_CAP },
3585 { TV_HELM, SV_HARD_LEATHER_CAP },
3587 { TV_SOFT_ARMOR, SV_ROBE },
3588 { TV_SOFT_ARMOR, SV_SOFT_LEATHER_ARMOR },
3589 { TV_SOFT_ARMOR, SV_SOFT_LEATHER_ARMOR },
3590 { TV_SOFT_ARMOR, SV_HARD_LEATHER_ARMOR },
3592 { TV_SOFT_ARMOR, SV_LEATHER_JACK },
3593 { TV_HARD_ARMOR, SV_METAL_SCALE_MAIL },
3594 { TV_HARD_ARMOR, SV_CHAIN_MAIL },
3595 { TV_HARD_ARMOR, SV_CHAIN_MAIL },
3597 { TV_GLOVES, SV_SET_OF_LEATHER_GLOVES },
3598 { TV_GLOVES, SV_SET_OF_GAUNTLETS },
3599 { TV_SHIELD, SV_SMALL_LEATHER_SHIELD },
3600 { TV_SHIELD, SV_SMALL_LEATHER_SHIELD }
3606 { TV_SWORD, SV_DAGGER },
3607 { TV_SWORD, SV_MAIN_GAUCHE },
3608 { TV_SWORD, SV_RAPIER },
3609 { TV_SWORD, SV_SMALL_SWORD },
3611 { TV_SWORD, SV_SHORT_SWORD },
3612 { TV_SWORD, SV_SABRE },
3613 { TV_SWORD, SV_CUTLASS },
3614 { TV_SWORD, SV_TULWAR },
3616 { TV_SWORD, SV_BROAD_SWORD },
3617 { TV_SWORD, SV_LONG_SWORD },
3618 { TV_SWORD, SV_SCIMITAR },
3619 { TV_SWORD, SV_KATANA },
3621 { TV_SWORD, SV_BASTARD_SWORD },
3622 { TV_POLEARM, SV_SPEAR },
3623 { TV_POLEARM, SV_AWL_PIKE },
3624 { TV_POLEARM, SV_TRIDENT },
3626 { TV_POLEARM, SV_PIKE },
3627 { TV_POLEARM, SV_BEAKED_AXE },
3628 { TV_POLEARM, SV_BROAD_AXE },
3629 { TV_POLEARM, SV_LANCE },
3631 { TV_POLEARM, SV_BATTLE_AXE },
3632 { TV_POLEARM, SV_HATCHET },
3633 { TV_BOW, SV_SLING },
3634 { TV_BOW, SV_SHORT_BOW },
3636 { TV_BOW, SV_LONG_BOW },
3637 { TV_BOW, SV_LIGHT_XBOW },
3638 { TV_SHOT, SV_AMMO_NORMAL },
3639 { TV_SHOT, SV_AMMO_NORMAL },
3641 { TV_ARROW, SV_AMMO_NORMAL },
3642 { TV_ARROW, SV_AMMO_NORMAL },
3643 { TV_BOLT, SV_AMMO_NORMAL },
3644 { TV_BOLT, SV_AMMO_NORMAL },
3646 { TV_BOW, SV_LONG_BOW },
3647 { TV_BOW, SV_LIGHT_XBOW },
3648 { TV_ARROW, SV_AMMO_NORMAL },
3649 { TV_BOLT, SV_AMMO_NORMAL },
3651 { TV_BOW, SV_SHORT_BOW },
3652 { TV_SWORD, SV_DAGGER },
3653 { TV_SWORD, SV_TANTO },
3654 { TV_SWORD, SV_RAPIER },
3656 { TV_SWORD, SV_SMALL_SWORD },
3657 { TV_SWORD, SV_SHORT_SWORD },
3658 { TV_SWORD, SV_LONG_SWORD },
3659 { TV_SWORD, SV_SCIMITAR },
3661 { TV_HISSATSU_BOOK, 0 },
3662 { TV_HISSATSU_BOOK, 0 },
3663 { TV_HISSATSU_BOOK, 1 },
3664 { TV_HISSATSU_BOOK, 1 },
3670 { TV_HAFTED, SV_NUNCHAKU },
3671 { TV_HAFTED, SV_QUARTERSTAFF },
3672 { TV_HAFTED, SV_MACE },
3673 { TV_HAFTED, SV_BO_STAFF },
3675 { TV_HAFTED, SV_WAR_HAMMER },
3676 { TV_HAFTED, SV_WAR_HAMMER },
3677 { TV_HAFTED, SV_MORNING_STAR },
3678 { TV_HAFTED, SV_FLAIL },
3680 { TV_HAFTED, SV_LEAD_FILLED_MACE },
3681 { TV_SCROLL, SV_SCROLL_REMOVE_CURSE },
3682 { TV_SCROLL, SV_SCROLL_BLESSING },
3683 { TV_SCROLL, SV_SCROLL_HOLY_CHANT },
3685 { TV_POTION, SV_POTION_HEROISM },
3686 { TV_SCROLL, SV_SCROLL_WORD_OF_RECALL },
3687 { TV_SCROLL, SV_SCROLL_WORD_OF_RECALL },
3688 { TV_SCROLL, SV_SCROLL_WORD_OF_RECALL },
3690 { TV_POTION, SV_POTION_CURE_LIGHT },
3691 { TV_POTION, SV_POTION_CURE_SERIOUS },
3692 { TV_POTION, SV_POTION_CURE_SERIOUS },
3693 { TV_POTION, SV_POTION_CURE_CRITICAL },
3695 { TV_POTION, SV_POTION_CURE_CRITICAL },
3696 { TV_POTION, SV_POTION_RESTORE_EXP },
3697 { TV_POTION, SV_POTION_RESTORE_EXP },
3698 { TV_POTION, SV_POTION_RESTORE_EXP },
3700 { TV_LIFE_BOOK, 0 },
3701 { TV_LIFE_BOOK, 0 },
3702 { TV_LIFE_BOOK, 0 },
3703 { TV_LIFE_BOOK, 0 },
3705 { TV_LIFE_BOOK, 1 },
3706 { TV_LIFE_BOOK, 1 },
3707 { TV_LIFE_BOOK, 1 },
3708 { TV_LIFE_BOOK, 1 },
3710 { TV_HAFTED, SV_WHIP },
3711 { TV_HAFTED, SV_MACE },
3712 { TV_HAFTED, SV_BALL_AND_CHAIN },
3713 { TV_HAFTED, SV_WAR_HAMMER },
3715 { TV_SCROLL, SV_SCROLL_WORD_OF_RECALL },
3716 { TV_SCROLL, SV_SCROLL_WORD_OF_RECALL },
3717 { TV_SCROLL, SV_SCROLL_WORD_OF_RECALL },
3718 { TV_POTION, SV_POTION_CURE_CRITICAL },
3720 { TV_POTION, SV_POTION_CURE_CRITICAL },
3721 { TV_POTION, SV_POTION_RESTORE_EXP },
3724 { TV_STATUE, SV_ANY },
3726 { TV_SCROLL, SV_SCROLL_REMOVE_CURSE },
3727 { TV_SCROLL, SV_SCROLL_REMOVE_CURSE },
3728 { TV_SCROLL, SV_SCROLL_STAR_REMOVE_CURSE },
3729 { TV_SCROLL, SV_SCROLL_STAR_REMOVE_CURSE }
3735 { TV_SCROLL, SV_SCROLL_ENCHANT_WEAPON_TO_HIT },
3736 { TV_SCROLL, SV_SCROLL_ENCHANT_WEAPON_TO_DAM },
3737 { TV_SCROLL, SV_SCROLL_ENCHANT_ARMOR },
3738 { TV_SCROLL, SV_SCROLL_IDENTIFY },
3740 { TV_SCROLL, SV_SCROLL_IDENTIFY },
3741 { TV_SCROLL, SV_SCROLL_IDENTIFY },
3742 { TV_SCROLL, SV_SCROLL_IDENTIFY },
3743 { TV_SCROLL, SV_SCROLL_LIGHT },
3745 { TV_SCROLL, SV_SCROLL_PHASE_DOOR },
3746 { TV_SCROLL, SV_SCROLL_PHASE_DOOR },
3747 { TV_SCROLL, SV_SCROLL_TELEPORT },
3748 { TV_SCROLL, SV_SCROLL_MONSTER_CONFUSION },
3750 { TV_SCROLL, SV_SCROLL_MAPPING },
3751 { TV_SCROLL, SV_SCROLL_DETECT_GOLD },
3752 { TV_SCROLL, SV_SCROLL_DETECT_ITEM },
3753 { TV_SCROLL, SV_SCROLL_DETECT_TRAP },
3755 { TV_SCROLL, SV_SCROLL_DETECT_INVIS },
3756 { TV_SCROLL, SV_SCROLL_RECHARGING },
3757 { TV_SCROLL, SV_SCROLL_SATISFY_HUNGER },
3758 { TV_SCROLL, SV_SCROLL_WORD_OF_RECALL },
3760 { TV_SCROLL, SV_SCROLL_WORD_OF_RECALL },
3761 { TV_SCROLL, SV_SCROLL_WORD_OF_RECALL },
3762 { TV_SCROLL, SV_SCROLL_WORD_OF_RECALL },
3763 { TV_SCROLL, SV_SCROLL_TELEPORT },
3765 { TV_SCROLL, SV_SCROLL_TELEPORT },
3766 { TV_POTION, SV_POTION_RES_STR },
3767 { TV_POTION, SV_POTION_RES_INT },
3768 { TV_POTION, SV_POTION_RES_WIS },
3770 { TV_POTION, SV_POTION_RES_DEX },
3771 { TV_POTION, SV_POTION_RES_CON },
3772 { TV_POTION, SV_POTION_RES_CHR },
3773 { TV_SCROLL, SV_SCROLL_IDENTIFY },
3775 { TV_SCROLL, SV_SCROLL_IDENTIFY },
3776 { TV_SCROLL, SV_SCROLL_STAR_IDENTIFY }, /* Yep, occasionally! */
3777 { TV_SCROLL, SV_SCROLL_STAR_IDENTIFY },
3778 { TV_SCROLL, SV_SCROLL_LIGHT },
3780 { TV_POTION, SV_POTION_RES_STR },
3781 { TV_POTION, SV_POTION_RES_INT },
3782 { TV_POTION, SV_POTION_RES_WIS },
3783 { TV_POTION, SV_POTION_RES_DEX },
3785 { TV_POTION, SV_POTION_RES_CON },
3786 { TV_POTION, SV_POTION_RES_CHR },
3787 { TV_SCROLL, SV_SCROLL_ENCHANT_ARMOR },
3788 { TV_SCROLL, SV_SCROLL_ENCHANT_ARMOR },
3790 { TV_SCROLL, SV_SCROLL_RECHARGING },
3791 { TV_SCROLL, SV_SCROLL_SATISFY_HUNGER },
3792 { TV_SCROLL, SV_SCROLL_SATISFY_HUNGER },
3793 { TV_SCROLL, SV_SCROLL_SATISFY_HUNGER }
3798 /* Magic-User store */
3800 { TV_RING, SV_RING_PROTECTION },
3801 { TV_RING, SV_RING_FEATHER_FALL },
3802 { TV_RING, SV_RING_PROTECTION },
3803 { TV_RING, SV_RING_RESIST_FIRE },
3805 { TV_RING, SV_RING_RESIST_COLD },
3806 { TV_AMULET, SV_AMULET_CHARISMA },
3807 { TV_RING, SV_RING_WARNING },
3808 { TV_AMULET, SV_AMULET_RESIST_ACID },
3810 { TV_AMULET, SV_AMULET_SEARCHING },
3811 { TV_WAND, SV_WAND_SLOW_MONSTER },
3812 { TV_WAND, SV_WAND_CONFUSE_MONSTER },
3813 { TV_WAND, SV_WAND_SLEEP_MONSTER },
3815 { TV_WAND, SV_WAND_MAGIC_MISSILE },
3816 { TV_WAND, SV_WAND_STINKING_CLOUD },
3817 { TV_WAND, SV_WAND_WONDER },
3818 { TV_WAND, SV_WAND_DISARMING },
3820 { TV_STAFF, SV_STAFF_LITE },
3821 { TV_STAFF, SV_STAFF_MAPPING },
3822 { TV_STAFF, SV_STAFF_DETECT_TRAP },
3823 { TV_STAFF, SV_STAFF_DETECT_DOOR },
3825 { TV_STAFF, SV_STAFF_DETECT_GOLD },
3826 { TV_STAFF, SV_STAFF_DETECT_ITEM },
3827 { TV_STAFF, SV_STAFF_DETECT_INVIS },
3828 { TV_STAFF, SV_STAFF_DETECT_EVIL },
3830 { TV_STAFF, SV_STAFF_TELEPORTATION },
3831 { TV_STAFF, SV_STAFF_TELEPORTATION },
3832 { TV_STAFF, SV_STAFF_TELEPORTATION },
3833 { TV_STAFF, SV_STAFF_TELEPORTATION },
3835 { TV_STAFF, SV_STAFF_IDENTIFY },
3836 { TV_STAFF, SV_STAFF_IDENTIFY },
3837 { TV_STAFF, SV_STAFF_IDENTIFY },
3839 { TV_STAFF, SV_STAFF_IDENTIFY },
3840 { TV_STAFF, SV_STAFF_REMOVE_CURSE },
3841 { TV_STAFF, SV_STAFF_CURE_LIGHT },
3842 { TV_STAFF, SV_STAFF_PROBING },
3846 { TV_SORCERY_BOOK, 0 },
3847 { TV_SORCERY_BOOK, 0 },
3848 { TV_SORCERY_BOOK, 1 },
3849 { TV_SORCERY_BOOK, 1 },
3851 { TV_ARCANE_BOOK, 0 },
3852 { TV_ARCANE_BOOK, 0 },
3853 { TV_ARCANE_BOOK, 1 },
3854 { TV_ARCANE_BOOK, 1 },
3856 { TV_ARCANE_BOOK, 2 },
3857 { TV_ARCANE_BOOK, 2 },
3858 { TV_ARCANE_BOOK, 3 },
3859 { TV_ARCANE_BOOK, 3 },
3864 /* Black Market (unused) */
3937 { TV_SORCERY_BOOK, 0 },
3938 { TV_SORCERY_BOOK, 0 },
3939 { TV_SORCERY_BOOK, 1 },
3940 { TV_SORCERY_BOOK, 1 },
3942 { TV_NATURE_BOOK, 0 },
3943 { TV_NATURE_BOOK, 0 },
3944 { TV_NATURE_BOOK, 1 },
3945 { TV_NATURE_BOOK, 1 },
3947 { TV_CHAOS_BOOK, 0 },
3948 { TV_CHAOS_BOOK, 0 },
3949 { TV_CHAOS_BOOK, 1 },
3950 { TV_CHAOS_BOOK, 1 },
3952 { TV_DEATH_BOOK, 0 },
3953 { TV_DEATH_BOOK, 0 },
3954 { TV_DEATH_BOOK, 1 },
3955 { TV_DEATH_BOOK, 1 },
3957 { TV_TRUMP_BOOK, 0 }, /* +16 */
3958 { TV_TRUMP_BOOK, 0 },
3959 { TV_TRUMP_BOOK, 1 },
3960 { TV_TRUMP_BOOK, 1 },
3962 { TV_ARCANE_BOOK, 0 },
3963 { TV_ARCANE_BOOK, 1 },
3964 { TV_ARCANE_BOOK, 2 },
3965 { TV_ARCANE_BOOK, 3 },
3967 { TV_ENCHANT_BOOK, 0 },
3968 { TV_ENCHANT_BOOK, 0 },
3969 { TV_ENCHANT_BOOK, 1 },
3970 { TV_ENCHANT_BOOK, 1 },
3972 { TV_DAEMON_BOOK, 0 },
3973 { TV_DAEMON_BOOK, 0 },
3974 { TV_DAEMON_BOOK, 1 },
3975 { TV_DAEMON_BOOK, 1 },
3977 { TV_MUSIC_BOOK, 0 },
3978 { TV_MUSIC_BOOK, 0 },
3979 { TV_MUSIC_BOOK, 1 },
3980 { TV_MUSIC_BOOK, 1 },
3984 /* Museum (unused) */
4022 * Initialize misc. values
4024 static errr init_misc(void)
4026 /* Initialize the values */
4027 process_dungeon_file("misc_j.txt", 0, 0, 0, 0);
4034 * Initialize town array
4036 static errr init_towns(void)
4040 /*** Prepare the Towns ***/
4042 /* Allocate the towns */
4043 C_MAKE(town, max_towns, town_type);
4045 for (i = 1; i < max_towns; i++)
4047 /*** Prepare the Stores ***/
4049 /* Allocate the stores */
4050 C_MAKE(town[i].store, MAX_STORES, store_type);
4052 /* Fill in each store */
4053 for (j = 0; j < MAX_STORES; j++)
4055 /* Access the store */
4056 store_type *st_ptr = &town[i].store[j];
4058 if ((i > 1) && (j == STORE_MUSEUM || j == STORE_HOME)) continue;
4060 /* Assume full stock */
4063 * ²æ¤¬²È¤¬ 20 ¥Ú¡¼¥¸¤Þ¤Ç»È¤¨¤ë±£¤·µ¡Ç½¤Î¤¿¤á¤Î½àÈ÷¡£
4064 * ¥ª¥×¥·¥ç¥ó¤¬Í¸ú¤Ç¤â¤½¤¦¤Ç¤Ê¤¯¤Æ¤â°ì±þ¥¹¥Ú¡¼¥¹
4067 if (j == STORE_HOME)
4069 st_ptr->stock_size = (STORE_INVEN_MAX * 10);
4071 else if (j == STORE_MUSEUM)
4073 st_ptr->stock_size = (STORE_INVEN_MAX * 50);
4077 st_ptr->stock_size = STORE_INVEN_MAX;
4081 /* Allocate the stock */
4082 C_MAKE(st_ptr->stock, st_ptr->stock_size, object_type);
4084 /* No table for the black market or home */
4085 if ((j == STORE_BLACK) || (j == STORE_HOME)) continue;
4087 /* Assume full table */
4088 st_ptr->table_size = STORE_CHOICES;
4090 /* Allocate the stock */
4091 C_MAKE(st_ptr->table, st_ptr->table_size, s16b);
4093 /* Scan the choices */
4094 for (k = 0; k < STORE_CHOICES; k++)
4098 /* Extract the tval/sval codes */
4099 int tv = store_table[j][k][0];
4100 int sv = store_table[j][k][1];
4103 for (k_idx = 1; k_idx < max_k_idx; k_idx++)
4105 object_kind *k_ptr = &k_info[k_idx];
4108 if ((k_ptr->tval == tv) && (k_ptr->sval == sv)) break;
4112 if (k_idx == max_k_idx) continue;
4114 /* Add that item index to the table */
4115 st_ptr->table[st_ptr->table_num++] = k_idx;
4124 * Initialize buildings
4126 errr init_buildings(void)
4130 for (i = 0; i < MAX_BLDG; i++)
4132 building[i].name[0] = '\0';
4133 building[i].owner_name[0] = '\0';
4134 building[i].owner_race[0] = '\0';
4136 for (j = 0; j < 8; j++)
4138 building[i].act_names[j][0] = '\0';
4139 building[i].member_costs[j] = 0;
4140 building[i].other_costs[j] = 0;
4141 building[i].letters[j] = 0;
4142 building[i].actions[j] = 0;
4143 building[i].action_restr[j] = 0;
4146 for (j = 0; j < MAX_CLASS; j++)
4148 building[i].member_class[j] = 0;
4151 for (j = 0; j < MAX_RACES; j++)
4153 building[i].member_race[j] = 0;
4156 for (j = 0; j < MAX_MAGIC+1; j++)
4158 building[i].member_realm[j] = 0;
4167 * Initialize quest array
4169 static errr init_quests(void)
4173 /*** Prepare the quests ***/
4175 /* Allocate the quests */
4176 C_MAKE(quest, max_quests, quest_type);
4178 /* Set all quest to "untaken" */
4179 for (i = 0; i < max_quests; i++)
4181 quest[i].status = QUEST_STATUS_UNTAKEN;
4189 * Initialize some other arrays
4191 static errr init_other(void)
4196 /*** Prepare the "dungeon" information ***/
4198 /* Allocate and Wipe the object list */
4199 C_MAKE(o_list, max_o_idx, object_type);
4201 /* Allocate and Wipe the monster list */
4202 C_MAKE(m_list, max_m_idx, monster_type);
4204 /* Allocate and Wipe the max dungeon level */
4205 C_MAKE(max_dlv, max_d_idx, s16b);
4207 /* Allocate and wipe each line of the cave */
4208 for (i = 0; i < MAX_HGT; i++)
4210 /* Allocate one row of the cave */
4211 C_MAKE(cave[i], MAX_WID, cave_type);
4215 /*** Prepare the various "bizarre" arrays ***/
4217 /* Macro variables */
4218 C_MAKE(macro__pat, MACRO_MAX, cptr);
4219 C_MAKE(macro__act, MACRO_MAX, cptr);
4220 C_MAKE(macro__cmd, MACRO_MAX, bool);
4222 /* Macro action buffer */
4223 C_MAKE(macro__buf, 1024, char);
4225 /* Quark variables */
4226 C_MAKE(quark__str, QUARK_MAX, cptr);
4228 /* Message variables */
4229 C_MAKE(message__ptr, MESSAGE_MAX, u16b);
4230 C_MAKE(message__buf, MESSAGE_BUF, char);
4232 /* Hack -- No messages yet */
4233 message__tail = MESSAGE_BUF;
4236 /*** Prepare the Player inventory ***/
4239 C_MAKE(inventory, INVEN_TOTAL, object_type);
4242 /*** Pre-allocate the basic "auto-inscriptions" ***/
4244 /* The "basic" feelings */
4246 (void)quark_add("¼ö¤ï¤ì¤Æ¤¤¤ë");
4247 (void)quark_add("²õ¤ì¤Æ¤¤¤ë");
4248 (void)quark_add("ÊÂ");
4249 (void)quark_add("¾å¼Á");
4251 (void)quark_add("cursed");
4252 (void)quark_add("broken");
4253 (void)quark_add("average");
4254 (void)quark_add("good");
4258 /* The "extra" feelings */
4260 (void)quark_add("¹âµéÉÊ");
4261 (void)quark_add("̵²ÁÃÍ");
4262 (void)quark_add("ÆÃÊÌÀ½");
4263 (void)quark_add("¶²¤í¤·¤¤");
4265 (void)quark_add("excellent");
4266 (void)quark_add("worthless");
4267 (void)quark_add("special");
4268 (void)quark_add("terrible");
4272 /* Some extra strings */
4274 (void)quark_add("¼ö¤¤¤Ê¤·");
4275 (void)quark_add("Çä½ÐÃæ");
4277 (void)quark_add("uncursed");
4278 (void)quark_add("on sale");
4283 /*** Prepare the options ***/
4285 /* Scan the options */
4286 for (i = 0; option_info[i].o_desc; i++)
4288 int os = option_info[i].o_set;
4289 int ob = option_info[i].o_bit;
4291 /* Set the "default" options */
4292 if (option_info[i].o_var)
4295 option_mask[os] |= (1L << ob);
4298 if (option_info[i].o_norm)
4301 option_flag[os] |= (1L << ob);
4308 option_flag[os] &= ~(1L << ob);
4313 /* Analyze the windows */
4314 for (n = 0; n < 8; n++)
4316 /* Analyze the options */
4317 for (i = 0; i < 32; i++)
4320 if (window_flag_desc[i])
4323 window_mask[n] |= (1L << i);
4329 /*** Pre-allocate space for the "format()" buffer ***/
4331 /* Hack -- Just call the "format()" function */
4332 (void)format("%s (%s).", "Mr.Hoge", MAINTAINER);
4342 * Initialize some other arrays
4344 static errr init_alloc(void)
4347 monster_race *r_ptr;
4353 /* Allocate the "r_info" array */
4354 C_MAKE(elements, max_r_idx, tag_type);
4356 /* Scan the monsters */
4357 for (i = 1; i < max_r_idx; i++)
4359 elements[i].tag = r_info[i].level;
4360 elements[i].pointer = (void*)i;
4363 tag_sort(elements, max_r_idx);
4365 /*** Initialize monster allocation info ***/
4367 /* Size of "alloc_race_table" */
4368 alloc_race_size = max_r_idx;
4370 /* Allocate the alloc_race_table */
4371 C_MAKE(alloc_race_table, alloc_race_size, alloc_entry);
4373 /* Scan the monsters */
4374 for (i = 1; i < max_r_idx; i++)
4376 /* Get the i'th race */
4377 r_ptr = &r_info[(int)elements[i].pointer];
4379 /* Count valid pairs */
4384 /* Extract the base level */
4387 /* Extract the base probability */
4388 p = (100 / r_ptr->rarity);
4390 /* Load the entry */
4391 alloc_race_table[i].index = (int)elements[i].pointer;
4392 alloc_race_table[i].level = x;
4393 alloc_race_table[i].prob1 = p;
4394 alloc_race_table[i].prob2 = p;
4395 alloc_race_table[i].prob3 = p;
4399 #else /* SORT_R_INFO */
4403 s16b num[MAX_DEPTH];
4404 s16b aux[MAX_DEPTH];
4406 /*** Analyze monster allocation info ***/
4408 /* Clear the "aux" array */
4409 C_WIPE(&aux, MAX_DEPTH, s16b);
4411 /* Clear the "num" array */
4412 C_WIPE(&num, MAX_DEPTH, s16b);
4414 /* Size of "alloc_race_table" */
4415 alloc_race_size = 0;
4417 /* Scan the monsters */
4418 for (i = 1; i < max_r_idx; i++)
4420 /* Get the i'th race */
4423 /* Legal monsters */
4426 /* Count the entries */
4429 /* Group by level */
4430 num[r_ptr->level]++;
4434 /* Collect the level indexes */
4435 for (i = 1; i < MAX_DEPTH; i++)
4437 /* Group by level */
4443 if (!num[0]) quit("Ä®¤Î¥â¥ó¥¹¥¿¡¼¤¬¤Ê¤¤¡ª");
4445 if (!num[0]) quit("No town monsters!");
4450 /*** Initialize monster allocation info ***/
4452 /* Allocate the alloc_race_table */
4453 C_MAKE(alloc_race_table, alloc_race_size, alloc_entry);
4455 /* Access the table entry */
4456 table = alloc_race_table;
4458 /* Scan the monsters */
4459 for (i = 1; i < max_r_idx; i++)
4461 /* Get the i'th race */
4464 /* Count valid pairs */
4469 /* Extract the base level */
4472 /* Extract the base probability */
4473 p = (100 / r_ptr->rarity);
4475 /* Skip entries preceding our locale */
4476 y = (x > 0) ? num[x-1] : 0;
4478 /* Skip previous entries at this locale */
4481 /* Load the entry */
4488 /* Another entry complete for this locale */
4493 #endif /* SORT_R_INFO */
4495 /* Init the "alloc_kind_table" */
4496 (void)init_object_alloc();
4505 * Hack -- take notes on line 23
4507 static void note(cptr str)
4509 Term_erase(0, 23, 255);
4510 Term_putstr(20, 23, -1, TERM_WHITE, str);
4517 * Hack -- Explain a broken "lib" folder and quit (see below).
4519 * XXX XXX XXX This function is "messy" because various things
4520 * may or may not be initialized, but the "plog()" and "quit()"
4521 * functions are "supposed" to work under any conditions.
4523 static void init_angband_aux(cptr why)
4530 plog("'lib'¥Ç¥£¥ì¥¯¥È¥ê¤¬Â¸ºß¤·¤Ê¤¤¤«²õ¤ì¤Æ¤¤¤ë¤è¤¦¤Ç¤¹¡£");
4533 plog("¤Ò¤ç¤Ã¤È¤¹¤ë¤È¥¢¡¼¥«¥¤¥Ö¤¬Àµ¤·¤¯²òÅव¤ì¤Æ¤¤¤Ê¤¤¤Î¤«¤â¤·¤ì¤Þ¤»¤ó¡£");
4536 plog("³ºÅö¤¹¤ë'README'¥Õ¥¡¥¤¥ë¤òÆɤó¤Ç³Îǧ¤·¤Æ¤ß¤Æ²¼¤µ¤¤¡£");
4538 /* Quit with error */
4539 quit("Ã×̿Ū¤Ê¥¨¥é¡¼¡£");
4542 plog("The 'lib' directory is probably missing or broken.");
4545 plog("Perhaps the archive was not extracted correctly.");
4548 plog("See the 'README' file for more information.");
4550 /* Quit with error */
4551 quit("Fatal Error.");
4558 * Hack -- main Angband initialization entry point
4560 * Verify some files, display the "news.txt" file, create
4561 * the high score file, initialize all internal arrays, and
4562 * load the basic "user pref files".
4564 * Be very careful to keep track of the order in which things
4565 * are initialized, in particular, the only thing *known* to
4566 * be available when this function is called is the "z-term.c"
4567 * package, and that may not be fully initialized until the
4568 * end of this function, when the default "user pref files"
4569 * are loaded and "Term_xtra(TERM_XTRA_REACT,0)" is called.
4571 * Note that this function attempts to verify the "news" file,
4572 * and the game aborts (cleanly) on failure, since without the
4573 * "news" file, it is likely that the "lib" folder has not been
4574 * correctly located. Otherwise, the news file is displayed for
4577 * Note that this function attempts to verify (or create) the
4578 * "high score" file, and the game aborts (cleanly) on failure,
4579 * since one of the most common "extraction" failures involves
4580 * failing to extract all sub-directories (even empty ones), such
4581 * as by failing to use the "-d" option of "pkunzip", or failing
4582 * to use the "save empty directories" option with "Compact Pro".
4583 * This error will often be caught by the "high score" creation
4584 * code below, since the "lib/apex" directory, being empty in the
4585 * standard distributions, is most likely to be "lost", making it
4586 * impossible to create the high score file.
4588 * Note that various things are initialized by this function,
4589 * including everything that was once done by "init_some_arrays".
4591 * This initialization involves the parsing of special files
4592 * in the "lib/data" and sometimes the "lib/edit" directories.
4594 * Note that the "template" files are initialized first, since they
4595 * often contain errors. This means that macros and message recall
4596 * and things like that are not available until after they are done.
4598 * We load the default "user pref files" here in case any "color"
4599 * changes are needed before character creation.
4601 * Note that the "graf-xxx.prf" file must be loaded separately,
4602 * if needed, in the first (?) pass through "TERM_XTRA_REACT".
4604 void init_angband(void)
4615 /*** Verify the "news" file ***/
4617 /* Build the filename */
4619 path_build(buf, 1024, ANGBAND_DIR_FILE, "news_j.txt");
4621 path_build(buf, 1024, ANGBAND_DIR_FILE, "news.txt");
4625 /* Attempt to open the file */
4626 fd = fd_open(buf, O_RDONLY);
4635 sprintf(why, "'%s'¥Õ¥¡¥¤¥ë¤Ë¥¢¥¯¥»¥¹¤Ç¤¤Þ¤»¤ó!", buf);
4637 sprintf(why, "Cannot access the '%s' file!", buf);
4641 /* Crash and burn */
4642 init_angband_aux(why);
4649 /*** Display the "news" file ***/
4654 /* Build the filename */
4656 path_build(buf, 1024, ANGBAND_DIR_FILE, "news_j.txt");
4658 path_build(buf, 1024, ANGBAND_DIR_FILE, "news.txt");
4662 /* Open the News file */
4663 fp = my_fopen(buf, "r");
4670 /* Dump the file to the screen */
4671 while (0 == my_fgets(fp, buf, 1024))
4673 /* Display and advance */
4674 Term_putstr(0, i++, -1, TERM_WHITE, buf);
4685 /*** Verify (or create) the "high score" file ***/
4687 /* Build the filename */
4688 path_build(buf, 1024, ANGBAND_DIR_APEX, "scores.raw");
4690 /* Attempt to open the high score file */
4691 fd = fd_open(buf, O_RDONLY);
4696 /* File type is "DATA" */
4697 FILE_TYPE(FILE_TYPE_DATA);
4699 /* Create a new high score file */
4700 fd = fd_make(buf, mode);
4709 sprintf(why, "'%s'¥Õ¥¡¥¤¥ë¤òºîÀ®¤Ç¤¤Þ¤»¤ó!", buf);
4711 sprintf(why, "Cannot create the '%s' file!", buf);
4715 /* Crash and burn */
4716 init_angband_aux(why);
4724 /*** Initialize some arrays ***/
4726 /* Initialize misc. values */
4728 note("[ÊÑ¿ô¤ò½é´ü²½¤·¤Æ¤¤¤Þ¤¹...(¤½¤Î¾)");
4730 note("[Initializing values... (misc)]");
4734 if (init_misc()) quit("¤½¤Î¾¤ÎÊÑ¿ô¤ò½é´ü²½¤Ç¤¤Þ¤»¤ó");
4736 if (init_misc()) quit("Cannot initialize misc. values");
4742 note("[¥¹¥¯¥ê¥×¥È¤ò½é´ü²½¤·¤Æ¤¤¤Þ¤¹... ]");
4744 note("[Initializing scripts... ]");
4748 if (init_script()) quit("¥¹¥¯¥ê¥×¥È¤ò½é´ü²½¤Ç¤¤Þ¤»¤ó");
4750 if (init_script()) quit("Cannot initialize scripts");
4753 #endif /* USE_SCRIPT */
4755 /* Initialize feature info */
4757 note("[¥Ç¡¼¥¿¤Î½é´ü²½Ãæ... (ÃÏ·Á)]");
4758 if (init_f_info()) quit("ÃÏ·Á½é´ü²½ÉÔǽ");
4760 note("[Initializing arrays... (features)]");
4761 if (init_f_info()) quit("Cannot initialize features");
4765 /* Initialize object info */
4767 note("[¥Ç¡¼¥¿¤Î½é´ü²½Ãæ... (¥¢¥¤¥Æ¥à)]");
4768 if (init_k_info()) quit("¥¢¥¤¥Æ¥à½é´ü²½ÉÔǽ");
4770 note("[Initializing arrays... (objects)]");
4771 if (init_k_info()) quit("Cannot initialize objects");
4775 /* Initialize artifact info */
4777 note("[¥Ç¡¼¥¿¤Î½é´ü²½Ãæ... (ÅÁÀâ¤Î¥¢¥¤¥Æ¥à)]");
4778 if (init_a_info()) quit("ÅÁÀâ¤Î¥¢¥¤¥Æ¥à½é´ü²½ÉÔǽ");
4780 note("[Initializing arrays... (artifacts)]");
4781 if (init_a_info()) quit("Cannot initialize artifacts");
4785 /* Initialize ego-item info */
4787 note("[¥Ç¡¼¥¿¤Î½é´ü²½Ãæ... (̾¤Î¤¢¤ë¥¢¥¤¥Æ¥à)]");
4788 if (init_e_info()) quit("̾¤Î¤¢¤ë¥¢¥¤¥Æ¥à½é´ü²½ÉÔǽ");
4790 note("[Initializing arrays... (ego-items)]");
4791 if (init_e_info()) quit("Cannot initialize ego-items");
4795 /* Initialize monster info */
4797 note("[¥Ç¡¼¥¿¤Î½é´ü²½Ãæ... (¥â¥ó¥¹¥¿¡¼)]");
4798 if (init_r_info()) quit("¥â¥ó¥¹¥¿¡¼½é´ü²½ÉÔǽ");
4800 note("[Initializing arrays... (monsters)]");
4801 if (init_r_info()) quit("Cannot initialize monsters");
4805 /* Initialize dungeon info */
4807 note("[¥Ç¡¼¥¿¤Î½é´ü²½Ãæ... (¥À¥ó¥¸¥ç¥ó)]");
4808 if (init_d_info()) quit("¥À¥ó¥¸¥ç¥ó½é´ü²½ÉÔǽ");
4810 note("[Initializing arrays... (dungeon)]");
4811 if (init_d_info()) quit("Cannot initialize dungeon");
4815 for (i = 1; i < max_d_idx; i++)
4816 if (d_info[i].final_guardian)
4817 r_info[d_info[i].final_guardian].flags7 |= RF7_GUARDIAN;
4820 /* Initialize magic info */
4822 note("[¥Ç¡¼¥¿¤Î½é´ü²½Ãæ... (ËâË¡)]");
4823 if (init_m_info()) quit("ËâË¡½é´ü²½ÉÔǽ");
4825 note("[Initializing arrays... (magic)]");
4826 if (init_m_info()) quit("Cannot initialize magic");
4829 /* Initialize weapon_exp info */
4831 note("[¥Ç¡¼¥¿¤Î½é´ü²½Ãæ... (Éð´ï½ÏÎýÅÙ)]");
4832 if (init_we_info()) quit("Éð´ï½ÏÎýÅÙ½é´ü²½ÉÔǽ");
4834 note("[Initializing arrays... (weapon exp)]");
4835 if (init_we_info()) quit("Cannot initialize weapon exp");
4838 /* Initialize weapon_exp info */
4840 note("[¥Ç¡¼¥¿¤Î½é´ü²½Ãæ... (µ»Ç½½ÏÎýÅÙ)]");
4841 if (init_se_info()) quit("µ»Ç½½ÏÎýÅÙ½é´ü²½ÉÔǽ");
4843 note("[Initializing arrays... (skill exp)]");
4844 if (init_se_info()) quit("Cannot initialize skill exp");
4847 /* Initialize wilderness array */
4849 note("[ÇÛÎó¤ò½é´ü²½¤·¤Æ¤¤¤Þ¤¹... (¹ÓÌî)]");
4851 note("[Initializing arrays... (wilderness)]");
4855 if (init_wilderness()) quit("¹ÓÌî¤ò½é´ü²½¤Ç¤¤Þ¤»¤ó");
4857 if (init_wilderness()) quit("Cannot initialize wilderness");
4861 /* Initialize town array */
4863 note("[ÇÛÎó¤ò½é´ü²½¤·¤Æ¤¤¤Þ¤¹... (³¹)]");
4865 note("[Initializing arrays... (towns)]");
4869 if (init_towns()) quit("³¹¤ò½é´ü²½¤Ç¤¤Þ¤»¤ó");
4871 if (init_towns()) quit("Cannot initialize towns");
4875 /* Initialize building array */
4877 note("[ÇÛÎó¤ò½é´ü²½¤·¤Æ¤¤¤Þ¤¹... (·úʪ)]");
4879 note("[Initializing arrays... (buildings)]");
4883 if (init_buildings()) quit("·úʪ¤ò½é´ü²½¤Ç¤¤Þ¤»¤ó");
4885 if (init_buildings()) quit("Cannot initialize buildings");
4889 /* Initialize quest array */
4891 note("[ÇÛÎó¤ò½é´ü²½¤·¤Æ¤¤¤Þ¤¹... (¥¯¥¨¥¹¥È)]");
4893 note("[Initializing arrays... (quests)]");
4897 if (init_quests()) quit("¥¯¥¨¥¹¥È¤ò½é´ü²½¤Ç¤¤Þ¤»¤ó");
4899 if (init_quests()) quit("Cannot initialize quests");
4903 /* Initialize some other arrays */
4905 note("[¥Ç¡¼¥¿¤Î½é´ü²½Ãæ... (¤½¤Î¾)]");
4906 if (init_other()) quit("¤½¤Î¾¤Î¥Ç¡¼¥¿½é´ü²½ÉÔǽ");
4908 note("[Initializing arrays... (other)]");
4909 if (init_other()) quit("Cannot initialize other stuff");
4913 /* Initialize some other arrays */
4916 note("[¥Ç¡¼¥¿¤Î½é´ü²½Ãæ... (¥¢¥í¥±¡¼¥·¥ç¥ó)]");
4917 if (init_alloc()) quit("¥¢¥í¥±¡¼¥·¥ç¥ó¡¦¥¹¥¿¥Ã¥Õ½é´ü²½ÉÔǽ");
4919 note("[Initializing arrays... (alloc)]");
4920 if (init_alloc()) quit("Cannot initialize alloc stuff");
4925 /*** Load default user pref files ***/
4927 /* Initialize feature info */
4929 note("[¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤ò½é´ü²½¤·¤Æ¤¤¤Þ¤¹...]");
4931 note("[Initializing user pref files...]");
4935 /* Access the "basic" pref file */
4936 strcpy(buf, "pref.prf");
4938 /* Process that file */
4939 process_pref_file(buf);
4941 /* Access the "user" pref file */
4942 sprintf(buf, "user.prf");
4944 /* Process that file */
4945 process_pref_file(buf);
4947 /* Access the "basic" system pref file */
4948 sprintf(buf, "pref-%s.prf", ANGBAND_SYS);
4950 /* Process that file */
4951 process_pref_file(buf);
4953 /* Access the "user" system pref file */
4954 sprintf(buf, "user-%s.prf", ANGBAND_SYS);
4956 /* Process that file */
4957 process_pref_file(buf);
4961 note("[½é´ü²½½ªÎ»]");
4963 note("[Initialization complete]");