diff options
author | haranp <haranp@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-07-03 21:55:23 +0000 |
---|---|---|
committer | haranp <haranp@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-07-03 21:55:23 +0000 |
commit | 00bb42dc5e7570932126361340420b339c0e265c (patch) | |
tree | c24b1ce518515a954f05185e80117301d42b9fb3 /crawl-ref/source/spl-cast.cc | |
parent | 2f988e26917a2fd048d66f16117f4f7627a80dd3 (diff) | |
download | crawl-ref-00bb42dc5e7570932126361340420b339c0e265c.tar.gz crawl-ref-00bb42dc5e7570932126361340420b339c0e265c.zip |
Coloured power display. This is, for now, a rather extreme hack.
Note that some spells (e.g. Apportation) have no actual power limits,
so they will always be 'red'. Suggestions welcome.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1736 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/spl-cast.cc')
-rw-r--r-- | crawl-ref/source/spl-cast.cc | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc index 6d3e80eea5..f587595fe4 100644 --- a/crawl-ref/source/spl-cast.cc +++ b/crawl-ref/source/spl-cast.cc @@ -29,6 +29,7 @@ #include "fight.h" #include "food.h" #include "format.h" +#include "initfile.h" #include "it_use2.h" #include "itemname.h" #include "itemprop.h" @@ -171,7 +172,10 @@ static std::string spell_extra_description(spell_type spell) desc << std::setw(30) << spell_title(spell); // spell power, hunger level, level - desc << std::setw(30) << spell_power_string(spell).tostring() + const char* colstr = colour_to_str(spell_power_colour(spell)); + desc << '<' << colstr << '>' + << std::setw(30) << spell_power_string(spell) + << "</" << colstr << '>' << std::setw(12) << spell_hunger_string(spell) << spell_difficulty(spell); @@ -181,7 +185,7 @@ static std::string spell_extra_description(spell_type spell) char list_spells() { ToggleableMenu spell_menu(MF_SINGLESELECT | MF_ANYPRINTABLE | - MF_ALWAYS_SHOW_MORE); + MF_ALWAYS_SHOW_MORE | MF_ALLOW_FORMATTING); spell_menu.set_title( new ToggleableMenuEntry( " Your Spells Type " @@ -3511,16 +3515,13 @@ const char* spell_hunger_string( spell_type spell ) return "Extreme"; } -formatted_string spell_power_string(spell_type spell) +std::string spell_power_string(spell_type spell) { - formatted_string result; - result.textcolor(spell_power_colour(spell)); const int numbars = spell_power_bars(spell); if ( numbars < 0 ) - result.cprintf("N/A"); + return "N/A"; else - result.cprintf(std::string(numbars, '#')); - return result; + return std::string(numbars, '#'); } int spell_power_colour(spell_type spell) |