|
@@ -1417,6 +1417,27 @@ static int npc_unload_ev(DBKey key,void *data,va_list ap) {
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
+static int npc_unload_dup_sub(DBKey key,void * data,va_list app)
|
|
|
+{
|
|
|
+ struct npc_data *nd = (struct npc_data *)data;
|
|
|
+ va_list ap;
|
|
|
+ int src_id;
|
|
|
+
|
|
|
+ if(nd->bl.type!=BL_NPC || nd->bl.subtype != SCRIPT)
|
|
|
+ return 0;
|
|
|
+
|
|
|
+ ap = va_arg(app, va_list);
|
|
|
+ src_id=va_arg(ap,int);
|
|
|
+ if (nd->u.scr.src_id == src_id)
|
|
|
+ npc_unload(nd);
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+//Removes all npcs that are duplicates of the passed one. [Skotlex]
|
|
|
+void npc_unload_duplicates (struct npc_data *nd)
|
|
|
+{
|
|
|
+ map_foreachiddb(npc_unload_dup_sub,nd->bl.id);
|
|
|
+}
|
|
|
+
|
|
|
int npc_unload (struct npc_data *nd)
|
|
|
{
|
|
|
nullpo_ret(nd);
|