#include "wizard/artifact-analyzer.h"
#include "wizard/fixed-artifacts-spoiler.h"
#include "wizard/spoiler-util.h"
+#include <sstream>
/*!
* @brief ランダムアーティファクト1件をスポイラー出力する /
*/
static void spoiler_print_randart(ItemEntity *o_ptr, obj_desc_list *art_ptr)
{
- pval_info_type *pval_ptr = &art_ptr->pval_info;
+ const auto *pval_ptr = &art_ptr->pval_info;
fprintf(spoiler_file, "%s\n", art_ptr->description);
if (!o_ptr->is_fully_known()) {
fprintf(spoiler_file, _("%s不明\n", "%sUnknown\n"), spoiler_indent);
} else {
- if (pval_ptr->pval_desc[0]) {
- spoiler_outlist(std::string(pval_ptr->pval_desc).append(_("の修正:", " to")).data(), pval_ptr->pval_affects, item_separator);
+ if (!pval_ptr->pval_desc.empty()) {
+ std::stringstream ss;
+ ss << pval_ptr->pval_desc << _("の修正:", " to");
+ spoiler_outlist(ss.str(), pval_ptr->pval_affects, item_separator);
}
spoiler_outlist(_("対:", "Slay"), art_ptr->slays, item_separator);
static void analyze_pval(ItemEntity *o_ptr, pval_info_type *pi_ptr)
{
if (!o_ptr->pval) {
- pi_ptr->pval_desc[0] = '\0';
return;
}
auto flags = object_flags(o_ptr);
- strnfmt(pi_ptr->pval_desc, sizeof(pi_ptr->pval_desc), "%s%d", o_ptr->pval >= 0 ? "+" : "", o_ptr->pval);
+ pi_ptr->pval_desc = format("%s%d", o_ptr->pval >= 0 ? "+" : "", o_ptr->pval);
std::vector<std::string> pval_descriptions;
if (flags.has_all_of(EnumRange(TR_STR, TR_CHR))) {
pval_descriptions.push_back(_("全能力", "All stats"));
#include "view/display-messages.h"
#include "wizard/artifact-analyzer.h"
#include "wizard/spoiler-util.h"
+#include <sstream>
/*!
* @brief フラグ名称を出力する汎用関数
* @param descriptions フラグ名リスト
* @param separator フラグ表示の区切り記号
*/
-void spoiler_outlist(std::string_view header, std::vector<std::string> &descriptions, char separator)
+void spoiler_outlist(std::string_view header, const std::vector<std::string> &descriptions, char separator)
{
if (descriptions.empty()) {
return;
*/
static void spoiler_print_art(obj_desc_list *art_ptr)
{
- pval_info_type *pval_ptr = &art_ptr->pval_info;
+ const auto *pval_ptr = &art_ptr->pval_info;
fprintf(spoiler_file, "%s\n", art_ptr->description);
- if (pval_ptr->pval_desc[0]) {
- spoiler_outlist(std::string(pval_ptr->pval_desc).append(_("の修正:", " to")).data(), pval_ptr->pval_affects, item_separator);
+ if (!pval_ptr->pval_desc.empty()) {
+ std::stringstream ss;
+ ss << pval_ptr->pval_desc << _("の修正:", " to");
+ spoiler_outlist(ss.str(), pval_ptr->pval_affects, item_separator);
}
spoiler_outlist(_("対:", "Slay"), art_ptr->slays, item_separator);
#include "system/angband.h"
#include "wizard/spoiler-util.h"
-void spoiler_outlist(std::string_view header, std::vector<std::string> &descriptions, char seperator);
+void spoiler_outlist(std::string_view header, const std::vector<std::string> &descriptions, char seperator);
void spoiler_outlist(concptr header, concptr *list, char separator);
SpoilerOutputResultType spoil_fixed_artifact(concptr fname);
struct pval_info_type {
pval_info_type() = default;
- char pval_desc[12]{}; /* This will contain a string such as "+2", "-10", etc. */
+ std::string pval_desc = ""; /* This will contain a string such as "+2", "-10", etc. */
/* A list of various player traits affected by an object's pval such as stats, speed, stealth, etc. */
std::vector<std::string> pval_affects{};