1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-07-13 01:20:34 +02:00

Merge pull request #518 from nullkiller/freeze-on-control-own-town-win-condition

AI: fix freeze when AI has a win condition  to control own town
This commit is contained in:
Alexander Shishkin
2018-11-07 09:42:25 +03:00
committed by GitHub

View File

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