diff options
author | Haru <haru@dotalux.com> | 2013-11-18 08:53:22 +0100 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2013-11-19 03:41:30 +0100 |
commit | 12dce46d611d6ea7c772174ebbd555fa10fead99 (patch) | |
tree | 8f953e4166750c2ec1cbd1df89717b8d5dc8f455 /src/map/mob.h | |
parent | 51cbaf27c96e874850588ddcfa13b656db45bb2e (diff) | |
download | hercules-12dce46d611d6ea7c772174ebbd555fa10fead99.tar.gz hercules-12dce46d611d6ea7c772174ebbd555fa10fead99.tar.bz2 hercules-12dce46d611d6ea7c772174ebbd555fa10fead99.tar.xz hercules-12dce46d611d6ea7c772174ebbd555fa10fead99.zip |
Sanitized and improved several macros through the code
- Sanitized all potentially unsafe macros (related eA:15259)
- Improved some function-like macros to evaluate their argument only
once and keep it in a temporary variable. This improves performance
in the damage calculation related code.
Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/map/mob.h')
-rw-r--r-- | src/map/mob.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/map/mob.h b/src/map/mob.h index 110d027ef..48a9f078e 100644 --- a/src/map/mob.h +++ b/src/map/mob.h @@ -37,7 +37,7 @@ #define MOB_CLONE_END MAX_MOB_DB //Used to determine default enemy type of mobs (for use in eachinrange calls) -#define DEFAULT_ENEMY_TYPE(md) (md->special_state.ai?BL_CHAR:BL_MOB|BL_PC|BL_HOM|BL_MER) +#define DEFAULT_ENEMY_TYPE(md) ((md)->special_state.ai?BL_CHAR:BL_MOB|BL_PC|BL_HOM|BL_MER) #define MAX_MOB_CHAT 250 //Max Skill's messages @@ -243,8 +243,9 @@ struct item_drop_list { }; -#define mob_stop_walking(md, type) unit->stop_walking(&(md)->bl, type) -#define mob_stop_attack(md) unit->stop_attack(&(md)->bl) +#define mob_stop_walking(md, type) (unit->stop_walking(&(md)->bl, (type))) +#define mob_stop_attack(md) (unit->stop_attack(&(md)->bl)) + #define mob_is_battleground(md) ( map->list[(md)->bl.m].flag.battleground && ((md)->class_ == MOBID_BARRICADE2 || ((md)->class_ >= MOBID_FOOD_STOR && (md)->class_ <= MOBID_PINK_CRYST)) ) #define mob_is_gvg(md) (map->list[(md)->bl.m].flag.gvg_castle && ( (md)->class_ == MOBID_EMPERIUM || (md)->class_ == MOBID_BARRICADE1 || (md)->class_ == MOBID_GUARIDAN_STONE1 || (md)->class_ == MOBID_GUARIDAN_STONE2) ) #define mob_is_treasure(md) (((md)->class_ >= MOBID_TREAS01 && (md)->class_ <= MOBID_TREAS40) || ((md)->class_ >= MOBID_TREAS41 && (md)->class_ <= MOBID_TREAS49)) |