mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-06 09:09:40 +02:00
Merge remote-tracking branch 'upstream/develop' into battle-dialog
This commit is contained in:
@@ -96,14 +96,14 @@ public:
|
||||
std::vector<SlotInfo> ArmyManager::getBestArmy(const IBonusBearer * armyCarrier, const CCreatureSet * target, const CCreatureSet * source) const
|
||||
{
|
||||
auto sortedSlots = getSortedSlots(target, source);
|
||||
std::map<TFaction, uint64_t> alignmentMap;
|
||||
std::map<FactionID, uint64_t> alignmentMap;
|
||||
|
||||
for(auto & slot : sortedSlots)
|
||||
{
|
||||
alignmentMap[slot.creature->getFactionIndex()] += slot.power;
|
||||
alignmentMap[slot.creature->getFaction()] += slot.power;
|
||||
}
|
||||
|
||||
std::set<TFaction> allowedFactions;
|
||||
std::set<FactionID> allowedFactions;
|
||||
std::vector<SlotInfo> resultingArmy;
|
||||
uint64_t armyValue = 0;
|
||||
|
||||
@@ -121,7 +121,7 @@ std::vector<SlotInfo> ArmyManager::getBestArmy(const IBonusBearer * armyCarrier,
|
||||
|
||||
while(allowedFactions.size() < alignmentMap.size())
|
||||
{
|
||||
auto strongestAlignment = vstd::maxElementByFun(alignmentMap, [&](std::pair<TFaction, uint64_t> pair) -> uint64_t
|
||||
auto strongestAlignment = vstd::maxElementByFun(alignmentMap, [&](std::pair<FactionID, uint64_t> pair) -> uint64_t
|
||||
{
|
||||
return vstd::contains(allowedFactions, pair.first) ? 0 : pair.second;
|
||||
});
|
||||
@@ -134,7 +134,7 @@ std::vector<SlotInfo> ArmyManager::getBestArmy(const IBonusBearer * armyCarrier,
|
||||
|
||||
for(auto & slot : sortedSlots)
|
||||
{
|
||||
if(vstd::contains(allowedFactions, slot.creature->getFactionIndex()))
|
||||
if(vstd::contains(allowedFactions, slot.creature->getFaction()))
|
||||
{
|
||||
auto slotID = newArmyInstance.getSlotFor(slot.creature);
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ TGoalVec GatherTroops::getAllPossibleSubgoals()
|
||||
}
|
||||
|
||||
auto creature = VLC->creatures()->getByIndex(objid);
|
||||
if(t->subID == creature->getFactionIndex()) //TODO: how to force AI to build unupgraded creatures? :O
|
||||
if(t->subID == creature->getFaction()) //TODO: how to force AI to build unupgraded creatures? :O
|
||||
{
|
||||
auto creatures = vstd::tryAt(t->town->creatures, creature->getLevel() - 1);
|
||||
if(!creatures)
|
||||
|
||||
Reference in New Issue
Block a user