From f5ff79f1aca3e3fd1621913e275b0fc50a2cf062 Mon Sep 17 00:00:00 2001 From: Dastgir Date: Sun, 17 Jan 2016 19:02:46 +0530 Subject: status_get_name returns NULL instead of Unknown, Changed all functions to use clif_get_bl_name --- src/map/clif.c | 4 ++-- src/map/script.c | 6 +++--- src/map/skill.c | 8 ++++---- src/map/status.c | 8 +++++++- 4 files changed, 16 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/map/clif.c b/src/map/clif.c index d7f47eadd..c678849b3 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -13284,7 +13284,7 @@ void clif_parse_GMKick(int fd, struct map_session_data *sd) { case BL_PC: { char command[NAME_LENGTH+6]; - sprintf(command, "%ckick %s", atcommand->at_symbol, status->get_name(target)); + sprintf(command, "%ckick %s", atcommand->at_symbol, clif->get_bl_name(target)); atcommand->exec(fd, sd, command, true); } break; @@ -13299,7 +13299,7 @@ void clif_parse_GMKick(int fd, struct map_session_data *sd) { clif->GM_kickack(sd, 0); return; } - sprintf(command, "/kick %s (%d)", status->get_name(target), status->get_class(target)); + sprintf(command, "/kick %s (%d)", clif->get_bl_name(target), status->get_class(target)); logs->atcommand(sd, command); status_percent_damage(&sd->bl, target, 100, 0, true); // can invalidate 'target' } diff --git a/src/map/script.c b/src/map/script.c index 67413669b..1128f400f 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -235,9 +235,9 @@ void script_reportsrc(struct script_state *st) { break; default: if( bl->m >= 0 ) - ShowDebug("Source (Non-NPC type %u): name %s at %s (%d,%d)\n", bl->type, status->get_name(bl), map->list[bl->m].name, bl->x, bl->y); + ShowDebug("Source (Non-NPC type %u): name %s at %s (%d,%d)\n", bl->type, clif->get_bl_name(bl), map->list[bl->m].name, bl->x, bl->y); else - ShowDebug("Source (Non-NPC type %u): name %s (invisible/not on a map)\n", bl->type, status->get_name(bl)); + ShowDebug("Source (Non-NPC type %u): name %s (invisible/not on a map)\n", bl->type, clif->get_bl_name(bl)); break; } } @@ -16817,7 +16817,7 @@ BUILDIN(unittalk) { if( bl != NULL ) { struct StringBuf sbuf; StrBuf->Init(&sbuf); - StrBuf->Printf(&sbuf, "%s : %s", status->get_name(bl), message); + StrBuf->Printf(&sbuf, "%s : %s", clif->get_bl_name(bl), message); clif->disp_overhead(bl, StrBuf->Value(&sbuf)); StrBuf->Destroy(&sbuf); } diff --git a/src/map/skill.c b/src/map/skill.c index 8271991fe..13418fece 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -9667,7 +9667,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin if(sd) { struct mob_data *summon_md; - summon_md = mob->once_spawn_sub(src, src->m, src->x, src->y, status->get_name(src), MOBID_KO_KAGE, "", SZ_SMALL, AI_NONE); + summon_md = mob->once_spawn_sub(src, src->m, src->x, src->y, clif->get_bl_name(src), MOBID_KO_KAGE, "", SZ_SMALL, AI_NONE); if( summon_md ) { summon_md->master_id = src->id; summon_md->special_state.ai = AI_ZANZOU; @@ -9847,7 +9847,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin break; for (i = 0; i < summons[skill_lv-1].quantity; i++) { - struct mob_data *summon_md = mob->once_spawn_sub(src, src->m, src->x, src->y, status->get_name(src), + struct mob_data *summon_md = mob->once_spawn_sub(src, src->m, src->x, src->y, clif->get_bl_name(src), summons[skill_lv-1].mob_id, "", SZ_SMALL, AI_ATTACK); if (summon_md != NULL) { summon_md->master_id = src->id; @@ -10588,7 +10588,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui } // Correct info, don't change any of this! [Celest] - md = mob->once_spawn_sub(src, src->m, x, y, status->get_name(src), class_, "", SZ_SMALL, AI_NONE); + md = mob->once_spawn_sub(src, src->m, x, y, clif->get_bl_name(src), class_, "", SZ_SMALL, AI_NONE); if (md) { md->master_id = src->id; md->special_state.ai = (skill_id == AM_SPHEREMINE) ? AI_SPHERE : AI_FLORA; @@ -10833,7 +10833,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui case NC_SILVERSNIPER: { - struct mob_data *md = mob->once_spawn_sub(src, src->m, x, y, status->get_name(src), MOBID_SILVERSNIPER, "", SZ_SMALL, AI_NONE); + struct mob_data *md = mob->once_spawn_sub(src, src->m, x, y, clif->get_bl_name(src), MOBID_SILVERSNIPER, "", SZ_SMALL, AI_NONE); if (md) { md->master_id = src->id; md->special_state.ai = AI_FLORA; diff --git a/src/map/status.c b/src/map/status.c index 55c95a987..2f0007b8f 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -6243,6 +6243,12 @@ uint32 status_calc_mode(const struct block_list *bl, const struct status_change return mode & MD_MASK; } +/** + * Returns the name of the given bl. + * + * @param bl The requested bl. + * @return The bl's name or NULL if not available. + */ const char *status_get_name(const struct block_list *bl) { nullpo_ret(bl); @@ -6259,7 +6265,7 @@ const char *status_get_name(const struct block_list *bl) case BL_HOM: return BL_UCCAST(BL_HOM, bl)->homunculus.name; case BL_NPC: return BL_UCCAST(BL_NPC, bl)->name; } - return "Unknown"; + return NULL; } /*========================================== -- cgit v1.2.3-70-g09d2