summaryrefslogtreecommitdiff
path: root/src/map/unit.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/unit.c')
-rw-r--r--src/map/unit.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/map/unit.c b/src/map/unit.c
index 02d1f4c1a..178fc3010 100644
--- a/src/map/unit.c
+++ b/src/map/unit.c
@@ -1765,10 +1765,10 @@ int unit_set_target(struct unit_data* ud, int target_id)
if (ud->target != target_id) {
struct unit_data * ux;
struct block_list* target;
- if( ud->target && (target = map->id2bl(ud->target)) && (ux = unit->bl2ud(target)) && ux->target_count > 0 )
- ux->target_count --;
- if( target_id && (target = map->id2bl(target_id)) && (ux = unit->bl2ud(target)) )
- ux->target_count ++;
+ if (ud->target && (target = map->id2bl(ud->target)) != NULL && (ux = unit->bl2ud(target)) != NULL && ux->target_count > 0)
+ --ux->target_count;
+ if (target_id && (target = map->id2bl(target_id)) != NULL && (ux = unit->bl2ud(target)) != NULL)
+ ++ux->target_count;
}
ud->target = target_id;
@@ -2268,7 +2268,7 @@ void unit_dataset(struct block_list *bl) {
int unit_counttargeted(struct block_list* bl)
{
struct unit_data* ud;
- if( bl && (ud = unit->bl2ud(bl)) )
+ if (bl && (ud = unit->bl2ud(bl)) != NULL)
return ud->target_count;
return 0;
}