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

Revert "Merge branch 'pr/4528' into develop"

This reverts commit f4578c6d3a, reversing
changes made to ac8e5b3711.
This commit is contained in:
Xilmi 2024-09-03 20:51:13 +02:00
parent 3f8a8733a2
commit 64fad53532
2 changed files with 9 additions and 15 deletions

View File

@ -491,18 +491,15 @@ ReachabilityData BattleExchangeEvaluator::getExchangeUnits(
vstd::concatenate(allReachableUnits, turn == 0 ? reachabilityMap.at(hex) : getOneTurnReachableUnits(turn, hex));
}
if(!ap.attack.attacker->isTurret())
for(auto hex : ap.attack.attacker->getHexes())
{
for(auto hex : ap.attack.attacker->getHexes())
auto unitsReachingAttacker = turn == 0 ? reachabilityMap.at(hex) : getOneTurnReachableUnits(turn, hex);
for(auto unit : unitsReachingAttacker)
{
auto unitsReachingAttacker = turn == 0 ? reachabilityMap.at(hex) : getOneTurnReachableUnits(turn, hex);
for(auto unit : unitsReachingAttacker)
if(unit->unitSide() != ap.attack.attacker->unitSide())
{
if(unit->unitSide() != ap.attack.attacker->unitSide())
{
allReachableUnits.push_back(unit);
result.enemyUnitsReachingAttacker.insert(unit->unitId());
}
allReachableUnits.push_back(unit);
result.enemyUnitsReachingAttacker.insert(unit->unitId());
}
}
}

View File

@ -126,23 +126,20 @@ void HeroManager::update()
}
std::sort(myHeroes.begin(), myHeroes.end(), scoreSort);
std::map<HeroPtr, HeroRole> newHeroRoles;
heroRoles.clear();
for(auto hero : myHeroes)
{
if(hero->patrol.patrolling)
{
newHeroRoles[hero] = HeroRole::MAIN;
heroRoles[hero] = HeroRole::MAIN;
}
else
{
newHeroRoles[hero] = (globalMainCount--) > 0 ? HeroRole::MAIN : HeroRole::SCOUT;
heroRoles[hero] = (globalMainCount--) > 0 ? HeroRole::MAIN : HeroRole::SCOUT;
}
}
heroRoles = std::move(newHeroRoles);
for(auto hero : myHeroes)
{
logAi->trace("Hero %s has role %s", hero->getNameTranslated(), heroRoles[hero] == HeroRole::MAIN ? "main" : "scout");