-#include "wizard/fixed-artifacts-spoiler.h"
+#include "wizard/fixed-artifacts-spoiler.h"
#include "io/files-util.h"
#include "object/object-kind-hook.h"
#include "system/angband-version.h"
}
/*!
- * @brief フラグ名称を出力する汎用関数
- * @param header ヘッダに出力するフラグ群の名前
- * @param list フラグ名リスト
- * @param separator フラグ表示の区切り記号
- * @todo 固定アーティファクトとランダムアーティファクトで共用、ここに置くべきかは要調整.
- * @todo いずれ上で定義したオーバーロードに吸収合併させてこれは消滅させる予定
- */
-void spoiler_outlist(concptr header, concptr *list, char separator)
-{
- if (*list == nullptr) {
- return;
- }
-
- std::string line = spoiler_indent;
- if (header && (header[0])) {
- line.append(header).append(" ");
- }
-
- while (true) {
- std::string elem = *list;
- if (list[1]) {
- elem.push_back(separator);
- elem.push_back(' ');
- }
-
- if (line.length() + elem.length() <= MAX_LINE_LEN) {
- line.append(elem);
- } else {
- if (line.length() > 1 && line[line.length() - 1] == ' ' && line[line.length() - 2] == list_separator) {
- line[line.length() - 2] = '\0';
- fprintf(spoiler_file, "%s\n", line.data());
- line = spoiler_indent;
- line.append(elem);
- } else {
- fprintf(spoiler_file, "%s\n", line.data());
- line = " ";
- line.append(elem);
- }
- }
-
- if (!*++list) {
- break;
- }
- }
-
- fprintf(spoiler_file, "%s\n", line.data());
-}
-
-/*!
- * @brief アーティファクト情報を出力するためにダミー生成を行う /
- * Hack -- Create a "forged" artifact
- * @param o_ptr 一時生成先を保管するオブジェクト構造体
+ * @brief アーティファクト情報を出力するためにダミー生成を行う
* @param fixed_artifact_idx 生成するアーティファクトID
- * @return ç\94\9fæ\88\90ã\81\8cæ\88\90å\8a\9fã\81\97ã\81\9få ´å\90\88TRUEã\82\92è¿\94ã\81\99
+ * @return ç\94\9fæ\88\90ã\81\97ã\81\9fã\82¢ã\83¼ã\83\86ã\82£ã\83\95ã\82¡ã\82¯ã\83\88 (é\80£ç\95ªã\81§å\9f\8bã\81¾ã\81£ã\81¦ã\81\84ã\82\8bã\81®ã\81§ä¸\8då\98å\9c¨ä¾\8bå¤\96ã\81¯å\90\90ã\81\8bã\81ªã\81\84)
*/
-static bool make_fake_artifact(ItemEntity *o_ptr, FixedArtifactId fixed_artifact_idx)
+static ItemEntity make_fake_artifact(FixedArtifactId fixed_artifact_idx)
{
const auto &artifact = ArtifactsInfo::get_instance().get_artifact(fixed_artifact_idx);
- if (artifact.name.empty()) {
- return false;
- }
-
const auto bi_id = lookup_baseitem_id(artifact.bi_key);
- if (bi_id == 0) {
- return false;
- }
-
- o_ptr->prep(bi_id);
- o_ptr->fixed_artifact_idx = fixed_artifact_idx;
- o_ptr->pval = artifact.pval;
- o_ptr->ac = artifact.ac;
- o_ptr->dd = artifact.dd;
- o_ptr->ds = artifact.ds;
- o_ptr->to_a = artifact.to_a;
- o_ptr->to_h = artifact.to_h;
- o_ptr->to_d = artifact.to_d;
- o_ptr->weight = artifact.weight;
- return true;
+ ItemEntity item;
+ item.prep(bi_id);
+ item.fixed_artifact_idx = fixed_artifact_idx;
+ item.pval = artifact.pval;
+ item.ac = artifact.ac;
+ item.dd = artifact.dd;
+ item.ds = artifact.ds;
+ item.to_a = artifact.to_a;
+ item.to_h = artifact.to_h;
+ item.to_d = artifact.to_d;
+ item.weight = artifact.weight;
+ return item;
}
/*!
static void spoiler_print_art(obj_desc_list *art_ptr)
{
const auto *pval_ptr = &art_ptr->pval_info;
- fprintf(spoiler_file, "%s\n", art_ptr->description);
+ fprintf(spoiler_file, "%s\n", art_ptr->description.data());
if (!pval_ptr->pval_desc.empty()) {
std::stringstream ss;
ss << pval_ptr->pval_desc << _("の修正:", " to");
spoiler_outlist(_("免疫:", "Immunity to"), art_ptr->immunities, item_separator);
spoiler_outlist(_("耐性:", "Resist"), art_ptr->resistances, item_separator);
spoiler_outlist(_("弱点:", "Vulnerable"), art_ptr->vulnerabilities, item_separator);
- spoiler_outlist(_("維持:", "Sustain"), art_ptr->sustains, item_separator);
+ spoiler_outlist(_("維持:", "Sustain"), art_ptr->sustenances, item_separator);
spoiler_outlist("", art_ptr->misc_magic, list_separator);
- if (art_ptr->addition[0]) {
- fprintf(spoiler_file, _("%s追加: %s\n", "%sAdditional %s\n"), spoiler_indent, art_ptr->addition);
+ if (!art_ptr->addition.empty()) {
+ fprintf(spoiler_file, _("%s追加: %s\n", "%sAdditional %s\n"), spoiler_indent, art_ptr->addition.data());
}
- if (art_ptr->activation) {
- fprintf(spoiler_file, _("%s発動: %s\n", "%sActivates for %s\n"), spoiler_indent, art_ptr->activation);
+ if (!art_ptr->activation.empty()) {
+ fprintf(spoiler_file, _("%s発動: %s\n", "%sActivates for %s\n"), spoiler_indent, art_ptr->activation.data());
}
- fprintf(spoiler_file, "%s%s\n\n", spoiler_indent, art_ptr->misc_desc);
+ fprintf(spoiler_file, "%s%s\n\n", spoiler_indent, art_ptr->misc_desc.data());
}
/*!
- * @brief アーティファクト情報のスポイラー出力を行うメインルーチン /
- * Create a spoiler file for artifacts
- * @param fname 生成ファイル名
+ * @brief アーティファクト情報のスポイラー出力を行うメインルーチン
*/
-SpoilerOutputResultType spoil_fixed_artifact(concptr fname)
+SpoilerOutputResultType spoil_fixed_artifact()
{
- const auto &path = path_build(ANGBAND_DIR_USER, fname);
+ const auto &path = path_build(ANGBAND_DIR_USER, "artifact.txt");
spoiler_file = angband_fopen(path, FileOpenMode::WRITE);
if (!spoiler_file) {
return SpoilerOutputResultType::FILE_OPEN_FAILED;
continue;
}
- ItemEntity item;
- if (!make_fake_artifact(&item, a_idx)) {
- continue;
- }
-
+ const auto item = make_fake_artifact(a_idx);
PlayerType dummy;
obj_desc_list artifact_descriptions;
object_analyze(&dummy, &item, &artifact_descriptions);