OSDN Git Service

英語版のモンスターの思い出で, 炎と氷とスパークに包まれたモンスターと
[hengband/hengband.git] / src / init2.c
index b6270c2..b7aaf49 100644 (file)
@@ -1202,7 +1202,7 @@ static byte store_table[MAX_STORES][STORE_CHOICES][2] =
                /* Magic-User store */
 
                { TV_RING, SV_RING_PROTECTION },
-               { TV_RING, SV_RING_FEATHER_FALL },
+               { TV_RING, SV_RING_LEVITATION_FALL },
                { TV_RING, SV_RING_PROTECTION },
                { TV_RING, SV_RING_RESIST_FIRE },
 
@@ -1368,10 +1368,10 @@ static byte store_table[MAX_STORES][STORE_CHOICES][2] =
                { TV_ARCANE_BOOK, 2 },
                { TV_ARCANE_BOOK, 3 },
 
-               { TV_ENCHANT_BOOK, 0 },
-               { TV_ENCHANT_BOOK, 0 },
-               { TV_ENCHANT_BOOK, 1 },
-               { TV_ENCHANT_BOOK, 1 },
+               { TV_CRAFT_BOOK, 0 },
+               { TV_CRAFT_BOOK, 0 },
+               { TV_CRAFT_BOOK, 1 },
+               { TV_CRAFT_BOOK, 1 },
 
                { TV_DAEMON_BOOK, 0 },
                { TV_DAEMON_BOOK, 0 },
@@ -1605,6 +1605,12 @@ static errr init_other(void)
        /* Allocate and Wipe the monster list */
        C_MAKE(m_list, max_m_idx, monster_type);
 
+       /* Allocate and Wipe the monster process list */
+       for (i = 0; i < MAX_MTIMED; i++)
+       {
+               C_MAKE(mproc_list[i], max_m_idx, s16b);
+       }
+
        /* Allocate and Wipe the max dungeon level */
        C_MAKE(max_dlv, max_d_idx, s16b);
 
@@ -1627,7 +1633,7 @@ static errr init_other(void)
        C_MAKE(macro__buf, 1024, char);
 
        /* Quark variables */
-       C_MAKE(quark__str, QUARK_MAX, cptr);
+       quark_init();
 
        /* Message variables */
        C_MAKE(message__ptr, MESSAGE_MAX, u16b);
@@ -1708,6 +1714,121 @@ static errr init_other(void)
 }
 
 
+/*
+ * Initialize some other arrays
+ */
+static errr init_object_alloc(void)
+{
+       int i, j;
+       object_kind *k_ptr;
+       alloc_entry *table;
+       s16b num[MAX_DEPTH];
+       s16b aux[MAX_DEPTH];
+
+
+       /*** Analyze object allocation info ***/
+
+       /* Clear the "aux" array */
+       (void)C_WIPE(&aux, MAX_DEPTH, s16b);
+
+       /* Clear the "num" array */
+       (void)C_WIPE(&num, MAX_DEPTH, s16b);
+
+       /* Free the old "alloc_kind_table" (if it exists) */
+       if (alloc_kind_table)
+       {
+               C_KILL(alloc_kind_table, alloc_kind_size, alloc_entry);
+       }
+
+       /* Size of "alloc_kind_table" */
+       alloc_kind_size = 0;
+
+       /* Scan the objects */
+       for (i = 1; i < max_k_idx; i++)
+       {
+               k_ptr = &k_info[i];
+
+               /* Scan allocation pairs */
+               for (j = 0; j < 4; j++)
+               {
+                       /* Count the "legal" entries */
+                       if (k_ptr->chance[j])
+                       {
+                               /* Count the entries */
+                               alloc_kind_size++;
+
+                               /* Group by level */
+                               num[k_ptr->locale[j]]++;
+                       }
+               }
+       }
+
+       /* Collect the level indexes */
+       for (i = 1; i < MAX_DEPTH; i++)
+       {
+               /* Group by level */
+               num[i] += num[i-1];
+       }
+
+       /* Paranoia */
+#ifdef JP
+if (!num[0]) quit("Ä®¤Î¥¢¥¤¥Æ¥à¤¬¤Ê¤¤¡ª");
+#else
+       if (!num[0]) quit("No town objects!");
+#endif
+
+
+
+       /*** Initialize object allocation info ***/
+
+       /* Allocate the alloc_kind_table */
+       C_MAKE(alloc_kind_table, alloc_kind_size, alloc_entry);
+
+       /* Access the table entry */
+       table = alloc_kind_table;
+
+       /* Scan the objects */
+       for (i = 1; i < max_k_idx; i++)
+       {
+               k_ptr = &k_info[i];
+
+               /* Scan allocation pairs */
+               for (j = 0; j < 4; j++)
+               {
+                       /* Count the "legal" entries */
+                       if (k_ptr->chance[j])
+                       {
+                               int p, x, y, z;
+
+                               /* Extract the base level */
+                               x = k_ptr->locale[j];
+
+                               /* Extract the base probability */
+                               p = (100 / k_ptr->chance[j]);
+
+                               /* Skip entries preceding our locale */
+                               y = (x > 0) ? num[x-1] : 0;
+
+                               /* Skip previous entries at this locale */
+                               z = y + aux[x];
+
+                               /* Load the entry */
+                               table[z].index = i;
+                               table[z].level = x;
+                               table[z].prob1 = p;
+                               table[z].prob2 = p;
+                               table[z].prob3 = p;
+
+                               /* Another entry complete for this locale */
+                               aux[x]++;
+                       }
+               }
+       }
+
+       /* Success */
+       return (0);
+}
+
 
 /*
  * Initialize some other arrays