From 5cd65ca8c6e1dd6ab026524171f857a0fd7ffdca Mon Sep 17 00:00:00 2001 From: haranp Date: Fri, 10 Oct 2008 00:35:26 +0000 Subject: 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 --- crawl-ref/source/beam.cc | 1 + crawl-ref/source/spl-cast.cc | 26 ++++++++++++++++++++------ crawl-ref/source/spl-cast.h | 2 +- 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc index dfb88d11f7..0ecfe0b823 100644 --- a/crawl-ref/source/beam.cc +++ b/crawl-ref/source/beam.cc @@ -325,6 +325,7 @@ template struct power_deducer { virtual T operator()(int pow) const = 0; + virtual ~power_deducer() {} }; typedef power_deducer tohit_deducer; 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, ','); +} diff --git a/crawl-ref/source/spl-cast.h b/crawl-ref/source/spl-cast.h index 1873ca8665..b5e20c5403 100644 --- a/crawl-ref/source/spl-cast.h +++ b/crawl-ref/source/spl-cast.h @@ -72,7 +72,7 @@ const char* failure_rate_to_string( int fail ); int spell_power_colour(spell_type spell); int spell_power_bars(spell_type spell); std::string spell_power_string(spell_type spell); - +std::string spell_range_string(spell_type spell); const char* spell_hunger_string( spell_type spell ); #endif -- cgit v1.2.3-54-g00ecf