mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-28 03:57:02 +02:00
Merge branch 'pr/4528' into develop
This commit is contained in:
commit
f4578c6d3a
@ -485,15 +485,18 @@ ReachabilityData BattleExchangeEvaluator::getExchangeUnits(
|
|||||||
vstd::concatenate(allReachableUnits, turn == 0 ? reachabilityMap.at(hex) : getOneTurnReachableUnits(turn, hex));
|
vstd::concatenate(allReachableUnits, turn == 0 ? reachabilityMap.at(hex) : getOneTurnReachableUnits(turn, hex));
|
||||||
}
|
}
|
||||||
|
|
||||||
for(auto hex : ap.attack.attacker->getHexes())
|
if(!ap.attack.attacker->isTurret())
|
||||||
{
|
{
|
||||||
auto unitsReachingAttacker = turn == 0 ? reachabilityMap.at(hex) : getOneTurnReachableUnits(turn, hex);
|
for(auto hex : ap.attack.attacker->getHexes())
|
||||||
for(auto unit : unitsReachingAttacker)
|
|
||||||
{
|
{
|
||||||
if(unit->unitSide() != ap.attack.attacker->unitSide())
|
auto unitsReachingAttacker = turn == 0 ? reachabilityMap.at(hex) : getOneTurnReachableUnits(turn, hex);
|
||||||
|
for(auto unit : unitsReachingAttacker)
|
||||||
{
|
{
|
||||||
allReachableUnits.push_back(unit);
|
if(unit->unitSide() != ap.attack.attacker->unitSide())
|
||||||
result.enemyUnitsReachingAttacker.insert(unit->unitId());
|
{
|
||||||
|
allReachableUnits.push_back(unit);
|
||||||
|
result.enemyUnitsReachingAttacker.insert(unit->unitId());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -126,20 +126,23 @@ void HeroManager::update()
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::sort(myHeroes.begin(), myHeroes.end(), scoreSort);
|
std::sort(myHeroes.begin(), myHeroes.end(), scoreSort);
|
||||||
heroRoles.clear();
|
|
||||||
|
std::map<HeroPtr, HeroRole> newHeroRoles;
|
||||||
|
|
||||||
for(auto hero : myHeroes)
|
for(auto hero : myHeroes)
|
||||||
{
|
{
|
||||||
if(hero->patrol.patrolling)
|
if(hero->patrol.patrolling)
|
||||||
{
|
{
|
||||||
heroRoles[hero] = HeroRole::MAIN;
|
newHeroRoles[hero] = HeroRole::MAIN;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
heroRoles[hero] = (globalMainCount--) > 0 ? HeroRole::MAIN : HeroRole::SCOUT;
|
newHeroRoles[hero] = (globalMainCount--) > 0 ? HeroRole::MAIN : HeroRole::SCOUT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
heroRoles = std::move(newHeroRoles);
|
||||||
|
|
||||||
for(auto hero : myHeroes)
|
for(auto hero : myHeroes)
|
||||||
{
|
{
|
||||||
logAi->trace("Hero %s has role %s", hero->getNameTranslated(), heroRoles[hero] == HeroRole::MAIN ? "main" : "scout");
|
logAi->trace("Hero %s has role %s", hero->getNameTranslated(), heroRoles[hero] == HeroRole::MAIN ? "main" : "scout");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user