mirror of
https://github.com/vcmi/vcmi.git
synced 2026-06-19 22:57:37 +02:00
Compare scout candidate unit power correctly
Fix the army-transfer tie breaker used when a scout must keep one stack after handing army to a stronger hero. The right-hand unit power accidentally reused the left-hand value, so equal-movement candidates could leave an expensive unit on the scout while transferring cheaper army.
This commit is contained in:
@@ -130,7 +130,7 @@ std::vector<SlotInfo>::iterator ArmyManager::getBestUnitForScout(std::vector<Slo
|
||||
auto fastest = boost::min_element(army, [&](const SlotInfo & left, const SlotInfo & right) -> bool
|
||||
{
|
||||
uint64_t leftUnitPower = left.power / left.count;
|
||||
uint64_t rightUnitPower = left.power / left.count;
|
||||
uint64_t rightUnitPower = right.power / right.count;
|
||||
bool leftUnitIsWeak = leftUnitPower < maxUnitValue || left.creature->getLevel() < 4;
|
||||
bool rightUnitIsWeak = rightUnitPower < maxUnitValue || right.creature->getLevel() < 4;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user