Browse Source

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 years ago
parent
commit
2272b4a316
1 changed files with 5 additions and 5 deletions
  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
 	if (hero->exp < VLC->heroh->reqExp(hero->level+1))
+	{
+		afterBattleCallback();
 		return;
-
+	}
 		
 	//give prim skill
 	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]);
 		else if (battleResult.data->exp[1] && hero2)
 			changePrimSkill(hero2->id,4,battleResult.data->exp[1]);
-
-		afterBattleCallback();
+		else
+			afterBattleCallback();
 	}
 
 	sendAndApply(&resultsApplied);
@@ -498,8 +500,6 @@ void CGameHandler::endBattle(int3 tile, const CGHeroInstance *hero1, const CGHer
 
 		sendAndApply(&sah);
 	}
-
-	delete battleResult.data;
 }
 
 void CGameHandler::afterBattleCallback() //object interaction after leveling up is done