summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBardur Arantsson <bardur@scientician.net>2015-02-23 09:11:55 +0100
committerBardur Arantsson <bardur@scientician.net>2015-02-23 09:11:55 +0100
commit7d6273cfbbc9717c30792817824b5511f7aee05f (patch)
tree4329d00cbfb9e382019e52515d1ac577334e7e65
parentb3585338e36d7a660fe3019131746feb9e445308 (diff)
Consolide the two spell_type headers
-rw-r--r--src/angband.h1
-rw-r--r--src/cmd5.cc2
-rw-r--r--src/cmd6.cc2
-rw-r--r--src/dungeon.cc2
-rw-r--r--src/externs.h8
-rw-r--r--src/lua_bind.cc2
-rw-r--r--src/lua_bind.hpp2
-rw-r--r--src/object1.cc1
-rw-r--r--src/object2.cc2
-rw-r--r--src/spell_type.cc1
-rw-r--r--src/spell_type.h95
-rw-r--r--src/spell_type.hpp84
-rw-r--r--src/spell_type_fwd.hpp (renamed from src/spell_type_fwd.h)8
-rw-r--r--src/spells1.cc2
-rw-r--r--src/spells3.cc2
-rw-r--r--src/spells3.hpp2
-rw-r--r--src/spells4.cc1
-rw-r--r--src/spells5.cc2
-rw-r--r--src/spells6.cc2
-rw-r--r--src/store.cc2
-rw-r--r--tests/get_level_device.cc2
-rw-r--r--tests/lua_get_level.cc2
22 files changed, 101 insertions, 126 deletions
diff --git a/src/angband.h b/src/angband.h
index 306b1f45..3284dd9a 100644
--- a/src/angband.h
+++ b/src/angband.h
@@ -48,7 +48,6 @@ extern "C" {
*/
#include "defines.h"
#include "types.h"
-#include "spell_type_fwd.h"
#include "externs.h"
/***** Some copyright messages follow below *****/
diff --git a/src/cmd5.cc b/src/cmd5.cc
index f0c83133..0b0da5a4 100644
--- a/src/cmd5.cc
+++ b/src/cmd5.cc
@@ -15,7 +15,7 @@
#include <assert.h>
-#include "spell_type.h"
+#include "spell_type.hpp"
#include "quark.h"
/* Maximum number of tries for teleporting */
diff --git a/src/cmd6.cc b/src/cmd6.cc
index 594470f7..64ce48d2 100644
--- a/src/cmd6.cc
+++ b/src/cmd6.cc
@@ -12,7 +12,7 @@
#include "angband.h"
#include "lua_bind.hpp"
-#include "spell_type.h"
+#include "spell_type.hpp"
#include "hooks.h"
#include <cassert>
diff --git a/src/dungeon.cc b/src/dungeon.cc
index 80ec167d..22ce130b 100644
--- a/src/dungeon.cc
+++ b/src/dungeon.cc
@@ -17,7 +17,7 @@
#include "quest.h"
#include "quark.h"
#include "hooks.h"
-#include "spell_type.h"
+#include "spell_type.hpp"
#define TY_CURSE_CHANCE 100
#define DG_CURSE_CHANCE 50
diff --git a/src/externs.h b/src/externs.h
index f7a07dc6..c2d513d1 100644
--- a/src/externs.h
+++ b/src/externs.h
@@ -510,7 +510,7 @@ extern int max_bg_idx;
extern s32b extra_savefile_parts;
extern bool_ player_char_health;
extern s16b school_spells_count;
-extern spell_type *school_spells[SCHOOL_SPELLS_MAX];
+extern struct spell_type *school_spells[SCHOOL_SPELLS_MAX];
extern s16b schools_count;
extern school_type schools[SCHOOLS_MAX];
extern int project_time;
@@ -1363,7 +1363,7 @@ void lua_cast_school_spell(s32b spell_idx, bool_ no_cost);
/* spells5.c */
void school_spells_init();
-spell_type *spell_at(s32b index);
+struct spell_type *spell_at(s32b index);
s16b get_random_spell(s16b random_type, int lev);
/* spells6.c */
@@ -1703,11 +1703,11 @@ extern int find_module(cptr name);
/* lua_bind.c */
-extern s32b lua_get_level(spell_type *spell, s32b lvl, s32b max, s32b min, s32b bonus);
+extern s32b lua_get_level(struct spell_type *spell, s32b lvl, s32b max, s32b min, s32b bonus);
extern int get_mana(s32b s);
extern s32b get_power(s32b s);
extern s32b get_level(s32b s, s32b max, s32b min);
-extern void get_level_school(spell_type *spell, s32b max, s32b min, s32b *level, bool_ *na);
+extern void get_level_school(struct spell_type *spell, s32b max, s32b min, s32b *level, bool_ *na);
extern s32b get_level_max_stick;
extern s32b get_level_use_stick;
diff --git a/src/lua_bind.cc b/src/lua_bind.cc
index cc55d815..1bd22600 100644
--- a/src/lua_bind.cc
+++ b/src/lua_bind.cc
@@ -16,7 +16,7 @@
#include <assert.h>
#include <functional>
-#include "spell_type.h"
+#include "spell_type.hpp"
#include "range.h"
/*
diff --git a/src/lua_bind.hpp b/src/lua_bind.hpp
index f4991bd3..c65795fc 100644
--- a/src/lua_bind.hpp
+++ b/src/lua_bind.hpp
@@ -1,7 +1,7 @@
#pragma once
#include "h-basic.h"
-#include "spell_type_fwd.h"
+#include "spell_type_fwd.hpp"
/** Calculate spell failure rate for a device, i.e. a wand or staff. */
extern s32b spell_chance_device(spell_type *spell_ptr);
diff --git a/src/object1.cc b/src/object1.cc
index 96f01517..b6677850 100644
--- a/src/object1.cc
+++ b/src/object1.cc
@@ -13,7 +13,6 @@
#include "angband.h"
#include "lua_bind.hpp"
#include "quark.h"
-#include "spell_type.h"
#include "spell_type.hpp"
#include "hooks.h"
diff --git a/src/object2.cc b/src/object2.cc
index 77bb6c78..0ecbcb1f 100644
--- a/src/object2.cc
+++ b/src/object2.cc
@@ -11,7 +11,7 @@
*/
#include "angband.h"
-#include "spell_type.h"
+#include "spell_type.hpp"
#include "device_allocation.h"
#include "hooks.h"
#include "spells3.hpp"
diff --git a/src/spell_type.cc b/src/spell_type.cc
index b8c01d31..7931069a 100644
--- a/src/spell_type.cc
+++ b/src/spell_type.cc
@@ -1,4 +1,3 @@
-#include "spell_type.h"
#include "spell_type.hpp"
#include "range.h"
#include "device_allocation.h"
diff --git a/src/spell_type.h b/src/spell_type.h
deleted file mode 100644
index e8d066fe..00000000
--- a/src/spell_type.h
+++ /dev/null
@@ -1,95 +0,0 @@
-#pragma once
-
-#include "spell_type_fwd.h"
-
-#include "h-basic.h"
-#include "types_fwd.h"
-#include "device_allocation_fwd.h"
-#include "range_fwd.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * Casting type
- */
-enum casting_type { USE_SPELL_POINTS, USE_PIETY };
-
-/*
- * Does the spell appear on spell random books?
- */
-enum random_type { RANDOM, NO_RANDOM };
-
-/*
- * Spell functions
- */
-
-void spell_type_init_music(spell_type *spell,
- s16b minimum_pval,
- const char* (*info_func)(),
- casting_result (*effect_func)(int o_idx));
-void spell_type_init_music_lasting(spell_type *spell,
- s16b minimum_pval,
- const char* (*info_func)(),
- casting_result (*effect_func)(int o_idx),
- int (*lasting_func)());
-void spell_type_init_mage(spell_type *spell,
- random_type random_type,
- s32b school_idx,
- const char* (*info_func)(),
- casting_result (*effect_func)(int o_idx));
-void spell_type_init_priest(spell_type *spell,
- s32b school_idx,
- const char* (*info_func)(),
- casting_result (*effect_func)(int o_idx));
-void spell_type_init_device(spell_type *spell,
- const char* (*info_func)(),
- casting_result (*effect_func)(int o_idx));
-void spell_type_init_demonology(spell_type *spell,
- const char* (*info_func)(),
- casting_result (*effect_func)(int o_idx));
-void spell_type_init_geomancy(spell_type *spell,
- const char* (*info_func)(),
- casting_result (*effect_func)(int o_idx),
- bool_ (*depend_func)());
-
-void spell_type_set_activation_timeout(spell_type *spell, cptr timeout_s);
-void spell_type_set_inertia(spell_type *spell, s32b difficulty, s32b delay);
-void spell_type_set_difficulty(spell_type *spell, byte skill_level, s32b failure_rate);
-void spell_type_set_mana(spell_type *spell, s32b min, s32b max);
-void spell_type_set_castable_while_blind(spell_type *spell, bool_ value);
-void spell_type_set_castable_while_confused(spell_type *spell, bool_ value);
-void spell_type_describe(spell_type *spell, cptr line);
-
-void spell_type_add_school(spell_type *spell, s32b school_idx);
-
-void spell_type_set_device_charges(spell_type *spell, cptr charges_s);
-void spell_type_add_device_allocation(spell_type *spell, device_allocation *a);
-
-spell_type *spell_type_new(cptr name);
-
-int spell_type_produce_effect_lasting(spell_type *spell);
-casting_result spell_type_produce_effect(spell_type *spell, int o_idx);
-cptr spell_type_name(spell_type *spell);
-int spell_type_skill_level(spell_type *spell);
-long spell_type_roll_charges(spell_type *spell);
-void spell_type_activation_description(spell_type *spell, char *buf);
-int spell_type_activation_roll_timeout(spell_type *spell);
-struct device_allocation *spell_type_device_allocation(spell_type *spell, byte tval);
-bool_ spell_type_uses_piety_to_cast(spell_type *spell);
-bool_ spell_type_castable_while_blind(spell_type *spell);
-bool_ spell_type_castable_while_confused(spell_type *spell);
-s16b spell_type_minimum_pval(spell_type *spell);
-s16b spell_type_random_type(spell_type *spell);
-bool_ spell_type_school_foreach(spell_type *spell, bool_ (*callback)(void *data, s32b school_idx), void *data);
-bool_ spell_type_inertia(spell_type *spell, s32b *difficulty, s32b *delay);
-s32b spell_type_failure_rate(spell_type *spell);
-s16b spell_type_casting_stat(spell_type *spell);
-cptr spell_type_info(spell_type *spell);
-void spell_type_mana_range(spell_type *spell, struct range_type *range);
-bool_ spell_type_dependencies_satisfied(spell_type *spell);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
diff --git a/src/spell_type.hpp b/src/spell_type.hpp
index 1817e6a8..db0b2409 100644
--- a/src/spell_type.hpp
+++ b/src/spell_type.hpp
@@ -1,7 +1,89 @@
#pragma once
-#include "spell_type_fwd.h"
+#include "spell_type_fwd.hpp"
#include <string>
#include <functional>
+#include "h-basic.h"
+#include "types_fwd.h"
+#include "device_allocation_fwd.h"
+#include "range_fwd.h"
+/*
+ * Casting type
+ */
+enum casting_type { USE_SPELL_POINTS, USE_PIETY };
+
+/*
+ * Does the spell appear on spell random books?
+ */
+enum random_type { RANDOM, NO_RANDOM };
+
+/*
+ * Spell functions
+ */
+
+void spell_type_init_music(spell_type *spell,
+ s16b minimum_pval,
+ const char* (*info_func)(),
+ casting_result (*effect_func)(int o_idx));
+void spell_type_init_music_lasting(spell_type *spell,
+ s16b minimum_pval,
+ const char* (*info_func)(),
+ casting_result (*effect_func)(int o_idx),
+ int (*lasting_func)());
+void spell_type_init_mage(spell_type *spell,
+ random_type random_type,
+ s32b school_idx,
+ const char* (*info_func)(),
+ casting_result (*effect_func)(int o_idx));
+void spell_type_init_priest(spell_type *spell,
+ s32b school_idx,
+ const char* (*info_func)(),
+ casting_result (*effect_func)(int o_idx));
+void spell_type_init_device(spell_type *spell,
+ const char* (*info_func)(),
+ casting_result (*effect_func)(int o_idx));
+void spell_type_init_demonology(spell_type *spell,
+ const char* (*info_func)(),
+ casting_result (*effect_func)(int o_idx));
+void spell_type_init_geomancy(spell_type *spell,
+ const char* (*info_func)(),
+ casting_result (*effect_func)(int o_idx),
+ bool_ (*depend_func)());
+
+void spell_type_set_activation_timeout(spell_type *spell, cptr timeout_s);
+void spell_type_set_inertia(spell_type *spell, s32b difficulty, s32b delay);
+void spell_type_set_difficulty(spell_type *spell, byte skill_level, s32b failure_rate);
+void spell_type_set_mana(spell_type *spell, s32b min, s32b max);
+void spell_type_set_castable_while_blind(spell_type *spell, bool_ value);
+void spell_type_set_castable_while_confused(spell_type *spell, bool_ value);
+void spell_type_describe(spell_type *spell, cptr line);
+
+void spell_type_add_school(spell_type *spell, s32b school_idx);
+
+void spell_type_set_device_charges(spell_type *spell, cptr charges_s);
+void spell_type_add_device_allocation(spell_type *spell, device_allocation *a);
+
+spell_type *spell_type_new(cptr name);
+
+int spell_type_produce_effect_lasting(spell_type *spell);
+casting_result spell_type_produce_effect(spell_type *spell, int o_idx);
+cptr spell_type_name(spell_type *spell);
+int spell_type_skill_level(spell_type *spell);
+long spell_type_roll_charges(spell_type *spell);
+void spell_type_activation_description(spell_type *spell, char *buf);
+int spell_type_activation_roll_timeout(spell_type *spell);
+struct device_allocation *spell_type_device_allocation(spell_type *spell, byte tval);
+bool_ spell_type_uses_piety_to_cast(spell_type *spell);
+bool_ spell_type_castable_while_blind(spell_type *spell);
+bool_ spell_type_castable_while_confused(spell_type *spell);
+s16b spell_type_minimum_pval(spell_type *spell);
+s16b spell_type_random_type(spell_type *spell);
+bool_ spell_type_school_foreach(spell_type *spell, bool_ (*callback)(void *data, s32b school_idx), void *data);
+bool_ spell_type_inertia(spell_type *spell, s32b *difficulty, s32b *delay);
+s32b spell_type_failure_rate(spell_type *spell);
+s16b spell_type_casting_stat(spell_type *spell);
+cptr spell_type_info(spell_type *spell);
+void spell_type_mana_range(spell_type *spell, struct range_type *range);
+bool_ spell_type_dependencies_satisfied(spell_type *spell);
void spell_type_description_foreach(spell_type *spell, std::function<void (std::string const &text)>);
diff --git a/src/spell_type_fwd.h b/src/spell_type_fwd.hpp
index e6c88145..a3b27d27 100644
--- a/src/spell_type_fwd.h
+++ b/src/spell_type_fwd.hpp
@@ -1,9 +1,5 @@
#pragma once
-#ifdef __cplusplus
-extern "C" {
-#endif
-
/*
* Spell effect function result
*/
@@ -18,7 +14,3 @@ typedef enum {
*/
typedef struct spell_type spell_type;
struct spell_type;
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
diff --git a/src/spells1.cc b/src/spells1.cc
index 0f5e83c9..09dd4261 100644
--- a/src/spells1.cc
+++ b/src/spells1.cc
@@ -11,7 +11,7 @@
*/
#include "angband.h"
-#include "spell_type.h"
+#include "spell_type.hpp"
#include <chrono>
#include <thread>
diff --git a/src/spells3.cc b/src/spells3.cc
index 205b5bd1..19594cbf 100644
--- a/src/spells3.cc
+++ b/src/spells3.cc
@@ -3,7 +3,7 @@
#include <assert.h>
-#include "spell_type.h"
+#include "spell_type.hpp"
#include "spell_idx_list.hpp"
#include <vector>
diff --git a/src/spells3.hpp b/src/spells3.hpp
index 992aed0e..17f34947 100644
--- a/src/spells3.hpp
+++ b/src/spells3.hpp
@@ -1,6 +1,6 @@
#pragma once
-#include "spell_type_fwd.h"
+#include "spell_type_fwd.hpp"
#include "h-basic.h"
#include "types_fwd.h"
diff --git a/src/spells4.cc b/src/spells4.cc
index 016014f2..4cd10e95 100644
--- a/src/spells4.cc
+++ b/src/spells4.cc
@@ -3,7 +3,6 @@
#include <assert.h>
#include "lua_bind.hpp"
-#include "spell_type.h"
#include "spell_type.hpp"
#include "spell_idx_list.hpp"
#include "spells3.hpp"
diff --git a/src/spells5.cc b/src/spells5.cc
index d89215d4..31a085ad 100644
--- a/src/spells5.cc
+++ b/src/spells5.cc
@@ -2,7 +2,7 @@
#include <assert.h>
-#include "spell_type.h"
+#include "spell_type.hpp"
#include "device_allocation.h"
#include "spells3.hpp"
diff --git a/src/spells6.cc b/src/spells6.cc
index 27e3925f..ceb9b050 100644
--- a/src/spells6.cc
+++ b/src/spells6.cc
@@ -1,6 +1,6 @@
#include <angband.h>
#include <assert.h>
-#include "spell_type.h"
+#include "spell_type.hpp"
#include <vector>
diff --git a/src/store.cc b/src/store.cc
index f903a8fc..ce06df11 100644
--- a/src/store.cc
+++ b/src/store.cc
@@ -11,7 +11,7 @@
*/
#include "angband.h"
-#include "spell_type.h"
+#include "spell_type.hpp"
#include "quark.h"
#include "hooks.h"
diff --git a/tests/get_level_device.cc b/tests/get_level_device.cc
index aacb8a94..a5a5afa9 100644
--- a/tests/get_level_device.cc
+++ b/tests/get_level_device.cc
@@ -1,5 +1,5 @@
#include "angband.h"
-#include "spell_type.h"
+#include "spell_type.hpp"
#include <bandit/bandit.h>
using namespace bandit;
diff --git a/tests/lua_get_level.cc b/tests/lua_get_level.cc
index b1cb559d..317fbe0e 100644
--- a/tests/lua_get_level.cc
+++ b/tests/lua_get_level.cc
@@ -1,4 +1,4 @@
-#include "spell_type.h"
+#include "spell_type.hpp"
#include <bandit/bandit.h>
using namespace bandit;