summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/describe.cc
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2009-09-10 15:58:46 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2009-09-10 15:58:46 +0000
commit1d23ad9eae6203fcabc6b1f9a933174bc907f2a9 (patch)
tree8182fbaccc51eecf655ed3feda605e4fff97ad67 /crawl-ref/source/describe.cc
parent383d392c17f076384fc37e631b6506739ca634fe (diff)
downloadcrawl-ref-1d23ad9eae6203fcabc6b1f9a933174bc907f2a9.tar.gz
crawl-ref-1d23ad9eae6203fcabc6b1f9a933174bc907f2a9.zip
Add an inventory-like region for the Tiles version to make spells
clickable. '_' toggles between inventory and spell display. Actual tiles are still missing, but everything works as it should. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@10648 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/describe.cc')
-rw-r--r--crawl-ref/source/describe.cc45
1 files changed, 29 insertions, 16 deletions
diff --git a/crawl-ref/source/describe.cc b/crawl-ref/source/describe.cc
index e6853746ca..08afab6671 100644
--- a/crawl-ref/source/describe.cc
+++ b/crawl-ref/source/describe.cc
@@ -2387,22 +2387,16 @@ void inscribe_item(item_def &item, bool proper_prompt)
}
}
-//---------------------------------------------------------------
-//
-// describe_spell
-//
-// Describes (most) every spell in the game.
-//
-//---------------------------------------------------------------
-void describe_spell(spell_type spelled, const item_def* item)
-{
- std::string description;
+bool _get_spell_description(const spell_type spell, std::string &description,
+ const item_def* item = NULL)
+{
description.reserve(500);
- description += spell_title( spelled );
+ description = spell_title( spell );
description += "$$";
- const std::string long_descrip = getLongDescription(spell_title(spelled));
+ const std::string long_descrip = getLongDescription(spell_title(spell));
+
if (!long_descrip.empty())
description += long_descrip;
else
@@ -2416,8 +2410,7 @@ void describe_spell(spell_type spelled, const item_def* item)
#endif
}
- bool can_mem = false;
- if (you_cannot_memorise(spelled))
+ if (you_cannot_memorise(spell))
{
description += "$$";
description += "You cannot memorise or cast this spell because you "
@@ -2427,12 +2420,32 @@ void describe_spell(spell_type spelled, const item_def* item)
}
else if (item && item->base_type == OBJ_BOOKS && in_inventory(*item))
{
- can_mem = true;
description += "$$";
description += "(M)emorise this spell.";
+ return (true);
}
+ return (false);
+}
- print_description(description);
+void get_spell_desc(const spell_type spell, describe_info &inf)
+{
+ std::string desc;
+ _get_spell_description(spell, desc);
+ inf.body << desc;
+}
+
+//---------------------------------------------------------------
+//
+// describe_spell
+//
+// Describes (most) every spell in the game.
+//
+//---------------------------------------------------------------
+void describe_spell(spell_type spelled, const item_def* item)
+{
+ std::string desc;
+ bool can_mem = _get_spell_description(spelled, desc, item);
+ print_description(desc);
mouse_control mc(MOUSE_MODE_MORE);