mirror of
				https://github.com/vcmi/vcmi.git
				synced 2025-10-31 00:07:39 +02:00 
			
		
		
		
	Nullkiller: fixes after first 5 autotesting maps
This commit is contained in:
		
				
					committed by
					
						 Andrii Danylchenko
						Andrii Danylchenko
					
				
			
			
				
	
			
			
			
						parent
						
							df78e3243b
						
					
				
				
					commit
					9c14ccab8f
				
			| @@ -53,7 +53,8 @@ const CGHeroInstance * getNearestHero(const CGTownInstance * town) | ||||
|  | ||||
| 	auto shortestPath = getShortestPath(town, paths); | ||||
|  | ||||
| 	if(shortestPath.nodes.size() > 1  | ||||
| 	if(shortestPath.nodes.size() > 1 | ||||
| 		|| shortestPath.turn() != 0 | ||||
| 		|| shortestPath.targetHero->visitablePos().dist2dSQ(town->visitablePos()) > 4 | ||||
| 		|| town->garrisonHero && shortestPath.targetHero == town->garrisonHero.get()) | ||||
| 		return nullptr; | ||||
|   | ||||
| @@ -102,13 +102,23 @@ void ExecuteHeroChain::accept(VCAI * ai) | ||||
| 					{ | ||||
| 						//TODO: decompose | ||||
| 					} | ||||
|  | ||||
| 					if(!hero.validAndSet()) | ||||
| 					{ | ||||
| 						logAi->error("Hero %s was lost trying to execute special action. Exit hero chain.", hero.name); | ||||
|  | ||||
| 						return; | ||||
| 					} | ||||
| 				} | ||||
|  | ||||
| 				if(node.turns == 0 && node.coord != hero->visitablePos()) | ||||
| 				{ | ||||
| 					auto targetNode = cb->getPathsInfo(hero.get())->getPathInfo(node.coord); | ||||
|  | ||||
| 					if(!targetNode->accessible || targetNode->turns != 0) | ||||
| 					if(targetNode->accessible == CGPathNode::EAccessibility::NOT_SET | ||||
| 						|| targetNode->accessible == CGPathNode::EAccessibility::BLOCKED | ||||
| 						|| targetNode->accessible == CGPathNode::EAccessibility::FLYABLE | ||||
| 						|| targetNode->turns != 0) | ||||
| 					{ | ||||
| 						logAi->error( | ||||
| 							"Enable to complete chain. Expected hero %s to arive to %s in 0 turns but he can not do this", | ||||
| @@ -127,6 +137,13 @@ void ExecuteHeroChain::accept(VCAI * ai) | ||||
| 					} | ||||
| 					catch(cannotFulfillGoalException) | ||||
| 					{ | ||||
| 						if(!hero.validAndSet()) | ||||
| 						{ | ||||
| 							logAi->error("Hero %s was lost. Exit hero chain.", hero.name); | ||||
|  | ||||
| 							return; | ||||
| 						} | ||||
|  | ||||
| 						if(hero->movement > 0) | ||||
| 						{ | ||||
| 							CGPath path; | ||||
|   | ||||
| @@ -411,7 +411,9 @@ void AINodeStorage::calculateHeroChain( | ||||
| 			continue; | ||||
|  | ||||
| 		if(node->action == CGPathNode::ENodeAction::BATTLE | ||||
| 			|| node->action == CGPathNode::ENodeAction::TELEPORT_BATTLE) | ||||
| 			|| node->action == CGPathNode::ENodeAction::TELEPORT_BATTLE | ||||
| 			|| node->action == CGPathNode::ENodeAction::TELEPORT_NORMAL | ||||
| 			|| node->action == CGPathNode::ENodeAction::TELEPORT_BLOCKING_VISIT) | ||||
| 		{ | ||||
| 			continue; | ||||
| 		} | ||||
|   | ||||
| @@ -200,11 +200,15 @@ void VCAI::gameOver(PlayerColor player, const EVictoryLossCheckResult & victoryL | ||||
| 	LOG_TRACE_PARAMS(logAi, "victoryLossCheckResult '%s'", victoryLossCheckResult.messageToSelf); | ||||
| 	NET_EVENT_HANDLER; | ||||
| 	logAi->debug("Player %d (%s): I heard that player %d (%s) %s.", playerID, playerID.getStr(), player, player.getStr(), (victoryLossCheckResult.victory() ? "won" : "lost")); | ||||
|  | ||||
| 	// some whitespace to flush stream | ||||
| 	logAi->debug(std::string(200, ' ')); | ||||
|  | ||||
| 	if(player == playerID) | ||||
| 	{ | ||||
| 		if(victoryLossCheckResult.victory()) | ||||
| 		{ | ||||
| 			logAi->debug("VCAI: I won! Incredible!"); | ||||
| 			logAi->debug("VCAI: Player %d (%s) won. I won! Incredible!", player, player.getStr()); | ||||
| 			logAi->debug("Turn nr %d", myCb->getDate()); | ||||
| 		} | ||||
| 		else | ||||
|   | ||||
		Reference in New Issue
	
	Block a user