소스 검색

Minor improvements.

Michał W. Urbańczyk 12 년 전
부모
커밋
1a2c8de6ad
2개의 변경된 파일7개의 추가작업 그리고 3개의 파일을 삭제
  1. 3 1
      client/CPlayerInterface.cpp
  2. 4 2
      client/battle/CBattleInterface.cpp

+ 3 - 1
client/CPlayerInterface.cpp

@@ -621,6 +621,9 @@ void CPlayerInterface::battleStart(const CCreatureSet *army1, const CCreatureSet
 	
 	waitForAllDialogs();
 
+	if(isAutoFightOn)
+		GH.topInt()->deactivate();
+
 	BATTLE_EVENT_POSSIBLE_RETURN;
 
 	GH.pushInt(battleInt);
@@ -758,7 +761,6 @@ BattleAction CPlayerInterface::activeStack(const CStack * stack) //called when i
 	{
 		if(isAutoFightOn)
 		{
-			assert(autofightingAI);
 			auto ret = autofightingAI->activeStack(stack);
 			if(isAutoFightOn)
 			{

+ 4 - 2
client/battle/CBattleInterface.cpp

@@ -3588,7 +3588,7 @@ void CBattleInterface::requestAutofightingAIToTakeAction()
 {
 	assert(curInt->isAutoFightOn);
 
-	auto tmp = make_unique<boost::thread>([&] 
+	boost::thread aiThread([&] 
 	{
 		auto ba = new BattleAction(curInt->autofightingAI->activeStack(activeStack));
 
@@ -3598,11 +3598,13 @@ void CBattleInterface::requestAutofightingAIToTakeAction()
 		}
 		else
 		{
+			delete ba;
 			boost::unique_lock<boost::recursive_mutex> un(*LOCPLINT->pim);
 			activateStack();
 		}
 	});
-	tmp->detach();
+	
+	aiThread.detach();
 }
 
 CBattleInterface::SiegeHelper::SiegeHelper(const CGTownInstance *siegeTown, const CBattleInterface * _owner)