diff options
author | Ben Longbons <b.r.longbons@gmail.com> | 2014-07-23 23:55:41 -0700 |
---|---|---|
committer | Ben Longbons <b.r.longbons@gmail.com> | 2014-08-05 17:41:35 -0700 |
commit | a7f64f0b39cb7141f16608c171b20bee452fd024 (patch) | |
tree | 6ceb293db3488161d4d5a620536560506e63134f /src/map/magic-expr-eval.hpp | |
parent | 7abac74323e2566173ea586e9acadac1ebf59098 (diff) | |
download | tmwa-a7f64f0b39cb7141f16608c171b20bee452fd024.tar.gz tmwa-a7f64f0b39cb7141f16608c171b20bee452fd024.tar.bz2 tmwa-a7f64f0b39cb7141f16608c171b20bee452fd024.tar.xz tmwa-a7f64f0b39cb7141f16608c171b20bee452fd024.zip |
In magic, use Variant for all the old anonymous nested unions
Diffstat (limited to 'src/map/magic-expr-eval.hpp')
-rw-r--r-- | src/map/magic-expr-eval.hpp | 30 |
1 files changed, 10 insertions, 20 deletions
diff --git a/src/map/magic-expr-eval.hpp b/src/map/magic-expr-eval.hpp index 3cbc8f5..4529c04 100644 --- a/src/map/magic-expr-eval.hpp +++ b/src/map/magic-expr-eval.hpp @@ -31,31 +31,21 @@ namespace tmwa namespace magic { // TODO soon kill this unlike I killed VAR -#define ARGINT(x) args[x].v.v_int -#define ARGDIR(x) args[x].v.v_dir -#define ARGSTR(x) ZString(args[x].v.v_string) -#define ARGENTITY(x) args[x].v.v_entity -#define ARGLOCATION(x) args[x].v.v_location -#define ARGAREA(x) args[x].v.v_area -#define ARGSPELL(x) args[x].v.v_spell -#define ARGINVOCATION(x) args[x].v.v_invocation - -#define RESULTINT result->v.v_int -#define RESULTDIR result->v.v_dir -#define RESULTSTR result->v.v_string -#define RESULTENTITY result->v.v_entity -#define RESULTLOCATION result->v.v_location -#define RESULTAREA result->v.v_area -#define RESULTSPELL result->v.v_spell -#define RESULTINVOCATION result->v.v_invocation - -#define ARG_TYPE(x) args[x].ty +#define ARGINT(x) args[x].get_if<ValInt>()->v_int +#define ARGDIR(x) args[x].get_if<ValDir>()->v_dir +#define ARGSTR(x) ZString(args[x].get_if<ValString>()->v_string) +#define ARGENTITY(x) args[x].get_if<ValEntityPtr>()->v_entity +#define ARGLOCATION(x) args[x].get_if<ValLocation>()->v_location +#define ARGAREA(x) args[x].get_if<ValArea>()->v_area +#define ARGSPELL(x) args[x].get_if<ValSpell>()->v_spell +#define ARGINVOCATION(x) args[x].get_if<ValInvocationPtr>()->v_invocation + #define ENTITY_TYPE(x) ARGENTITY(x)->bl_type #define ARGPC(x) (ARGENTITY(x)->is_player()) #define ARGNPC(x) (ARGENTITY(x)->is_npc()) #define ARGMOB(x) (ARGENTITY(x)->is_mob()) -#define ARG_MAY_BE_AREA(x) (ARG_TYPE(x) == TYPE::AREA || ARG_TYPE(x) == TYPE::LOCATION) +#define ARG_MAY_BE_AREA(x) (args[x].is<ValArea>() || args[x].is<ValArea>()) } // namespace magic } // namespace tmwa |