From add2ea4f7944ccabfcaa67be9d9ee5a57fbfb97e Mon Sep 17 00:00:00 2001 From: Dastgir Date: Sun, 17 Jan 2016 19:00:24 +0530 Subject: Implemented new function clif_get_bl_name --- src/map/clif.c | 17 +++++++++++++++++ src/map/clif.h | 6 ++++-- 2 files changed, 21 insertions(+), 2 deletions(-) (limited to 'src/map') diff --git a/src/map/clif.c b/src/map/clif.c index 71409fab4..d7f47eadd 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -18760,6 +18760,22 @@ void clif_selectcart(struct map_session_data *sd) #endif } +/** + * Returns the name of the given bl, in a client-friendly format. + * + * @param bl The requested bl. + * @return The bl's name (guaranteed to be non-NULL). + */ +const char *clif_get_bl_name(const struct block_list *bl) +{ + const char *name = status->get_name(bl); + + if (name == NULL) + return "Unknown"; + + return name; +} + /* */ unsigned short clif_decrypt_cmd( int cmd, struct map_session_data *sd ) { if( sd ) { @@ -19829,4 +19845,5 @@ void clif_defaults(void) { clif->pHotkeyRowShift = clif_parse_HotkeyRowShift; clif->dressroom_open = clif_dressroom_open; clif->pOneClick_ItemIdentify = clif_parse_OneClick_ItemIdentify; + clif->get_bl_name = clif_get_bl_name; } diff --git a/src/map/clif.h b/src/map/clif.h index ac0191210..f930e4ca1 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -1334,8 +1334,10 @@ struct clif_interface { void (*dressroom_open) (struct map_session_data *sd, int view); void (*pOneClick_ItemIdentify) (int fd,struct map_session_data *sd); /* Cart Deco */ - void(*selectcart) (struct map_session_data *sd); - void(*pSelectCart) (int fd, struct map_session_data *sd); + void (*selectcart) (struct map_session_data *sd); + void (*pSelectCart) (int fd, struct map_session_data *sd); + + const char *(*get_bl_name) (const struct block_list *bl); }; #ifdef HERCULES_CORE -- cgit v1.2.3-60-g2f50