Fixes npc last path caching (#7769)

Fixes #7766
This commit is contained in:
Singe Horizontal 2023-06-04 04:56:04 +02:00 committed by GitHub
parent 08a1c41d1b
commit 75faf9ac1a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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++;
}