diff options
author | skyleo <skyleo@skyleo.de> | 2019-10-03 18:37:05 +0200 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2020-03-08 20:56:27 +0100 |
commit | a51003dda282a5aeed0e63b93b8a213acd82cafb (patch) | |
tree | 19e4cc2532886a1414a75f701345b53abcec83bc /src/map | |
parent | 4891c9710015fdf98ebea2873802e993aa127654 (diff) | |
download | hercules-a51003dda282a5aeed0e63b93b8a213acd82cafb.tar.gz hercules-a51003dda282a5aeed0e63b93b8a213acd82cafb.tar.bz2 hercules-a51003dda282a5aeed0e63b93b8a213acd82cafb.tar.xz hercules-a51003dda282a5aeed0e63b93b8a213acd82cafb.zip |
Refactor unit->bl2ud
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/unit.c | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/src/map/unit.c b/src/map/unit.c index 29a01aea7..f0125ec79 100644 --- a/src/map/unit.c +++ b/src/map/unit.c @@ -76,15 +76,26 @@ struct unit_interface *unit; **/ static struct unit_data *unit_bl2ud(struct block_list *bl) { - if (bl == NULL) return NULL; - if (bl->type == BL_PC) return &BL_UCAST(BL_PC, bl)->ud; - if (bl->type == BL_MOB) return &BL_UCAST(BL_MOB, bl)->ud; - if (bl->type == BL_PET) return &BL_UCAST(BL_PET, bl)->ud; - if (bl->type == BL_NPC) return BL_UCAST(BL_NPC, bl)->ud; - if (bl->type == BL_HOM) return &BL_UCAST(BL_HOM, bl)->ud; - if (bl->type == BL_MER) return &BL_UCAST(BL_MER, bl)->ud; - if (bl->type == BL_ELEM) return &BL_UCAST(BL_ELEM, bl)->ud; - return NULL; + if (bl == NULL) + return NULL; + switch (bl->type) { + case BL_PC: + return &BL_UCAST(BL_PC, bl)->ud; + case BL_MOB: + return &BL_UCAST(BL_MOB, bl)->ud; + case BL_PET: + return &BL_UCAST(BL_PET, bl)->ud; + case BL_NPC: + return BL_UCAST(BL_NPC, bl)->ud; + case BL_HOM: + return &BL_UCAST(BL_HOM, bl)->ud; + case BL_MER: + return &BL_UCAST(BL_MER, bl)->ud; + case BL_ELEM: + return &BL_UCAST(BL_ELEM, bl)->ud; + default: + return NULL; + } } /** |