diff --git a/doc/script_commands.txt b/doc/script_commands.txt index c3cc8a79905..ab47f1a4be6 100644 --- a/doc/script_commands.txt +++ b/doc/script_commands.txt @@ -10165,10 +10165,17 @@ returns -1 if value could not be retrieved. *getunitname() + @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + @ /!\ This command is deprecated @ + @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + Retrieve the name of a unit. returns "Unknown" if the value could not be retrieved. +This command is deprecated and it should not be used in new scripts, as it is +likely to be removed at a later time. Please use rid2name instead. + --------------------------------------- *setunitname(, ) diff --git a/src/map/script.c b/src/map/script.c index 7e6e06376bb..671d184d65a 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -18449,6 +18449,7 @@ static BUILDIN(rid2name) case BL_PET: script_pushstrcopy(st, BL_UCCAST(BL_PET, bl)->pet.name); break; case BL_HOM: script_pushstrcopy(st, BL_UCCAST(BL_HOM, bl)->homunculus.name); break; case BL_MER: script_pushstrcopy(st, BL_UCCAST(BL_MER, bl)->db->name); break; + case BL_ELEM: script_pushstrcopy(st, BL_UCCAST(BL_ELEM, bl)->db->name); break; default: ShowError("buildin_rid2name: BL type unknown.\n"); script_pushconststr(st,""); @@ -25581,7 +25582,7 @@ static void script_parse_builtin(void) /* Unit Data */ BUILDIN_DEF(setunitdata,"iiv??"), BUILDIN_DEF(getunitdata,"ii?"), - BUILDIN_DEF(getunitname,"i"), + BUILDIN_DEF_DEPRECATED(getunitname,"i"), // Deprecated 2019-02-28 BUILDIN_DEF(setunitname,"is"), BUILDIN_DEF(unitwalk,"ii?"), BUILDIN_DEF(unitkill,"i"),