1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Merge pull request #3801 from vcmi/fixes

Fixes
This commit is contained in:
Andrii Danylchenko 2024-04-21 14:00:46 +03:00 committed by GitHub
commit 23fd47ae63
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 24 additions and 4 deletions

View File

@ -64,6 +64,18 @@ std::vector<BattleHex> BattleEvaluator::getBrokenWallMoatHexes() const
auto moatHex = wallHex.cloneInDirection(BattleHex::LEFT);
result.push_back(moatHex);
moatHex = moatHex.cloneInDirection(BattleHex::LEFT);
auto obstaclesSecondRow = cb->getBattle(battleID)->battleGetAllObstaclesOnPos(moatHex, false);
for(auto obstacle : obstaclesSecondRow)
{
if(obstacle->obstacleType == CObstacleInstance::EObstacleType::MOAT)
{
result.push_back(moatHex);
break;
}
}
}
return result;

View File

@ -27,7 +27,7 @@ namespace NKAI
mainHeroTurnDistanceLimit(10),
scoutHeroTurnDistanceLimit(5),
maxGoldPressure(0.3f),
maxpass(30),
maxpass(10),
allowObjectGraph(false)
{
ResourcePath resource("config/ai/nkai/nkai-settings", EResType::JSON);

View File

@ -112,7 +112,9 @@ public:
void addMinimalDistanceJunctions()
{
pforeachTilePaths(ai->cb->getMapSize(), ai, [this](const int3 & pos, std::vector<AIPath> & paths)
tbb::concurrent_unordered_set<int3, std::hash<int3>> junctions;
pforeachTilePaths(ai->cb->getMapSize(), ai, [this, &junctions](const int3 & pos, std::vector<AIPath> & paths)
{
if(target->hasNodeAt(pos))
return;
@ -129,9 +131,14 @@ public:
if(currentCost.avg < neighborCost)
{
addJunctionActor(pos);
junctions.insert(pos);
}
});
for(auto pos : junctions)
{
addJunctionActor(pos);
}
}
private:

View File

@ -709,7 +709,8 @@ void CGWhirlpool::teleportDialogAnswered(const CGHeroInstance *hero, ui32 answer
bool CGWhirlpool::isProtected(const CGHeroInstance * h)
{
return h->hasBonusOfType(BonusType::WHIRLPOOL_PROTECTION)
|| (h->stacksCount() == 1 && h->Slots().begin()->second->count == 1);
|| (h->stacksCount() == 1 && h->Slots().begin()->second->count == 1)
|| (h->stacksCount() == 0 && h->commander && h->commander->alive);
}
ArtifactID CGArtifact::getArtifact() const