summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/describe.h
blob: bd2c676ee2e1d51f3581c40de08f4f3f79aef5a8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
/**
 * @file
 * @brief Functions used to print information about various game objects.
**/

#ifndef DESCRIBE_H
#define DESCRIBE_H

#include <string>
#include <sstream>
#include "externs.h"
#include "enum.h"
#include "mon-util.h"

struct monster_info;

// If you add any more description types, remember to also
// change item_description in externs.h
enum item_description_type
{
    IDESC_WANDS = 0,
    IDESC_POTIONS,
    IDESC_SCROLLS,                      // special field (like the others)
    IDESC_RINGS,
    IDESC_SCROLLS_II,
    IDESC_STAVES,
    NUM_IDESC
};

enum book_mem_or_forget
{
    BOOK_MEM,
    BOOK_FORGET,
    BOOK_NEITHER
};

struct describe_info
{
    ostringstream body;
    string title;
    string prefix;
    string suffix;
    string footer;
    string quote;
};

void append_spells(string &desc, const item_def &item);

bool is_dumpable_artefact(const item_def &item, bool verbose);

string get_item_description(const item_def &item, bool verbose,
                            bool dump = false, bool noquote = false);

string god_title(god_type which_god, species_type which_species, int piety);
void describe_god(god_type which_god, bool give_title);

void describe_feature_wide(const coord_def& pos, bool show_quote = false);
void get_feature_desc(const coord_def &gc, describe_info &inf);

bool describe_item(item_def &item, bool allow_inscribe = false,
                   bool shopping = false);
void get_item_desc(const item_def &item, describe_info &inf);
void inscribe_item(item_def &item, bool msgwin);

void append_weapon_stats(string &description, const item_def &item);
void append_armour_stats(string &description, const item_def &item);
void append_missile_info(string &description, const item_def &item);

int describe_monsters(const monster_info &mi, bool force_seen = false,
                      const string &footer = "");

void get_monster_db_desc(const monster_info &mi, describe_info &inf,
                         bool &has_stat_desc, bool force_seen = false);

void get_spell_desc(const spell_type spell, describe_info &inf);
void describe_spell(spell_type spelled, const item_def* item = NULL);

string short_ghost_description(const monster *mon, bool abbrev = false);
string get_ghost_description(const monster_info &mi, bool concise = false);

string get_skill_description(skill_type skill, bool need_title = false);

void describe_skill(skill_type skill);

#ifdef USE_TILE
string get_command_description(const command_type cmd, bool terse);
#endif

void print_description(const string &desc);
void print_description(const describe_info &inf);

string artefact_inscription(const item_def& item);
void add_inscription(item_def &item, string inscrip);

string trap_name(trap_type trap);
string full_trap_name(trap_type trap);
int str_to_trap(const string &s);

int count_desc_lines(const string& _desc, const int width);

class alt_desc_proc
{
public:
    alt_desc_proc(int _w, int _h) { w = _w; h = _h; }

    int width() { return w; }
    int height() { return h; }

    void nextline();
    void print(const string &str);
    static int count_newlines(const string &str);

    // Remove trailing newlines.
    static void trim(string &str);
    // rfind consecutive newlines and truncate.
    static bool chop(string &str);

    void get_string(string &str);

protected:
    int w;
    int h;
    ostringstream ostr;
};

#endif