From f8b4fc65481df7c8c3d831677763387d7effb863 Mon Sep 17 00:00:00 2001 From: shennetsind Date: Tue, 20 Nov 2012 08:31:41 +0000 Subject: Minor performance improvement; created guild flag cache to replace the inefficient npcdb lookup, in perspective: Before: whenever a guild emblem was changed it'd loop through all npcs looking for flags belongin to that guild Now: whenever a guild emblem is changed it'll loop through a very small list which contains all guild flags, and from there it'll update the flags accordingly. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@16935 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/npc.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/map/npc.c') diff --git a/src/map/npc.c b/src/map/npc.c index f3a939c2c..189ae953f 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -1838,6 +1838,8 @@ int npc_unload(struct npc_data* nd, bool single) { nd->u.scr.label_list_num = 0; } } + if( nd->u.scr.guild_id ) + guild_flag_remove(nd); } script_stop_sleeptimers(nd->bl.id); @@ -3594,6 +3596,9 @@ int npc_reload(void) { struct s_mapiterator* iter; struct block_list* bl; + /* clear guild flag cache */ + guild_flags_clear(); + npc_clear_pathlist(); db_clear(npc_path_db); -- cgit v1.2.3-70-g09d2