4 * Copyright (c) 1997 Ben Harrison
6 * This software may be copied and distributed for educational, research,
7 * and not for profit purposes provided that this copyright and statement
8 * are included in all such copies. Other copyrights may also apply.
11 /* Purpose: Initialization (part 2) -BEN- */
18 #ifdef CHECK_MODIFICATION_TIME
19 #include <sys/types.h>
21 #endif /* CHECK_MODIFICATION_TIME */
25 * This file is used to initialize various variables and arrays for the
26 * Angband game. Note the use of "fd_read()" and "fd_write()" to bypass
27 * the common limitation of "read()" and "write()" to only 32767 bytes
30 * Several of the arrays for Angband are built from "template" files in
31 * the "lib/file" directory, from which quick-load binary "image" files
32 * are constructed whenever they are not present in the "lib/data"
33 * directory, or if those files become obsolete, if we are allowed.
35 * Warning -- the "ascii" file parsers use a minor hack to collect the
36 * name and text information in a single pass. Thus, the game will not
37 * be able to load any template file with more than 20K of names or 60K
38 * of text, even though technically, up to 64K should be legal.
40 * The "init1.c" file is used only to parse the ascii template files,
41 * to create the binary image files. If you include the binary image
42 * files instead of the ascii template files, then you can undefine
43 * "ALLOW_TEMPLATES", saving about 20K by removing "init1.c". Note
44 * that the binary image files are extremely system dependant.
50 * Find the default paths to all of our important sub-directories.
52 * The purpose of each sub-directory is described in "variable.c".
54 * All of the sub-directories should, by default, be located inside
55 * the main "lib" directory, whose location is very system dependant.
57 * This function takes a writable buffer, initially containing the
58 * "path" to the "lib" directory, for example, "/pkg/lib/angband/",
59 * or a system dependant string, for example, ":lib:". The buffer
60 * must be large enough to contain at least 32 more characters.
62 * Various command line options may allow some of the important
63 * directories to be changed to user-specified directories, most
64 * importantly, the "info" and "user" and "save" directories,
65 * but this is done after this function, see "main.c".
67 * In general, the initial path should end in the appropriate "PATH_SEP"
68 * string. All of the "sub-directory" paths (created below or supplied
69 * by the user) will NOT end in the "PATH_SEP" string, see the special
70 * "path_build()" function in "util.c" for more information.
72 * Mega-Hack -- support fat raw files under NEXTSTEP, using special
73 * "suffixed" directories for the "ANGBAND_DIR_DATA" directory, but
74 * requiring the directories to be created by hand by the user.
76 * Hack -- first we free all the strings, since this is known
77 * to succeed even if the strings have not been allocated yet,
78 * as long as the variables start out as "NULL". This allows
79 * this function to be called multiple times, for example, to
80 * try several base "path" values until a good one is found.
82 void init_file_paths(char *path)
86 #ifdef PRIVATE_USER_PATH
88 #endif /* PRIVATE_USER_PATH */
90 /*** Free everything ***/
92 /* Free the main path */
93 string_free(ANGBAND_DIR);
95 /* Free the sub-paths */
96 string_free(ANGBAND_DIR_APEX);
97 string_free(ANGBAND_DIR_BONE);
98 string_free(ANGBAND_DIR_DATA);
99 string_free(ANGBAND_DIR_EDIT);
100 string_free(ANGBAND_DIR_SCRIPT);
101 string_free(ANGBAND_DIR_FILE);
102 string_free(ANGBAND_DIR_HELP);
103 string_free(ANGBAND_DIR_INFO);
104 string_free(ANGBAND_DIR_SAVE);
105 string_free(ANGBAND_DIR_USER);
106 string_free(ANGBAND_DIR_XTRA);
109 /*** Prepare the "path" ***/
111 /* Hack -- save the main directory */
112 ANGBAND_DIR = string_make(path);
114 /* Prepare to append to the Base Path */
115 tail = path + strlen(path);
120 /*** Use "flat" paths with VM/ESA ***/
122 /* Use "blank" path names */
123 ANGBAND_DIR_APEX = string_make("");
124 ANGBAND_DIR_BONE = string_make("");
125 ANGBAND_DIR_DATA = string_make("");
126 ANGBAND_DIR_EDIT = string_make("");
127 ANGBAND_DIR_SCRIPT = string_make("");
128 ANGBAND_DIR_FILE = string_make("");
129 ANGBAND_DIR_HELP = string_make("");
130 ANGBAND_DIR_INFO = string_make("");
131 ANGBAND_DIR_SAVE = string_make("");
132 ANGBAND_DIR_USER = string_make("");
133 ANGBAND_DIR_XTRA = string_make("");
139 /*** Build the sub-directory names ***/
141 /* Build a path name */
142 strcpy(tail, "apex");
143 ANGBAND_DIR_APEX = string_make(path);
145 /* Build a path name */
146 strcpy(tail, "bone");
147 ANGBAND_DIR_BONE = string_make(path);
149 /* Build a path name */
150 strcpy(tail, "data");
151 ANGBAND_DIR_DATA = string_make(path);
153 /* Build a path name */
154 strcpy(tail, "edit");
155 ANGBAND_DIR_EDIT = string_make(path);
157 /* Build a path name */
158 strcpy(tail, "script");
159 ANGBAND_DIR_SCRIPT = string_make(path);
161 /* Build a path name */
162 strcpy(tail, "file");
163 ANGBAND_DIR_FILE = string_make(path);
165 /* Build a path name */
166 strcpy(tail, "help");
167 ANGBAND_DIR_HELP = string_make(path);
169 /* Build a path name */
170 strcpy(tail, "info");
171 ANGBAND_DIR_INFO = string_make(path);
173 /* Build a path name */
174 strcpy(tail, "pref");
175 ANGBAND_DIR_PREF = string_make(path);
177 /* Build a path name */
178 strcpy(tail, "save");
179 ANGBAND_DIR_SAVE = string_make(path);
181 #ifdef PRIVATE_USER_PATH
183 /* Build the path to the user specific directory */
184 path_build(buf, sizeof(buf), PRIVATE_USER_PATH, VERSION_NAME);
186 /* Build a relative path name */
187 ANGBAND_DIR_USER = string_make(buf);
189 #else /* PRIVATE_USER_PATH */
191 /* Build a path name */
192 strcpy(tail, "user");
193 ANGBAND_DIR_USER = string_make(path);
195 #endif /* PRIVATE_USER_PATH */
197 /* Build a path name */
198 strcpy(tail, "xtra");
199 ANGBAND_DIR_XTRA = string_make(path);
206 /* Allow "fat binary" usage with NeXT */
227 /* Use special directory */
230 /* Forget the old path name */
231 string_free(ANGBAND_DIR_DATA);
233 /* Build a new path name */
234 sprintf(tail, "data-%s", next);
235 ANGBAND_DIR_DATA = string_make(path);
245 #ifdef ALLOW_TEMPLATES
249 * Hack -- help give useful error messages
256 * Standard error message text
258 cptr err_str[PARSE_ERROR_MAX] =
266 "¤ª¤«¤·¤Ê¥Õ¥é¥°Â¸ºß",
275 "missing record header",
276 "non-sequential records",
277 "invalid flag specification",
278 "undefined directive",
280 "coordinates out of bounds",
282 "undefined terrain tag",
288 #endif /* ALLOW_TEMPLATES */
304 #ifdef CHECK_MODIFICATION_TIME
306 static errr check_modification_date(int fd, cptr template_file)
310 struct stat txt_stat, raw_stat;
312 /* Build the filename */
313 path_build(buf, sizeof(buf), ANGBAND_DIR_EDIT, template_file);
315 /* Access stats on text file */
316 if (stat(buf, &txt_stat))
318 /* No text file - continue */
321 /* Access stats on raw file */
322 else if (fstat(fd, &raw_stat))
328 /* Ensure text file is not newer than raw file */
329 else if (txt_stat.st_mtime > raw_stat.st_mtime)
331 /* Reprocess text file */
338 #endif /* CHECK_MODIFICATION_TIME */
342 /*** Initialize from binary image files ***/
346 * Initialize the "*_info" array, by parsing a binary "image" file
348 static errr init_info_raw(int fd, header *head)
352 /* Read and Verify the header */
353 if (fd_read(fd, (char*)(&test), sizeof(header)) ||
354 (test.v_major != head->v_major) ||
355 (test.v_minor != head->v_minor) ||
356 (test.v_patch != head->v_patch) ||
357 (test.info_num != head->info_num) ||
358 (test.info_len != head->info_len) ||
359 (test.head_size != head->head_size) ||
360 (test.info_size != head->info_size))
367 /* Accept the header */
371 /* Allocate the "*_info" array */
372 C_MAKE(head->info_ptr, head->info_size, char);
374 /* Read the "*_info" array */
375 fd_read(fd, head->info_ptr, head->info_size);
380 /* Allocate the "*_name" array */
381 C_MAKE(head->name_ptr, head->name_size, char);
383 /* Read the "*_name" array */
384 fd_read(fd, head->name_ptr, head->name_size);
390 /* Allocate the "*_text" array */
391 C_MAKE(head->text_ptr, head->text_size, char);
393 /* Read the "*_text" array */
394 fd_read(fd, head->text_ptr, head->text_size);
400 /* Allocate the "*_tag" array */
401 C_MAKE(head->tag_ptr, head->tag_size, char);
403 /* Read the "*_tag" array */
404 fd_read(fd, head->tag_ptr, head->tag_size);
415 * Initialize the header of an *_info.raw file.
417 static void init_header(header *head, int num, int len)
419 /* Save the "version" */
420 head->v_major = FAKE_VER_MAJOR;
421 head->v_minor = FAKE_VER_MINOR;
422 head->v_patch = FAKE_VER_PATCH;
425 /* Save the "record" information */
426 head->info_num = num;
427 head->info_len = len;
429 /* Save the size of "*_head" and "*_info" */
430 head->head_size = sizeof(header);
431 head->info_size = head->info_num * head->info_len;
436 * Initialize the "*_info" array
438 * Note that we let each entry have a unique "name" and "text" string,
439 * even if the string happens to be empty (everyone has a unique '\0').
441 static errr init_info(cptr filename, header *head,
442 void **info, char **name, char **text, char **tag)
456 #ifdef ALLOW_TEMPLATES
458 /*** Load the binary image file ***/
460 /* Build the filename */
462 path_build(buf, sizeof(buf), ANGBAND_DIR_DATA, format("%s_j.raw", filename));
464 path_build(buf, sizeof(buf), ANGBAND_DIR_DATA, format("%s.raw", filename));
468 /* Attempt to open the "raw" file */
469 fd = fd_open(buf, O_RDONLY);
471 /* Process existing "raw" file */
474 #ifdef CHECK_MODIFICATION_TIME
476 err = check_modification_date(fd, format("%s.txt", filename));
478 #endif /* CHECK_MODIFICATION_TIME */
480 /* Attempt to parse the "raw" file */
482 err = init_info_raw(fd, head);
489 /* Do we have to parse the *.txt file? */
492 /*** Make the fake arrays ***/
494 /* Allocate the "*_info" array */
495 C_MAKE(head->info_ptr, head->info_size, char);
497 /* Hack -- make "fake" arrays */
498 if (name) C_MAKE(head->name_ptr, FAKE_NAME_SIZE, char);
499 if (text) C_MAKE(head->text_ptr, FAKE_TEXT_SIZE, char);
500 if (tag) C_MAKE(head->tag_ptr, FAKE_TAG_SIZE, char);
502 if (info) (*info) = head->info_ptr;
503 if (name) (*name) = head->name_ptr;
504 if (text) (*text) = head->text_ptr;
505 if (tag) (*tag) = head->tag_ptr;
507 /*** Load the ascii template file ***/
509 /* Build the filename */
511 path_build(buf, sizeof(buf), ANGBAND_DIR_EDIT, format("%s.txt", filename));
514 fp = my_fopen(buf, "r");
518 if (!fp) quit(format("'%s.txt'¥Õ¥¡¥¤¥ë¤ò¥ª¡¼¥×¥ó¤Ç¤¤Þ¤»¤ó¡£", filename));
520 if (!fp) quit(format("Cannot open '%s.txt' file.", filename));
525 err = init_info_txt(fp, buf, head, head->parse_info_txt);
537 oops = (((err > 0) && (err < PARSE_ERROR_MAX)) ? err_str[err] : "̤ÃΤÎ");
540 msg_format("'%s.txt'¥Õ¥¡¥¤¥ë¤Î %d ¹ÔÌܤ˥¨¥é¡¼¡£", filename, error_line);
541 msg_format("¥ì¥³¡¼¥É %d ¤Ï '%s' ¥¨¥é¡¼¤¬¤¢¤ê¤Þ¤¹¡£", error_idx, oops);
542 msg_format("¹½Ê¸ '%s'¡£", buf);
546 quit(format("'%s.txt'¥Õ¥¡¥¤¥ë¤Ë¥¨¥é¡¼", filename));
549 oops = (((err > 0) && (err < PARSE_ERROR_MAX)) ? err_str[err] : "unknown");
552 msg_format("Error %d at line %d of '%s.txt'.", err, error_line, filename);
553 msg_format("Record %d contains a '%s' error.", error_idx, oops);
554 msg_format("Parsing '%s'.", buf);
558 quit(format("Error in '%s.txt' file.", filename));
564 /*** Make final retouch on fake tags ***/
568 (*head->retouch)(head);
572 /*** Dump the binary image file ***/
574 /* File type is "DATA" */
575 FILE_TYPE(FILE_TYPE_DATA);
577 /* Build the filename */
579 path_build(buf, sizeof(buf), ANGBAND_DIR_DATA, format("%s_j.raw", filename));
581 path_build(buf, sizeof(buf), ANGBAND_DIR_DATA, format("%s.raw", filename));
585 /* Grab permissions */
588 /* Kill the old file */
591 /* Attempt to create the raw file */
592 fd = fd_make(buf, mode);
594 /* Drop permissions */
597 /* Dump to the file */
601 fd_write(fd, (cptr)(head), head->head_size);
603 /* Dump the "*_info" array */
604 fd_write(fd, head->info_ptr, head->info_size);
606 /* Dump the "*_name" array */
607 fd_write(fd, head->name_ptr, head->name_size);
609 /* Dump the "*_text" array */
610 fd_write(fd, head->text_ptr, head->text_size);
612 /* Dump the "*_tag" array */
613 fd_write(fd, head->tag_ptr, head->tag_size);
620 /*** Kill the fake arrays ***/
622 /* Free the "*_info" array */
623 C_KILL(head->info_ptr, head->info_size, char);
625 /* Hack -- Free the "fake" arrays */
626 if (name) C_KILL(head->name_ptr, FAKE_NAME_SIZE, char);
627 if (text) C_KILL(head->text_ptr, FAKE_TEXT_SIZE, char);
628 if (tag) C_KILL(head->tag_ptr, FAKE_TAG_SIZE, char);
630 #endif /* ALLOW_TEMPLATES */
633 /*** Load the binary image file ***/
635 /* Build the filename */
637 path_build(buf, sizeof(buf), ANGBAND_DIR_DATA, format("%s_j.raw", filename));
639 path_build(buf, sizeof(buf), ANGBAND_DIR_DATA, format("%s.raw", filename));
643 /* Attempt to open the "raw" file */
644 fd = fd_open(buf, O_RDONLY);
646 /* Process existing "raw" file */
648 if (fd < 0) quit(format("'%s_j.raw'¥Õ¥¡¥¤¥ë¤ò¥í¡¼¥É¤Ç¤¤Þ¤»¤ó¡£", filename));
650 if (fd < 0) quit(format("Cannot load '%s.raw' file.", filename));
654 /* Attempt to parse the "raw" file */
655 err = init_info_raw(fd, head);
662 if (err) quit(format("'%s_j.raw'¥Õ¥¡¥¤¥ë¤ò²òÀϤǤ¤Þ¤»¤ó¡£", filename));
664 if (err) quit(format("Cannot parse '%s.raw' file.", filename));
667 #ifdef ALLOW_TEMPLATES
671 if (info) (*info) = head->info_ptr;
672 if (name) (*name) = head->name_ptr;
673 if (text) (*text) = head->text_ptr;
674 if (tag) (*tag) = head->tag_ptr;
682 * Initialize the "f_info" array
684 static errr init_f_info(void)
686 /* Init the header */
687 init_header(&f_head, max_f_idx, sizeof(feature_type));
689 #ifdef ALLOW_TEMPLATES
691 /* Save a pointer to the parsing function */
692 f_head.parse_info_txt = parse_f_info;
694 /* Save a pointer to the retouch fake tags */
695 f_head.retouch = retouch_f_info;
697 #endif /* ALLOW_TEMPLATES */
699 return init_info("f_info", &f_head,
700 (void*)&f_info, &f_name, NULL, &f_tag);
705 * Initialize the "k_info" array
707 static errr init_k_info(void)
709 /* Init the header */
710 init_header(&k_head, max_k_idx, sizeof(object_kind));
712 #ifdef ALLOW_TEMPLATES
714 /* Save a pointer to the parsing function */
715 k_head.parse_info_txt = parse_k_info;
717 #endif /* ALLOW_TEMPLATES */
719 return init_info("k_info", &k_head,
720 (void*)&k_info, &k_name, &k_text, NULL);
726 * Initialize the "a_info" array
728 static errr init_a_info(void)
730 /* Init the header */
731 init_header(&a_head, max_a_idx, sizeof(artifact_type));
733 #ifdef ALLOW_TEMPLATES
735 /* Save a pointer to the parsing function */
736 a_head.parse_info_txt = parse_a_info;
738 #endif /* ALLOW_TEMPLATES */
740 return init_info("a_info", &a_head,
741 (void*)&a_info, &a_name, &a_text, NULL);
747 * Initialize the "e_info" array
749 static errr init_e_info(void)
751 /* Init the header */
752 init_header(&e_head, max_e_idx, sizeof(ego_item_type));
754 #ifdef ALLOW_TEMPLATES
756 /* Save a pointer to the parsing function */
757 e_head.parse_info_txt = parse_e_info;
759 #endif /* ALLOW_TEMPLATES */
761 return init_info("e_info", &e_head,
762 (void*)&e_info, &e_name, &e_text, NULL);
768 * Initialize the "r_info" array
770 static errr init_r_info(void)
772 /* Init the header */
773 init_header(&r_head, max_r_idx, sizeof(monster_race));
775 #ifdef ALLOW_TEMPLATES
777 /* Save a pointer to the parsing function */
778 r_head.parse_info_txt = parse_r_info;
780 #endif /* ALLOW_TEMPLATES */
782 return init_info("r_info", &r_head,
783 (void*)&r_info, &r_name, &r_text, NULL);
789 * Initialize the "d_info" array
791 static errr init_d_info(void)
793 /* Init the header */
794 init_header(&d_head, max_d_idx, sizeof(dungeon_info_type));
796 #ifdef ALLOW_TEMPLATES
798 /* Save a pointer to the parsing function */
799 d_head.parse_info_txt = parse_d_info;
801 #endif /* ALLOW_TEMPLATES */
803 return init_info("d_info", &d_head,
804 (void*)&d_info, &d_name, &d_text, NULL);
809 * Initialize the "v_info" array
811 * Note that we let each entry have a unique "name" and "text" string,
812 * even if the string happens to be empty (everyone has a unique '\0').
814 errr init_v_info(void)
816 /* Init the header */
817 init_header(&v_head, max_v_idx, sizeof(vault_type));
819 #ifdef ALLOW_TEMPLATES
821 /* Save a pointer to the parsing function */
822 v_head.parse_info_txt = parse_v_info;
824 #endif /* ALLOW_TEMPLATES */
826 return init_info("v_info", &v_head,
827 (void*)&v_info, &v_name, &v_text, NULL);
832 * Initialize the "s_info" array
834 static errr init_s_info(void)
836 /* Init the header */
837 init_header(&s_head, MAX_CLASS, sizeof(skill_table));
839 #ifdef ALLOW_TEMPLATES
841 /* Save a pointer to the parsing function */
842 s_head.parse_info_txt = parse_s_info;
844 #endif /* ALLOW_TEMPLATES */
846 return init_info("s_info", &s_head,
847 (void*)&s_info, NULL, NULL, NULL);
852 * Initialize the "m_info" array
854 static errr init_m_info(void)
856 /* Init the header */
857 init_header(&m_head, MAX_CLASS, sizeof(player_magic));
859 #ifdef ALLOW_TEMPLATES
861 /* Save a pointer to the parsing function */
862 m_head.parse_info_txt = parse_m_info;
864 #endif /* ALLOW_TEMPLATES */
866 return init_info("m_info", &m_head,
867 (void*)&m_info, NULL, NULL, NULL);
872 /*** Initialize others ***/
875 * Hack -- Objects sold in the stores -- by tval/sval pair.
877 static byte store_table[MAX_STORES][STORE_CHOICES][2] =
882 { TV_FOOD, SV_FOOD_RATION },
883 { TV_FOOD, SV_FOOD_RATION },
884 { TV_FOOD, SV_FOOD_RATION },
885 { TV_FOOD, SV_FOOD_RATION },
887 { TV_FOOD, SV_FOOD_RATION },
888 { TV_FOOD, SV_FOOD_BISCUIT },
889 { TV_FOOD, SV_FOOD_JERKY },
890 { TV_FOOD, SV_FOOD_JERKY },
892 { TV_FOOD, SV_FOOD_PINT_OF_WINE },
893 { TV_FOOD, SV_FOOD_PINT_OF_ALE },
894 { TV_LITE, SV_LITE_TORCH },
895 { TV_LITE, SV_LITE_TORCH },
897 { TV_LITE, SV_LITE_TORCH },
898 { TV_LITE, SV_LITE_TORCH },
899 { TV_LITE, SV_LITE_LANTERN },
900 { TV_LITE, SV_LITE_LANTERN },
912 { TV_SHOT, SV_AMMO_NORMAL },
913 { TV_ARROW, SV_AMMO_NORMAL },
914 { TV_BOLT, SV_AMMO_NORMAL },
915 { TV_DIGGING, SV_SHOVEL },
917 { TV_DIGGING, SV_PICK },
918 { TV_CLOAK, SV_CLOAK },
919 { TV_CLOAK, SV_CLOAK },
920 { TV_CLOAK, SV_FUR_CLOAK },
922 { TV_FOOD, SV_FOOD_RATION },
923 { TV_FOOD, SV_FOOD_RATION },
924 { TV_FOOD, SV_FOOD_RATION },
925 { TV_FOOD, SV_FOOD_RATION },
927 { TV_POTION, SV_POTION_WATER },
928 { TV_POTION, SV_POTION_WATER },
929 { TV_LITE, SV_LITE_LANTERN },
930 { TV_LITE, SV_LITE_LANTERN },
932 { TV_FOOD, SV_FOOD_WAYBREAD },
933 { TV_FOOD, SV_FOOD_WAYBREAD },
937 { TV_SHOT, SV_AMMO_NORMAL },
938 { TV_ARROW, SV_AMMO_NORMAL },
939 { TV_BOLT, SV_AMMO_NORMAL },
940 { TV_DIGGING, SV_SHOVEL }
946 { TV_BOOTS, SV_PAIR_OF_SOFT_LEATHER_BOOTS },
947 { TV_BOOTS, SV_PAIR_OF_SOFT_LEATHER_BOOTS },
948 { TV_BOOTS, SV_PAIR_OF_HARD_LEATHER_BOOTS },
949 { TV_BOOTS, SV_PAIR_OF_HARD_LEATHER_BOOTS },
951 { TV_HELM, SV_HARD_LEATHER_CAP },
952 { TV_HELM, SV_HARD_LEATHER_CAP },
953 { TV_HELM, SV_METAL_CAP },
954 { TV_HELM, SV_IRON_HELM },
956 { TV_SOFT_ARMOR, SV_ROBE },
957 { TV_SOFT_ARMOR, SV_ROBE },
958 { TV_SOFT_ARMOR, SV_SOFT_LEATHER_ARMOR },
959 { TV_SOFT_ARMOR, SV_SOFT_LEATHER_ARMOR },
961 { TV_SOFT_ARMOR, SV_HARD_LEATHER_ARMOR },
962 { TV_SOFT_ARMOR, SV_HARD_LEATHER_ARMOR },
963 { TV_SOFT_ARMOR, SV_HARD_STUDDED_LEATHER },
964 { TV_SOFT_ARMOR, SV_HARD_STUDDED_LEATHER },
966 { TV_SOFT_ARMOR, SV_RHINO_HIDE_ARMOR },
967 { TV_SOFT_ARMOR, SV_LEATHER_SCALE_MAIL },
968 { TV_HARD_ARMOR, SV_METAL_SCALE_MAIL },
969 { TV_HARD_ARMOR, SV_CHAIN_MAIL },
971 { TV_HARD_ARMOR, SV_DOUBLE_RING_MAIL },
972 { TV_HARD_ARMOR, SV_AUGMENTED_CHAIN_MAIL },
973 { TV_HARD_ARMOR, SV_BAR_CHAIN_MAIL },
974 { TV_HARD_ARMOR, SV_DOUBLE_CHAIN_MAIL },
976 { TV_HARD_ARMOR, SV_METAL_BRIGANDINE_ARMOUR },
977 { TV_HARD_ARMOR, SV_SPLINT_MAIL },
978 { TV_GLOVES, SV_SET_OF_LEATHER_GLOVES },
979 { TV_GLOVES, SV_SET_OF_LEATHER_GLOVES },
981 { TV_GLOVES, SV_SET_OF_GAUNTLETS },
982 { TV_SHIELD, SV_SMALL_LEATHER_SHIELD },
983 { TV_SHIELD, SV_LARGE_LEATHER_SHIELD },
984 { TV_SHIELD, SV_SMALL_METAL_SHIELD },
986 { TV_BOOTS, SV_PAIR_OF_HARD_LEATHER_BOOTS },
987 { TV_BOOTS, SV_PAIR_OF_HARD_LEATHER_BOOTS },
988 { TV_HELM, SV_HARD_LEATHER_CAP },
989 { TV_HELM, SV_HARD_LEATHER_CAP },
991 { TV_SOFT_ARMOR, SV_ROBE },
992 { TV_SOFT_ARMOR, SV_SOFT_LEATHER_ARMOR },
993 { TV_SOFT_ARMOR, SV_SOFT_LEATHER_ARMOR },
994 { TV_SOFT_ARMOR, SV_HARD_LEATHER_ARMOR },
996 { TV_SOFT_ARMOR, SV_LEATHER_JACK },
997 { TV_HARD_ARMOR, SV_METAL_SCALE_MAIL },
998 { TV_HARD_ARMOR, SV_CHAIN_MAIL },
999 { TV_HARD_ARMOR, SV_CHAIN_MAIL },
1001 { TV_GLOVES, SV_SET_OF_LEATHER_GLOVES },
1002 { TV_GLOVES, SV_SET_OF_GAUNTLETS },
1003 { TV_SHIELD, SV_SMALL_LEATHER_SHIELD },
1004 { TV_SHIELD, SV_SMALL_LEATHER_SHIELD }
1010 { TV_SWORD, SV_DAGGER },
1011 { TV_SWORD, SV_MAIN_GAUCHE },
1012 { TV_SWORD, SV_RAPIER },
1013 { TV_SWORD, SV_SMALL_SWORD },
1015 { TV_SWORD, SV_SHORT_SWORD },
1016 { TV_SWORD, SV_SABRE },
1017 { TV_SWORD, SV_CUTLASS },
1018 { TV_SWORD, SV_TULWAR },
1020 { TV_SWORD, SV_BROAD_SWORD },
1021 { TV_SWORD, SV_LONG_SWORD },
1022 { TV_SWORD, SV_SCIMITAR },
1023 { TV_SWORD, SV_KATANA },
1025 { TV_SWORD, SV_BASTARD_SWORD },
1026 { TV_POLEARM, SV_SPEAR },
1027 { TV_POLEARM, SV_AWL_PIKE },
1028 { TV_POLEARM, SV_TRIDENT },
1030 { TV_POLEARM, SV_PIKE },
1031 { TV_POLEARM, SV_BEAKED_AXE },
1032 { TV_POLEARM, SV_BROAD_AXE },
1033 { TV_POLEARM, SV_LANCE },
1035 { TV_POLEARM, SV_BATTLE_AXE },
1036 { TV_POLEARM, SV_HATCHET },
1037 { TV_BOW, SV_SLING },
1038 { TV_BOW, SV_SHORT_BOW },
1040 { TV_BOW, SV_LIGHT_XBOW },
1041 { TV_SHOT, SV_AMMO_NORMAL },
1042 { TV_SHOT, SV_AMMO_NORMAL },
1043 { TV_ARROW, SV_AMMO_NORMAL },
1045 { TV_ARROW, SV_AMMO_NORMAL },
1046 { TV_BOLT, SV_AMMO_NORMAL },
1047 { TV_BOLT, SV_AMMO_NORMAL },
1048 { TV_BOW, SV_LIGHT_XBOW },
1050 { TV_ARROW, SV_AMMO_NORMAL },
1051 { TV_BOLT, SV_AMMO_NORMAL },
1052 { TV_BOW, SV_SHORT_BOW },
1053 { TV_BOW, SV_LIGHT_XBOW },
1055 { TV_SWORD, SV_DAGGER },
1056 { TV_SWORD, SV_TANTO },
1057 { TV_SWORD, SV_RAPIER },
1058 { TV_SWORD, SV_SMALL_SWORD },
1060 { TV_SWORD, SV_SHORT_SWORD },
1061 { TV_SWORD, SV_LONG_SWORD },
1062 { TV_SWORD, SV_SCIMITAR },
1063 { TV_SWORD, SV_BROAD_SWORD },
1065 { TV_HISSATSU_BOOK, 0 },
1066 { TV_HISSATSU_BOOK, 0 },
1067 { TV_HISSATSU_BOOK, 1 },
1068 { TV_HISSATSU_BOOK, 1 },
1074 { TV_HAFTED, SV_NUNCHAKU },
1075 { TV_HAFTED, SV_QUARTERSTAFF },
1076 { TV_HAFTED, SV_MACE },
1077 { TV_HAFTED, SV_BO_STAFF },
1079 { TV_HAFTED, SV_WAR_HAMMER },
1080 { TV_HAFTED, SV_WAR_HAMMER },
1081 { TV_HAFTED, SV_MORNING_STAR },
1082 { TV_HAFTED, SV_FLAIL },
1084 { TV_HAFTED, SV_LEAD_FILLED_MACE },
1085 { TV_SCROLL, SV_SCROLL_REMOVE_CURSE },
1086 { TV_SCROLL, SV_SCROLL_BLESSING },
1087 { TV_SCROLL, SV_SCROLL_HOLY_CHANT },
1089 { TV_POTION, SV_POTION_HEROISM },
1090 { TV_SCROLL, SV_SCROLL_WORD_OF_RECALL },
1091 { TV_SCROLL, SV_SCROLL_WORD_OF_RECALL },
1092 { TV_SCROLL, SV_SCROLL_WORD_OF_RECALL },
1094 { TV_POTION, SV_POTION_CURE_LIGHT },
1095 { TV_POTION, SV_POTION_CURE_SERIOUS },
1096 { TV_POTION, SV_POTION_CURE_SERIOUS },
1097 { TV_POTION, SV_POTION_CURE_CRITICAL },
1099 { TV_POTION, SV_POTION_CURE_CRITICAL },
1100 { TV_POTION, SV_POTION_RESTORE_EXP },
1101 { TV_POTION, SV_POTION_RESTORE_EXP },
1102 { TV_POTION, SV_POTION_RESTORE_EXP },
1104 { TV_LIFE_BOOK, 0 },
1105 { TV_LIFE_BOOK, 0 },
1106 { TV_LIFE_BOOK, 1 },
1107 { TV_LIFE_BOOK, 1 },
1109 { TV_CRUSADE_BOOK, 0 },
1110 { TV_CRUSADE_BOOK, 0 },
1111 { TV_CRUSADE_BOOK, 1 },
1112 { TV_CRUSADE_BOOK, 1 },
1114 { TV_HAFTED, SV_WHIP },
1115 { TV_HAFTED, SV_MACE },
1116 { TV_HAFTED, SV_BALL_AND_CHAIN },
1117 { TV_HAFTED, SV_WAR_HAMMER },
1119 { TV_SCROLL, SV_SCROLL_WORD_OF_RECALL },
1120 { TV_SCROLL, SV_SCROLL_WORD_OF_RECALL },
1121 { TV_SCROLL, SV_SCROLL_WORD_OF_RECALL },
1122 { TV_POTION, SV_POTION_CURE_CRITICAL },
1124 { TV_POTION, SV_POTION_CURE_CRITICAL },
1125 { TV_POTION, SV_POTION_RESTORE_EXP },
1128 { TV_STATUE, SV_ANY },
1130 { TV_SCROLL, SV_SCROLL_REMOVE_CURSE },
1131 { TV_SCROLL, SV_SCROLL_REMOVE_CURSE },
1132 { TV_SCROLL, SV_SCROLL_STAR_REMOVE_CURSE },
1133 { TV_SCROLL, SV_SCROLL_STAR_REMOVE_CURSE }
1139 { TV_SCROLL, SV_SCROLL_ENCHANT_WEAPON_TO_HIT },
1140 { TV_SCROLL, SV_SCROLL_ENCHANT_WEAPON_TO_DAM },
1141 { TV_SCROLL, SV_SCROLL_ENCHANT_ARMOR },
1142 { TV_SCROLL, SV_SCROLL_IDENTIFY },
1144 { TV_SCROLL, SV_SCROLL_IDENTIFY },
1145 { TV_SCROLL, SV_SCROLL_IDENTIFY },
1146 { TV_SCROLL, SV_SCROLL_IDENTIFY },
1147 { TV_SCROLL, SV_SCROLL_LIGHT },
1149 { TV_SCROLL, SV_SCROLL_PHASE_DOOR },
1150 { TV_SCROLL, SV_SCROLL_PHASE_DOOR },
1151 { TV_SCROLL, SV_SCROLL_TELEPORT },
1152 { TV_SCROLL, SV_SCROLL_MONSTER_CONFUSION },
1154 { TV_SCROLL, SV_SCROLL_MAPPING },
1155 { TV_SCROLL, SV_SCROLL_DETECT_GOLD },
1156 { TV_SCROLL, SV_SCROLL_DETECT_ITEM },
1157 { TV_SCROLL, SV_SCROLL_DETECT_TRAP },
1159 { TV_SCROLL, SV_SCROLL_DETECT_INVIS },
1160 { TV_SCROLL, SV_SCROLL_RECHARGING },
1161 { TV_SCROLL, SV_SCROLL_TELEPORT },
1162 { TV_SCROLL, SV_SCROLL_WORD_OF_RECALL },
1164 { TV_SCROLL, SV_SCROLL_WORD_OF_RECALL },
1165 { TV_SCROLL, SV_SCROLL_WORD_OF_RECALL },
1166 { TV_SCROLL, SV_SCROLL_WORD_OF_RECALL },
1167 { TV_SCROLL, SV_SCROLL_TELEPORT },
1169 { TV_SCROLL, SV_SCROLL_TELEPORT },
1170 { TV_POTION, SV_POTION_RES_STR },
1171 { TV_POTION, SV_POTION_RES_INT },
1172 { TV_POTION, SV_POTION_RES_WIS },
1174 { TV_POTION, SV_POTION_RES_DEX },
1175 { TV_POTION, SV_POTION_RES_CON },
1176 { TV_POTION, SV_POTION_RES_CHR },
1177 { TV_SCROLL, SV_SCROLL_IDENTIFY },
1179 { TV_SCROLL, SV_SCROLL_IDENTIFY },
1180 { TV_SCROLL, SV_SCROLL_STAR_IDENTIFY }, /* Yep, occasionally! */
1181 { TV_SCROLL, SV_SCROLL_STAR_IDENTIFY },
1182 { TV_SCROLL, SV_SCROLL_LIGHT },
1184 { TV_POTION, SV_POTION_RES_STR },
1185 { TV_POTION, SV_POTION_RES_INT },
1186 { TV_POTION, SV_POTION_RES_WIS },
1187 { TV_POTION, SV_POTION_RES_DEX },
1189 { TV_POTION, SV_POTION_RES_CON },
1190 { TV_POTION, SV_POTION_RES_CHR },
1191 { TV_SCROLL, SV_SCROLL_ENCHANT_ARMOR },
1192 { TV_SCROLL, SV_SCROLL_ENCHANT_ARMOR },
1194 { TV_SCROLL, SV_SCROLL_RECHARGING },
1195 { TV_SCROLL, SV_SCROLL_PHASE_DOOR },
1196 { TV_SCROLL, SV_SCROLL_ENCHANT_WEAPON_TO_HIT },
1197 { TV_SCROLL, SV_SCROLL_ENCHANT_WEAPON_TO_DAM },
1202 /* Magic-User store */
1204 { TV_RING, SV_RING_PROTECTION },
1205 { TV_RING, SV_RING_LEVITATION_FALL },
1206 { TV_RING, SV_RING_PROTECTION },
1207 { TV_RING, SV_RING_RESIST_FIRE },
1209 { TV_RING, SV_RING_RESIST_COLD },
1210 { TV_AMULET, SV_AMULET_CHARISMA },
1211 { TV_RING, SV_RING_WARNING },
1212 { TV_AMULET, SV_AMULET_RESIST_ACID },
1214 { TV_AMULET, SV_AMULET_SEARCHING },
1215 { TV_WAND, SV_WAND_SLOW_MONSTER },
1216 { TV_WAND, SV_WAND_CONFUSE_MONSTER },
1217 { TV_WAND, SV_WAND_SLEEP_MONSTER },
1219 { TV_WAND, SV_WAND_MAGIC_MISSILE },
1220 { TV_WAND, SV_WAND_STINKING_CLOUD },
1221 { TV_WAND, SV_WAND_WONDER },
1222 { TV_WAND, SV_WAND_DISARMING },
1224 { TV_STAFF, SV_STAFF_LITE },
1225 { TV_STAFF, SV_STAFF_MAPPING },
1226 { TV_STAFF, SV_STAFF_DETECT_TRAP },
1227 { TV_STAFF, SV_STAFF_DETECT_DOOR },
1229 { TV_STAFF, SV_STAFF_DETECT_GOLD },
1230 { TV_STAFF, SV_STAFF_DETECT_ITEM },
1231 { TV_STAFF, SV_STAFF_DETECT_INVIS },
1232 { TV_STAFF, SV_STAFF_DETECT_EVIL },
1234 { TV_STAFF, SV_STAFF_TELEPORTATION },
1235 { TV_STAFF, SV_STAFF_TELEPORTATION },
1236 { TV_STAFF, SV_STAFF_TELEPORTATION },
1237 { TV_STAFF, SV_STAFF_TELEPORTATION },
1239 { TV_STAFF, SV_STAFF_IDENTIFY },
1240 { TV_STAFF, SV_STAFF_IDENTIFY },
1241 { TV_STAFF, SV_STAFF_IDENTIFY },
1243 { TV_STAFF, SV_STAFF_IDENTIFY },
1244 { TV_STAFF, SV_STAFF_REMOVE_CURSE },
1245 { TV_STAFF, SV_STAFF_CURE_LIGHT },
1246 { TV_STAFF, SV_STAFF_PROBING },
1250 { TV_SORCERY_BOOK, 0 },
1251 { TV_SORCERY_BOOK, 0 },
1252 { TV_SORCERY_BOOK, 1 },
1253 { TV_SORCERY_BOOK, 1 },
1255 { TV_ARCANE_BOOK, 0 },
1256 { TV_ARCANE_BOOK, 0 },
1257 { TV_ARCANE_BOOK, 1 },
1258 { TV_ARCANE_BOOK, 1 },
1260 { TV_ARCANE_BOOK, 2 },
1261 { TV_ARCANE_BOOK, 2 },
1262 { TV_ARCANE_BOOK, 3 },
1263 { TV_ARCANE_BOOK, 3 },
1268 /* Black Market (unused) */
1341 { TV_SORCERY_BOOK, 0 },
1342 { TV_SORCERY_BOOK, 0 },
1343 { TV_SORCERY_BOOK, 1 },
1344 { TV_SORCERY_BOOK, 1 },
1346 { TV_NATURE_BOOK, 0 },
1347 { TV_NATURE_BOOK, 0 },
1348 { TV_NATURE_BOOK, 1 },
1349 { TV_NATURE_BOOK, 1 },
1351 { TV_CHAOS_BOOK, 0 },
1352 { TV_CHAOS_BOOK, 0 },
1353 { TV_CHAOS_BOOK, 1 },
1354 { TV_CHAOS_BOOK, 1 },
1356 { TV_DEATH_BOOK, 0 },
1357 { TV_DEATH_BOOK, 0 },
1358 { TV_DEATH_BOOK, 1 },
1359 { TV_DEATH_BOOK, 1 },
1361 { TV_TRUMP_BOOK, 0 }, /* +16 */
1362 { TV_TRUMP_BOOK, 0 },
1363 { TV_TRUMP_BOOK, 1 },
1364 { TV_TRUMP_BOOK, 1 },
1366 { TV_ARCANE_BOOK, 0 },
1367 { TV_ARCANE_BOOK, 1 },
1368 { TV_ARCANE_BOOK, 2 },
1369 { TV_ARCANE_BOOK, 3 },
1371 { TV_CRAFT_BOOK, 0 },
1372 { TV_CRAFT_BOOK, 0 },
1373 { TV_CRAFT_BOOK, 1 },
1374 { TV_CRAFT_BOOK, 1 },
1376 { TV_DAEMON_BOOK, 0 },
1377 { TV_DAEMON_BOOK, 0 },
1378 { TV_DAEMON_BOOK, 1 },
1379 { TV_DAEMON_BOOK, 1 },
1381 { TV_MUSIC_BOOK, 0 },
1382 { TV_MUSIC_BOOK, 0 },
1383 { TV_MUSIC_BOOK, 1 },
1384 { TV_MUSIC_BOOK, 1 },
1393 /* Museum (unused) */
1431 * Initialize misc. values
1433 static errr init_misc(void)
1435 /* Initialize the values */
1436 process_dungeon_file("misc.txt", 0, 0, 0, 0);
1443 * Initialize town array
1445 static errr init_towns(void)
1449 /*** Prepare the Towns ***/
1451 /* Allocate the towns */
1452 C_MAKE(town, max_towns, town_type);
1454 for (i = 1; i < max_towns; i++)
1456 /*** Prepare the Stores ***/
1458 /* Allocate the stores */
1459 C_MAKE(town[i].store, MAX_STORES, store_type);
1461 /* Fill in each store */
1462 for (j = 0; j < MAX_STORES; j++)
1464 /* Access the store */
1465 store_type *st_ptr = &town[i].store[j];
1467 if ((i > 1) && (j == STORE_MUSEUM || j == STORE_HOME)) continue;
1469 /* Assume full stock */
1472 * ²æ¤¬²È¤¬ 20 ¥Ú¡¼¥¸¤Þ¤Ç»È¤¨¤ë±£¤·µ¡Ç½¤Î¤¿¤á¤Î½àÈ÷¡£
1473 * ¥ª¥×¥·¥ç¥ó¤¬Í¸ú¤Ç¤â¤½¤¦¤Ç¤Ê¤¯¤Æ¤â°ì±þ¥¹¥Ú¡¼¥¹
1476 if (j == STORE_HOME)
1478 st_ptr->stock_size = (STORE_INVEN_MAX * 10);
1480 else if (j == STORE_MUSEUM)
1482 st_ptr->stock_size = (STORE_INVEN_MAX * 50);
1486 st_ptr->stock_size = STORE_INVEN_MAX;
1490 /* Allocate the stock */
1491 C_MAKE(st_ptr->stock, st_ptr->stock_size, object_type);
1493 /* No table for the black market or home */
1494 if ((j == STORE_BLACK) || (j == STORE_HOME) || (j == STORE_MUSEUM)) continue;
1496 /* Assume full table */
1497 st_ptr->table_size = STORE_CHOICES;
1499 /* Allocate the stock */
1500 C_MAKE(st_ptr->table, st_ptr->table_size, s16b);
1502 /* Scan the choices */
1503 for (k = 0; k < STORE_CHOICES; k++)
1507 /* Extract the tval/sval codes */
1508 int tv = store_table[j][k][0];
1509 int sv = store_table[j][k][1];
1512 for (k_idx = 1; k_idx < max_k_idx; k_idx++)
1514 object_kind *k_ptr = &k_info[k_idx];
1517 if ((k_ptr->tval == tv) && (k_ptr->sval == sv)) break;
1521 if (k_idx == max_k_idx) continue;
1523 /* Add that item index to the table */
1524 st_ptr->table[st_ptr->table_num++] = k_idx;
1533 * Initialize buildings
1535 errr init_buildings(void)
1539 for (i = 0; i < MAX_BLDG; i++)
1541 building[i].name[0] = '\0';
1542 building[i].owner_name[0] = '\0';
1543 building[i].owner_race[0] = '\0';
1545 for (j = 0; j < 8; j++)
1547 building[i].act_names[j][0] = '\0';
1548 building[i].member_costs[j] = 0;
1549 building[i].other_costs[j] = 0;
1550 building[i].letters[j] = 0;
1551 building[i].actions[j] = 0;
1552 building[i].action_restr[j] = 0;
1555 for (j = 0; j < MAX_CLASS; j++)
1557 building[i].member_class[j] = 0;
1560 for (j = 0; j < MAX_RACES; j++)
1562 building[i].member_race[j] = 0;
1565 for (j = 0; j < MAX_MAGIC+1; j++)
1567 building[i].member_realm[j] = 0;
1576 * Initialize quest array
1578 static errr init_quests(void)
1582 /*** Prepare the quests ***/
1584 /* Allocate the quests */
1585 C_MAKE(quest, max_quests, quest_type);
1587 /* Set all quest to "untaken" */
1588 for (i = 0; i < max_quests; i++)
1590 quest[i].status = QUEST_STATUS_UNTAKEN;
1597 static bool feat_tag_is_not_found = FALSE;
1600 s16b f_tag_to_index_in_init(cptr str)
1602 s16b feat = f_tag_to_index(str);
1604 if (feat < 0) feat_tag_is_not_found = TRUE;
1611 * Initialize feature variables
1613 static errr init_feat_variables(void)
1618 feat_none = f_tag_to_index_in_init("NONE");
1621 feat_floor = f_tag_to_index_in_init("FLOOR");
1624 feat_glyph = f_tag_to_index_in_init("GLYPH");
1625 feat_explosive_rune = f_tag_to_index_in_init("EXPLOSIVE_RUNE");
1626 feat_mirror = f_tag_to_index_in_init("MIRROR");
1629 feat_door[DOOR_DOOR].open = f_tag_to_index_in_init("OPEN_DOOR");
1630 feat_door[DOOR_DOOR].broken = f_tag_to_index_in_init("BROKEN_DOOR");
1631 feat_door[DOOR_DOOR].closed = f_tag_to_index_in_init("CLOSED_DOOR");
1634 for (i = 1; i < MAX_LJ_DOORS; i++)
1636 s16b door = f_tag_to_index(format("LOCKED_DOOR_%d", i));
1637 if (door < 0) break;
1638 feat_door[DOOR_DOOR].locked[i - 1] = door;
1640 if (i == 1) return PARSE_ERROR_UNDEFINED_TERRAIN_TAG;
1641 feat_door[DOOR_DOOR].num_locked = i - 1;
1644 for (i = 0; i < MAX_LJ_DOORS; i++)
1646 s16b door = f_tag_to_index(format("JAMMED_DOOR_%d", i));
1647 if (door < 0) break;
1648 feat_door[DOOR_DOOR].jammed[i] = door;
1650 if (!i) return PARSE_ERROR_UNDEFINED_TERRAIN_TAG;
1651 feat_door[DOOR_DOOR].num_jammed = i;
1654 feat_door[DOOR_GLASS_DOOR].open = f_tag_to_index_in_init("OPEN_GLASS_DOOR");
1655 feat_door[DOOR_GLASS_DOOR].broken = f_tag_to_index_in_init("BROKEN_GLASS_DOOR");
1656 feat_door[DOOR_GLASS_DOOR].closed = f_tag_to_index_in_init("CLOSED_GLASS_DOOR");
1658 /* Locked glass doors */
1659 for (i = 1; i < MAX_LJ_DOORS; i++)
1661 s16b door = f_tag_to_index(format("LOCKED_GLASS_DOOR_%d", i));
1662 if (door < 0) break;
1663 feat_door[DOOR_GLASS_DOOR].locked[i - 1] = door;
1665 if (i == 1) return PARSE_ERROR_UNDEFINED_TERRAIN_TAG;
1666 feat_door[DOOR_GLASS_DOOR].num_locked = i - 1;
1668 /* Jammed glass doors */
1669 for (i = 0; i < MAX_LJ_DOORS; i++)
1671 s16b door = f_tag_to_index(format("JAMMED_GLASS_DOOR_%d", i));
1672 if (door < 0) break;
1673 feat_door[DOOR_GLASS_DOOR].jammed[i] = door;
1675 if (!i) return PARSE_ERROR_UNDEFINED_TERRAIN_TAG;
1676 feat_door[DOOR_GLASS_DOOR].num_jammed = i;
1679 feat_door[DOOR_CURTAIN].open = f_tag_to_index_in_init("OPEN_CURTAIN");
1680 feat_door[DOOR_CURTAIN].broken = feat_door[DOOR_CURTAIN].open;
1681 feat_door[DOOR_CURTAIN].closed = f_tag_to_index_in_init("CLOSED_CURTAIN");
1682 feat_door[DOOR_CURTAIN].locked[0] = feat_door[DOOR_CURTAIN].closed;
1683 feat_door[DOOR_CURTAIN].num_locked = 1;
1684 feat_door[DOOR_CURTAIN].jammed[0] = feat_door[DOOR_CURTAIN].closed;
1685 feat_door[DOOR_CURTAIN].num_jammed = 1;
1688 feat_up_stair = f_tag_to_index_in_init("UP_STAIR");
1689 feat_down_stair = f_tag_to_index_in_init("DOWN_STAIR");
1690 feat_entrance = f_tag_to_index_in_init("ENTRANCE");
1693 init_normal_traps();
1696 feat_trap_open = f_tag_to_index_in_init("TRAP_OPEN");
1697 feat_trap_armageddon = f_tag_to_index_in_init("TRAP_ARMAGEDDON");
1698 feat_trap_piranha = f_tag_to_index_in_init("TRAP_PIRANHA");
1701 feat_rubble = f_tag_to_index_in_init("RUBBLE");
1704 feat_magma_vein = f_tag_to_index_in_init("MAGMA_VEIN");
1705 feat_quartz_vein = f_tag_to_index_in_init("QUARTZ_VEIN");
1708 feat_granite = f_tag_to_index_in_init("GRANITE");
1709 feat_permanent = f_tag_to_index_in_init("PERMANENT");
1712 feat_glass_floor = f_tag_to_index_in_init("GLASS_FLOOR");
1715 feat_glass_wall = f_tag_to_index_in_init("GLASS_WALL");
1716 feat_permanent_glass_wall = f_tag_to_index_in_init("PERMANENT_GLASS_WALL");
1719 feat_pattern_start = f_tag_to_index_in_init("PATTERN_START");
1720 feat_pattern_1 = f_tag_to_index_in_init("PATTERN_1");
1721 feat_pattern_2 = f_tag_to_index_in_init("PATTERN_2");
1722 feat_pattern_3 = f_tag_to_index_in_init("PATTERN_3");
1723 feat_pattern_4 = f_tag_to_index_in_init("PATTERN_4");
1724 feat_pattern_end = f_tag_to_index_in_init("PATTERN_END");
1725 feat_pattern_old = f_tag_to_index_in_init("PATTERN_OLD");
1726 feat_pattern_exit = f_tag_to_index_in_init("PATTERN_EXIT");
1727 feat_pattern_corrupted = f_tag_to_index_in_init("PATTERN_CORRUPTED");
1730 feat_black_market = f_tag_to_index_in_init("BLACK_MARKET");
1731 feat_town = f_tag_to_index_in_init("TOWN");
1734 feat_deep_water = f_tag_to_index_in_init("DEEP_WATER");
1735 feat_shallow_water = f_tag_to_index_in_init("SHALLOW_WATER");
1736 feat_deep_lava = f_tag_to_index_in_init("DEEP_LAVA");
1737 feat_shallow_lava = f_tag_to_index_in_init("SHALLOW_LAVA");
1738 feat_dirt = f_tag_to_index_in_init("DIRT");
1739 feat_grass = f_tag_to_index_in_init("GRASS");
1740 feat_flower = f_tag_to_index_in_init("FLOWER");
1741 feat_brake = f_tag_to_index_in_init("BRAKE");
1742 feat_tree = f_tag_to_index_in_init("TREE");
1743 feat_mountain = f_tag_to_index_in_init("MOUNTAIN");
1744 feat_swamp = f_tag_to_index_in_init("SWAMP");
1746 /* Unknown grid (not detected) */
1747 feat_undetected = f_tag_to_index_in_init("UNDETECTED");
1749 /* Wilderness terrains */
1750 init_wilderness_terrains();
1752 return feat_tag_is_not_found ? PARSE_ERROR_UNDEFINED_TERRAIN_TAG : 0;
1757 * Initialize some other arrays
1759 static errr init_other(void)
1764 /*** Prepare the "dungeon" information ***/
1766 /* Allocate and Wipe the object list */
1767 C_MAKE(o_list, max_o_idx, object_type);
1769 /* Allocate and Wipe the monster list */
1770 C_MAKE(m_list, max_m_idx, monster_type);
1772 /* Allocate and Wipe the monster process list */
1773 for (i = 0; i < MAX_MTIMED; i++)
1775 C_MAKE(mproc_list[i], max_m_idx, s16b);
1778 /* Allocate and Wipe the max dungeon level */
1779 C_MAKE(max_dlv, max_d_idx, s16b);
1781 /* Allocate and wipe each line of the cave */
1782 for (i = 0; i < MAX_HGT; i++)
1784 /* Allocate one row of the cave */
1785 C_MAKE(cave[i], MAX_WID, cave_type);
1789 /*** Prepare the various "bizarre" arrays ***/
1791 /* Macro variables */
1792 C_MAKE(macro__pat, MACRO_MAX, cptr);
1793 C_MAKE(macro__act, MACRO_MAX, cptr);
1794 C_MAKE(macro__cmd, MACRO_MAX, bool);
1796 /* Macro action buffer */
1797 C_MAKE(macro__buf, 1024, char);
1799 /* Quark variables */
1802 /* Message variables */
1803 C_MAKE(message__ptr, MESSAGE_MAX, u16b);
1804 C_MAKE(message__buf, MESSAGE_BUF, char);
1806 /* Hack -- No messages yet */
1807 message__tail = MESSAGE_BUF;
1810 /*** Prepare the Player inventory ***/
1813 C_MAKE(inventory, INVEN_TOTAL, object_type);
1816 /*** Prepare the options ***/
1818 /* Scan the options */
1819 for (i = 0; option_info[i].o_desc; i++)
1821 int os = option_info[i].o_set;
1822 int ob = option_info[i].o_bit;
1824 /* Set the "default" options */
1825 if (option_info[i].o_var)
1828 option_mask[os] |= (1L << ob);
1831 if (option_info[i].o_norm)
1834 option_flag[os] |= (1L << ob);
1841 option_flag[os] &= ~(1L << ob);
1846 /* Analyze the windows */
1847 for (n = 0; n < 8; n++)
1849 /* Analyze the options */
1850 for (i = 0; i < 32; i++)
1853 if (window_flag_desc[i])
1856 window_mask[n] |= (1L << i);
1862 * Set the "default" window flags
1863 * Window 1 : Display messages
1864 * Window 2 : Display inven/equip
1866 window_flag[1] = 1L << 6;
1867 window_flag[2] = 1L << 0;
1870 /*** Pre-allocate space for the "format()" buffer ***/
1872 /* Hack -- Just call the "format()" function */
1873 (void)format("%s (%s).", "Mr.Hoge", MAINTAINER);
1882 * Initialize some other arrays
1884 static errr init_object_alloc(void)
1889 s16b num[MAX_DEPTH];
1890 s16b aux[MAX_DEPTH];
1893 /*** Analyze object allocation info ***/
1895 /* Clear the "aux" array */
1896 (void)C_WIPE(&aux, MAX_DEPTH, s16b);
1898 /* Clear the "num" array */
1899 (void)C_WIPE(&num, MAX_DEPTH, s16b);
1901 /* Free the old "alloc_kind_table" (if it exists) */
1902 if (alloc_kind_table)
1904 C_KILL(alloc_kind_table, alloc_kind_size, alloc_entry);
1907 /* Size of "alloc_kind_table" */
1908 alloc_kind_size = 0;
1910 /* Scan the objects */
1911 for (i = 1; i < max_k_idx; i++)
1915 /* Scan allocation pairs */
1916 for (j = 0; j < 4; j++)
1918 /* Count the "legal" entries */
1919 if (k_ptr->chance[j])
1921 /* Count the entries */
1924 /* Group by level */
1925 num[k_ptr->locale[j]]++;
1930 /* Collect the level indexes */
1931 for (i = 1; i < MAX_DEPTH; i++)
1933 /* Group by level */
1939 if (!num[0]) quit("Ä®¤Î¥¢¥¤¥Æ¥à¤¬¤Ê¤¤¡ª");
1941 if (!num[0]) quit("No town objects!");
1946 /*** Initialize object allocation info ***/
1948 /* Allocate the alloc_kind_table */
1949 C_MAKE(alloc_kind_table, alloc_kind_size, alloc_entry);
1951 /* Access the table entry */
1952 table = alloc_kind_table;
1954 /* Scan the objects */
1955 for (i = 1; i < max_k_idx; i++)
1959 /* Scan allocation pairs */
1960 for (j = 0; j < 4; j++)
1962 /* Count the "legal" entries */
1963 if (k_ptr->chance[j])
1967 /* Extract the base level */
1968 x = k_ptr->locale[j];
1970 /* Extract the base probability */
1971 p = (100 / k_ptr->chance[j]);
1973 /* Skip entries preceding our locale */
1974 y = (x > 0) ? num[x-1] : 0;
1976 /* Skip previous entries at this locale */
1979 /* Load the entry */
1986 /* Another entry complete for this locale */
1998 * Initialize some other arrays
2000 static errr init_alloc(void)
2003 monster_race *r_ptr;
2009 /* Allocate the "r_info" array */
2010 C_MAKE(elements, max_r_idx, tag_type);
2012 /* Scan the monsters */
2013 for (i = 1; i < max_r_idx; i++)
2015 elements[i].tag = r_info[i].level;
2016 elements[i].index = i;
2019 tag_sort(elements, max_r_idx);
2021 /*** Initialize monster allocation info ***/
2023 /* Size of "alloc_race_table" */
2024 alloc_race_size = max_r_idx;
2026 /* Allocate the alloc_race_table */
2027 C_MAKE(alloc_race_table, alloc_race_size, alloc_entry);
2029 /* Scan the monsters */
2030 for (i = 1; i < max_r_idx; i++)
2032 /* Get the i'th race */
2033 r_ptr = &r_info[elements[i].index];
2035 /* Count valid pairs */
2040 /* Extract the base level */
2043 /* Extract the base probability */
2044 p = (100 / r_ptr->rarity);
2046 /* Load the entry */
2047 alloc_race_table[i].index = elements[i].index;
2048 alloc_race_table[i].level = x;
2049 alloc_race_table[i].prob1 = p;
2050 alloc_race_table[i].prob2 = p;
2051 alloc_race_table[i].prob3 = p;
2055 /* Free the "r_info" array */
2056 C_KILL(elements, max_r_idx, tag_type);
2058 #else /* SORT_R_INFO */
2062 s16b num[MAX_DEPTH];
2063 s16b aux[MAX_DEPTH];
2065 /*** Analyze monster allocation info ***/
2067 /* Clear the "aux" array */
2068 C_WIPE(&aux, MAX_DEPTH, s16b);
2070 /* Clear the "num" array */
2071 C_WIPE(&num, MAX_DEPTH, s16b);
2073 /* Size of "alloc_race_table" */
2074 alloc_race_size = 0;
2076 /* Scan the monsters */
2077 for (i = 1; i < max_r_idx; i++)
2079 /* Get the i'th race */
2082 /* Legal monsters */
2085 /* Count the entries */
2088 /* Group by level */
2089 num[r_ptr->level]++;
2093 /* Collect the level indexes */
2094 for (i = 1; i < MAX_DEPTH; i++)
2096 /* Group by level */
2102 if (!num[0]) quit("Ä®¤Î¥â¥ó¥¹¥¿¡¼¤¬¤Ê¤¤¡ª");
2104 if (!num[0]) quit("No town monsters!");
2109 /*** Initialize monster allocation info ***/
2111 /* Allocate the alloc_race_table */
2112 C_MAKE(alloc_race_table, alloc_race_size, alloc_entry);
2114 /* Access the table entry */
2115 table = alloc_race_table;
2117 /* Scan the monsters */
2118 for (i = 1; i < max_r_idx; i++)
2120 /* Get the i'th race */
2123 /* Count valid pairs */
2128 /* Extract the base level */
2131 /* Extract the base probability */
2132 p = (100 / r_ptr->rarity);
2134 /* Skip entries preceding our locale */
2135 y = (x > 0) ? num[x-1] : 0;
2137 /* Skip previous entries at this locale */
2140 /* Load the entry */
2147 /* Another entry complete for this locale */
2152 #endif /* SORT_R_INFO */
2154 /* Init the "alloc_kind_table" */
2155 (void)init_object_alloc();
2164 * Hack -- take notes on line 23
2166 static void note(cptr str)
2168 Term_erase(0, 23, 255);
2169 Term_putstr(20, 23, -1, TERM_WHITE, str);
2176 * Hack -- Explain a broken "lib" folder and quit (see below).
2178 * XXX XXX XXX This function is "messy" because various things
2179 * may or may not be initialized, but the "plog()" and "quit()"
2180 * functions are "supposed" to work under any conditions.
2182 static void init_angband_aux(cptr why)
2189 plog("'lib'¥Ç¥£¥ì¥¯¥È¥ê¤¬Â¸ºß¤·¤Ê¤¤¤«²õ¤ì¤Æ¤¤¤ë¤è¤¦¤Ç¤¹¡£");
2192 plog("¤Ò¤ç¤Ã¤È¤¹¤ë¤È¥¢¡¼¥«¥¤¥Ö¤¬Àµ¤·¤¯²òÅव¤ì¤Æ¤¤¤Ê¤¤¤Î¤«¤â¤·¤ì¤Þ¤»¤ó¡£");
2195 plog("³ºÅö¤¹¤ë'README'¥Õ¥¡¥¤¥ë¤òÆɤó¤Ç³Îǧ¤·¤Æ¤ß¤Æ²¼¤µ¤¤¡£");
2197 /* Quit with error */
2198 quit("Ã×̿Ū¤Ê¥¨¥é¡¼¡£");
2201 plog("The 'lib' directory is probably missing or broken.");
2204 plog("Perhaps the archive was not extracted correctly.");
2207 plog("See the 'README' file for more information.");
2209 /* Quit with error */
2210 quit("Fatal Error.");
2217 * Hack -- main Angband initialization entry point
2219 * Verify some files, display the "news.txt" file, create
2220 * the high score file, initialize all internal arrays, and
2221 * load the basic "user pref files".
2223 * Be very careful to keep track of the order in which things
2224 * are initialized, in particular, the only thing *known* to
2225 * be available when this function is called is the "z-term.c"
2226 * package, and that may not be fully initialized until the
2227 * end of this function, when the default "user pref files"
2228 * are loaded and "Term_xtra(TERM_XTRA_REACT,0)" is called.
2230 * Note that this function attempts to verify the "news" file,
2231 * and the game aborts (cleanly) on failure, since without the
2232 * "news" file, it is likely that the "lib" folder has not been
2233 * correctly located. Otherwise, the news file is displayed for
2236 * Note that this function attempts to verify (or create) the
2237 * "high score" file, and the game aborts (cleanly) on failure,
2238 * since one of the most common "extraction" failures involves
2239 * failing to extract all sub-directories (even empty ones), such
2240 * as by failing to use the "-d" option of "pkunzip", or failing
2241 * to use the "save empty directories" option with "Compact Pro".
2242 * This error will often be caught by the "high score" creation
2243 * code below, since the "lib/apex" directory, being empty in the
2244 * standard distributions, is most likely to be "lost", making it
2245 * impossible to create the high score file.
2247 * Note that various things are initialized by this function,
2248 * including everything that was once done by "init_some_arrays".
2250 * This initialization involves the parsing of special files
2251 * in the "lib/data" and sometimes the "lib/edit" directories.
2253 * Note that the "template" files are initialized first, since they
2254 * often contain errors. This means that macros and message recall
2255 * and things like that are not available until after they are done.
2257 * We load the default "user pref files" here in case any "color"
2258 * changes are needed before character creation.
2260 * Note that the "graf-xxx.prf" file must be loaded separately,
2261 * if needed, in the first (?) pass through "TERM_XTRA_REACT".
2263 void init_angband(void)
2274 /*** Verify the "news" file ***/
2276 /* Build the filename */
2278 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, "news_j.txt");
2280 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, "news.txt");
2284 /* Attempt to open the file */
2285 fd = fd_open(buf, O_RDONLY);
2294 sprintf(why, "'%s'¥Õ¥¡¥¤¥ë¤Ë¥¢¥¯¥»¥¹¤Ç¤¤Þ¤»¤ó!", buf);
2296 sprintf(why, "Cannot access the '%s' file!", buf);
2300 /* Crash and burn */
2301 init_angband_aux(why);
2308 /*** Display the "news" file ***/
2313 /* Build the filename */
2315 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, "news_j.txt");
2317 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, "news.txt");
2321 /* Open the News file */
2322 fp = my_fopen(buf, "r");
2329 /* Dump the file to the screen */
2330 while (0 == my_fgets(fp, buf, sizeof(buf)))
2332 /* Display and advance */
2333 Term_putstr(0, i++, -1, TERM_WHITE, buf);
2344 /*** Verify (or create) the "high score" file ***/
2346 /* Build the filename */
2347 path_build(buf, sizeof(buf), ANGBAND_DIR_APEX, "scores.raw");
2349 /* Attempt to open the high score file */
2350 fd = fd_open(buf, O_RDONLY);
2355 /* File type is "DATA" */
2356 FILE_TYPE(FILE_TYPE_DATA);
2358 /* Grab permissions */
2361 /* Create a new high score file */
2362 fd = fd_make(buf, mode);
2364 /* Drop permissions */
2374 sprintf(why, "'%s'¥Õ¥¡¥¤¥ë¤òºîÀ®¤Ç¤¤Þ¤»¤ó!", buf);
2376 sprintf(why, "Cannot create the '%s' file!", buf);
2380 /* Crash and burn */
2381 init_angband_aux(why);
2389 /*** Initialize some arrays ***/
2391 /* Initialize misc. values */
2393 note("[ÊÑ¿ô¤ò½é´ü²½¤·¤Æ¤¤¤Þ¤¹...(¤½¤Î¾)");
2395 note("[Initializing values... (misc)]");
2399 if (init_misc()) quit("¤½¤Î¾¤ÎÊÑ¿ô¤ò½é´ü²½¤Ç¤¤Þ¤»¤ó");
2401 if (init_misc()) quit("Cannot initialize misc. values");
2405 /* Initialize feature info */
2407 note("[¥Ç¡¼¥¿¤Î½é´ü²½Ãæ... (ÃÏ·Á)]");
2408 if (init_f_info()) quit("ÃÏ·Á½é´ü²½ÉÔǽ");
2409 if (init_feat_variables()) quit("ÃÏ·Á½é´ü²½ÉÔǽ");
2411 note("[Initializing arrays... (features)]");
2412 if (init_f_info()) quit("Cannot initialize features");
2413 if (init_feat_variables()) quit("Cannot initialize features");
2417 /* Initialize object info */
2419 note("[¥Ç¡¼¥¿¤Î½é´ü²½Ãæ... (¥¢¥¤¥Æ¥à)]");
2420 if (init_k_info()) quit("¥¢¥¤¥Æ¥à½é´ü²½ÉÔǽ");
2422 note("[Initializing arrays... (objects)]");
2423 if (init_k_info()) quit("Cannot initialize objects");
2427 /* Initialize artifact info */
2429 note("[¥Ç¡¼¥¿¤Î½é´ü²½Ãæ... (ÅÁÀâ¤Î¥¢¥¤¥Æ¥à)]");
2430 if (init_a_info()) quit("ÅÁÀâ¤Î¥¢¥¤¥Æ¥à½é´ü²½ÉÔǽ");
2432 note("[Initializing arrays... (artifacts)]");
2433 if (init_a_info()) quit("Cannot initialize artifacts");
2437 /* Initialize ego-item info */
2439 note("[¥Ç¡¼¥¿¤Î½é´ü²½Ãæ... (̾¤Î¤¢¤ë¥¢¥¤¥Æ¥à)]");
2440 if (init_e_info()) quit("̾¤Î¤¢¤ë¥¢¥¤¥Æ¥à½é´ü²½ÉÔǽ");
2442 note("[Initializing arrays... (ego-items)]");
2443 if (init_e_info()) quit("Cannot initialize ego-items");
2447 /* Initialize monster info */
2449 note("[¥Ç¡¼¥¿¤Î½é´ü²½Ãæ... (¥â¥ó¥¹¥¿¡¼)]");
2450 if (init_r_info()) quit("¥â¥ó¥¹¥¿¡¼½é´ü²½ÉÔǽ");
2452 note("[Initializing arrays... (monsters)]");
2453 if (init_r_info()) quit("Cannot initialize monsters");
2457 /* Initialize dungeon info */
2459 note("[¥Ç¡¼¥¿¤Î½é´ü²½Ãæ... (¥À¥ó¥¸¥ç¥ó)]");
2460 if (init_d_info()) quit("¥À¥ó¥¸¥ç¥ó½é´ü²½ÉÔǽ");
2462 note("[Initializing arrays... (dungeon)]");
2463 if (init_d_info()) quit("Cannot initialize dungeon");
2467 for (i = 1; i < max_d_idx; i++)
2468 if (d_info[i].final_guardian)
2469 r_info[d_info[i].final_guardian].flags7 |= RF7_GUARDIAN;
2472 /* Initialize magic info */
2474 note("[¥Ç¡¼¥¿¤Î½é´ü²½Ãæ... (ËâË¡)]");
2475 if (init_m_info()) quit("ËâË¡½é´ü²½ÉÔǽ");
2477 note("[Initializing arrays... (magic)]");
2478 if (init_m_info()) quit("Cannot initialize magic");
2481 /* Initialize weapon_exp info */
2483 note("[¥Ç¡¼¥¿¤Î½é´ü²½Ãæ... (½ÏÎýÅÙ)]");
2484 if (init_s_info()) quit("½ÏÎýÅÙ½é´ü²½ÉÔǽ");
2486 note("[Initializing arrays... (skill)]");
2487 if (init_s_info()) quit("Cannot initialize skill");
2490 /* Initialize wilderness array */
2492 note("[ÇÛÎó¤ò½é´ü²½¤·¤Æ¤¤¤Þ¤¹... (¹ÓÌî)]");
2494 note("[Initializing arrays... (wilderness)]");
2498 if (init_wilderness()) quit("¹ÓÌî¤ò½é´ü²½¤Ç¤¤Þ¤»¤ó");
2500 if (init_wilderness()) quit("Cannot initialize wilderness");
2504 /* Initialize town array */
2506 note("[ÇÛÎó¤ò½é´ü²½¤·¤Æ¤¤¤Þ¤¹... (³¹)]");
2508 note("[Initializing arrays... (towns)]");
2512 if (init_towns()) quit("³¹¤ò½é´ü²½¤Ç¤¤Þ¤»¤ó");
2514 if (init_towns()) quit("Cannot initialize towns");
2518 /* Initialize building array */
2520 note("[ÇÛÎó¤ò½é´ü²½¤·¤Æ¤¤¤Þ¤¹... (·úʪ)]");
2522 note("[Initializing arrays... (buildings)]");
2526 if (init_buildings()) quit("·úʪ¤ò½é´ü²½¤Ç¤¤Þ¤»¤ó");
2528 if (init_buildings()) quit("Cannot initialize buildings");
2532 /* Initialize quest array */
2534 note("[ÇÛÎó¤ò½é´ü²½¤·¤Æ¤¤¤Þ¤¹... (¥¯¥¨¥¹¥È)]");
2536 note("[Initializing arrays... (quests)]");
2540 if (init_quests()) quit("¥¯¥¨¥¹¥È¤ò½é´ü²½¤Ç¤¤Þ¤»¤ó");
2542 if (init_quests()) quit("Cannot initialize quests");
2546 /* Initialize vault info */
2548 if (init_v_info()) quit("vault ½é´ü²½ÉÔǽ");
2550 if (init_v_info()) quit("Cannot initialize vaults");
2554 /* Initialize some other arrays */
2556 note("[¥Ç¡¼¥¿¤Î½é´ü²½Ãæ... (¤½¤Î¾)]");
2557 if (init_other()) quit("¤½¤Î¾¤Î¥Ç¡¼¥¿½é´ü²½ÉÔǽ");
2559 note("[Initializing arrays... (other)]");
2560 if (init_other()) quit("Cannot initialize other stuff");
2564 /* Initialize some other arrays */
2567 note("[¥Ç¡¼¥¿¤Î½é´ü²½Ãæ... (¥¢¥í¥±¡¼¥·¥ç¥ó)]");
2568 if (init_alloc()) quit("¥¢¥í¥±¡¼¥·¥ç¥ó¡¦¥¹¥¿¥Ã¥Õ½é´ü²½ÉÔǽ");
2570 note("[Initializing arrays... (alloc)]");
2571 if (init_alloc()) quit("Cannot initialize alloc stuff");
2576 /*** Load default user pref files ***/
2578 /* Initialize feature info */
2580 note("[¥æ¡¼¥¶¡¼ÀßÄê¥Õ¥¡¥¤¥ë¤ò½é´ü²½¤·¤Æ¤¤¤Þ¤¹...]");
2582 note("[Initializing user pref files...]");
2586 /* Access the "basic" pref file */
2587 strcpy(buf, "pref.prf");
2589 /* Process that file */
2590 process_pref_file(buf);
2592 /* Access the "basic" system pref file */
2593 sprintf(buf, "pref-%s.prf", ANGBAND_SYS);
2595 /* Process that file */
2596 process_pref_file(buf);
2600 note("[½é´ü²½½ªÎ»]");
2602 note("[Initialization complete]");
2608 * Get check sum in string form
2610 cptr get_check_sum(void)
2612 return format("%02x%02x%02x%02x%02x%02x%02x%02x%02x",