diff options
author | EyesOfAHawk <blackoutro2006@gmail.com> | 2018-10-18 03:23:18 +1300 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2018-11-13 17:13:38 +0100 |
commit | 7b45d05bd8e3f476f1d801203f2968993b52a31f (patch) | |
tree | b1f73f007939678c46cea7123b75ff74a3017653 /src | |
parent | baeb7a1742b0fd7ac5d3a4cecd90f74d461895fe (diff) | |
download | hercules-7b45d05bd8e3f476f1d801203f2968993b52a31f.tar.gz hercules-7b45d05bd8e3f476f1d801203f2968993b52a31f.tar.bz2 hercules-7b45d05bd8e3f476f1d801203f2968993b52a31f.tar.xz hercules-7b45d05bd8e3f476f1d801203f2968993b52a31f.zip |
Remove type argument from buildin_getnpcid.
Diffstat (limited to 'src')
-rw-r--r-- | src/map/script.c | 33 |
1 files changed, 12 insertions, 21 deletions
diff --git a/src/map/script.c b/src/map/script.c index 5eed58977..7507aabfd 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -8774,32 +8774,23 @@ static BUILDIN(getcharid) return true; } + /*========================================== * returns the GID of an NPC *------------------------------------------*/ static BUILDIN(getnpcid) { - int num = script_getnum(st,2); - struct npc_data* nd = NULL; - - if( script_hasdata(st,3) ) - {// unique npc name - if( ( nd = npc->name2id(script_getstr(st,3)) ) == NULL ) - { - ShowError("buildin_getnpcid: No such NPC '%s'.\n", script_getstr(st,3)); - script_pushint(st,0); - return false; + if (script_hasdata(st, 2)) { + if (script_isinttype(st, 2)) { + // Deprecate old form - getnpcid(<type>{, <"npc name">}) + ShowWarning("buildin_getnpcid: Use of type is deprecated. Format - getnpcid({<\"npc name\">})\n"); + script_pushint(st, 0); + } else { + struct npc_data *nd = npc->name2id(script_getstr(st, 2)); + script_pushint(st, (nd != NULL) ? nd->bl.id : 0); } - } - - switch (num) { - case 0: - script_pushint(st,nd ? nd->bl.id : st->oid); - break; - default: - ShowError("buildin_getnpcid: invalid parameter (%d).\n", num); - script_pushint(st,0); - return false; + } else { + script_pushint(st, st->oid); } return true; @@ -25027,7 +25018,7 @@ static void script_parse_builtin(void) BUILDIN_DEF(readparam,"i?"), BUILDIN_DEF(setparam,"ii?"), BUILDIN_DEF(getcharid,"i?"), - BUILDIN_DEF(getnpcid,"i?"), + BUILDIN_DEF(getnpcid, "?"), BUILDIN_DEF(getpartyname,"i"), BUILDIN_DEF(getpartymember,"i?"), BUILDIN_DEF(getpartyleader,"i?"), |