From 0bd5782470d93962f3cfd6bfb82dbd44e2e42732 Mon Sep 17 00:00:00 2001 From: Andrii Danylchenko Date: Tue, 28 May 2019 09:04:31 +0300 Subject: [PATCH 1/2] AI: blind fix for 3062 --- AI/VCAI/Goals/GatherTroops.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/AI/VCAI/Goals/GatherTroops.cpp b/AI/VCAI/Goals/GatherTroops.cpp index 10b15147d..8292fb9c2 100644 --- a/AI/VCAI/Goals/GatherTroops.cpp +++ b/AI/VCAI/Goals/GatherTroops.cpp @@ -115,6 +115,7 @@ TGoalVec GatherTroops::getAllPossibleSubgoals() }*/ } } + for(auto obj : ai->visitableObjs) { auto d = dynamic_cast(obj); @@ -135,6 +136,12 @@ TGoalVec GatherTroops::getAllPossibleSubgoals() } } + CreatureID creID = CreatureID(objid); + + vstd::erase_if(solutions, [&](TSubgoal goal)->bool{ + return goal->hero && !goal->hero->getSlotFor(creID).validSlot() && !goal->hero->getFreeSlot().validSlot(); + }); + return solutions; //TODO: exchange troops between heroes } From 11af1431fb4f8c6daecc8b3f42c44cf81059eff4 Mon Sep 17 00:00:00 2001 From: Andrii Danylchenko Date: Wed, 29 May 2019 22:07:10 +0300 Subject: [PATCH 2/2] Fix code style Co-Authored-By: Alexander Shishkin --- AI/VCAI/Goals/GatherTroops.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/AI/VCAI/Goals/GatherTroops.cpp b/AI/VCAI/Goals/GatherTroops.cpp index 8292fb9c2..19cb9dcad 100644 --- a/AI/VCAI/Goals/GatherTroops.cpp +++ b/AI/VCAI/Goals/GatherTroops.cpp @@ -138,7 +138,8 @@ TGoalVec GatherTroops::getAllPossibleSubgoals() CreatureID creID = CreatureID(objid); - vstd::erase_if(solutions, [&](TSubgoal goal)->bool{ + vstd::erase_if(solutions, [&](TSubgoal goal)->bool + { return goal->hero && !goal->hero->getSlotFor(creID).validSlot() && !goal->hero->getFreeSlot().validSlot(); });