*/
#include "angband.h"
+#include "util.h"
+#include "term.h"
+
+#include "core.h"
+#include "artifact.h"
+#include "sort.h"
+#include "store.h"
+#include "monster.h"
+#include "object-flavor.h"
+#include "object-hook.h"
+#include "object-ego.h"
+#include "objectkind.h"
+#include "floor-town.h"
+#include "files.h"
#ifdef ALLOW_SPOILERS
* @param r_ptr モンスター種族の構造体ポインタ
* @return シンボル職の記述名
*/
-static cptr attr_to_text(monster_race *r_ptr)
+static concptr attr_to_text(monster_race *r_ptr)
{
#ifdef JP000
if (r_ptr->flags1 & RF1_ATTR_CLEAR) return "透明な";
typedef struct
{
OBJECT_TYPE_VALUE tval;
- cptr name;
+ concptr name;
} grouper;
(*lev) = k_info[q_ptr->k_idx].level;
(*val) = object_value(q_ptr);
- /* Hack */
if (!buf || !dam || !chance || !wgt) return;
/* Description (too brief) */
* @param fname ファイル名
* @return なし
*/
-static void spoil_obj_desc(cptr fname)
+static void spoil_obj_desc(concptr fname)
{
int i, k, s, t, n = 0, group_start = 0;
char chance[80];
char dam[80];
-
- /* Build the filename */
path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
/* File type is "TEXT" */
struct flag_desc
{
const int flag;
- const char *const desc;
+ concptr const desc;
};
*
* This list includes extra attacks, for simplicity.
*/
- cptr pval_affects[N_ELEMENTS(stat_flags_desc) - 1 +
+ concptr pval_affects[N_ELEMENTS(stat_flags_desc) - 1 +
N_ELEMENTS(pval_flags1_desc) + 1];
} pval_info_type;
pval_info_type pval_info;
/* A list of an object's slaying preferences */
- cptr slays[N_ELEMENTS(slay_flags_desc) + 1];
+ concptr slays[N_ELEMENTS(slay_flags_desc) + 1];
/* A list if an object's elemental brands */
- cptr brands[N_ELEMENTS(brand_flags_desc) + 1];
+ concptr brands[N_ELEMENTS(brand_flags_desc) + 1];
/* A list of immunities granted by an object */
- cptr immunities[N_ELEMENTS(immune_flags_desc) + 1];
+ concptr immunities[N_ELEMENTS(immune_flags_desc) + 1];
/* A list of resistances granted by an object */
- cptr resistances[N_ELEMENTS(resist_flags_desc) + 1];
+ concptr resistances[N_ELEMENTS(resist_flags_desc) + 1];
/* A list of stats sustained by an object */
- cptr sustains[N_ELEMENTS(sustain_flags_desc) - 1 + 1];
+ concptr sustains[N_ELEMENTS(sustain_flags_desc) - 1 + 1];
/* A list of various magical qualities an object may have */
- cptr misc_magic[N_ELEMENTS(misc_flags2_desc) + N_ELEMENTS(misc_flags3_desc)
+ concptr misc_magic[N_ELEMENTS(misc_flags2_desc) + N_ELEMENTS(misc_flags3_desc)
+ 1 /* Permanent Light */
+ 1 /* TY curse */
+ 1 /* type of curse */
char addition[80];
/* A string describing an artifact's activation */
- cptr activation;
+ concptr activation;
/* "Level 20, Rarity 30, 3.0 lbs, 20000 Gold" */
char misc_desc[80];
* @param str 出力したい文字列
* @return なし
*/
-static void spoiler_underline(cptr str)
+static void spoiler_underline(concptr str)
{
fprintf(fff, "%s\n", str);
spoiler_out_n_chars(strlen(str), '-');
* The possibly updated description pointer is returned.
* </pre>
*/
-static cptr *spoiler_flag_aux(const BIT_FLAGS art_flags[TR_FLAG_SIZE],
+static concptr *spoiler_flag_aux(const BIT_FLAGS art_flags[TR_FLAG_SIZE],
const flag_desc *flag_ptr,
- cptr *desc_ptr, const int n_elmnts)
+ concptr *desc_ptr, const int n_elmnts)
{
int i;
{
BIT_FLAGS flgs[TR_FLAG_SIZE];
- cptr *affects_list;
+ concptr *affects_list;
/* If pval == 0, there is nothing to do. */
if (!o_ptr->pval)
pi_ptr->pval_desc[0] = '\0';
return;
}
-
- /* Extract the flags */
object_flags(o_ptr, flgs);
affects_list = pi_ptr->pval_affects;
* @param slay_list 種族スレイ構造体の参照ポインタ
* @return なし
*/
-static void analyze_slay(object_type *o_ptr, cptr *slay_list)
+static void analyze_slay(object_type *o_ptr, concptr *slay_list)
{
BIT_FLAGS flgs[TR_FLAG_SIZE];
* @param brand_list 属性ブランド構造体の参照ポインタ
* @return なし
*/
-static void analyze_brand(object_type *o_ptr, cptr *brand_list)
+static void analyze_brand(object_type *o_ptr, concptr *brand_list)
{
BIT_FLAGS flgs[TR_FLAG_SIZE];
* @param resist_list 通常耐性構造体の参照ポインタ
* @return なし
*/
-static void analyze_resist(object_type *o_ptr, cptr *resist_list)
+static void analyze_resist(object_type *o_ptr, concptr *resist_list)
{
BIT_FLAGS flgs[TR_FLAG_SIZE];
* @param immune_list 免疫構造体の参照ポインタ
* @return なし
*/
-static void analyze_immune(object_type *o_ptr, cptr *immune_list)
+static void analyze_immune(object_type *o_ptr, concptr *immune_list)
{
BIT_FLAGS flgs[TR_FLAG_SIZE];
* @param sustain_list 維持特性構造体の参照ポインタ
* @return なし
*/
-static void analyze_sustains(object_type *o_ptr, cptr *sustain_list)
+static void analyze_sustains(object_type *o_ptr, concptr *sustain_list)
{
BIT_FLAGS flgs[TR_FLAG_SIZE];
* @param misc_list その他の特性構造体の参照ポインタ
* @return なし
*/
-static void analyze_misc_magic(object_type *o_ptr, cptr *misc_list)
+static void analyze_misc_magic(object_type *o_ptr, concptr *misc_list)
{
BIT_FLAGS flgs[TR_FLAG_SIZE];
POSITION rad;
/* Init */
strcpy(addition, "");
-#ifdef JP
- if ((a_ptr->gen_flags & TRG_XTRA_POWER) && (a_ptr->gen_flags & TRG_XTRA_H_RES)) strcat(addition, "能力and耐性");
- else if (a_ptr->gen_flags & TRG_XTRA_POWER)
- {
- strcat(addition, "能力");
- if (a_ptr->gen_flags & TRG_XTRA_RES_OR_POWER) strcat(addition, "(1/2でand耐性)");
- }
- else if (a_ptr->gen_flags & TRG_XTRA_H_RES)
- {
- strcat(addition, "耐性");
- if (a_ptr->gen_flags & TRG_XTRA_RES_OR_POWER) strcat(addition, "(1/2でand能力)");
- }
- else if (a_ptr->gen_flags & TRG_XTRA_RES_OR_POWER) strcat(addition, "能力or耐性");
-#else
- if ((a_ptr->gen_flags & TRG_XTRA_POWER) && (a_ptr->gen_flags & TRG_XTRA_H_RES)) strcat(addition, "Ability and Resistance");
+ if ((a_ptr->gen_flags & TRG_XTRA_POWER) && (a_ptr->gen_flags & TRG_XTRA_H_RES)) strcat(addition, _("能力and耐性", "Ability and Resistance"));
else if (a_ptr->gen_flags & TRG_XTRA_POWER)
{
- strcat(addition, "Ability");
- if (a_ptr->gen_flags & TRG_XTRA_RES_OR_POWER) strcat(addition, "(plus Resistance about 1/2)");
+ strcat(addition, _("能力", "Ability"));
+ if (a_ptr->gen_flags & TRG_XTRA_RES_OR_POWER) strcat(addition, _("(1/2でand耐性)", "(plus Resistance about 1/2)"));
}
else if (a_ptr->gen_flags & TRG_XTRA_H_RES)
{
- strcat(addition, "Resistance");
- if (a_ptr->gen_flags & TRG_XTRA_RES_OR_POWER) strcat(addition, "(plus Ability about 1/2)");
+ strcat(addition, _("耐性", "Resistance"));
+ if (a_ptr->gen_flags & TRG_XTRA_RES_OR_POWER) strcat(addition, _("(1/2でand能力)", "(plus Ability about 1/2)"));
}
- else if (a_ptr->gen_flags & TRG_XTRA_RES_OR_POWER) strcat(addition, "Ability or Resistance");
-#endif
+ else if (a_ptr->gen_flags & TRG_XTRA_RES_OR_POWER) strcat(addition, _("能力or耐性", "Ability or Resistance"));
}
* @param separator フラグ表示の区切り記号
* @return なし
*/
-static void spoiler_outlist(cptr header, cptr *list, char separator)
+static void spoiler_outlist(concptr header, concptr *list, char separator)
{
int line_len, buf_len;
char line[MAX_LINE_LEN+1], buf[80];
if (!i) return (FALSE);
- /* Create the artifact */
object_prep(o_ptr, i);
/* Save the name */
* @param fname 生成ファイル名
* @return なし
*/
-static void spoil_artifact(cptr fname)
+static void spoil_artifact(concptr fname)
{
int i;
IDX j;
object_type *q_ptr;
obj_desc_list artifact;
char buf[1024];
-
- /* Build the filename */
path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
/* File type is "TEXT" */
* @param fname 生成ファイル名
* @return なし
*/
-static void spoil_mon_desc(cptr fname)
+static void spoil_mon_desc(concptr fname)
{
int i, n = 0;
u16b why = 2;
- s16b *who;
+ MONRACE_IDX *who;
char buf[1024];
char ac[80];
char hp[80];
char exp[80];
-
- /* Build the filename */
path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
/* File type is "TEXT" */
}
/* Allocate the "who" array */
- C_MAKE(who, max_r_idx, s16b);
+ C_MAKE(who, max_r_idx, MONRACE_IDX);
/* Dump the header */
fprintf(fff, "Monster Spoilers for Hengband Version %d.%d.%d\n",
if (r_ptr->name) who[n++] = (s16b)i;
}
- /* Select the sort method */
- ang_sort_comp = ang_sort_comp_hook;
- ang_sort_swap = ang_sort_swap_hook;
-
/* Sort the array by dungeon depth of monsters */
- ang_sort(who, &why, n);
+ ang_sort(who, &why, n, ang_sort_comp_hook, ang_sort_swap_hook);
/* Scan again */
for (i = 0; i < n; i++)
{
monster_race *r_ptr = &r_info[who[i]];
- cptr name = (r_name + r_ptr->name);
+ concptr name = (r_name + r_ptr->name);
if (r_ptr->flags7 & (RF7_KAGE)) continue;
/* Get the "name" */
sprintf(nam, _(" %s", "The %s"), name);
}
-
/* Level */
sprintf(lev, "%d", (int)r_ptr->level);
/* Rarity */
sprintf(rar, "%d", (int)r_ptr->rarity);
- /* Speed */
if (r_ptr->speed >= 110)
{
sprintf(spd, "+%d", (r_ptr->speed - 110));
* @param str 文字列参照ポインタ
* @return なし
*/
-static void spoil_out(cptr str)
+static void spoil_out(concptr str)
{
- cptr r;
+ concptr r;
/* Line buffer */
static char roff_buf[256];
#ifdef JP
bool k_flag_local;
bool iskanji_flag_local = FALSE;
- cptr tail = str + (k_flag ? 2 : 1);
+ concptr tail = str + (k_flag ? 2 : 1);
#else
- cptr tail = str + 1;
+ concptr tail = str + 1;
#endif
for (; *tail; tail++)
* @param str 文字列参照ポインタ
* @return なし
*/
-static void roff_func(byte attr, cptr str)
+static void roff_func(TERM_COLOR attr, concptr str)
{
/* Unused */
(void)attr;
* @param fname ファイル名
* @return なし
*/
-static void spoil_mon_info(cptr fname)
+static void spoil_mon_info(concptr fname)
{
char buf[1024];
int i, l, n = 0;
BIT_FLAGS flags1;
u16b why = 2;
- s16b *who;
-
- /* Build the filename */
+ MONRACE_IDX *who;
path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
/* File type is "TEXT" */
spoil_out("------------------------------------------\n\n");
/* Allocate the "who" array */
- C_MAKE(who, max_r_idx, s16b);
+ C_MAKE(who, max_r_idx, MONRACE_IDX);
/* Scan the monsters */
for (i = 1; i < max_r_idx; i++)
if (r_ptr->name) who[n++] = (s16b)i;
}
- /* Select the sort method */
- ang_sort_comp = ang_sort_comp_hook;
- ang_sort_swap = ang_sort_swap_hook;
-
- /* Sort the array by dungeon depth of monsters */
- ang_sort(who, &why, n);
-
+ ang_sort(who, &why, n, ang_sort_comp_hook, ang_sort_swap_hook);
/*
* List all monsters in order
for (l = 0; l < n; l++)
{
monster_race *r_ptr = &r_info[who[l]];
-
- /* Extract the flags */
flags1 = r_ptr->flags1;
/* Prefix */
sprintf(buf, "Rar:%d ", r_ptr->rarity);
spoil_out(buf);
- /* Speed */
if (r_ptr->speed >= 110)
{
sprintf(buf, "Spd:+%d ", (r_ptr->speed - 110));
return FALSE;
}
-
-/*!
- * @brief 進化ツリーをソートするためモンスター種族の判定関数 /
- * Sorting hook -- Comp function
- * @param u 進化木構造データ
- * @param v 未使用
- * @param a 比較したいモンスター種族ID1
- * @param b 比較したいモンスター種族ID2
- * @return 2が大きければTRUEを返す
- */
-static bool ang_sort_comp_evol_tree(vptr u, vptr v, int a, int b)
-{
- int **evol_tree = (int **)u;
-
- int w1 = evol_tree[a][0];
- int w2 = evol_tree[b][0];
- monster_race *r1_ptr = &r_info[w1];
- monster_race *r2_ptr = &r_info[w2];
-
- /* Unused */
- (void)v;
-
- /* Used tree first */
- if (w1 && !w2) return TRUE;
- if (!w1 && w2) return FALSE;
-
- /* Sort by monster level */
- if (r1_ptr->level < r2_ptr->level) return TRUE;
- if (r1_ptr->level > r2_ptr->level) return FALSE;
-
- /* Sort by monster experience */
- if (r1_ptr->mexp < r2_ptr->mexp) return TRUE;
- if (r1_ptr->mexp > r2_ptr->mexp) return FALSE;
-
- /* Compare indexes */
- return w1 <= w2;
-}
-
-/*!
- * @brief 進化ツリーをソートするため木構造のスワップ関数 /
- * Sorting hook -- Swap function
- * @param u 進化木構造データ
- * @param v 未使用
- * @param a スワップしたい木構造1
- * @param b スワップしたい木構造2
- * @return 2が大きければTRUEを返す
- */
-static void ang_sort_swap_evol_tree(vptr u, vptr v, int a, int b)
-{
- int **evol_tree = (int **)u;
- int *holder;
-
- /* Unused */
- (void)v;
-
- /* Swap */
- holder = evol_tree[a];
- evol_tree[a] = evol_tree[b];
- evol_tree[b] = holder;
-}
-
/*!
* @brief 進化ツリーをスポイラー出力するメインルーチン /
* Print monsters' evolution information to file
* @param fname 出力ファイル名
* @return なし
*/
-static void spoil_mon_evol(cptr fname)
+static void spoil_mon_evol(concptr fname)
{
char buf[1024];
monster_race *r_ptr;
int **evol_tree, i, j, n, r_idx;
int *evol_tree_zero; /* For C_KILL() */
-
- /* Build the filename */
path_build(buf, sizeof buf, ANGBAND_DIR_USER, fname);
/* File type is "TEXT" */
}
/* Step 3: Sort the evolution trees */
-
- /* Select the sort method */
- ang_sort_comp = ang_sort_comp_evol_tree;
- ang_sort_swap = ang_sort_swap_evol_tree;
-
- /* Sort the array */
- ang_sort(evol_tree, NULL, max_r_idx);
+ ang_sort(evol_tree, NULL, max_r_idx, ang_sort_comp_evol_tree, ang_sort_swap_evol_tree);
/* Step 4: Print the evolution trees */
for (i = 0; i < max_r_idx; i++)
}
-
-/*
- * Forward declare
- */
-extern void do_cmd_spoilers(void);
-
/*!
* @brief スポイラー出力を行うコマンドのメインルーチン /
* Create Spoiler files -BEN-
/* Interact */
while (1)
{
- /* Clear screen */
Term_clear();
/* Info */
{
/* Escape */
case ESCAPE:
- /* Restore the screen */
screen_load();
return;
/* Now deal with the description lists */
-#ifdef JP
- spoiler_outlist("対:", art_ptr->slays, ITEM_SEP);
- spoiler_outlist("武器属性:", art_ptr->brands, LIST_SEP);
- spoiler_outlist("免疫:", art_ptr->immunities, ITEM_SEP);
- spoiler_outlist("耐性:", art_ptr->resistances, ITEM_SEP);
- spoiler_outlist("維持:", art_ptr->sustains, ITEM_SEP);
-#else
- spoiler_outlist("Slay", art_ptr->slays, ITEM_SEP);
- spoiler_outlist("", art_ptr->brands, LIST_SEP);
- spoiler_outlist("Immunity to", art_ptr->immunities, ITEM_SEP);
- spoiler_outlist("Resist", art_ptr->resistances, ITEM_SEP);
- spoiler_outlist("Sustain", art_ptr->sustains, ITEM_SEP);
-#endif
+ spoiler_outlist(_("対:", "Slay"), art_ptr->slays, ITEM_SEP);
+ spoiler_outlist(_("武器属性:", ""), art_ptr->brands, LIST_SEP);
+ spoiler_outlist(_("免疫:", "Immunity to"), art_ptr->immunities, ITEM_SEP);
+ spoiler_outlist(_("耐性:", "Resist"), art_ptr->resistances, ITEM_SEP);
+ spoiler_outlist(_("維持:", "Sustain"), art_ptr->sustains, ITEM_SEP);
spoiler_outlist("", art_ptr->misc_magic, LIST_SEP);
/* Write out the possible activation at the primary indention level */
* @param fname 出力ファイル名
* @return なし
*/
-void spoil_random_artifact(cptr fname)
+void spoil_random_artifact(concptr fname)
{
int i,j;
object_type *q_ptr;
char buf[1024];
-
-
- /* Build the filename */
path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
/* File type is "TEXT" */
/* random artifacts wielding */
for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
{
- q_ptr = &inventory[i];
+ q_ptr = &p_ptr->inventory_list[i];
spoil_random_artifact_aux(q_ptr, j);
}
- /* random artifacts in inventory */
+ /* random artifacts in p_ptr->inventory_list */
for (i = 0; i < INVEN_PACK; i++)
{
- q_ptr = &inventory[i];
+ q_ptr = &p_ptr->inventory_list[i];
spoil_random_artifact_aux(q_ptr, j);
}
/* random artifacts in home */
- st_ptr = &town[1].store[STORE_HOME];
+ st_ptr = &town_info[1].store[STORE_HOME];
for (i = 0; i < st_ptr->stock_num; i++)
{
q_ptr = &st_ptr->stock[i];
}
/* random artifacts in museum */
- st_ptr = &town[1].store[STORE_MUSEUM];
+ st_ptr = &town_info[1].store[STORE_MUSEUM];
for (i = 0; i < st_ptr->stock_num; i++)
{
q_ptr = &st_ptr->stock[i];