summaryrefslogtreecommitdiff
path: root/src/map/magic-interpreter-base.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/magic-interpreter-base.cpp')
-rw-r--r--src/map/magic-interpreter-base.cpp27
1 files changed, 15 insertions, 12 deletions
diff --git a/src/map/magic-interpreter-base.cpp b/src/map/magic-interpreter-base.cpp
index be9a61a..c2be363 100644
--- a/src/map/magic-interpreter-base.cpp
+++ b/src/map/magic-interpreter-base.cpp
@@ -25,10 +25,12 @@
#include "../strings/xstring.hpp"
#include "../io/cxxstdio.hpp"
-#include "../io/cxxstdio_enums.hpp"
+
+#include "../mmo/cxxstdio_enums.hpp"
#include "../net/timer.hpp"
+#include "globals.hpp"
#include "magic.hpp"
#include "magic-expr.hpp"
#include "magic-interpreter.hpp"
@@ -39,6 +41,8 @@
namespace tmwa
{
+namespace map
+{
namespace magic
{
static
@@ -78,9 +82,6 @@ void set_spell(val_t *v, dumb_ptr<spell_t> x)
*v = ValSpell{x};
}
-magic_conf_t magic_conf; /* Global magic conf */
-env_t magic_default_env = { &magic_conf, nullptr };
-
AString magic_find_invocation(XString spellname)
{
auto it = magic_conf.spells_by_name.find(spellname);
@@ -313,22 +314,22 @@ const effect_set_t *spellguard_check_sub(spellguard_check_t *check,
if (guard == nullptr)
return nullptr;
- MATCH (*guard)
+ MATCH_BEGIN (*guard)
{
- CASE (const GuardCondition&, s)
+ MATCH_CASE (const GuardCondition&, s)
{
if (!magic_eval_int(env, s.s_condition))
return nullptr;
}
- CASE (const GuardComponents&, s)
+ MATCH_CASE (const GuardComponents&, s)
{
copy_components(&check->components, s.s_components);
}
- CASE (const GuardCatalysts&, s)
+ MATCH_CASE (const GuardCatalysts&, s)
{
copy_components(&check->catalysts, s.s_catalysts);
}
- CASE (const GuardChoice&, s)
+ MATCH_CASE (const GuardChoice&, s)
{
spellguard_check_t altcheck = *check;
const effect_set_t *retval;
@@ -350,15 +351,15 @@ const effect_set_t *spellguard_check_sub(spellguard_check_t *check,
return spellguard_check_sub(check, s.s_alt, caster,
env, near_miss);
}
- CASE (const GuardMana&, s)
+ MATCH_CASE (const GuardMana&, s)
{
check->mana += magic_eval_int(env, s.s_mana);
}
- CASE (const GuardCastTime&, s)
+ MATCH_CASE (const GuardCastTime&, s)
{
check->casttime += static_cast<interval_t>(magic_eval_int(env, s.s_casttime));
}
- CASE (const effect_set_t&, s_effect)
+ MATCH_CASE (const effect_set_t&, s_effect)
{
if (spellguard_can_satisfy(check, caster, env, near_miss))
return &s_effect;
@@ -366,6 +367,7 @@ const effect_set_t *spellguard_check_sub(spellguard_check_t *check,
return nullptr;
}
}
+ MATCH_END ();
return spellguard_check_sub(check, guard->next, caster, env, near_miss);
}
@@ -547,4 +549,5 @@ int spell_unbind(dumb_ptr<map_session_data> subject, dumb_ptr<invocation> invoca
return 1;
}
} // namespace magic
+} // namespace map
} // namespace tmwa