1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-04-17 11:56:46 +02:00

AiI will ignore winning conditions that require defeating his own objects. Fixes #2174

This commit is contained in:
DjWarmonger 2015-04-13 18:45:43 +02:00
parent e45b6cfdda
commit f3c7774576

View File

@ -221,6 +221,12 @@ TSubgoal Win::whatToDoToAchieve()
{ {
if (goal.object) if (goal.object)
{ {
auto obj = cb->getObj (goal.object->id);
if (obj)
if (obj->getOwner() == ai->playerID) //we can't capture our own object
return sptr(Goals::Conquer());
return sptr (Goals::GetObj(goal.object->id.getNum())); return sptr (Goals::GetObj(goal.object->id.getNum()));
} }
else else