瀏覽代碼

Fixes homunculus level up crashing the map server. bugreport:7106

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@17147 54d463be-8e91-2dee-dedb-b68131a5f0ec
lemongrass3110 12 年之前
父節點
當前提交
0ec8a5b6c5
共有 2 個文件被更改,包括 13 次插入7 次删除
  1. 3 1
      src/map/atcommand.c
  2. 10 6
      src/map/homunculus.c

+ 3 - 1
src/map/atcommand.c

@@ -6904,7 +6904,9 @@ ACMD_FUNC(homlevel)
 
 	for (i = 1; i <= level && hd->exp_next; i++){
 		hd->homunculus.exp += hd->exp_next;
-		merc_hom_levelup(hd);
+		if( !merc_hom_levelup(hd) ){
+			break;
+		}
 	}
 	status_calc_homunculus(hd,0);
 	status_percent_heal(&hd->bl, 100, 100);

+ 10 - 6
src/map/homunculus.c

@@ -501,12 +501,13 @@ int merc_hom_gainexp(struct homun_data *hd,int exp)
 		return 0;
 	}
 
- 	//levelup
-	do
-	{
-		merc_hom_levelup(hd) ;
+ 	// Do the levelup(s)
+	while( hd->homunculus.exp > hd->exp_next ){
+		// Max level reached or error
+		if( !merc_hom_levelup(hd) ){
+			break;
+		}
 	}
-	while(hd->homunculus.exp > hd->exp_next && hd->exp_next != 0 );
 
 	if( hd->exp_next == 0 )
 		hd->homunculus.exp = 0 ;
@@ -999,7 +1000,10 @@ int merc_hom_shuffle(struct homun_data *hd)
 	//Level it back up
 	for (i = 1; i < lv && hd->exp_next; i++){
 		hd->homunculus.exp += hd->exp_next;
-		merc_hom_levelup(hd);
+		// Should never happen, but who knows
+		if( !merc_hom_levelup(hd) ){
+			break;
+		}
 	}
 
 	if(hd->homunculus.class_ == hd->homunculusDB->evo_class) {