瀏覽代碼

Fixed a clone issue (#4226)

* Fixed a potential crash when using a clone
* Fixed #4225

Thanks to @laziem and @aleos89 !
Atemo 5 年之前
父節點
當前提交
912d97e460
共有 1 個文件被更改,包括 18 次插入2 次删除
  1. 18 2
      src/map/unit.cpp

+ 18 - 2
src/map/unit.cpp

@@ -3283,6 +3283,9 @@ int unit_free(struct block_list *bl, clr_type clrtype)
 			// Clearing...
 			if (sd->bonus_script.head)
 				pc_bonus_script_clear(sd, BSF_REM_ALL);
+
+			skill_clear_unitgroup(bl);
+			status_change_clear(bl,1);
 			break;
 		}
 		case BL_PET: {
@@ -3304,6 +3307,9 @@ int unit_free(struct block_list *bl, clr_type clrtype)
 			if( sd )
 				sd->pd = NULL;
 			pd->master = NULL;
+
+			skill_clear_unitgroup(bl);
+			status_change_clear(bl,1);
 			break;
 		}
 		case BL_MOB: {
@@ -3359,6 +3365,9 @@ int unit_free(struct block_list *bl, clr_type clrtype)
 				md->base_status = NULL;
 			}
 
+			skill_clear_unitgroup(bl);
+			status_change_clear(bl,1);
+
 			if( mob_is_clone(md->mob_id) )
 				mob_clone_delete(md);
 
@@ -3385,6 +3394,9 @@ int unit_free(struct block_list *bl, clr_type clrtype)
 			if( sd )
 				sd->hd = NULL;
 			hd->master = NULL;
+
+			skill_clear_unitgroup(bl);
+			status_change_clear(bl,1);
 			break;
 		}
 		case BL_MER: {
@@ -3405,6 +3417,9 @@ int unit_free(struct block_list *bl, clr_type clrtype)
 
 			mercenary_contract_stop(md);
 			md->master = NULL;
+
+			skill_clear_unitgroup(bl);
+			status_change_clear(bl,1);
 			break;
 		}
 		case BL_ELEM: {
@@ -3425,12 +3440,13 @@ int unit_free(struct block_list *bl, clr_type clrtype)
 
 			elemental_summon_stop(ed);
 			ed->master = NULL;
+
+			skill_clear_unitgroup(bl);
+			status_change_clear(bl,1);
 			break;
 		}
 	}
 
-	skill_clear_unitgroup(bl);
-	status_change_clear(bl,1);
 	map_deliddb(bl);
 
 	if( bl->type != BL_PC ) // Players are handled by map_quit