X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=src%2Finit1.c;h=7010093f0231f9b32d4591bf133bd70862814d30;hb=7de4d6dfb51f88bb16a02b538ab727fc1a6b9858;hp=a072d5514e31736b6cfa5f702aada0bbdf91a22d;hpb=3df123256e57aefda1790fde25b16c96c8190399;p=hengband%2Fhengband.git diff --git a/src/init1.c b/src/init1.c index a072d5514..7010093f0 100644 --- a/src/init1.c +++ b/src/init1.c @@ -1,29 +1,25 @@ -/* File: init1.c */ - -/* - * Copyright (c) 1997 Ben Harrison - * +/*! + * @file init1.c + * @brief ã²ã¼ã ãã¼ã¿åæå1 / Initialization (part 1) -BEN- + * @date 2014/01/28 + * @author + *
+ * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke * 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 1) -BEN- */ - -#include "angband.h" - - -/* + * 2014 Deskull rearranged comment for Doxygen.\n + *+ * @details + *
* This file is used to initialize various variables and arrays for the * Angband game. Note the use of "fd_read()" and "fd_write()" to bypass * the common limitation of "read()" and "write()" to only 32767 bytes * at a time. - * * Several of the arrays for Angband are built from "template" files in * the "lib/file" directory, from which quick-load binary "image" files * are constructed whenever they are not present in the "lib/data" * directory, or if those files become obsolete, if we are allowed. - * * Warning -- the "ascii" file parsers use a minor hack to collect the * name and text information in a single pass. Thus, the game will not * be able to load any template file with more than 20K of names or 60K @@ -36,12 +32,25 @@ * "*.raw" files in "lib/data", and then quit, and recompile without * defining ALLOW_TEMPLATES, which will both save 20K and prevent people * from changing the ascii template files in potentially dangerous ways. - * + * ãã¼ãã¨ãã¦è¨é²ï¼ALLOW_TEMPLATESãå®ç¾©ããã¦ããªãå ´åã + * ãã®ãã¡ã¤ã«ã®ã³ã¼ãã®å¤ãã¯ã³ã³ãã¤ã«åºåãããæ¬ã²ã¼ã 㯠+ * æ£è¦ã®ããã¤ããªãã³ãã¬ã¼ããã¡ã¤ã«ããlib/dataãã¡ã¤ã«å ã« + * åå¨ããªãéãèµ·åããªããªããä¸æ¹ALLOW_TEMPLATESãå®ç¾©ããã¦ãã + * ãªãã°ï¼åº¦ã²ã¼ã ãèµ·åãããã¨ã«*.rawãã¡ã¤ã«ç¾¤ãä½æãããçµäºæã«ã¯ + * ALLOW_TEMPLATEã®å®ç¾©ã«é¢ä¿ãªããªã³ã³ãã¤ã«ããããããã«ãã20K(ãã¤ãï¼) + * ã®ãã¼ã¿ãä¿åããããã¬ã¤ã¤ã¼ãæ½å¨çã«å±éºãªæ¹æ³ã§asciiæåã® + * ãã³ãã¬ã¼ããã¡ã¤ã«ãå¤æ´ãããã¨ã妨ãããã¨ãã§ããã * The code could actually be removed and placed into a "stand-alone" * program, but that feels a little silly, especially considering some * of the platforms that we currently support. + **/ +#include "angband.h" +#include "trap.h" + + + #ifdef ALLOW_TEMPLATES #include "init.h" @@ -49,10 +58,11 @@ /*** Helper arrays for parsing ascii template files ***/ -/* +/*! + * ã¢ã³ã¹ã¿ã¼ã®æææ段ãã¼ã¯ã³ã®å®ç¾© / * Monster Blow Methods */ -static cptr r_info_blow_method[] = +static concptr r_info_blow_method[] = { "", "HIT", @@ -84,10 +94,11 @@ static cptr r_info_blow_method[] = }; -/* +/*! + * ã¢ã³ã¹ã¿ã¼ã®ææå±æ§ãã¼ã¯ã³ã®å®ç¾© / * Monster Blow Effects */ -static cptr r_info_blow_effect[] = +static concptr r_info_blow_effect[] = { "", "HURT", @@ -128,11 +139,11 @@ static cptr r_info_blow_effect[] = NULL }; - -/* +/*! + * å°å½¢å±æ§ãã¼ã¯ã³ã®å®ç¾© / * Feature info flags */ -static cptr f_info_flags[] = +static concptr f_info_flags[] = { "LOS", "PROJECT", @@ -178,15 +189,15 @@ static cptr f_info_flags[] = "LAVA", "SHALLOW", "DEEP", - "FILLED", + "POISON_PUDDLE", "HURT_ROCK", "HURT_FIRE", "HURT_COLD", "HURT_ACID", - "ICE", - "ACID", + "COLD_PUDDLE", + "ACID_PUDDLE", "OIL", - "XXX04", + "ELEC_PUDDLE", "CAN_CLIMB", "CAN_FLY", "CAN_SWIM", @@ -253,10 +264,11 @@ static cptr f_info_flags[] = }; -/* +/*! + * ã¢ã³ã¹ã¿ã¼ç¹æ§ãã¼ã¯ã³ã®å®ç¾©1 / * Monster race flags */ -static cptr r_info_flags1[] = +static concptr r_info_flags1[] = { "UNIQUE", "QUESTOR", @@ -292,10 +304,11 @@ static cptr r_info_flags1[] = "XXX3" }; -/* +/*! + * ã¢ã³ã¹ã¿ã¼ç¹æ§ãã¼ã¯ã³ã®å®ç¾©2 / * Monster race flags */ -static cptr r_info_flags2[] = +static concptr r_info_flags2[] = { "STUPID", "SMART", @@ -331,10 +344,11 @@ static cptr r_info_flags2[] = "QUANTUM" }; -/* +/*! + * ã¢ã³ã¹ã¿ã¼ç¹æ§ãã¼ã¯ã³ã®å®ç¾©3 / * Monster race flags */ -static cptr r_info_flags3[] = +static concptr r_info_flags3[] = { "ORC", "TROLL", @@ -352,7 +366,7 @@ static cptr r_info_flags3[] = "HURT_ROCK", "HURT_FIRE", "HURT_COLD", - "XXX", + "ANGEL", "XXX", "XXX", "XXX", @@ -370,10 +384,11 @@ static cptr r_info_flags3[] = "NO_SLEEP" }; -/* +/*! + * ã¢ã³ã¹ã¿ã¼ç¹æ§ãã¼ã¯ã³ã®å®ç¾©4 / * Monster race flags */ -static cptr r_info_flags4[] = +static concptr r_info_flags4[] = { "SHRIEK", "XXX1", @@ -409,10 +424,11 @@ static cptr r_info_flags4[] = "BR_DISI", }; -/* +/*! + * ã¢ã³ã¹ã¿ã¼ç¹æ§ãã¼ã¯ã³(çºååè½å1) / * Monster race flags */ -static cptr r_info_flags5[] = +static concptr r_a_ability_flags1[] = { "BA_ACID", "BA_ELEC", @@ -448,10 +464,11 @@ static cptr r_info_flags5[] = "HOLD" }; -/* +/*! + * ã¢ã³ã¹ã¿ã¼ç¹æ§ãã¼ã¯ã³(çºååè½å2) / * Monster race flags */ -static cptr r_info_flags6[] = +static concptr r_a_ability_flags2[] = { "HASTE", "HAND_DOOM", @@ -487,11 +504,96 @@ static cptr r_info_flags6[] = "S_UNIQUE" }; +#if 0 +/*! + * ã¢ã³ã¹ã¿ã¼ç¹æ§ãã¼ã¯ã³(çºååè½å3) / + * Monster race flags + */ +static concptr r_a_ability_flags3[] = +{ + "XXXA3X00", + "XXXA3X01", + "XXXA3X02", + "XXXA3X03", + "XXXA3X04", + "XXXA3X05", + "XXXA3X06", + "XXXA3X07", + "XXXA3X08", + "XXXA3X09", + "XXXA3X10", + "XXXA3X11", + "XXXA3X12", + "XXXA3X13", + "XXXA3X14", + "XXXA3X15", + "XXXA3X16", + "XXXA3X17", + "XXXA3X18", + "XXXA3X19", + "XXXA3X20", + "XXXA3X21", + "XXXA3X22", + "XXXA3X23", + "XXXA3X24", + "XXXA3X25", + "XXXA3X26", + "XXXA3X27", + "XXXA3X28", + "XXXA3X29", + "XXXA3X30", + "XXXA3X31", +}; +#endif -/* +#if 0 +/*! + * ã¢ã³ã¹ã¿ã¼ç¹æ§ãã¼ã¯ã³(çºååè½å4) / * Monster race flags */ -static cptr r_info_flags7[] = +static concptr r_a_ability_flags4[] = +{ + "XXXA4X00", + "XXXA4X01", + "XXXA4X02", + "XXXA4X03", + "XXXA4X04", + "XXXA4X05", + "XXXA4X06", + "XXXA4X07", + "XXXA4X08", + "XXXA4X09", + "XXXA4X10", + "XXXA4X11", + "XXXA4X12", + "XXXA4X13", + "XXXA4X14", + "XXXA4X15", + "XXXA4X16", + "XXXA4X17", + "XXXA4X18", + "XXXA4X19", + "XXXA4X20", + "XXXA4X21", + "XXXA4X22", + "XXXA4X23", + "XXXA4X24", + "XXXA4X25", + "XXXA4X26", + "XXXA4X27", + "XXXA4X28", + "XXXA4X29", + "XXXA4X30", + "XXXA4X31", +}; +#endif + + +/*! + * ã¢ã³ã¹ã¿ã¼ç¹æ§ãã¼ã¯ã³ã®å®ç¾©7 / + * Monster race flags + */ +static concptr r_info_flags7[] = { "AQUATIC", "CAN_SWIM", @@ -527,10 +629,11 @@ static cptr r_info_flags7[] = "XXX7X31", }; -/* +/*! + * ã¢ã³ã¹ã¿ã¼ç¹æ§ãã¼ã¯ã³ã®å®ç¾©8 / * Monster race flags */ -static cptr r_info_flags8[] = +static concptr r_info_flags8[] = { "WILD_ONLY", "WILD_TOWN", @@ -567,10 +670,11 @@ static cptr r_info_flags8[] = }; -/* - * Monster race flags - Drops +/*! + * ã¢ã³ã¹ã¿ã¼ç¹æ§ãã¼ã¯ã³ã®å®ç¾©9 / + * Monster race flags */ -static cptr r_info_flags9[] = +static concptr r_info_flags9[] = { "DROP_CORPSE", "DROP_SKELETON", @@ -608,10 +712,11 @@ static cptr r_info_flags9[] = }; -/* - * Monster race flags - Resistances +/*! + * ã¢ã³ã¹ã¿ã¼ç¹æ§ãã¼ã¯ã³ã®å®ç¾©R(èæ§) / + * Monster race flags */ -static cptr r_info_flagsr[] = +static concptr r_info_flagsr[] = { "IM_ACID", "IM_ELEC", @@ -648,10 +753,11 @@ static cptr r_info_flagsr[] = }; -/* +/*! + * ãªãã¸ã§ã¯ãåºæ¬ç¹æ§ãã¼ã¯ã³ã®å®ç¾© / * Object flags */ -static cptr k_info_flags[] = +static concptr k_info_flags[] = { "STR", "INT", @@ -701,7 +807,7 @@ static cptr k_info_flags[] = "THROW", "REFLECT", "FREE_ACT", - "HOLD_LIFE", + "HOLD_EXP", "RES_ACID", "RES_ELEC", "RES_FIRE", @@ -778,10 +884,31 @@ static cptr k_info_flags[] = "ADD_H_CURSE", "DRAIN_HP", "DRAIN_MANA", + + "LITE_2", + "LITE_3", + "LITE_M1", + "LITE_M2", + "LITE_M3", + "LITE_FUEL", + + "CALL_ANIMAL", + "CALL_DEMON", + "CALL_DRAGON", + "CALL_UNDEAD", + "COWARDICE", + "LOW_MELEE", + "LOW_AC", + "LOW_MAGIC", + "FAST_DIGEST", + "SLOW_REGEN", }; - -static cptr k_info_gen_flags[] = +/*! + * ãªãã¸ã§ã¯ãçæç¹æ§ãã¼ã¯ã³ã®å®ç¾© / + * Object flags + */ +static concptr k_info_gen_flags[] = { "INSTA_ART", "QUESTITEM", @@ -800,7 +927,7 @@ static cptr k_info_gen_flags[] = "RANDOM_CURSE1", "RANDOM_CURSE2", "XTRA_DICE", - "XXX", + "POWERFUL", "XXX", "XXX", "XXX", @@ -817,10 +944,11 @@ static cptr k_info_gen_flags[] = "XXX", }; -/* +/*! + * ãã³ã¸ã§ã³ç¹æ§ãã¼ã¯ã³ã®å®ç¾© / * Dungeon flags */ -static cptr d_info_flags1[] = +static concptr d_info_flags1[] = { "WINNER", "MAZE", @@ -835,8 +963,8 @@ static cptr d_info_flags1[] = "CAVE", "CAVERN", "ARCADE", - "XXX", - "XXX", + "LAKE_ACID", + "LAKE_POISONOUS", "XXX", "FORGET", "LAKE_WATER", @@ -852,18 +980,24 @@ static cptr d_info_flags1[] = "NO_MELEE", "CHAMELEON", "DARKNESS", - "XXX", - "XXX" + "ACID_RIVER", + "POISONOUS_RIVER" }; -/* +/*! + * @brief ãã¼ã¿ã®å¯å¤æååæ å ±ãããã¹ãã¨ãã¦ä¿ç®¡ãã / * Add a text to the text-storage and store offset to it. - * + * @param offset æååä¿ç®¡ãã¤ã³ã¿ããã®ãªãã»ãã + * @param head ããã¹ãä¿ç®¡ãããæ å ±ã®æ§é ä½åç §ãã¤ã³ã¿ + * @param buf ä¿ç®¡æåå + * @param normal_text ããã¹ãã®æ£è¦åãè¡ã + * @return + * ç¡äºä¿ç®¡ãã§ãããTRUEãè¿ãã * Returns FALSE when there isn't enough space available to store * the text. */ -static bool add_text(u32b *offset, header *head, cptr buf, bool normal_text) +static bool add_text(u32b *offset, header *head, concptr buf, bool normal_text) { /* Hack -- Verify space */ if (head->text_size + strlen(buf) + 8 > FAKE_TEXT_SIZE) @@ -914,13 +1048,18 @@ static bool add_text(u32b *offset, header *head, cptr buf, bool normal_text) } -/* +/*! + * @brief ãã¼ã¿ã®å¯å¤æååæ å ±ãååã¨ãã¦ä¿ç®¡ãã / * Add a name to the name-storage and return an offset to it. - * + * @param offset æååä¿ç®¡ãã¤ã³ã¿ããã®ãªãã»ãã + * @param head ããã¹ãä¿ç®¡ãããæ å ±ã®æ§é ä½åç §ãã¤ã³ã¿ + * @param buf ä¿ç®¡æåå + * @return + * ç¡äºä¿ç®¡ãã§ãããTRUEãè¿ãã * Returns FALSE when there isn't enough space available to store - * the name. + * the text. */ -static bool add_name(u32b *offset, header *head, cptr buf) +static bool add_name(u32b *offset, header *head, concptr buf) { /* Hack -- Verify space */ if (head->name_size + strlen(buf) + 8 > FAKE_NAME_SIZE) @@ -944,13 +1083,18 @@ static bool add_name(u32b *offset, header *head, cptr buf) } -/* +/*! + * @brief ãã¼ã¿ã®å¯å¤æååæ å ±ãã¿ã°ã¨ãã¦ä¿ç®¡ãã / * Add a tag to the tag-storage and return an offset to it. - * + * @param offset æååä¿ç®¡ãã¤ã³ã¿ããã®ãªãã»ãã + * @param head ããã¹ãä¿ç®¡ãããæ å ±ã®æ§é ä½åç §ãã¤ã³ã¿ + * @param buf ä¿ç®¡æåå + * @return + * ç¡äºä¿ç®¡ãã§ãããTRUEãè¿ãã * Returns FALSE when there isn't enough space available to store - * the name. + * the text. */ -static bool add_tag(s16b *offset, header *head, cptr buf) +static bool add_tag(STR_OFFSET *offset, header *head, concptr buf) { u32b i; @@ -986,9 +1130,12 @@ static bool add_tag(s16b *offset, header *head, cptr buf) } -/* +/*! + * @brief ã·ã³ãã«1æåãã«ã©ã¼IDã«å¤æ´ãã / * Convert a "color letter" into an "actual" color * The colors are: dwsorgbuDWvyRGBU, as shown below + * @param c ã·ã³ãã«æå + * @return ã«ã©ã¼ID */ byte color_char_to_attr(char c) { @@ -1021,11 +1168,16 @@ byte color_char_to_attr(char c) /*** Initialize from ascii template files ***/ -/* +/*! + * @brief ãã¼ã¹é¢æ°ã«åºã¥ãã¦ãã¼ã¿ãã¡ã¤ã«ãããã¼ã¿ãèªã¿åã / * Initialize an "*_info" array, by parsing an ascii "template" file + * @param fp èªã¿åãã«ä½¿ããã¡ã¤ã«ãã¤ã³ã¿ + * @param buf èªã¿åãã«ä½¿ããããã¡é å + * @param head ãããæ§é ä½ + * @param parse_info_txt_line ãã¼ã¹é¢æ° + * @return ã¨ã©ã¼ã³ã¼ã */ -errr init_info_txt(FILE *fp, char *buf, header *head, - parse_info_txt_func parse_info_txt_line) +errr init_info_txt(FILE *fp, char *buf, header *head, parse_info_txt_func parse_info_txt_line) { errr err; @@ -1087,8 +1239,12 @@ errr init_info_txt(FILE *fp, char *buf, header *head, } -/* +/*! + * @brief Vaultæ å ±(v_info)ã®ãã¼ã¹é¢æ° / * Initialize the "v_info" array, by parsing an ascii "template" file + * @param buf ããã¹ãå + * @param head ãããæ§é ä½ + * @return ã¨ã©ã¼ã³ã¼ã */ errr parse_v_info(char *buf, header *head) { @@ -1148,20 +1304,19 @@ errr parse_v_info(char *buf, header *head) /* Process 'X' for "Extra info" (one line only) */ else if (buf[0] == 'X') { - int typ, rat, hgt, wid; + EFFECT_ID typ, rat, hgt, wid; /* Scan for the values */ if (4 != sscanf(buf+2, "%d:%d:%d:%d", &typ, &rat, &hgt, &wid)) return (1); /* Save the values */ - v_ptr->typ = typ; - v_ptr->rat = rat; - v_ptr->hgt = hgt; - v_ptr->wid = wid; + v_ptr->typ = (ROOM_IDX)typ; + v_ptr->rat = (PROB)rat; + v_ptr->hgt = (POSITION)hgt; + v_ptr->wid = (POSITION)wid; } - /* Oops */ else return (6); /* Success */ @@ -1169,9 +1324,12 @@ errr parse_v_info(char *buf, header *head) } - -/* +/*! + * @brief è·æ¥æè½æ å ±(s_info)ã®ãã¼ã¹é¢æ° / * Initialize the "s_info" array, by parsing an ascii "template" file + * @param buf ããã¹ãå + * @param head ãããæ§é ä½ + * @return ã¨ã©ã¼ã³ã¼ã */ errr parse_s_info(char *buf, header *head) { @@ -1238,12 +1396,11 @@ errr parse_s_info(char *buf, header *head) || max < WEAPON_EXP_UNSKILLED || max > WEAPON_EXP_MASTER) return (8); /* Save the values */ - s_ptr->s_start[num] = start; - s_ptr->s_max[num] = max; + s_ptr->s_start[num] = (SUB_EXP)start; + s_ptr->s_max[num] = (SUB_EXP)max; } - /* Oops */ else return (6); /* Success */ @@ -1251,8 +1408,12 @@ errr parse_s_info(char *buf, header *head) } -/* +/*! + * @brief è·æ¥éæ³æ å ±(m_info)ã®ãã¼ã¹é¢æ° / * Initialize the "m_info" array, by parsing an ascii "template" file + * @param buf ããã¹ãå + * @param head ãããæ§é ä½ + * @return ã¨ã©ã¼ã³ã¼ã */ errr parse_m_info(char *buf, header *head) { @@ -1363,15 +1524,14 @@ errr parse_m_info(char *buf, header *head) if (4 != sscanf(buf+2, "%d:%d:%d:%d", &level, &mana, &fail, &exp)) return (1); - m_ptr->info[realm][magic_idx].slevel = level; - m_ptr->info[realm][magic_idx].smana = mana; - m_ptr->info[realm][magic_idx].sfail = fail; - m_ptr->info[realm][magic_idx].sexp = exp; + m_ptr->info[realm][magic_idx].slevel = (PLAYER_LEVEL)level; + m_ptr->info[realm][magic_idx].smana = (MANA_POINT)mana; + m_ptr->info[realm][magic_idx].sfail = (PERCENTAGE)fail; + m_ptr->info[realm][magic_idx].sexp = (EXP)exp; magic_idx ++; } - /* Oops */ else return (6); /* Success */ @@ -1379,10 +1539,15 @@ errr parse_m_info(char *buf, header *head) } -/* +/*! + * @brief ããã¹ããã¼ã¯ã³ãèµ°æ»ãã¦ãã©ã°ãä¸ã¤å¾ã(æ±ç¨) / * Grab one flag from a textual string + * @param flags ããããã©ã°ã追å ããå ã®åç §ãã¤ã³ã¿ + * @param names ãã¼ã¯ã³å®ç¾©é å + * @param what åç §å ã®æååãã¤ã³ã¿ + * @return ã¨ã©ã¼ã³ã¼ã */ -static errr grab_one_flag(u32b *flags, cptr names[], cptr what) +static errr grab_one_flag(u32b *flags, concptr names[], concptr what) { int i; @@ -1400,10 +1565,14 @@ static errr grab_one_flag(u32b *flags, cptr names[], cptr what) } -/* +/*! + * @brief ããã¹ããã¼ã¯ã³ãèµ°æ»ãã¦ãã©ã°ãä¸ã¤å¾ãï¼å°å½¢æ å ±åãï¼ / * Grab one flag in an feature_type from a textual string + * @param f_ptr å°å½¢æ å ±ãä¿ç®¡ããå ã®æ§é ä½åç §ãã¤ã³ã¿ + * @param what åç §å ã®æååãã¤ã³ã¿ + * @return ã¨ã©ã¼ã³ã¼ã */ -static errr grab_one_feat_flag(feature_type *f_ptr, cptr what) +static errr grab_one_feat_flag(feature_type *f_ptr, concptr what) { int i; @@ -1417,24 +1586,24 @@ static errr grab_one_feat_flag(feature_type *f_ptr, cptr what) } } - /* Oops */ -#ifdef JP - msg_format("̤ÃΤÎÃÏ·Á¥Õ¥é¥° '%s'¡£", what); -#else - msg_format("Unknown feature flag '%s'.", what); -#endif + msg_format(_("æªç¥ã®å°å½¢ãã©ã° '%s'ã", "Unknown feature flag '%s'."), what); /* Error */ return PARSE_ERROR_GENERIC; } -/* +/*! + * @brief ããã¹ããã¼ã¯ã³ãèµ°æ»ãã¦ãã©ã°(ã¹ãã¼ã)ãä¸ã¤å¾ãï¼å°å½¢æ å ±åã2ï¼ / * Grab an action in an feature_type from a textual string + * @param f_ptr å°å½¢æ å ±ãä¿ç®¡ããå ã®æ§é ä½åç §ãã¤ã³ã¿ + * @param what åç §å ã®æååãã¤ã³ã¿ + * @param count ã¹ãã¼ãã®ä¿åå ID + * @return ã¨ã©ã¼ã³ã¼ã */ -static errr grab_one_feat_action(feature_type *f_ptr, cptr what, int count) +static errr grab_one_feat_action(feature_type *f_ptr, concptr what, int count) { - int i; + FF_FLAGS_IDX i; /* Check flags */ for (i = 0; i < FF_FLAG_MAX; i++) @@ -1446,20 +1615,19 @@ static errr grab_one_feat_action(feature_type *f_ptr, cptr what, int count) } } - /* Oops */ -#ifdef JP - msg_format("̤ÃΤÎÃÏ·Á¥¢¥¯¥·¥ç¥ó '%s'¡£", what); -#else - msg_format("Unknown feature action '%s'.", what); -#endif + msg_format(_("æªç¥ã®å°å½¢ã¢ã¯ã·ã§ã³ '%s'ã", "Unknown feature action '%s'."), what); /* Error */ return PARSE_ERROR_GENERIC; } -/* +/*! + * @brief å°å½¢æ å ±(f_info)ã®ãã¼ã¹é¢æ° / * Initialize the "f_info" array, by parsing an ascii "template" file + * @param buf ããã¹ãå + * @param head ãããæ§é ä½ + * @return ã¨ã©ã¼ã³ã¼ã */ errr parse_f_info(char *buf, header *head) { @@ -1506,10 +1674,10 @@ errr parse_f_info(char *buf, header *head) } /* Default "mimic" */ - f_ptr->mimic = i; + f_ptr->mimic = (FEAT_IDX)i; /* Default "destroyed state" -- if not specified */ - f_ptr->destroyed = i; + f_ptr->destroyed = (FEAT_IDX)i; /* Default "states" */ for (i = 0; i < MAX_FEAT_STATES; i++) f_ptr->state[i].action = FF_FLAG_MAX; @@ -1549,12 +1717,12 @@ errr parse_f_info(char *buf, header *head) /* Process 'M' for "Mimic" (one line only) */ else if (buf[0] == 'M') { - s16b offset; + STR_OFFSET offset; if (!add_tag(&offset, head, buf + 2)) return PARSE_ERROR_OUT_OF_MEMORY; /* Record a fake tag index */ - f_ptr->mimic = -offset; + f_ptr->mimic_tag = offset; } @@ -1648,29 +1816,26 @@ errr parse_f_info(char *buf, header *head) while (*t == ' ' || *t == '|') t++; } - /* XXX XXX XXX Hack -- Read feature subtype */ + /* Hack -- Read feature subtype */ if (1 == sscanf(s, "SUBTYPE_%d", &i)) { /* Extract a "subtype" */ - f_ptr->subtype = i; + f_ptr->subtype = (FEAT_SUBTYPE)i; /* Start at next entry */ s = t; - /* Continue */ continue; } - /* XXX XXX XXX Hack -- Read feature power */ + /* Hack -- Read feature power */ if (1 == sscanf(s, "POWER_%d", &i)) { /* Extract a "power" */ - f_ptr->power = i; + f_ptr->power = (FEAT_POWER)i; /* Start at next entry */ s = t; - - /* Continue */ continue; } @@ -1691,13 +1856,13 @@ errr parse_f_info(char *buf, header *head) if (1 != sscanf(buf+2, "%d", &priority)) return (PARSE_ERROR_GENERIC); /* Save the value */ - f_ptr->priority = priority; + f_ptr->priority = (FEAT_PRIORITY)priority; } /* Process 'K' for "States" (up to four lines + default (which cannot be last)) */ else if (buf[0] == 'K') { - s16b offset; + STR_OFFSET offset; /* Find the next empty state slot (if any) */ for (i = 0; i < MAX_FEAT_STATES; i++) if (f_ptr->state[i].action == FF_FLAG_MAX) break; @@ -1717,7 +1882,7 @@ errr parse_f_info(char *buf, header *head) if (!add_tag(&offset, head, t)) return PARSE_ERROR_OUT_OF_MEMORY; /* Record a fake tag index */ - f_ptr->destroyed = -offset; + f_ptr->destroyed_tag = offset; } else { @@ -1730,22 +1895,24 @@ errr parse_f_info(char *buf, header *head) if (!add_tag(&offset, head, t)) return PARSE_ERROR_OUT_OF_MEMORY; /* Record a fake tag index */ - f_ptr->state[i].result = -offset; + f_ptr->state[i].result_tag = offset; } } - /* Oops */ - else return (6); + else return (6); /* Success */ return (0); } -/* +/*! + * @brief å°å½¢ã¿ã°ããIDãå¾ã / * Convert a fake tag to a real feat index + * @param str ã¿ã°æåå + * @return å°å½¢ID */ -s16b f_tag_to_index(cptr str) +s16b f_tag_to_index(concptr str) { u16b i; @@ -1764,38 +1931,43 @@ s16b f_tag_to_index(cptr str) } -/* +/*! + * @brief å°å½¢ã¿ã°ããIDãå¾ã / * Search for real index corresponding to this fake tag + * @param feat ã¿ã°æååã®ãªãã»ãã + * @return å°å½¢IDã該å½ããªããªã-1 */ -static void search_real_feat(s16b *feat) +static FEAT_IDX search_real_feat(STR_OFFSET feat) { - int i; + FEAT_IDX i; /* Don't convert non-fake tag */ - if (*feat >= 0) return; + if (feat <= 0) + { + return -1; + } /* Search for real index corresponding to this fake tag */ for (i = 0; i < f_head.info_num; i++) { - if ((-(*feat)) == f_info[i].tag) + if (feat == f_info[i].tag) { /* Record real index */ - *feat = (s16b)i; - return; + return i; } } /* Undefined tag */ -#ifdef JP - msg_format("̤ÄêµÁ¤Î¥¿¥° '%s'¡£", f_tag + (-(*feat))); -#else - msg_format("%s is undefined.", f_tag + (-(*feat))); -#endif + msg_format(_("æªå®ç¾©ã®ã¿ã° '%s'ã", "%s is undefined."), f_tag + feat); + return -1; } -/* +/*! + * @brief å°å½¢æ å ±ã®å種ã¿ã°ããIDã¸å¤æãã¦çµæãåãã / * Retouch fake tags of f_info + * @param head ãããæ§é ä½ + * @return ãªã */ void retouch_f_info(header *head) { @@ -1805,21 +1977,29 @@ void retouch_f_info(header *head) for (i = 0; i < head->info_num; i++) { feature_type *f_ptr = &f_info[i]; - int j; - - search_real_feat(&f_ptr->mimic); - - search_real_feat(&f_ptr->destroyed); + FEAT_IDX j, k; - for (j = 0; j < MAX_FEAT_STATES; j++) search_real_feat(&f_ptr->state[j].result); + k = search_real_feat(f_ptr->mimic_tag); + f_ptr->mimic = k < 0 ? f_ptr->mimic : k; + k = search_real_feat(f_ptr->destroyed_tag); + f_ptr->destroyed = k < 0 ? f_ptr->destroyed : k; + for (j = 0; j < MAX_FEAT_STATES; j++) + { + k = search_real_feat(f_ptr->state[j].result_tag); + f_ptr->state[j].result = k < 0 ? f_ptr->state[j].result : k; + } } } -/* +/*! + * @brief ããã¹ããã¼ã¯ã³ãèµ°æ»ãã¦ãã©ã°ãä¸ã¤å¾ã(ãã¼ã¹ã¢ã¤ãã ç¨) / * Grab one flag in an object_kind from a textual string + * @param k_ptr ä¿ç®¡å ã®ãã¼ã¹ã¢ã¤ãã æ§é ä½åç §ãã¤ã³ã¿ + * @param what åç §å ã®æååãã¤ã³ã¿ + * @return ã¨ã©ã¼ã³ã¼ã */ -static errr grab_one_kind_flag(object_kind *k_ptr, cptr what) +static errr grab_one_kind_flag(object_kind *k_ptr, concptr what) { int i; @@ -1836,22 +2016,19 @@ static errr grab_one_kind_flag(object_kind *k_ptr, cptr what) if (grab_one_flag(&k_ptr->gen_flags, k_info_gen_flags, what) == 0) return 0; - /* Oops */ -#ifdef JP - msg_format("̤ÃΤΥ¢¥¤¥Æ¥à¡¦¥Õ¥é¥° '%s'¡£", what); -#else - msg_format("Unknown object flag '%s'.", what); -#endif - + msg_format(_("æªç¥ã®ã¢ã¤ãã ã»ãã©ã° '%s'ã", "Unknown object flag '%s'."), what); /* Error */ return (1); } -/* +/*! + * @brief ããã¹ããã¼ã¯ã³ãèµ°æ»ãã¦ãã©ã°ãä¸ã¤å¾ã(çºåè½åç¨) / * Grab one activation index flag + * @param what åç §å ã®æååãã¤ã³ã¿ + * @return çºåè½åID */ -static byte grab_one_activation_flag(cptr what) +static byte grab_one_activation_flag(concptr what) { int i; @@ -1871,20 +2048,19 @@ static byte grab_one_activation_flag(cptr what) return ((byte) i); } - /* Oops */ -#ifdef JP - msg_format("̤ÃΤÎȯư¡¦¥Õ¥é¥° '%s'¡£", what); -#else - msg_format("Unknown activation flag '%s'.", what); -#endif + msg_format(_("æªç¥ã®çºåã»ãã©ã° '%s'ã", "Unknown activation flag '%s'."), what); /* Error */ return (0); } -/* +/*! + * @brief ãã¼ã¹ã¢ã¤ãã (k_info)ã®ãã¼ã¹é¢æ° / * Initialize the "k_info" array, by parsing an ascii "template" file + * @param buf ããã¹ãå + * @param head ãããæ§é ä½ + * @return ã¨ã©ã¼ã³ã¼ã */ errr parse_k_info(char *buf, header *head) { @@ -1954,8 +2130,8 @@ errr parse_k_info(char *buf, header *head) #ifdef JP - /* ±Ñ¸ì̾¤òÆɤà¥ë¡¼¥Á¥ó¤òÄɲà */ - /* 'E' ¤«¤é»Ï¤Þ¤ë¹Ô¤Ï±Ñ¸ì̾¤È¤·¤Æ¤¤¤ë */ + /* è±èªåãèªãã«ã¼ãã³ã追å */ + /* 'E' ããå§ã¾ãè¡ã¯è±èªåã¨ãã¦ãã */ else if (buf[0] == 'E') { /* nothing to do */ @@ -2041,9 +2217,9 @@ errr parse_k_info(char *buf, header *head) &tval, &sval, &pval)) return (1); /* Save the values */ - k_ptr->tval = tval; - k_ptr->sval = sval; - k_ptr->pval = pval; + k_ptr->tval = (OBJECT_TYPE_VALUE)tval; + k_ptr->sval = (OBJECT_SUBTYPE_VALUE)sval; + k_ptr->pval = (PARAMETER_VALUE)pval; } /* Process 'W' for "More Info" (one line only) */ @@ -2057,18 +2233,17 @@ errr parse_k_info(char *buf, header *head) &level, &extra, &wgt, &cost)) return (1); /* Save the values */ - k_ptr->level = level; - k_ptr->extra = extra; - k_ptr->weight = wgt; - k_ptr->cost = cost; + k_ptr->level = (DEPTH)level; + k_ptr->extra = (BIT_FLAGS8)extra; + k_ptr->weight = (WEIGHT)wgt; + k_ptr->cost = (PRICE)cost; } /* Process 'A' for "Allocation" (one line only) */ else if (buf[0] == 'A') { - int i; - /* XXX XXX XXX Simply read each number following a colon */ + /* Simply read each number following a colon */ for (i = 0, s = buf+1; s && (s[0] == ':') && s[1]; ++i) { /* Default chance */ @@ -2087,7 +2262,7 @@ errr parse_k_info(char *buf, header *head) if (t && (!s || t < s)) { int chance = atoi(t+1); - if (chance > 0) k_ptr->chance[i] = chance; + if (chance > 0) k_ptr->chance[i] = (PROB)chance; } } } @@ -2101,12 +2276,12 @@ errr parse_k_info(char *buf, header *head) if (6 != sscanf(buf+2, "%d:%dd%d:%d:%d:%d", &ac, &hd1, &hd2, &th, &td, &ta)) return (1); - k_ptr->ac = ac; - k_ptr->dd = hd1; - k_ptr->ds = hd2; - k_ptr->to_h = th; - k_ptr->to_d = td; - k_ptr->to_a = ta; + k_ptr->ac = (ARMOUR_CLASS)ac; + k_ptr->dd = (DICE_NUMBER)hd1; + k_ptr->ds = (DICE_SID)hd2; + k_ptr->to_h = (HIT_PROB)th; + k_ptr->to_d = (HIT_POINT)td; + k_ptr->to_a = (ARMOUR_CLASS)ta; } /* Hack -- Process 'U' for activation index */ @@ -2149,7 +2324,6 @@ errr parse_k_info(char *buf, header *head) } - /* Oops */ else return (6); @@ -2157,11 +2331,14 @@ errr parse_k_info(char *buf, header *head) return (0); } - -/* - * Grab one flag in an artifact_type from a textual string +/*! + * @brief ããã¹ããã¼ã¯ã³ãèµ°æ»ãã¦ãã©ã°ãä¸ã¤å¾ã(ã¢ã¼ãã£ãã¡ã¯ãç¨) / + * Grab one activation index flag + * @param a_ptr ä¿ç®¡å ã®ã¢ã¼ãã£ãã¡ã¯ãæ§é ä½åç §ãã¤ã³ã¿ + * @param what åç §å ã®æååãã¤ã³ã¿ + * @return ã¨ã©ã¼ããã£ãå ´å1ãã¨ã©ã¼ããªãå ´å0ãè¿ã */ -static errr grab_one_artifact_flag(artifact_type *a_ptr, cptr what) +static errr grab_one_artifact_flag(artifact_type *a_ptr, concptr what) { int i; @@ -2178,21 +2355,19 @@ static errr grab_one_artifact_flag(artifact_type *a_ptr, cptr what) if (grab_one_flag(&a_ptr->gen_flags, k_info_gen_flags, what) == 0) return 0; - /* Oops */ -#ifdef JP - msg_format("̤ÃΤÎÅÁÀâ¤Î¥¢¥¤¥Æ¥à¡¦¥Õ¥é¥° '%s'¡£", what); -#else - msg_format("Unknown artifact flag '%s'.", what); -#endif - + msg_format(_("æªç¥ã®ä¼èª¬ã®ã¢ã¤ãã ã»ãã©ã° '%s'ã", "Unknown artifact flag '%s'."), what); /* Error */ return (1); } -/* +/*! + * @brief åºå®ã¢ã¼ãã£ãã¡ã¯ãæ å ±(a_info)ã®ãã¼ã¹é¢æ° / * Initialize the "a_info" array, by parsing an ascii "template" file + * @param buf ããã¹ãå + * @param head ãããæ§é ä½ + * @return ã¨ã©ã¼ã³ã¼ã */ errr parse_a_info(char *buf, header *head) { @@ -2250,8 +2425,8 @@ errr parse_a_info(char *buf, header *head) #ifdef JP - /* ±Ñ¸ì̾¤òÆɤà¥ë¡¼¥Á¥ó¤òÄɲà */ - /* 'E' ¤«¤é»Ï¤Þ¤ë¹Ô¤Ï±Ñ¸ì̾¤È¤·¤Æ¤¤¤ë */ + /* è±èªåãèªãã«ã¼ãã³ã追å */ + /* 'E' ããå§ã¾ãè¡ã¯è±èªåã¨ãã¦ãã */ else if (buf[0] == 'E') { /* nothing to do */ @@ -2297,9 +2472,9 @@ errr parse_a_info(char *buf, header *head) &tval, &sval, &pval)) return (1); /* Save the values */ - a_ptr->tval = tval; - a_ptr->sval = sval; - a_ptr->pval = pval; + a_ptr->tval = (OBJECT_TYPE_VALUE)tval; + a_ptr->sval = (OBJECT_SUBTYPE_VALUE)sval; + a_ptr->pval = (PARAMETER_VALUE)pval; } /* Process 'W' for "More Info" (one line only) */ @@ -2313,10 +2488,10 @@ errr parse_a_info(char *buf, header *head) &level, &rarity, &wgt, &cost)) return (1); /* Save the values */ - a_ptr->level = level; - a_ptr->rarity = rarity; - a_ptr->weight = wgt; - a_ptr->cost = cost; + a_ptr->level = (DEPTH)level; + a_ptr->rarity = (RARITY)rarity; + a_ptr->weight = (WEIGHT)wgt; + a_ptr->cost = (PRICE)cost; } /* Hack -- Process 'P' for "power" and such */ @@ -2328,12 +2503,12 @@ errr parse_a_info(char *buf, header *head) if (6 != sscanf(buf+2, "%d:%dd%d:%d:%d:%d", &ac, &hd1, &hd2, &th, &td, &ta)) return (1); - a_ptr->ac = ac; - a_ptr->dd = hd1; - a_ptr->ds = hd2; - a_ptr->to_h = th; - a_ptr->to_d = td; - a_ptr->to_a = ta; + a_ptr->ac = (ARMOUR_CLASS)ac; + a_ptr->dd = (DICE_NUMBER)hd1; + a_ptr->ds = (DICE_SID)hd2; + a_ptr->to_h = (HIT_PROB)th; + a_ptr->to_d = (HIT_POINT)td; + a_ptr->to_a = (ARMOUR_CLASS)ta; } /* Hack -- Process 'U' for activation index */ @@ -2376,7 +2551,6 @@ errr parse_a_info(char *buf, header *head) } - /* Oops */ else return (6); @@ -2385,10 +2559,14 @@ errr parse_a_info(char *buf, header *head) } -/* +/*! + * @brief ããã¹ããã¼ã¯ã³ãèµ°æ»ãã¦ãã©ã°ãä¸ã¤å¾ã(ã¢ã¼ãã£ãã¡ã¯ãç¨) / * Grab one flag in a ego-item_type from a textual string + * @param e_ptr ä¿ç®¡å ã®ã¨ã´æ§é ä½åç §ãã¤ã³ã¿ + * @param what åç §å ã®æååãã¤ã³ã¿ + * @return ã¨ã©ã¼ããã£ãå ´å1ãã¨ã©ã¼ããªãå ´å0ãè¿ã */ -static bool grab_one_ego_item_flag(ego_item_type *e_ptr, cptr what) +static bool grab_one_ego_item_flag(ego_item_type *e_ptr, concptr what) { int i; @@ -2405,48 +2583,41 @@ static bool grab_one_ego_item_flag(ego_item_type *e_ptr, cptr what) if (grab_one_flag(&e_ptr->gen_flags, k_info_gen_flags, what) == 0) return 0; - /* Oops */ -#ifdef JP - msg_format("̤ÃΤÎ̾¤Î¤¢¤ë¥¢¥¤¥Æ¥à¡¦¥Õ¥é¥° '%s'¡£", what); -#else - msg_format("Unknown ego-item flag '%s'.", what); -#endif - + msg_format(_("æªç¥ã®åã®ããã¢ã¤ãã ã»ãã©ã° '%s'ã", "Unknown ego-item flag '%s'."), what); /* Error */ return (1); } - - -/* +/*! + * @brief ã¢ã¤ãã ã¨ã´æ å ±(e_info)ã®ãã¼ã¹é¢æ° / * Initialize the "e_info" array, by parsing an ascii "template" file + * @param buf ããã¹ãå + * @param head ãããæ§é ä½ + * @return ã¨ã©ã¼ã³ã¼ã */ errr parse_e_info(char *buf, header *head) { int i; - char *s, *t; /* Current entry */ static ego_item_type *e_ptr = NULL; - /* Just before the first record */ error_idx = -1; /* Just before the first line */ error_line = -1; - /* Process 'N' for "New/Number/Name" */ if (buf[0] == 'N') { /* Find the colon before the name */ s = my_strchr(buf+2, ':'); - /* Verify that colon */ + /* Verify that colon */ if (!s) return (1); /* Nuke the colon, advance to the name */ @@ -2480,8 +2651,8 @@ errr parse_e_info(char *buf, header *head) #ifdef JP - /* ±Ñ¸ì̾¤òÆɤà¥ë¡¼¥Á¥ó¤òÄɲà */ - /* 'E' ¤«¤é»Ï¤Þ¤ë¹Ô¤Ï±Ñ¸ì̾ */ + /* è±èªåãèªãã«ã¼ãã³ã追å */ + /* 'E' ããå§ã¾ãè¡ã¯è±èªå */ else if (buf[0] == 'E') { /* nothing to do */ @@ -2520,8 +2691,8 @@ errr parse_e_info(char *buf, header *head) &slot, &rating)) return (1); /* Save the values */ - e_ptr->slot = slot; - e_ptr->rating = rating; + e_ptr->slot = (INVENTORY_IDX)slot; + e_ptr->rating = (PRICE)rating; } /* Process 'W' for "More Info" (one line only) */ @@ -2536,7 +2707,7 @@ errr parse_e_info(char *buf, header *head) /* Save the values */ e_ptr->level = level; - e_ptr->rarity = rarity; + e_ptr->rarity = (RARITY)rarity; /* e_ptr->weight = wgt; */ e_ptr->cost = cost; } @@ -2544,16 +2715,16 @@ errr parse_e_info(char *buf, header *head) /* Hack -- Process 'C' for "creation" */ else if (buf[0] == 'C') { - int th, td, ta, pv; + int th, td, ta, pval; /* Scan for the values */ if (4 != sscanf(buf+2, "%d:%d:%d:%d", - &th, &td, &ta, &pv)) return (1); + &th, &td, &ta, &pval)) return (1); - e_ptr->max_to_h = th; - e_ptr->max_to_d = td; - e_ptr->max_to_a = ta; - e_ptr->max_pval = pv; + e_ptr->max_to_h = (HIT_PROB)th; + e_ptr->max_to_d = (HIT_POINT)td; + e_ptr->max_to_a = (ARMOUR_CLASS)ta; + e_ptr->max_pval = (PARAMETER_VALUE)pval; } /* Hack -- Process 'U' for activation index */ @@ -2595,7 +2766,6 @@ errr parse_e_info(char *buf, header *head) } } - /* Oops */ else return (6); /* Success */ @@ -2603,10 +2773,14 @@ errr parse_e_info(char *buf, header *head) } -/* +/*! + * @brief ããã¹ããã¼ã¯ã³ãèµ°æ»ãã¦ãã©ã°ãä¸ã¤å¾ã(ã¢ã³ã¹ã¿ã¼ç¨1) / * Grab one (basic) flag in a monster_race from a textual string + * @param r_ptr ä¿ç®¡å ã®ã¢ã³ã¹ã¿ã¼ç¨®ææ§é ä½åç §ãã¤ã³ã¿ + * @param what åç §å ã®æååãã¤ã³ã¿ + * @return ã¨ã©ã¼ã³ã¼ã */ -static errr grab_one_basic_flag(monster_race *r_ptr, cptr what) +static errr grab_one_basic_flag(monster_race *r_ptr, concptr what) { if (grab_one_flag(&r_ptr->flags1, r_info_flags1, what) == 0) return 0; @@ -2629,55 +2803,48 @@ static errr grab_one_basic_flag(monster_race *r_ptr, cptr what) if (grab_one_flag(&r_ptr->flagsr, r_info_flagsr, what) == 0) return 0; - /* Oops */ -#ifdef JP - msg_format("̤ÃΤΥâ¥ó¥¹¥¿¡¼¡¦¥Õ¥é¥° '%s'¡£", what); -#else - msg_format("Unknown monster flag '%s'.", what); -#endif - + msg_format(_("æªç¥ã®ã¢ã³ã¹ã¿ã¼ã»ãã©ã° '%s'ã", "Unknown monster flag '%s'."), what); /* Failure */ return (1); } -/* +/*! + * @brief ããã¹ããã¼ã¯ã³ãèµ°æ»ãã¦ãã©ã°ãä¸ã¤å¾ã(ã¢ã³ã¹ã¿ã¼ç¨2) / * Grab one (spell) flag in a monster_race from a textual string + * @param r_ptr ä¿ç®¡å ã®ã¢ã³ã¹ã¿ã¼ç¨®ææ§é ä½åç §ãã¤ã³ã¿ + * @param what åç §å ã®æååãã¤ã³ã¿ + * @return ã¨ã©ã¼ã³ã¼ã */ -static errr grab_one_spell_flag(monster_race *r_ptr, cptr what) +static errr grab_one_spell_flag(monster_race *r_ptr, concptr what) { if (grab_one_flag(&r_ptr->flags4, r_info_flags4, what) == 0) return 0; - if (grab_one_flag(&r_ptr->flags5, r_info_flags5, what) == 0) + if (grab_one_flag(&r_ptr->a_ability_flags1, r_a_ability_flags1, what) == 0) return 0; - if (grab_one_flag(&r_ptr->flags6, r_info_flags6, what) == 0) + if (grab_one_flag(&r_ptr->a_ability_flags2, r_a_ability_flags2, what) == 0) return 0; - /* Oops */ -#ifdef JP - msg_format("̤ÃΤΥâ¥ó¥¹¥¿¡¼¡¦¥Õ¥é¥° '%s'¡£", what); -#else - msg_format("Unknown monster flag '%s'.", what); -#endif - + msg_format(_("æªç¥ã®ã¢ã³ã¹ã¿ã¼ã»ãã©ã° '%s'ã", "Unknown monster flag '%s'."), what); /* Failure */ return (1); } - - -/* +/*! + * @brief ã¢ã³ã¹ã¿ã¼ç¨®ææ å ±(r_info)ã®ãã¼ã¹é¢æ° / * Initialize the "r_info" array, by parsing an ascii "template" file + * @param buf ããã¹ãå + * @param head ãããæ§é ä½ + * @return ã¨ã©ã¼ã³ã¼ã */ errr parse_r_info(char *buf, header *head) { int i; - char *s, *t; /* Current entry */ @@ -2724,8 +2891,8 @@ errr parse_r_info(char *buf, header *head) #ifdef JP - /* ±Ñ¸ì̾¤òÆɤà¥ë¡¼¥Á¥ó¤òÄɲà */ - /* 'E' ¤«¤é»Ï¤Þ¤ë¹Ô¤Ï±Ñ¸ì̾ */ + /* è±èªåãèªãã«ã¼ãã³ã追å */ + /* 'E' ããå§ã¾ãè¡ã¯è±èªå */ else if (buf[0] == 'E') { /* Acquire the Text */ @@ -2799,12 +2966,12 @@ errr parse_r_info(char *buf, header *head) &spd, &hp1, &hp2, &aaf, &ac, &slp)) return (1); /* Save the values */ - r_ptr->speed = spd; - r_ptr->hdice = MAX(hp1, 1); - r_ptr->hside = MAX(hp2, 1); - r_ptr->aaf = aaf; - r_ptr->ac = ac; - r_ptr->sleep = slp; + r_ptr->speed = (SPEED)spd; + r_ptr->hdice = (DICE_NUMBER)MAX(hp1, 1); + r_ptr->hside = (DICE_SID)MAX(hp2, 1); + r_ptr->aaf = (POSITION)aaf; + r_ptr->ac = (ARMOUR_CLASS)ac; + r_ptr->sleep = (SLEEP_DEGREE)slp; } /* Process 'W' for "More Info" (one line only) */ @@ -2820,12 +2987,29 @@ errr parse_r_info(char *buf, header *head) &lev, &rar, &pad, &exp, &nextexp, &nextmon)) return (1); /* Save the values */ - r_ptr->level = lev; - r_ptr->rarity = rar; - r_ptr->extra = pad; - r_ptr->mexp = exp; - r_ptr->next_exp = nextexp; - r_ptr->next_r_idx = nextmon; + r_ptr->level = (DEPTH)lev; + r_ptr->rarity = (RARITY)rar; + r_ptr->extra = (BIT_FLAGS16)pad; + r_ptr->mexp = (EXP)exp; + r_ptr->next_exp = (EXP)nextexp; + r_ptr->next_r_idx = (IDX)nextmon; + } + + /* Process 'R' for "Reinforcement" (up to six lines) */ + else if (buf[0] == 'R') + { + int id, ds, dd; + /* Find the next empty blow slot (if any) */ + for (i = 0; i < A_MAX; i++) if (r_ptr->reinforce_id[i] == 0) break; + + /* Oops, no more slots */ + if (i == 6) return (1); + + /* Scan for the values */ + if (3 != sscanf(buf+2, "%d:%dd%d", &id, &dd, &ds)) return (1); + r_ptr->reinforce_id[i] = (MONRACE_IDX)id; + r_ptr->reinforce_dd[i] = (DICE_NUMBER)dd; + r_ptr->reinforce_ds[i] = (DICE_SID)ds; } /* Process 'B' for "Blows" (up to four lines) */ @@ -2876,10 +3060,10 @@ errr parse_r_info(char *buf, header *head) if (*t == 'd') *t++ = '\0'; /* Save the method */ - r_ptr->blow[i].method = n1; + r_ptr->blow[i].method = (BLOW_METHOD)n1; /* Save the effect */ - r_ptr->blow[i].effect = n2; + r_ptr->blow[i].effect = (BLOW_EFFECT)n2; /* Extract the damage dice and sides */ r_ptr->blow[i].d_dice = atoi(s); @@ -2926,7 +3110,7 @@ errr parse_r_info(char *buf, header *head) while ((*t == ' ') || (*t == '|')) t++; } - /* XXX XXX XXX Hack -- Read spell frequency */ + /* Hack -- Read spell frequency */ if (1 == sscanf(s, "1_IN_%d", &i)) { /* Extract a "frequency" */ @@ -2934,8 +3118,6 @@ errr parse_r_info(char *buf, header *head) /* Start at next entry */ s = t; - - /* Continue */ continue; } @@ -2947,7 +3129,31 @@ errr parse_r_info(char *buf, header *head) } } - /* Oops */ + /* Process 'A' for "Artifact Flags" (multiple lines) */ + else if (buf[0] == 'A') + { + int id, per, rarity; + + /* Find the next empty blow slot (if any) */ + for (i = 0; i < 4; i++) if (!r_ptr->artifact_id[i]) break; + + /* Oops, no more slots */ + if (i == 4) return (1); + + if (3 != sscanf(buf+2, "%d:%d:%d", &id, &rarity, &per)) return (1); + r_ptr->artifact_id[i] = (ARTIFACT_IDX)id; + r_ptr->artifact_rarity[i] = (RARITY)rarity; + r_ptr->artifact_percent[i] = (PERCENTAGE)per; + } + + /* Process 'V' for "Arena power value ratio" */ + else if (buf[0] == 'V') + { + int val; + if (3 != sscanf(buf+2, "%d", &val)) return (1); + r_ptr->arena_ratio = (PERCENTAGE)val; + } + else return (6); @@ -2956,29 +3162,32 @@ errr parse_r_info(char *buf, header *head) } -/* +/*! + * @brief ããã¹ããã¼ã¯ã³ãèµ°æ»ãã¦ãã©ã°ãä¸ã¤å¾ã(ãã³ã¸ã§ã³ç¨) / * Grab one flag for a dungeon type from a textual string + * @param d_ptr ä¿ç®¡å ã®ãã³ã¸ã§ã³æ§é ä½åç §ãã¤ã³ã¿ + * @param what åç §å ã®æååãã¤ã³ã¿ + * @return ã¨ã©ã¼ã³ã¼ã */ -static errr grab_one_dungeon_flag(dungeon_info_type *d_ptr, cptr what) +static errr grab_one_dungeon_flag(dungeon_info_type *d_ptr, concptr what) { if (grab_one_flag(&d_ptr->flags1, d_info_flags1, what) == 0) return 0; - /* Oops */ -#ifdef JP - msg_format("̤ÃΤΥÀ¥ó¥¸¥ç¥ó¡¦¥Õ¥é¥° '%s'¡£", what); -#else - msg_format("Unknown dungeon type flag '%s'.", what); -#endif + msg_format(_("æªç¥ã®ãã³ã¸ã§ã³ã»ãã©ã° '%s'ã", "Unknown dungeon type flag '%s'."), what); /* Failure */ return (1); } -/* +/*! + * @brief ããã¹ããã¼ã¯ã³ãèµ°æ»ãã¦ãã©ã°ãä¸ã¤å¾ã(ã¢ã³ã¹ã¿ã¼ã®ãã³ã¸ã§ã³åºç¾æ¡ä»¶ç¨1) / * Grab one (basic) flag in a monster_race from a textual string + * @param d_ptr ä¿ç®¡å ã®ãã³ã¸ã§ã³æ§é ä½åç §ãã¤ã³ã¿ + * @param what åç §å ã®æååãã¤ã³ã¿ + * @return ã¨ã©ã¼ã³ã¼ã */ -static errr grab_one_basic_monster_flag(dungeon_info_type *d_ptr, cptr what) +static errr grab_one_basic_monster_flag(dungeon_info_type *d_ptr, concptr what) { if (grab_one_flag(&d_ptr->mflags1, r_info_flags1, what) == 0) return 0; @@ -3001,55 +3210,51 @@ static errr grab_one_basic_monster_flag(dungeon_info_type *d_ptr, cptr what) if (grab_one_flag(&d_ptr->mflagsr, r_info_flagsr, what) == 0) return 0; - /* Oops */ -#ifdef JP - msg_format("̤ÃΤΥâ¥ó¥¹¥¿¡¼¡¦¥Õ¥é¥° '%s'¡£", what); -#else - msg_format("Unknown monster flag '%s'.", what); -#endif + msg_format(_("æªç¥ã®ã¢ã³ã¹ã¿ã¼ã»ãã©ã° '%s'ã", "Unknown monster flag '%s'."), what); /* Failure */ return (1); } -/* +/*! + * @brief ããã¹ããã¼ã¯ã³ãèµ°æ»ãã¦ãã©ã°ãä¸ã¤å¾ã(ã¢ã³ã¹ã¿ã¼ã®ãã³ã¸ã§ã³åºç¾æ¡ä»¶ç¨2) / * Grab one (spell) flag in a monster_race from a textual string + * @param d_ptr ä¿ç®¡å ã®ãã³ã¸ã§ã³æ§é ä½åç §ãã¤ã³ã¿ + * @param what åç §å ã®æååãã¤ã³ã¿ + * @return ã¨ã©ã¼ã³ã¼ã */ -static errr grab_one_spell_monster_flag(dungeon_info_type *d_ptr, cptr what) +static errr grab_one_spell_monster_flag(dungeon_info_type *d_ptr, concptr what) { if (grab_one_flag(&d_ptr->mflags4, r_info_flags4, what) == 0) return 0; - if (grab_one_flag(&d_ptr->mflags5, r_info_flags5, what) == 0) + if (grab_one_flag(&d_ptr->m_a_ability_flags1, r_a_ability_flags1, what) == 0) return 0; - if (grab_one_flag(&d_ptr->mflags6, r_info_flags6, what) == 0) + if (grab_one_flag(&d_ptr->m_a_ability_flags2, r_a_ability_flags2, what) == 0) return 0; - /* Oops */ -#ifdef JP - msg_format("̤ÃΤΥâ¥ó¥¹¥¿¡¼¡¦¥Õ¥é¥° '%s'¡£", what); -#else - msg_format("Unknown monster flag '%s'.", what); -#endif + msg_format(_("æªç¥ã®ã¢ã³ã¹ã¿ã¼ã»ãã©ã° '%s'ã", "Unknown monster flag '%s'."), what); /* Failure */ return (1); } -/* +/*! + * @brief ãã³ã¸ã§ã³æ å ±(d_info)ã®ãã¼ã¹é¢æ° / * Initialize the "d_info" array, by parsing an ascii "template" file + * @param buf ããã¹ãå + * @param head ãããæ§é ä½ + * @return ã¨ã©ã¼ã³ã¼ã */ errr parse_d_info(char *buf, header *head) { int i; - char *s, *t; /* Current entry */ static dungeon_info_type *d_ptr = NULL; - /* Process 'N' for "New/Number/Name" */ if (buf[0] == 'N') { @@ -3131,16 +3336,16 @@ errr parse_d_info(char *buf, header *head) &min_lev, &max_lev, &min_plev, &mode, &min_alloc, &max_chance, &obj_good, &obj_great, (unsigned int *)&pit, (unsigned int *)&nest)) return (1); /* Save the values */ - d_ptr->mindepth = min_lev; - d_ptr->maxdepth = max_lev; - d_ptr->min_plev = min_plev; - d_ptr->mode = mode; + d_ptr->mindepth = (DEPTH)min_lev; + d_ptr->maxdepth = (DEPTH)max_lev; + d_ptr->min_plev = (PLAYER_LEVEL)min_plev; + d_ptr->mode = (BIT_FLAGS8)mode; d_ptr->min_m_alloc_level = min_alloc; d_ptr->max_m_alloc_chance = max_chance; d_ptr->obj_good = obj_good; d_ptr->obj_great = obj_great; - d_ptr->pit = pit; - d_ptr->nest = nest; + d_ptr->pit = (BIT_FLAGS16)pit; + d_ptr->nest = (BIT_FLAGS16)nest; } /* Process 'P' for "Place Info" */ @@ -3170,7 +3375,7 @@ errr parse_d_info(char *buf, header *head) d_ptr->floor[i].feat = f_tag_to_index(zz[i * 2]); if (d_ptr->floor[i].feat < 0) return PARSE_ERROR_UNDEFINED_TERRAIN_TAG; - d_ptr->floor[i].percent = atoi(zz[i * 2 + 1]); + d_ptr->floor[i].percent = (PERCENTAGE)atoi(zz[i * 2 + 1]); } d_ptr->tunnel_percent = atoi(zz[DUNGEON_FEAT_PROB_NUM * 2]); } @@ -3189,7 +3394,7 @@ errr parse_d_info(char *buf, header *head) d_ptr->fill[i].feat = f_tag_to_index(zz[i * 2]); if (d_ptr->fill[i].feat < 0) return PARSE_ERROR_UNDEFINED_TERRAIN_TAG; - d_ptr->fill[i].percent = atoi(zz[i * 2 + 1]); + d_ptr->fill[i].percent = (PERCENTAGE)atoi(zz[i * 2 + 1]); } d_ptr->outer_wall = f_tag_to_index(zz[DUNGEON_FEAT_PROB_NUM * 2]); @@ -3223,55 +3428,47 @@ errr parse_d_info(char *buf, header *head) while (*t == ' ' || *t == '|') t++; } - /* XXX XXX XXX Hack -- Read Final Artifact */ + /* Hack -- Read Final Artifact */ if (1 == sscanf(s, "FINAL_ARTIFACT_%d", &artif)) { /* Extract a "Final Artifact" */ - d_ptr->final_artifact = artif; + d_ptr->final_artifact = (ARTIFACT_IDX)artif; /* Start at next entry */ s = t; - - /* Continue */ continue; } - /* XXX XXX XXX Hack -- Read Final Object */ + /* Hack -- Read Final Object */ if (1 == sscanf(s, "FINAL_OBJECT_%d", &artif)) { /* Extract a "Final Artifact" */ - d_ptr->final_object = artif; + d_ptr->final_object = (KIND_OBJECT_IDX)artif; /* Start at next entry */ s = t; - - /* Continue */ continue; } - /* XXX XXX XXX Hack -- Read Artifact Guardian */ + /* Hack -- Read Artifact Guardian */ if (1 == sscanf(s, "FINAL_GUARDIAN_%d", &monst)) { /* Extract a "Artifact Guardian" */ - d_ptr->final_guardian = monst; + d_ptr->final_guardian = (MONRACE_IDX)monst; /* Start at next entry */ s = t; - - /* Continue */ continue; } - /* XXX XXX XXX Hack -- Read Special Percentage */ + /* Hack -- Read Special Percentage */ if (1 == sscanf(s, "MONSTER_DIV_%d", &monst)) { /* Extract a "Special %" */ - d_ptr->special_div = monst; + d_ptr->special_div = (PROB)monst; /* Start at next entry */ s = t; - - /* Continue */ continue; } @@ -3310,8 +3507,6 @@ errr parse_d_info(char *buf, header *head) /* Start at next entry */ s = t; - - /* Continue */ continue; } @@ -3339,13 +3534,11 @@ errr parse_d_info(char *buf, header *head) while ((*t == ' ') || (*t == '|')) t++; } - /* XXX XXX XXX Hack -- Read spell frequency */ + /* Hack -- Read spell frequency */ if (1 == sscanf(s, "1_IN_%d", &i)) { /* Start at next entry */ s = t; - - /* Continue */ continue; } @@ -3357,7 +3550,6 @@ errr parse_d_info(char *buf, header *head) } } - /* Oops */ else return (6); /* Success */ @@ -3388,30 +3580,32 @@ typedef struct dungeon_grid dungeon_grid; struct dungeon_grid { - int feature; /* Terrain feature */ - int monster; /* Monster */ - int object; /* Object */ - int ego; /* Ego-Item */ - int artifact; /* Artifact */ - int trap; /* Trap */ - int cave_info; /* Flags for CAVE_MARK, CAVE_GLOW, CAVE_ICKY, CAVE_ROOM */ - int special; /* Reserved for special terrain info */ - int random; /* Number of the random effect */ + FEAT_IDX feature; /* Terrain feature */ + MONSTER_IDX monster; /* Monster */ + OBJECT_IDX object; /* Object */ + EGO_IDX ego; /* Ego-Item */ + ARTIFACT_IDX artifact; /* Artifact */ + IDX trap; /* Trap */ + BIT_FLAGS cave_info; /* Flags for CAVE_MARK, CAVE_GLOW, CAVE_ICKY, CAVE_ROOM */ + s16b special; /* Reserved for special terrain info */ + int random; /* Number of the random effect */ }; static dungeon_grid letter[255]; -/* +/*! + * @brief å°å½¢æ å ±ã®ãF:ãæ å ±ããã¼ã¹ãã * Process "F: