summaryrefslogtreecommitdiff
path: root/src/monster_spell.cc
diff options
context:
space:
mode:
authorBardur Arantsson <bardur@scientician.net>2016-06-20 22:49:05 +0200
committerBardur Arantsson <bardur@scientician.net>2016-06-20 22:49:05 +0200
commit59b5314b6b7880cfda73f34aed03a700fd523017 (patch)
tree4b5255289c8216f2d7dcfac2824045e5c0acdc45 /src/monster_spell.cc
parentfa5083020d4cc4d6d7471b461c430d40ed36c02e (diff)
Rework RF{4,5,6}_* monster spell flags to flag_set<>
Diffstat (limited to 'src/monster_spell.cc')
-rw-r--r--src/monster_spell.cc36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/monster_spell.cc b/src/monster_spell.cc
new file mode 100644
index 00000000..08627916
--- /dev/null
+++ b/src/monster_spell.cc
@@ -0,0 +1,36 @@
+#include "monster_spell.hpp"
+
+#include "monster_spell_flag.hpp"
+
+#include <boost/preprocessor/cat.hpp>
+
+std::vector<monster_spell const *> const &monster_spells()
+{
+ // Static instance for one-time initialization.
+ static std::vector<monster_spell const *> instance;
+
+ if (instance.empty())
+ {
+#define SF(tier, index, name, is_summon, is_annoy, is_damage, is_bolt, is_smart, is_innate, is_escape, is_tactic, is_haste, is_heal) \
+ instance.emplace_back(new monster_spell { \
+ BOOST_PP_CAT(SF_, BOOST_PP_CAT(name, _IDX)), \
+ BOOST_PP_CAT(SF_, name), \
+ #name, \
+ is_summon, \
+ is_annoy, \
+ is_damage, \
+ is_bolt, \
+ is_smart, \
+ is_innate, \
+ is_escape, \
+ is_tactic, \
+ is_haste, \
+ is_heal, \
+ !is_innate, \
+ });
+#include "monster_spell_flag_list.hpp"
+#undef SF
+ };
+
+ return instance;
+}