summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/spl-cast.cc
diff options
context:
space:
mode:
authorharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2008-10-10 00:35:26 +0000
committerharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2008-10-10 00:35:26 +0000
commit5cd65ca8c6e1dd6ab026524171f857a0fd7ffdca (patch)
treecf2e561ae185b37f3f34b6e7c7f7879755793ad2 /crawl-ref/source/spl-cast.cc
parentbbc87d91594a2f5efad548e497c4c75c6f762742 (diff)
downloadcrawl-ref-5cd65ca8c6e1dd6ab026524171f857a0fd7ffdca.tar.gz
crawl-ref-5cd65ca8c6e1dd6ab026524171f857a0fd7ffdca.zip
Added range information to alternate spell display (dpeg).
Quelled a warning on lack of virtual destructors. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7205 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/spl-cast.cc')
-rw-r--r--crawl-ref/source/spl-cast.cc26
1 files changed, 20 insertions, 6 deletions
diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc
index 82a451f88e..518dfb8456 100644
--- a/crawl-ref/source/spl-cast.cc
+++ b/crawl-ref/source/spl-cast.cc
@@ -177,8 +177,9 @@ static std::string _spell_extra_description(spell_type spell)
// spell name
desc << std::setw(30) << spell_title(spell);
- // spell power, hunger level, level
- desc << std::setw(30) << spell_power_string(spell)
+ // spell power, spell range, hunger level, level
+ desc << std::setw(14) << spell_power_string(spell)
+ << std::setw(16) << spell_range_string(spell)
<< std::setw(12) << spell_hunger_string(spell)
<< spell_difficulty(spell);
@@ -191,10 +192,10 @@ int list_spells(bool toggle_with_I)
MF_ALWAYS_SHOW_MORE | MF_ALLOW_FORMATTING);
spell_menu.set_title(
new ToggleableMenuEntry(
- " Your Spells Type "
- " Success Level",
- " Your Spells Power "
- " Hunger Level",
+ " Your Spells Type "
+ " Success Level",
+ " Your Spells Power "
+ "Range Hunger Level",
MEL_TITLE));
spell_menu.set_highlighter(NULL);
spell_menu.add_toggle_key('!');
@@ -4569,3 +4570,16 @@ std::string spell_power_string(spell_type spell)
else
return std::string(numbars, '#') + std::string(capbars - numbars, '.');
}
+
+std::string spell_range_string(spell_type spell)
+{
+ const int cap = spell_power_cap(spell);
+ const int power = calc_spell_power(spell, true);
+ const int range = spell_range(spell, power, false);
+ const int maxrange = spell_range(spell, cap, false);
+ if (range < 0)
+ return "N/A";
+ else
+ return std::string("@") + std::string(range, '.')
+ + std::string(maxrange - range, ',');
+}