OSDN Git Service

★聖騎士強化, その他新★のレアリティ調整.
[hengband/hengband.git] / src / init2.c
index 920b17f..0d050a3 100644 (file)
@@ -1,5 +1,13 @@
 /* File: init2.c */
 
+/*
+ * Copyright (c) 1997 Ben Harrison
+ *
+ * This software may be copied and distributed for educational, research,
+ * and not for profit purposes provided that this copyright and statement
+ * are included in all such copies.  Other copyrights may also apply.
+ */
+
 /* Purpose: Initialization (part 2) -BEN- */
 
 #include "angband.h"
@@ -452,7 +460,7 @@ static errr init_info(cptr filename, header *head,
        {
 #ifdef CHECK_MODIFICATION_TIME
 
-               err = check_modification_date(fd, format("%s_j.txt", filename));
+               err = check_modification_date(fd, format("%s.txt", filename));
 
 #endif /* CHECK_MODIFICATION_TIME */
 
@@ -485,14 +493,14 @@ static errr init_info(cptr filename, header *head,
 
                /* Build the filename */
 
-               path_build(buf, sizeof(buf), ANGBAND_DIR_EDIT, format("%s_j.txt", filename));
+               path_build(buf, sizeof(buf), ANGBAND_DIR_EDIT, format("%s.txt", filename));
 
                /* Open the file */
                fp = my_fopen(buf, "r");
 
                /* Parse it */
 #ifdef JP
-               if (!fp) quit(format("'%s_j.txt'¥Õ¥¡¥¤¥ë¤ò¥ª¡¼¥×¥ó¤Ç¤­¤Þ¤»¤ó¡£", filename));
+               if (!fp) quit(format("'%s.txt'¥Õ¥¡¥¤¥ë¤ò¥ª¡¼¥×¥ó¤Ç¤­¤Þ¤»¤ó¡£", filename));
 #else
                if (!fp) quit(format("Cannot open '%s.txt' file.", filename));
 #endif
@@ -514,13 +522,13 @@ static errr init_info(cptr filename, header *head,
                        oops = ((err > 0) ? err_str[err] : "̤ÃΤÎ");
 
                        /* Oops */
-                       msg_format("'%s_j.txt'¥Õ¥¡¥¤¥ë¤Î %d ¹ÔÌܤ˥¨¥é¡¼¡£", filename, error_line);
+                       msg_format("'%s.txt'¥Õ¥¡¥¤¥ë¤Î %d ¹ÔÌܤ˥¨¥é¡¼¡£", filename, error_line);
                        msg_format("¥ì¥³¡¼¥É %d ¤Ï '%s' ¥¨¥é¡¼¤¬¤¢¤ê¤Þ¤¹¡£", error_idx, oops);
                        msg_format("¹½Ê¸ '%s'¡£", buf);
                        msg_print(NULL);
 
                        /* Quit */
-                       quit(format("'%s_j.txt'¥Õ¥¡¥¤¥ë¤Ë¥¨¥é¡¼", filename));
+                       quit(format("'%s.txt'¥Õ¥¡¥¤¥ë¤Ë¥¨¥é¡¼", filename));
 #else
                        /* Error string */
                        oops = (((err > 0) && (err < PARSE_ERROR_MAX)) ? err_str[err] : "unknown");
@@ -551,19 +559,25 @@ static errr init_info(cptr filename, header *head,
 #endif
 
 
+               /* Grab permissions */
+               safe_setuid_grab();
+
                /* Kill the old file */
                (void)fd_kill(buf);
 
                /* Attempt to create the raw file */
                fd = fd_make(buf, mode);
 
+               /* Drop permissions */
+               safe_setuid_drop();
+
                /* Dump to the file */
                if (fd >= 0)
                {
                        /* Dump it */
                        fd_write(fd, (cptr)(head), head->head_size);
 
-               /* Dump the "*_info" array */
+                       /* Dump the "*_info" array */
                        fd_write(fd, head->info_ptr, head->info_size);
 
                        /* Dump the "*_name" array */
@@ -652,7 +666,7 @@ static errr init_f_info(void)
 #endif /* ALLOW_TEMPLATES */
 
        return init_info("f_info", &f_head,
-                        (void*)&f_info, (void*)&f_name, (void*)&f_text);
+                        (void*)&f_info, (void*)&f_name, NULL);
 }
 
 
@@ -799,7 +813,7 @@ static errr init_s_info(void)
 #endif /* ALLOW_TEMPLATES */
 
        return init_info("s_info", &s_head,
-                        (void*)&s_info, (void*)&s_name, (void*)&s_text);
+                        (void*)&s_info, NULL, NULL);
 }
 
 
@@ -819,7 +833,7 @@ static errr init_m_info(void)
 #endif /* ALLOW_TEMPLATES */
 
        return init_info("m_info", &m_head,
-                        (void*)&m_info, (void*)&m_name, (void*)&m_text);
+                        (void*)&m_info, NULL, NULL);
 }
 
 
@@ -879,16 +893,14 @@ static byte store_table[MAX_STORES][STORE_CHOICES][2] =
                { TV_FOOD, SV_FOOD_RATION },
                { TV_FOOD, SV_FOOD_RATION },
 
