浏览代码

Reverted changes from r2270. These strange callbacks were introduced for purpose (bugs 574 & 615).

Described crash after a battle is not reproductible now. Refer to these bug reports for more details.
DjWarmonger 14 年之前
父节点
当前提交
2272b4a316
共有 1 个文件被更改,包括 5 次插入5 次删除
  1. 5 5
      server/CGameHandler.cpp

+ 5 - 5
server/CGameHandler.cpp

@@ -201,8 +201,10 @@ void CGameHandler::levelUpHero(int ID)
 	
 	
 	// required exp for at least 1 lvl-up hasn't been reached
 	// required exp for at least 1 lvl-up hasn't been reached
 	if (hero->exp < VLC->heroh->reqExp(hero->level+1))
 	if (hero->exp < VLC->heroh->reqExp(hero->level+1))
+	{
+		afterBattleCallback();
 		return;
 		return;
-
+	}
 		
 		
 	//give prim skill
 	//give prim skill
 	tlog5 << hero->name <<" got level "<<hero->level<<std::endl;
 	tlog5 << hero->name <<" got level "<<hero->level<<std::endl;
@@ -458,8 +460,8 @@ void CGameHandler::endBattle(int3 tile, const CGHeroInstance *hero1, const CGHer
 			changePrimSkill(hero1->id,4,battleResult.data->exp[0]);
 			changePrimSkill(hero1->id,4,battleResult.data->exp[0]);
 		else if (battleResult.data->exp[1] && hero2)
 		else if (battleResult.data->exp[1] && hero2)
 			changePrimSkill(hero2->id,4,battleResult.data->exp[1]);
 			changePrimSkill(hero2->id,4,battleResult.data->exp[1]);
-
-		afterBattleCallback();
+		else
+			afterBattleCallback();
 	}
 	}
 
 
 	sendAndApply(&resultsApplied);
 	sendAndApply(&resultsApplied);
@@ -498,8 +500,6 @@ void CGameHandler::endBattle(int3 tile, const CGHeroInstance *hero1, const CGHer
 
 
 		sendAndApply(&sah);
 		sendAndApply(&sah);
 	}
 	}
-
-	delete battleResult.data;
 }
 }
 
 
 void CGameHandler::afterBattleCallback() //object interaction after leveling up is done
 void CGameHandler::afterBattleCallback() //object interaction after leveling up is done