Potential range now in darkgrey. Spell power coloured red/green/yellow/white. (This might have been there in the past and removed as fruit salad; if so sorry and I'll remove it again.)
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7206 c06c8d41-db1a-0410-9941-cceddc491573
CMAHQ2ZS37MGH4XGMVKRDK665PKNFBISOEZLY7RZXX7CXVLUPL5AC
static int _string_tag_length(const std::string& s)
{
int taglen = 0;
bool in_tag = false;
int last_taglen = 0;
for (std::string::const_iterator ci = s.begin(); ci != s.end(); ++ci)
{
if (in_tag)
{
if (*ci == '<' && last_taglen == 1)
{
in_tag = false;
--taglen;
}
else if (*ci == '>')
{
in_tag = false;
++taglen;
}
else
{
++last_taglen;
++taglen;
}
}
else if (*ci == '<')
{
in_tag = true;
last_taglen = 1;
++taglen;
}
}
return (taglen);
}
desc << std::setw(14) << spell_power_string(spell)
<< std::setw(16) << spell_range_string(spell)
const std::string power_colour = colour_to_str(spell_power_colour(spell));
const std::string rangestring = spell_range_string(spell);
desc << '<' << power_colour << '>'
<< std::setw(14) << spell_power_string(spell)
<< "</" << power_colour << '>'
<< std::setw(16 + _string_tag_length(rangestring)) << rangestring