-               { TV_LITE, SV_LITE_TORCH },
-               { TV_LITE, SV_LITE_TORCH },
+               { TV_POTION, SV_POTION_WATER },
+               { TV_POTION, SV_POTION_WATER },
                { TV_LITE, SV_LITE_LANTERN },
                { TV_LITE, SV_LITE_LANTERN },
 
-               { TV_FLASK, 0 },
-               { TV_FLASK, 0 },
-
+               { TV_FOOD, SV_FOOD_WAYBREAD },
+               { TV_FOOD, SV_FOOD_WAYBREAD },
                { TV_CAPTURE, 0 },
-
                { TV_FIGURINE, 0 },
 
                { TV_SHOT, SV_AMMO_NORMAL },
@@ -1115,7 +1127,7 @@ static byte store_table[MAX_STORES][STORE_CHOICES][2] =
 
                { TV_SCROLL, SV_SCROLL_DETECT_INVIS },
                { TV_SCROLL, SV_SCROLL_RECHARGING },
-               { TV_SCROLL, SV_SCROLL_SATISFY_HUNGER },
+               { TV_SCROLL, SV_SCROLL_TELEPORT },
                { TV_SCROLL, SV_SCROLL_WORD_OF_RECALL },
 
                { TV_SCROLL, SV_SCROLL_WORD_OF_RECALL },
@@ -1149,9 +1161,9 @@ static byte store_table[MAX_STORES][STORE_CHOICES][2] =
                { TV_SCROLL, SV_SCROLL_ENCHANT_ARMOR },
 
                { TV_SCROLL, SV_SCROLL_RECHARGING },
-               { TV_SCROLL, SV_SCROLL_SATISFY_HUNGER },
-               { TV_SCROLL, SV_SCROLL_SATISFY_HUNGER },
-               { TV_SCROLL, SV_SCROLL_SATISFY_HUNGER }
+               { TV_SCROLL, SV_SCROLL_PHASE_DOOR },
+               { TV_SCROLL, SV_SCROLL_ENCHANT_WEAPON_TO_HIT },
+               { TV_SCROLL, SV_SCROLL_ENCHANT_WEAPON_TO_DAM },
 
        },
 
@@ -1385,7 +1397,7 @@ static byte store_table[MAX_STORES][STORE_CHOICES][2] =
 static errr init_misc(void)
 {
        /* Initialize the values */
-       process_dungeon_file("misc_j.txt", 0, 0, 0, 0);
+       process_dungeon_file("misc.txt", 0, 0, 0, 0);
 
        return 0;
 }
@@ -1600,47 +1612,6 @@ static errr init_other(void)
        C_MAKE(inventory, INVEN_TOTAL, object_type);
 
 
-       /*** Pre-allocate the basic "auto-inscriptions" ***/
-
-       /* The "basic" feelings */
-#ifdef JP
-       (void)quark_add("¼ö¤ï¤ì¤Æ¤¤¤ë");
-       (void)quark_add("²õ¤ì¤Æ¤¤¤ë");
-       (void)quark_add("ÊÂ");
-       (void)quark_add("¾å¼Á");
-#else
-       (void)quark_add("cursed");
-       (void)quark_add("broken");
-       (void)quark_add("average");
-       (void)quark_add("good");
-#endif
-
-
-       /* The "extra" feelings */
-#ifdef JP
-       (void)quark_add("¹âµéÉÊ");
-       (void)quark_add("̵²ÁÃÍ");
-       (void)quark_add("ÆÃÊÌÀ½");
-       (void)quark_add("¶²¤í¤·¤¤");
-#else
-       (void)quark_add("excellent");
-       (void)quark_add("worthless");
-       (void)quark_add("special");
-       (void)quark_add("terrible");
-#endif
-
-
-       /* Some extra strings */
-#ifdef JP
-       (void)quark_add("¼ö¤¤¤Ê¤·");
-       (void)quark_add("Çä½ÐÃæ");
-#else
-       (void)quark_add("uncursed");
-       (void)quark_add("on sale");
-#endif
-
-
-
        /*** Prepare the options ***/
 
        /* Scan the options */
@@ -1977,7 +1948,7 @@ void init_angband(void)
 {
        int fd = -1;
 
-       int mode = 0644;
+       int mode = 0664;
 
        FILE *fp;
 
@@ -2068,9 +2039,15 @@ void init_angband(void)
                /* File type is "DATA" */
                FILE_TYPE(FILE_TYPE_DATA);
 
+               /* Grab permissions */
+               safe_setuid_grab();
+
                /* Create a new high score file */
                fd = fd_make(buf, mode);
 
+               /* Drop permissions */
+               safe_setuid_drop();
+
                /* Failure */
                if (fd < 0)
                {
@@ -2248,6 +2225,14 @@ if (init_quests()) quit("
 #endif
 
 
+       /* Initialize vault info */
+#ifdef JP
+       if (init_v_info()) quit("vault ½é´ü²½ÉÔǽ");
+#else
+       if (init_v_info()) quit("Cannot initialize vaults");
+#endif
+
+
        /* Initialize some other arrays */
 #ifdef JP
        note("[¥Ç¡¼¥¿¤Î½é´ü²½Ãæ... (¤½¤Î¾)]");