summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/process_desc.h
diff options
context:
space:
mode:
authorAdam Borowski <kilobyte@angband.pl>2012-03-30 23:45:49 +0200
committerAdam Borowski <kilobyte@angband.pl>2012-03-30 23:45:49 +0200
commitc7765d595c93a52788a8d6edbc7d7904c78bab5c (patch)
treef72ef8e56f93f8a30aa1bacf4f388919cd94c0d0 /crawl-ref/source/process_desc.h
parent0ed23417bd9f77d2acd8696de088cefadb8b5ede (diff)
downloadcrawl-ref-c7765d595c93a52788a8d6edbc7d7904c78bab5c.tar.gz
crawl-ref-c7765d595c93a52788a8d6edbc7d7904c78bab5c.zip
An ugly hack to put descriptions through filters as well.
Sadly, menus, especially columned, break too much.
Diffstat (limited to 'crawl-ref/source/process_desc.h')
-rw-r--r--crawl-ref/source/process_desc.h24
1 files changed, 13 insertions, 11 deletions
diff --git a/crawl-ref/source/process_desc.h b/crawl-ref/source/process_desc.h
index 4d1043ae2f..450619241c 100644
--- a/crawl-ref/source/process_desc.h
+++ b/crawl-ref/source/process_desc.h
@@ -7,6 +7,7 @@
#define DESCRIBE_TEMPLATES_H
#include "describe.h"
+#include "translate.h"
template<class T> void process_description(T &proc, const describe_info &inf);
template<class T> void process_quote(T &proc, const describe_info &inf);
@@ -22,27 +23,28 @@ inline void process_description(T &proc, const describe_info &inf)
const int height = proc.height();
std::string desc;
+ // most stuff goes through translate() twice unnecessarily, yadda yadda yadda
// How many lines is the title; we also seem to be adding 1 to
// start with.
- int num_lines = count_desc_lines(inf.title, line_width) + 1;
+ int num_lines = count_desc_lines(translated(inf.title), line_width) + 1;
- int body_lines = count_desc_lines(inf.body.str(), line_width);
- const int suffix_lines = count_desc_lines(inf.suffix, line_width);
- const int prefix_lines = count_desc_lines(inf.prefix, line_width);
- const int footer_lines = count_desc_lines(inf.footer, line_width)
+ int body_lines = count_desc_lines(translated(inf.body.str()), line_width);
+ const int suffix_lines = count_desc_lines(translated(inf.suffix), line_width);
+ const int prefix_lines = count_desc_lines(translated(inf.prefix), line_width);
+ const int footer_lines = count_desc_lines(translated(inf.footer), line_width)
+ (inf.footer.empty() ? 0 : 1);
if (inf.title.empty())
{
- desc = inf.body.str();
+ desc = translated(inf.body.str());
// There is a default 1 line addition for some reason.
num_lines = body_lines + 1;
}
else
{
- desc = inf.title + "\n\n";
- desc += inf.body.str();
+ desc = translated(inf.title) + "\n\n";
+ desc += translated(inf.body.str());
// Got 2 lines from the two \ns that weren't counted yet.
num_lines += body_lines + 2;
}
@@ -50,14 +52,14 @@ inline void process_description(T &proc, const describe_info &inf)
// Prefer the footer over the suffix.
if (num_lines + suffix_lines + footer_lines <= height)
{
- desc = desc + inf.suffix;
+ desc = desc + translated(inf.suffix);
num_lines += suffix_lines;
}
// Prefer the footer over the prefix.
if (num_lines + prefix_lines + footer_lines <= height)
{
- desc = inf.prefix + desc;
+ desc = translated(inf.prefix) + desc;
num_lines += prefix_lines;
}
@@ -70,7 +72,7 @@ inline void process_description(T &proc, const describe_info &inf)
if (newlines >= 0)
{
desc.append(newlines, '\n');
- desc = desc + inf.footer;
+ desc = desc + translated(inf.footer);
}
}