Originally posted by [b]Paradox924X[/b]
http://www.eathena.ws/board/index.php?autocom=bugtracker&showbug=3758
src/map/script.c:
CODE
switch(num){
case 0: // display name
name = aStrdup(nd->name);
break;
case 1: // visible part of display name name
if((buf = strchr(nd->name,'#')) != NULL)
{
name = aStrdup(nd->name);
name[buf - nd->name] = 0;
}
break;
case 2: // # fragment
if((buf = strchr(nd->name,'#')) != NULL)
name = aStrdup(buf+1);
break;
case 3: // unique name
name = aStrdup(nd->exname);
break;
}
Note under case 1, which is the code that runs when strnpcinfo(1) is used, the following line:
CODE
if((buf = strchr(nd->name,'#')) != NULL)
strchr returns a pointer to the first occurence of the character passed in, sort of like a delimiter. That pointer location is stored in 'buf'. If it doesn't find the character in question (in this case, '#'), it returns NULL.
The if only runs the code for it if it does not return a null.
So what happens if NULL is returned? (i.e. There is no '#' in the name).
It simply breaks from the switch and moves on and ultimately returns an empty string ''.
This is not proper behavior as NPCs without a hidden name are not named "MyCoolNPC#", but rather "MyCoolNPC". If no '#' is found, it should return the full NPC name.