diff options
Diffstat (limited to 'src/config')
-rw-r--r-- | src/config/const.h | 51 |
1 files changed, 27 insertions, 24 deletions
diff --git a/src/config/const.h b/src/config/const.h index f0902759d..7badb1071 100644 --- a/src/config/const.h +++ b/src/config/const.h @@ -53,39 +53,42 @@ /* pointer size fix which fixes several gcc warnings */ #ifdef __64BIT__ - #define __64BPTRSIZE(y) (intptr)y + #define __64BPTRSIZE(y) ((intptr)(y)) #else - #define __64BPTRSIZE(y) y + #define __64BPTRSIZE(y) (y) #endif /* ATCMD_FUNC(mobinfo) HIT and FLEE calculations */ #ifdef RENEWAL - #define MOB_FLEE(mob) ( mob->lv + mob->status.agi + 100 ) - #define MOB_HIT(mob) ( mob->lv + mob->status.dex + 150 ) - #define RE_SKILL_REDUCTION(){ \ - wd.damage = battle->calc_elefix(src, target, skill_id, skill_lv, battle->calc_cardfix(BF_WEAPON, src, target, nk, s_ele, s_ele_, wd.damage, 0, wd.flag), nk, n_ele, s_ele, s_ele_, false, flag.arrow); \ - if( flag.lh ) \ - wd.damage2 = battle->calc_elefix(src, target, skill_id, skill_lv, battle->calc_cardfix(BF_WEAPON, src, target, nk, s_ele, s_ele_, wd.damage2, 1, wd.flag), nk, n_ele, s_ele, s_ele_, true, flag.arrow); \ - } + #define MOB_FLEE(mobdata) ( (mobdata)->lv + (mobdata)->status.agi + 100 ) + #define MOB_HIT(mobdata) ( (mobdata)->lv + (mobdata)->status.dex + 150 ) + #define RE_SKILL_REDUCTION() do { \ + wd.damage = battle->calc_elefix(src, target, skill_id, skill_lv, battle->calc_cardfix(BF_WEAPON, src, target, nk, s_ele, s_ele_, wd.damage, 0, wd.flag), nk, n_ele, s_ele, s_ele_, false, flag.arrow); \ + if( flag.lh ) \ + wd.damage2 = battle->calc_elefix(src, target, skill_id, skill_lv, battle->calc_cardfix(BF_WEAPON, src, target, nk, s_ele, s_ele_, wd.damage2, 1, wd.flag), nk, n_ele, s_ele, s_ele_, true, flag.arrow); \ + } while(0) #else - #define MOB_FLEE(mob) ( mob->lv + mob->status.agi ) - #define MOB_HIT(mob) ( mob->lv + mob->status.dex ) + #define MOB_FLEE(mobdata) ( (mobdata)->lv + (mobdata)->status.agi ) + #define MOB_HIT(mobdata) ( (mobdata)->lv + (mobdata)->status.dex ) #endif /* Renewal's dmg level modifier, used as a macro for a easy way to turn off. */ #ifdef RENEWAL_LVDMG - #define RE_LVL_DMOD(val) \ - if( iStatus->get_lv(src) > 100 && val > 0 ) \ - skillratio = skillratio * iStatus->get_lv(src) / val; - #define RE_LVL_MDMOD(val) \ - if( iStatus->get_lv(src) > 100 && val > 0) \ - md.damage = md.damage * iStatus->get_lv(src) / val; + #define RE_LVL_DMOD(val) do { \ + if( iStatus->get_lv(src) > 100 && (val) > 0 ) \ + skillratio = skillratio * iStatus->get_lv(src) / (val); \ + } while(0) + #define RE_LVL_MDMOD(val) do { \ + if( iStatus->get_lv(src) > 100 && (val) > 0) \ + md.damage = md.damage * iStatus->get_lv(src) / (val); \ + } while(0) /* ranger traps special */ - #define RE_LVL_TMDMOD() \ + #define RE_LVL_TMDMOD() do { \ if( iStatus->get_lv(src) > 100 ) \ - md.damage = md.damage * 150 / 100 + md.damage * iStatus->get_lv(src) / 100; + md.damage = md.damage * 150 / 100 + md.damage * iStatus->get_lv(src) / 100; \ + } while(0) #else - #define RE_LVL_DMOD(val) + #define RE_LVL_DMOD(val) #define RE_LVL_MDMOD(val) #define RE_LVL_TMDMOD() #endif @@ -100,10 +103,10 @@ // Renewal variable cast time reduction #ifdef RENEWAL_CAST - #define VARCAST_REDUCTION(val){ \ - if( (varcast_r += val) != 0 && varcast_r >= 0 ) \ - time = time * (1 - (float)min(val, 100) / 100); \ - } + #define VARCAST_REDUCTION(val) do { \ + if( (varcast_r += (val)) != 0 && varcast_r >= 0 ) \ + time = time * (1 - (float)min((val), 100) / 100); \ + } while(0) #endif /* console_input doesn't go well with minicore */ |