From 205558527913c42956bf5bbe2afbceac3dad1935 Mon Sep 17 00:00:00 2001 From: Haru Date: Mon, 28 Dec 2015 00:24:24 +0100 Subject: Replaced some map->id2sd calls with the proper map->id2XX function - Also added new map->id2XX convenience functions for the other bl types. Signed-off-by: Haru --- src/map/pc.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'src/map/pc.c') diff --git a/src/map/pc.c b/src/map/pc.c index cf7bc6dcb..d1cd0592c 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -123,10 +123,11 @@ bool pc_should_log_commands(struct map_session_data *sd) return pcg->should_log_commands(sd->group); } -int pc_invincible_timer(int tid, int64 tick, int id, intptr_t data) { - struct map_session_data *sd; +int pc_invincible_timer(int tid, int64 tick, int id, intptr_t data) +{ + struct map_session_data *sd = map->id2sd(id); - if( (sd=(struct map_session_data *)map->id2sd(id)) == NULL || sd->bl.type!=BL_PC ) + if (sd == NULL) return 1; if(sd->invincible_timer != tid){ @@ -162,10 +163,10 @@ void pc_delinvincibletimer(struct map_session_data* sd) } int pc_spiritball_timer(int tid, int64 tick, int id, intptr_t data) { - struct map_session_data *sd; + struct map_session_data *sd = map->id2sd(id); int i; - if( (sd=(struct map_session_data *)map->id2sd(id)) == NULL || sd->bl.type!=BL_PC ) + if (sd == NULL) return 1; if( sd->spiritball <= 0 ) @@ -1861,9 +1862,9 @@ int pc_disguise(struct map_session_data *sd, int class_) { clif->updatestatus(sd,SP_CARTINFO); } if (sd->chatID) { - struct chat_data* cd; + struct chat_data *cd = map->id2cd(sd->chatID); - if( (cd = (struct chat_data*)map->id2bl(sd->chatID)) ) + if (cd != NULL) clif->dispchat(cd,0); } } @@ -10414,10 +10415,10 @@ bool pc_can_use_command(struct map_session_data *sd, const char *command) { */ int pc_charm_timer(int tid, int64 tick, int id, intptr_t data) { - struct map_session_data *sd; + struct map_session_data *sd = map->id2sd(id); int i; - if( (sd=(struct map_session_data *)map->id2sd(id)) == NULL || sd->bl.type!=BL_PC ) + if (sd == NULL) return 1; if (sd->charm_count <= 0) { -- cgit v1.2.3-70-g09d2