OSDN Git Service

[Refactor] format 関数の戻り値を std::string にする
[hengbandforosx/hengbandosx.git] / src / wizard / spoiler-util.h
1 #pragma once
2
3 #include "system/angband.h"
4 #include "wizard/spoiler-table.h"
5 #include <string_view>
6
7 /* MAX_LINE_LEN specifies when a line should wrap. */
8 #define MAX_LINE_LEN 75
9
10 /* Given an array, determine how many elements are in the array */
11 #define N_ELEMENTS(a) (sizeof(a) / sizeof((a)[0]))
12
13 enum class SpoilerOutputResultType {
14     CANCELED,
15     SUCCESSFUL,
16     FILE_OPEN_FAILED,
17     FILE_CLOSE_FAILED,
18 };
19
20 /* A special type used just for deailing with pvals */
21 struct pval_info_type {
22     char pval_desc[12]; /* This will contain a string such as "+2", "-10", etc. */
23
24     /* A list of various player traits affected by an object's pval such as stats, speed, stealth, etc. */
25     concptr pval_affects[N_ELEMENTS(stat_flags_desc) - 1 + N_ELEMENTS(pval_flags1_desc) + 1];
26 };
27
28 struct obj_desc_list {
29     char description[MAX_NLEN]; /* "The Longsword Dragonsmiter (6d4) (+20, +25)" */
30     pval_info_type pval_info; /* Description of what is affected by an object's pval */
31     concptr slays[N_ELEMENTS(slay_flags_desc) + 1]; /* A list of an object's slaying preferences */
32     concptr brands[N_ELEMENTS(brand_flags_desc) + 1]; /* A list if an object's elemental brands */
33     concptr immunities[N_ELEMENTS(immune_flags_desc) + 1]; /* A list of immunities granted by an object */
34     concptr resistances[N_ELEMENTS(resist_flags_desc) + 1]; /* A list of resistances granted by an object */
35     concptr vulnerables[N_ELEMENTS(vulnerable_flags_desc) + 1]; /* A list of resistances granted by an object */
36     concptr sustains[N_ELEMENTS(sustain_flags_desc) - 1 + 1]; /* A list of stats sustained by an object */
37
38     /* A list of various magical qualities an object may have */
39     concptr misc_magic[N_ELEMENTS(misc_flags2_desc) + N_ELEMENTS(misc_flags3_desc) + 1 /* Permanent Light */
40                        + 1 /* TY curse */
41                        + 1 /* type of curse */
42                        + 1]; /* sentinel nullptr */
43
44     char addition[80]; /* Additional ability or resistance */
45     concptr activation; /* A string describing an artifact's activation */
46     char misc_desc[80]; /* "Level 20, Rarity 30, 3.0 lbs, 20000 Gold" */
47 };
48
49 extern const char item_separator;
50 extern const char list_separator;
51 extern const int max_evolution_depth;
52 extern concptr spoiler_indent;
53 extern FILE *spoiler_file;
54
55 void spoiler_blanklines(int n);
56 void spoiler_underline(concptr str);
57 void spoil_out(std::string_view sv, bool flush_buffer = false);