Added NPC path to debug output (#6198)

Have you ever been annoyed by a script error that did not tell you in which file the NPC is located?
This will fix it for you.
This commit is contained in:
Lemongrass3110 2021-08-17 01:50:43 +02:00 committed by GitHub
parent 135705069a
commit ff2c4e2b00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -496,12 +496,15 @@ static void script_reportsrc(struct script_state *st)
return;
switch( bl->type ) {
case BL_NPC:
case BL_NPC: {
struct npc_data* nd = (struct npc_data*)bl;
if( bl->m >= 0 )
ShowDebug("Source (NPC): %s at %s (%d,%d)\n", ((struct npc_data *)bl)->name, map_mapid2mapname(bl->m), bl->x, bl->y);
ShowDebug("Source (NPC): %s at %s (%d,%d)\n", nd->name, map_mapid2mapname(bl->m), bl->x, bl->y);
else
ShowDebug("Source (NPC): %s (invisible/not on a map)\n", ((struct npc_data *)bl)->name);
break;
ShowDebug("Source (NPC): %s (invisible/not on a map)\n", nd->name);
ShowDebug( "Source (NPC): %s is located in: %s\n", nd->name, nd->path );
} break;
default:
if( bl->m >= 0 )
ShowDebug("Source (Non-NPC type %d): name %s at %s (%d,%d)\n", bl->type, status_get_name(bl), map_mapid2mapname(bl->m), bl->x, bl->y);