diff options
author | Haru <haru@dotalux.com> | 2015-12-28 00:24:24 +0100 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2016-01-06 15:14:50 +0100 |
commit | 205558527913c42956bf5bbe2afbceac3dad1935 (patch) | |
tree | 137f1f8bf50c8b41c839cfe9d30a7e0fd7158469 /src/map/pc.c | |
parent | f878d5e2156dc88fb73d27473acfe01d72427bbd (diff) | |
download | hercules-205558527913c42956bf5bbe2afbceac3dad1935.tar.gz hercules-205558527913c42956bf5bbe2afbceac3dad1935.tar.bz2 hercules-205558527913c42956bf5bbe2afbceac3dad1935.tar.xz hercules-205558527913c42956bf5bbe2afbceac3dad1935.zip |
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 <haru@dotalux.com>
Diffstat (limited to 'src/map/pc.c')
-rw-r--r-- | src/map/pc.c | 19 |
1 files changed, 10 insertions, 9 deletions
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) { |