Jelajahi Sumber

Fixes npc last path caching (#7769)

Fixes #7766
Singe Horizontal 1 tahun lalu
induk
melakukan
75faf9ac1a
1 mengubah file dengan 2 tambahan dan 5 penghapusan
  1. 2 5
      src/map/npc.cpp

+ 2 - 5
src/map/npc.cpp

@@ -99,7 +99,6 @@ static struct eri *timer_event_ers; //For the npc timer data. [Skotlex]
 
 /* hello */
 static char *npc_last_path;
-static char *npc_last_ref;
 
 struct npc_path_data {
 	char* path;
@@ -3471,7 +3470,6 @@ int npc_unload(struct npc_data* nd, bool single) {
 
 			if (npd == npc_last_npd) {
 				npc_last_npd = NULL;
-				npc_last_ref = NULL;
 				npc_last_path = NULL;
 			}
 		}
@@ -3706,10 +3704,9 @@ static void npc_parsename(struct npc_data* nd, const char* name, const char* sta
 		npd->references++;
 
 		npc_last_npd = npd;
-		npc_last_ref = npd->path;
-		npc_last_path = (char*) filepath;
+		npc_last_path = npd->path;
 	} else {
-		nd->path = npc_last_ref;
+		nd->path = npc_last_path;
 		if( npc_last_npd )
 			npc_last_npd->references++;
 	}