summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/format.cc
diff options
context:
space:
mode:
authorAdam Borowski <kilobyte@angband.pl>2011-04-04 00:19:17 +0200
committerAdam Borowski <kilobyte@angband.pl>2011-04-04 00:23:48 +0200
commit93abc8e4b8b486a21de5c51a4054422b8a50476d (patch)
tree82d120997d513e3a8bea7d038bcdb7127d2651af /crawl-ref/source/format.cc
parentdde024d6f089cb38070025bbdcb6cb278d527dce (diff)
downloadcrawl-ref-93abc8e4b8b486a21de5c51a4054422b8a50476d.tar.gz
crawl-ref-93abc8e4b8b486a21de5c51a4054422b8a50476d.zip
Fix and merge away tagged_string_substr().
It was used on user-supplied string (inscribed items), so non-ASCII can happen in 0.8.
Diffstat (limited to 'crawl-ref/source/format.cc')
-rw-r--r--crawl-ref/source/format.cc50
1 files changed, 0 insertions, 50 deletions
diff --git a/crawl-ref/source/format.cc b/crawl-ref/source/format.cc
index 6e30da221e..f5ba4dc1e5 100644
--- a/crawl-ref/source/format.cc
+++ b/crawl-ref/source/format.cc
@@ -517,56 +517,6 @@ int count_linebreaks(const formatted_string& fs)
return count;
}
-// Return the actual (string) offset of character #loc to be printed,
-// i.e. ignoring tags. So for instance, if s == "<tag>ab</tag>", then
-// _find_string_location(s, 2) == 6.
-static int _find_string_location(const std::string& s, int loc)
-{
- int real_offset = 0;
- bool in_tag = false;
- int last_taglen = 0;
- int offset = 0;
- for (std::string::const_iterator ci = s.begin();
- ci != s.end() && real_offset < loc;
- ++ci, ++offset)
- {
- if (in_tag)
- {
- if (*ci == '<' && last_taglen == 1)
- {
- ++real_offset;
- in_tag = false;
- }
- else if (*ci == '>')
- {
- in_tag = false;
- }
- else
- {
- ++last_taglen;
- }
- }
- else if (*ci == '<')
- {
- in_tag = true;
- last_taglen = 1;
- }
- else
- {
- ++real_offset;
- }
- }
- return (offset);
-}
-
-// Return the substring of s from character start to character end,
-// where tags count as length 0.
-std::string tagged_string_substr(const std::string& s, int start, int end)
-{
- return (s.substr(_find_string_location(s, start),
- _find_string_location(s, end)));
-}
-
static int _tagged_string_printable_length(const std::string& s)
{
int len = 0;