1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-23 22:37:55 +02:00

AI: fix freeze when AI has a win condition to control own town

This commit is contained in:
Andrii Danylchenko
2018-11-06 21:45:29 +02:00
parent d36f59e1af
commit 9a0b5a0afc

View File

@@ -421,10 +421,20 @@ TSubgoal Win::whatToDoToAchieve()
case EventCondition::CONTROL:
{
if(goal.object)
{
auto objRelations = cb->getPlayerRelations(ai->playerID, goal.object->tempOwner);
if(objRelations == PlayerRelations::ENEMIES)
{
return sptr(Goals::VisitObj(goal.object->id.getNum()));
}
else
{
// TODO: Defance
break;
}
}
else
{
//TODO: control all objects of type "goal.objectType"
// Represents H3 condition "Flag all mines"