From a1a02150d710df2838060445b9ad447689538985 Mon Sep 17 00:00:00 2001 From: Ben Longbons Date: Sun, 23 Dec 2012 14:23:32 -0800 Subject: Enumify some more things ... maybe even everything --- src/map/magic-interpreter-parser.ypp | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) (limited to 'src/map/magic-interpreter-parser.ypp') diff --git a/src/map/magic-interpreter-parser.ypp b/src/map/magic-interpreter-parser.ypp index 860103a..2b80ffb 100644 --- a/src/map/magic-interpreter-parser.ypp +++ b/src/map/magic-interpreter-parser.ypp @@ -38,10 +38,10 @@ static spellguard_t *spellguard_implication(spellguard_t *a, spellguard_t *b); static -spellguard_t *new_spellguard(int ty); +spellguard_t *new_spellguard(SPELLGUARD ty); static -effect_t *new_effect(int ty); +effect_t *new_effect(EFFECT_ ty); static effect_t *set_effect_continuation(effect_t *src, effect_t *continuation); @@ -78,6 +78,9 @@ val_t *find_constant(char *name); %union { int i; + SPELL_FLAG spell_flags; + SPELLARG spell_arg; + FOREACH_FILTER foreach_filter; char *s; int op; magic_conf_t *magic_conf; @@ -88,7 +91,7 @@ val_t *find_constant(char *name); args_rec_t arg_list; struct { int letdefs_nr; letdef_t *letdefs; } letdefs; spell_t *spell; - struct { int id, ty; } spellarg_def; + struct { int id; SPELLARG ty; } spellarg_def; letdef_t vardef; spellguard_t *spellguard; component_t *components; @@ -189,15 +192,15 @@ val_t *find_constant(char *name); %type items %type item_list %type item_name -%type selection; +%type selection; %type effect %type effect_list %type maybe_trigger %type maybe_end -%type spell_flags; +%type spell_flags; %type expr -%type arg_ty +%type arg_ty %type proc_formals_list %type proc_formals_list_ne @@ -300,19 +303,19 @@ spellconf_option : ID '=' expr } spell_flags : /* empty */ - { $$ = 0; } + { $$ = SPELL_FLAG::ZERO; } | LOCAL spell_flags - { if ($2 & SPELL_FLAG_LOCAL) + { if (bool($2 & SPELL_FLAG_LOCAL)) fail(@1.first_line, @1.first_column, "`LOCAL' specified more than once"); $$ = $2 | SPELL_FLAG_LOCAL; } | NONMAGIC spell_flags - { if ($2 & SPELL_FLAG_NONMAGIC) + { if (bool($2 & SPELL_FLAG_NONMAGIC)) fail(@1.first_line, @1.first_column, "`NONMAGIC' specified more than once"); $$ = $2 | SPELL_FLAG_NONMAGIC; } | SILENT spell_flags - { if ($2 & SPELL_FLAG_SILENT) + { if (bool($2 & SPELL_FLAG_SILENT)) fail(@1.first_line, @1.first_column, "`SILENT' specified more than once"); $$ = $2 | SPELL_FLAG_SILENT; } @@ -841,7 +844,7 @@ spell_t *new_spell(spellguard_t *guard) } static -spellguard_t *new_spellguard(int ty) +spellguard_t *new_spellguard(SPELLGUARD ty) { spellguard_t *retval = (spellguard_t *)calloc(1, sizeof(spellguard_t)); retval->ty = ty; @@ -879,7 +882,7 @@ spellguard_t *spellguard_implication(spellguard_t *a, spellguard_t *b) } static -effect_t *new_effect(int ty) +effect_t *new_effect(EFFECT_ ty) { effect_t *effect = (effect_t *) calloc(1, sizeof(effect_t)); effect->ty = ty; -- cgit v1.2.3-70-g09d2