From bba3416bb2ce9939fce0fbbce238b267462e99cf Mon Sep 17 00:00:00 2001 From: Haru Date: Sun, 17 Jan 2016 18:21:31 +0100 Subject: Added const qualifier to several status->get_XXX() functions Signed-off-by: Haru --- src/map/status.c | 24 ++++++++++++++---------- src/map/status.h | 20 ++++++++++---------- 2 files changed, 24 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/map/status.c b/src/map/status.c index f8cd2940a..55c95a987 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -2255,7 +2255,8 @@ int status_calc_pet_(struct pet_data *pd, enum e_status_calc_opt opt) return 1; } -unsigned int status_get_base_maxsp(struct map_session_data* sd, struct status_data *st) { +unsigned int status_get_base_maxsp(const struct map_session_data *sd, const struct status_data *st) +{ uint64 val = pc->class2idx(sd->status.class_); val = status->dbs->SP_table[val][sd->status.base_level]; @@ -2272,7 +2273,8 @@ unsigned int status_get_base_maxsp(struct map_session_data* sd, struct status_da return (unsigned int)cap_value(val, 0, UINT_MAX); } -unsigned int status_get_base_maxhp(struct map_session_data *sd, struct status_data *st) { +unsigned int status_get_base_maxhp(const struct map_session_data *sd, const struct status_data *st) +{ uint64 val = pc->class2idx(sd->status.class_); val = status->dbs->HP_table[val][sd->status.base_level]; @@ -6241,7 +6243,7 @@ uint32 status_calc_mode(const struct block_list *bl, const struct status_change return mode & MD_MASK; } -const char *status_get_name(struct block_list *bl) +const char *status_get_name(const struct block_list *bl) { nullpo_ret(bl); switch (bl->type) { @@ -6266,7 +6268,7 @@ const char *status_get_name(struct block_list *bl) * 0 = fail * class_id = success *------------------------------------------*/ -int status_get_class(struct block_list *bl) +int status_get_class(const struct block_list *bl) { nullpo_ret(bl); switch (bl->type) { @@ -6286,7 +6288,7 @@ int status_get_class(struct block_list *bl) * 1 = fail * level = success *------------------------------------------*/ -int status_get_lv(struct block_list *bl) +int status_get_lv(const struct block_list *bl) { nullpo_ret(bl); switch (bl->type) { @@ -6376,7 +6378,8 @@ unsigned short status_get_speed(struct block_list *bl) return status->get_status_data(bl)->speed; } -int status_get_party_id(struct block_list *bl) { +int status_get_party_id(const struct block_list *bl) +{ nullpo_ret(bl); switch (bl->type) { case BL_PC: @@ -6431,7 +6434,7 @@ int status_get_party_id(struct block_list *bl) { return 0; } -int status_get_guild_id(struct block_list *bl) +int status_get_guild_id(const struct block_list *bl) { nullpo_ret(bl); switch (bl->type) { @@ -6497,7 +6500,8 @@ int status_get_guild_id(struct block_list *bl) return 0; } -int status_get_emblem_id(struct block_list *bl) { +int status_get_emblem_id(const struct block_list *bl) +{ nullpo_ret(bl); switch (bl->type) { case BL_PC: @@ -6558,7 +6562,7 @@ int status_get_emblem_id(struct block_list *bl) { return 0; } -int status_get_mexp(struct block_list *bl) +int status_get_mexp(const struct block_list *bl) { nullpo_ret(bl); if (bl->type == BL_MOB) @@ -6568,7 +6572,7 @@ int status_get_mexp(struct block_list *bl) return 0; } -int status_get_race2(struct block_list *bl) +int status_get_race2(const struct block_list *bl) { nullpo_ret(bl); if (bl->type == BL_MOB) diff --git a/src/map/status.h b/src/map/status.h index fda700387..2b932b149 100644 --- a/src/map/status.h +++ b/src/map/status.h @@ -2219,17 +2219,17 @@ struct status_interface { struct regen_data * (*get_regen_data) (struct block_list *bl); struct status_data * (*get_status_data) (struct block_list *bl); struct status_data * (*get_base_status) (struct block_list *bl); - const char * (*get_name) (struct block_list *bl); - int (*get_class) (struct block_list *bl); - int (*get_lv) (struct block_list *bl); + const char *(*get_name) (const struct block_list *bl); + int (*get_class) (const struct block_list *bl); + int (*get_lv) (const struct block_list *bl); defType (*get_def) (struct block_list *bl); unsigned short (*get_speed) (struct block_list *bl); unsigned char (*calc_attack_element) (struct block_list *bl, struct status_change *sc, int element); - int (*get_party_id) (struct block_list *bl); - int (*get_guild_id) (struct block_list *bl); - int (*get_emblem_id) (struct block_list *bl); - int (*get_mexp) (struct block_list *bl); - int (*get_race2) (struct block_list *bl); + int (*get_party_id) (const struct block_list *bl); + int (*get_guild_id) (const struct block_list *bl); + int (*get_emblem_id) (const struct block_list *bl); + int (*get_mexp) (const struct block_list *bl); + int (*get_race2) (const struct block_list *bl); struct view_data * (*get_viewdata) (struct block_list *bl); void (*set_viewdata) (struct block_list *bl, int class_); void (*change_init) (struct block_list *bl); @@ -2275,8 +2275,8 @@ struct status_interface { void (*initDummyData) (void); int (*base_amotion_pc) (struct map_session_data *sd, struct status_data *st); unsigned short (*base_atk) (const struct block_list *bl, const struct status_data *st); - unsigned int (*get_base_maxhp) (struct map_session_data *sd, struct status_data *st); - unsigned int (*get_base_maxsp) (struct map_session_data *sd, struct status_data *st); + unsigned int (*get_base_maxhp) (const struct map_session_data *sd, const struct status_data *st); + unsigned int (*get_base_maxsp) (const struct map_session_data *sd, const struct status_data *st); int (*calc_npc_) (struct npc_data *nd, enum e_status_calc_opt opt); unsigned short (*calc_str) (struct block_list *bl, struct status_change *sc, int str); unsigned short (*calc_agi) (struct block_list *bl, struct status_change *sc, int agi); -- cgit v1.2.3-70-g09d2