Просмотр исходного кода

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.
Lemongrass3110 3 лет назад
Родитель
Сommit
ff2c4e2b00
1 измененных файлов с 7 добавлено и 4 удалено
  1. 7 4
      src/map/script.cpp

+ 7 - 4
src/map/script.cpp

@@ -496,12 +496,15 @@ static void script_reportsrc(struct script_state *st)
 		return;
 		return;
 
 
 	switch( bl->type ) {
 	switch( bl->type ) {
-		case BL_NPC:
+		case BL_NPC: {
+			struct npc_data* nd = (struct npc_data*)bl;
+
 			if( bl->m >= 0 )
 			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
 			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:
 		default:
 			if( bl->m >= 0 )
 			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);
 				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);