summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/spl-pick.cc
diff options
context:
space:
mode:
authorPete Hurst <pete@streamuniverse.tv>2013-06-24 00:42:11 +0100
committerPete Hurst <pete@streamuniverse.tv>2013-06-24 00:42:11 +0100
commit1cc1d03c18bf89cdb604b02b4031775c5a0ed763 (patch)
tree1987a3f3194bcaba1d28563dab593b3a5b4f5d88 /crawl-ref/source/spl-pick.cc
parent57d3b8a80fd46a46853ee536c04474c6fd3564f7 (diff)
downloadcrawl-ref-1cc1d03c18bf89cdb604b02b4031775c5a0ed763.tar.gz
crawl-ref-1cc1d03c18bf89cdb604b02b4031775c5a0ed763.zip
Add missing spell_picker files
Diffstat (limited to 'crawl-ref/source/spl-pick.cc')
-rw-r--r--crawl-ref/source/spl-pick.cc23
1 files changed, 23 insertions, 0 deletions
diff --git a/crawl-ref/source/spl-pick.cc b/crawl-ref/source/spl-pick.cc
new file mode 100644
index 0000000000..698018ebd3
--- /dev/null
+++ b/crawl-ref/source/spl-pick.cc
@@ -0,0 +1,23 @@
+/**
+ * @file
+ * @brief Functions for picking from lists of spells.
+**/
+
+#include "AppHdr.h"
+
+#include "spl-pick.h"
+
+spell_type spell_picker::pick_with_veto(const spell_entry *weights,
+ int level, spell_type none,
+ spell_pick_vetoer vetoer)
+{
+ veto_func = vetoer;
+ return pick(weights, level, none);
+}
+
+// Veto specialisation for the spell_picker class; this simply calls the
+// stored veto function. Can subclass further for more complex veto behaviour.
+bool spell_picker::veto(spell_type mon)
+{
+ return veto_func && veto_func(mon);
+}